From 4942a7b77917f9a163453ecdd040993965672cc0 Mon Sep 17 00:00:00 2001 From: Aaron Brashears Date: Thu, 4 Oct 2007 16:31:48 +0000 Subject: Result of svn merge -r70873:71086 svn+ssh://svn/svn/linden/branches/enable-exceptions into release. --- indra/llcommon/ctype_workaround.h | 2 +- indra/llcommon/linden_common.h | 34 +++++++++++------- indra/llcommon/llassettype.cpp | 2 -- indra/llcommon/llcriticaldamp.cpp | 1 - indra/llcommon/lldlinked.h | 2 -- indra/llcommon/llerror.cpp | 27 ++++++--------- indra/llcommon/llfasttimer.h | 2 -- indra/llcommon/llfile.h | 7 +--- indra/llcommon/llformat.cpp | 2 +- indra/llcommon/llformat.h | 2 -- indra/llcommon/llmap.h | 4 --- indra/llcommon/llprocessor.cpp | 4 +-- indra/llcommon/llsd.cpp | 3 -- indra/llcommon/llstl.h | 6 ---- indra/llcommon/llstring.cpp | 20 +++++++++++ indra/llcommon/llstring.h | 73 +++++++-------------------------------- indra/llcommon/llsys.cpp | 2 ++ indra/llcommon/lltimer.cpp | 3 -- indra/llcommon/lltimer.h | 5 +-- indra/llcommon/stdtypes.h | 3 -- indra/llcommon/timing.h | 3 +- 21 files changed, 72 insertions(+), 135 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/ctype_workaround.h b/indra/llcommon/ctype_workaround.h index 8c52b0290c..5b095c8c19 100644 --- a/indra/llcommon/ctype_workaround.h +++ b/indra/llcommon/ctype_workaround.h @@ -18,7 +18,7 @@ * -- Leviathan 20060113 */ -#include +#include __const unsigned short int *__ctype_b; __const __int32_t *__ctype_tolower; diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h index 5826bc917d..73dfc53c61 100644 --- a/indra/llcommon/linden_common.h +++ b/indra/llcommon/linden_common.h @@ -11,34 +11,42 @@ #include "llpreprocessor.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // Work around stupid Microsoft STL warning #ifdef LL_WINDOWS #pragma warning (disable : 4702) // warning C4702: unreachable code #endif // LL_WINDOWS -#include -#include +#include +#include +#include #include #include -#include "llfile.h" +#ifdef LL_WINDOWS +#pragma warning (3 : 4702) // we like level 3, not 4 +#endif // LL_WINDOWS + +// Linden only libs in alpha-order other than stdtypes.h #include "stdtypes.h" #include "lldefs.h" #include "llerror.h" #include "llextendedstatus.h" +#include "llfasttimer.h" +#include "llfile.h" #include "llformat.h" #include "llstring.h" -#include "lltimer.h" -#include "llfasttimer.h" #include "llsys.h" - -#ifdef LL_WINDOWS -#pragma warning (3 : 4702) // we like level 3, not 4 -#endif // LL_WINDOWS +#include "lltimer.h" #endif diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index b5378943ca..4b37f0d188 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -10,8 +10,6 @@ #include "llassettype.h" -#include - #include "llstring.h" #include "lltimer.h" diff --git a/indra/llcommon/llcriticaldamp.cpp b/indra/llcommon/llcriticaldamp.cpp index ee7dfecdaa..1757f16c99 100644 --- a/indra/llcommon/llcriticaldamp.cpp +++ b/indra/llcommon/llcriticaldamp.cpp @@ -7,7 +7,6 @@ */ #include "linden_common.h" -#include #include "llcriticaldamp.h" diff --git a/indra/llcommon/lldlinked.h b/indra/llcommon/lldlinked.h index 54087848d9..1e5ddfd1a4 100644 --- a/indra/llcommon/lldlinked.h +++ b/indra/llcommon/lldlinked.h @@ -8,8 +8,6 @@ #ifndef LL_LLDLINKED_H #define LL_LLDLINKED_H -#include - template class LLDLinked { LLDLinked* mNextp; diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 90ea72f24c..98972950b7 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -12,33 +12,28 @@ #include "llerror.h" #include "llerrorcontrol.h" -#include "llapp.h" -#include "llapr.h" -#include "llfile.h" -#include "llfixedbuffer.h" -#include "lllivefile.h" -#include "llsd.h" -#include "llsdserialize.h" -#include "llstl.h" - -#include #include -#include +#ifdef __GNUC__ +#include +#endif #include #if !LL_WINDOWS -#include #include #endif -#include #if LL_WINDOWS #include #endif #include +#include "llapp.h" +#include "llapr.h" +#include "llfile.h" +#include "llfixedbuffer.h" +#include "lllivefile.h" +#include "llsd.h" +#include "llsdserialize.h" +#include "llstl.h" -#ifdef __GNUC__ -#include -#endif namespace { #if !LL_WINDOWS diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 3e88784d3c..648c4bab4e 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -9,8 +9,6 @@ #ifndef LL_LLFASTTIMER_H #define LL_LLFASTTIMER_H -#include "lltimer.h" - #define FAST_TIMER_ON 1 U64 get_cpu_clock_count(); diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 605918cd29..77bd20e274 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -17,12 +17,6 @@ * Attempts to mostly mirror the POSIX style IO functions. */ -#include -#include -#include -#include -#include "stdtypes.h" - typedef FILE LLFILE; #ifdef LL_WINDOWS @@ -36,6 +30,7 @@ typedef FILE LLFILE; // windows version of stat function and stat data structure are called _stat typedef struct _stat llstat; #else +#include typedef struct stat llstat; #endif diff --git a/indra/llcommon/llformat.cpp b/indra/llcommon/llformat.cpp index 0c2a6d3b1e..9bfdb14446 100644 --- a/indra/llcommon/llformat.cpp +++ b/indra/llcommon/llformat.cpp @@ -11,7 +11,7 @@ #include "llformat.h" -#include +#include std::string llformat(const char *fmt, ...) { diff --git a/indra/llcommon/llformat.h b/indra/llcommon/llformat.h index 7079656b72..31ee3194d3 100644 --- a/indra/llcommon/llformat.h +++ b/indra/llcommon/llformat.h @@ -10,8 +10,6 @@ #ifndef LL_LLFORMAT_H #define LL_LLFORMAT_H -#include - // Use as follows: // llinfos << llformat("Test:%d (%.2f %.2f)", idx, x, y) << llendl; // diff --git a/indra/llcommon/llmap.h b/indra/llcommon/llmap.h index fc958421da..97af9f5ec9 100644 --- a/indra/llcommon/llmap.h +++ b/indra/llcommon/llmap.h @@ -9,10 +9,6 @@ #ifndef LL_LLMAP_H #define LL_LLMAP_H -#include -#include -#include - // llmap uses the fast stl library code in a manner consistant with LLSkipMap, et. al. template class LLMap diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index c8c565a05b..c676a37a5e 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -28,9 +28,7 @@ #include "processor.h" -#include -#include -#include +#include #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 2fb9a0ab9c..aa52255704 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -9,9 +9,6 @@ #include "linden_common.h" #include "llsd.h" -#include -#include - #include "llerror.h" #include "../llmath/llmath.h" #include "llformat.h" diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 8a32a04fc2..541f1a9c81 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -10,15 +10,9 @@ #define LL_LLSTL_H #include -#include -#include -#include #include #include -#include -#include - // Use to compare the first element only of a pair // e.g. typedef std::set, compare_pair > some_pair_set_t; template diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 0b799b94ae..2d7c903341 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -35,6 +35,26 @@ U8 hex_as_nybble(char hex) } +bool _read_file_into_string(std::string& str, const char* filename) +{ + llifstream ifs(filename, llifstream::binary); + if (!ifs.is_open()) + { + llinfos << "Unable to open file" << filename << llendl; + return false; + } + + std::ostringstream oss; + + oss << ifs.rdbuf(); + str = oss.str(); + ifs.close(); + return true; +} + + + + // See http://www.unicode.org/Public/BETA/CVTUTF-1-2/ConvertUTF.c // for the Unicode implementation - this doesn't match because it was written before finding // it. diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 3005155b19..b922b2f8e5 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -9,17 +9,6 @@ #ifndef LL_LLSTRING_H #define LL_LLSTRING_H -#include "stdtypes.h" -#include "llerror.h" -#include "llfile.h" -#include -#include -#include -#include -#include -#include -#include -#include /* for vsnprintf */ #if LL_LINUX || LL_SOLARIS #include #include @@ -260,9 +249,6 @@ public: */ static void _makeASCII(std::basic_string& string); - static BOOL read(std::basic_string& string, const char* filename); /*Flawfinder: ignore*/ - static BOOL write(std::basic_string& string, const char* filename); - // Conversion to other data types static BOOL convertToBOOL(const std::basic_string& string, BOOL& value); static BOOL convertToU8(const std::basic_string& string, U8& value); @@ -353,6 +339,16 @@ std::string ll_safe_string(const char* in); */ U8 hex_as_nybble(char hex); +/** + * @brief read the contents of a file into a string. + * + * Since this function has no concept of character encoding, most + * anything you do with this method ill-advised. Please avoid. + * @param str [out] The string which will have. + * @param filename The full name of the file to read. + * @return Returns true on success. If false, str is unmodified. + */ +bool _read_file_into_string(std::string& str, const char* filename); /** * Unicode support @@ -913,8 +909,6 @@ void LLStringBase::replaceNonstandardASCII( std::basic_string& string, T r template void LLStringBase::replaceTabsWithSpaces( std::basic_string& str, size_type spaces_per_tab ) { - llassert( spaces_per_tab >= 0 ); - const T TAB = '\t'; const T SPACE = ' '; @@ -1017,11 +1011,10 @@ void LLStringBase::copy( T* dst, const T* src, size_type dst_size ) template void LLStringBase::copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset) { - llassert( offset <= dst.length() ); - - // special case - append to end of string and avoid expensive (when strings are large) string manipulations if ( offset == dst.length() ) { + // special case - append to end of string and avoid expensive + // (when strings are large) string manipulations dst += src; } else @@ -1050,48 +1043,6 @@ BOOL LLStringBase::isHead( const std::basic_string& string, const T* s ) } } -//static -template -BOOL LLStringBase::read(std::basic_string& string, const char* filename) /*Flawfinder: ignore*/ -{ - llifstream ifs(filename, llifstream::binary); - if (!ifs.is_open()) - { - llinfos << "Unable to open file" << filename << llendl; - return FALSE; - } - - std::basic_ostringstream oss; - - oss << ifs.rdbuf(); - - string = oss.str(); - - ifs.close(); - return TRUE; -} - -//static -template -BOOL LLStringBase::write(std::basic_string& string, const char* filename) -{ -#if LL_LINUX || LL_SOLARIS - printf("STUBBED: LLStringBase::write at %s:%d\n", __FILE__, __LINE__); -#else - llofstream ofs(filename, llofstream::binary); - if (!ofs.is_open()) - { - llinfos << "Unable to open file" << filename << llendl; - return FALSE; - } - - ofs << string; - - ofs.close(); -#endif - return TRUE; -} - template BOOL LLStringBase::convertToBOOL(const std::basic_string& string, BOOL& value) { diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index b1b92ae277..86ec4c0d61 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -24,10 +24,12 @@ # include # include #elif LL_DARWIN +# include # include # include # include #elif LL_LINUX +# include # include # include # include diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 73e73b9c44..013fab0965 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -16,13 +16,10 @@ # define WIN32_LEAN_AND_MEAN # include # include -# include #elif LL_LINUX || LL_SOLARIS -# include # include # include #elif LL_DARWIN -# include # include #else # error "architecture not supported" diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index 6f67e19c48..e6ea032514 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -10,12 +10,9 @@ #define LL_TIMER_H #if LL_LINUX || LL_DARWIN -# include -# include +#include #endif -#include - // units conversions #ifndef USEC_PER_SEC const U32 USEC_PER_SEC = 1000000; diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index ccb843061d..bc069f009d 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -8,9 +8,6 @@ #ifndef LL_STDTYPES_H #define LL_STDTYPES_H -#include -#include - typedef signed char S8; typedef unsigned char U8; typedef signed short S16; diff --git a/indra/llcommon/timing.h b/indra/llcommon/timing.h index 8952bc3b52..53e7a62a85 100644 --- a/indra/llcommon/timing.h +++ b/indra/llcommon/timing.h @@ -9,10 +9,9 @@ #ifndef LL_TIMING_H #define LL_TIMING_H -#include #if LL_LINUX || LL_DARWIN || LL_SOLARIS -# include +#include #endif -- cgit v1.2.3