diff options
author | Christian Goetze (CG) <cg@lindenlab.com> | 2010-08-02 15:57:01 -0700 |
---|---|---|
committer | Christian Goetze (CG) <cg@lindenlab.com> | 2010-08-02 15:57:01 -0700 |
commit | 4f6e814eaa7ae5cfc10e4e7d1f22e53be395a2f4 (patch) | |
tree | be554f9f22996e00dada6da67f7e77eb0502b0f5 /indra/llcommon | |
parent | f423a69864c40f760c1c7e64a2e544fd1dba77fb (diff) | |
parent | 15247f086989a43881d79c1ee5416bb00721eb68 (diff) |
Fix the reversion imported from viewer-hotfix via: "hg pull -r 1c95812ba38b ../viewer-public" - reviewed by richard
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llformat.cpp | 32 | ||||
-rw-r--r-- | indra/llcommon/llformat.h | 4 | ||||
-rw-r--r-- | indra/llcommon/llmd5.cpp | 37 | ||||
-rw-r--r-- | indra/llcommon/llmd5.h | 11 | ||||
-rw-r--r-- | indra/llcommon/llqueuedthread.cpp | 5 | ||||
-rw-r--r-- | indra/llcommon/llstring.cpp | 38 | ||||
-rw-r--r-- | indra/llcommon/llstring.h | 15 |
7 files changed, 28 insertions, 114 deletions
diff --git a/indra/llcommon/llformat.cpp b/indra/llcommon/llformat.cpp index 689f649d0a..cf509bee14 100644 --- a/indra/llcommon/llformat.cpp +++ b/indra/llcommon/llformat.cpp @@ -37,40 +37,16 @@ #include <cstdarg> -// common used function with va_list argument -// wrapper for vsnprintf to be called from llformatXXX functions. -static void va_format(std::string& out, const char *fmt, va_list va) +std::string llformat(const char *fmt, ...) { char tstr[1024]; /* Flawfinder: ignore */ + va_list va; + va_start(va, fmt); #if LL_WINDOWS _vsnprintf(tstr, 1024, fmt, va); #else vsnprintf(tstr, 1024, fmt, va); /* Flawfinder: ignore */ #endif - out.assign(tstr); -} - -std::string llformat(const char *fmt, ...) -{ - std::string res; - va_list va; - va_start(va, fmt); - va_format(res, fmt, va); va_end(va); - return res; -} - -std::string llformat_to_utf8(const char *fmt, ...) -{ - std::string res; - va_list va; - va_start(va, fmt); - va_format(res, fmt, va); - va_end(va); - -#if LL_WINDOWS - // made converting to utf8. See EXT-8318. - res = ll_convert_string_to_utf8_string(res); -#endif - return res; + return std::string(tstr); } diff --git a/indra/llcommon/llformat.h b/indra/llcommon/llformat.h index 17d8b4a8ad..dc64edb26d 100644 --- a/indra/llcommon/llformat.h +++ b/indra/llcommon/llformat.h @@ -42,8 +42,4 @@ std::string LL_COMMON_API llformat(const char *fmt, ...); -// the same version as above but ensures that returned string is in utf8 on windows -// to enable correct converting utf8_to_wstring. -std::string LL_COMMON_API llformat_to_utf8(const char *fmt, ...); - #endif // LL_LLFORMAT_H diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp index cc73c3e45c..da9cb94e13 100644 --- a/indra/llcommon/llmd5.cpp +++ b/indra/llcommon/llmd5.cpp @@ -171,6 +171,11 @@ void LLMD5::update(FILE* file){ } + + + + + // MD5 update for istreams. // Like update for files; see above. @@ -187,10 +192,9 @@ void LLMD5::update(std::istream& stream){ } -void LLMD5::update(const std::string& s) -{ - update((unsigned char *)s.c_str(),s.length()); -} + + + // MD5 finalization. Ends an MD5 message-digest operation, writing the // the message digest and zeroizing the context. @@ -273,7 +277,7 @@ LLMD5::LLMD5(const unsigned char *s) finalize(); } -void LLMD5::raw_digest(unsigned char *s) const +void LLMD5::raw_digest(unsigned char *s) { if (!finalized) { @@ -289,7 +293,7 @@ void LLMD5::raw_digest(unsigned char *s) const -void LLMD5::hex_digest(char *s) const +void LLMD5::hex_digest(char *s) { int i; @@ -315,7 +319,6 @@ void LLMD5::hex_digest(char *s) const - std::ostream& operator<<(std::ostream &stream, LLMD5 context) { char s[33]; /* Flawfinder: ignore */ @@ -324,25 +327,13 @@ std::ostream& operator<<(std::ostream &stream, LLMD5 context) return stream; } -bool operator==(const LLMD5& a, const LLMD5& b) -{ - unsigned char a_guts[16]; - unsigned char b_guts[16]; - a.raw_digest(a_guts); - b.raw_digest(b_guts); - if (memcmp(a_guts,b_guts,16)==0) - return true; - else - return false; -} -bool operator!=(const LLMD5& a, const LLMD5& b) -{ - return !(a==b); -} + // PRIVATE METHODS: + + void LLMD5::init(){ finalized=0; // we just started! @@ -540,5 +531,3 @@ void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){ output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) | (((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24); } - - diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h index 4e68ba0d5e..df9d7324ab 100644 --- a/indra/llcommon/llmd5.h +++ b/indra/llcommon/llmd5.h @@ -95,7 +95,6 @@ public: void update (const uint1 *input, const uint4 input_length); void update (std::istream& stream); void update (FILE *file); - void update (const std::string& str); void finalize (); // constructors for special circumstances. All these constructors finalize @@ -106,11 +105,12 @@ public: LLMD5 (const unsigned char *string, const unsigned int number); // methods to acquire finalized result - void raw_digest(unsigned char *array) const; // provide 16-byte array for binary data - void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string - + void raw_digest(unsigned char *array); // provide 16-byte array for binary data + void hex_digest(char *string); // provide 33-byte array for ascii-hex string friend std::ostream& operator<< (std::ostream&, LLMD5 context); + + private: @@ -131,7 +131,4 @@ private: }; -LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b); -LL_COMMON_API bool operator!=(const LLMD5& a, const LLMD5& b); - #endif // LL_LLMD5_H diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 809a626c93..e0b56b7973 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -428,9 +428,11 @@ S32 LLQueuedThread::processNextRequest() llassert_always(req->getStatus() == STATUS_QUEUED); break; } + U32 start_priority = 0 ; if (req) { req->setStatus(STATUS_INPROGRESS); + start_priority = req->getPriority(); } unlockData(); @@ -439,8 +441,7 @@ S32 LLQueuedThread::processNextRequest() // safe to access req. if (req) { - // process request - U32 start_priority = req->getPriority(); + // process request bool complete = req->processRequest(); if (complete) diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 2693c0e22b..1561bda201 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -633,14 +633,14 @@ namespace snprintf_hack } } -std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page) +std::string ll_convert_wide_to_string(const wchar_t* in) { std::string out; if(in) { int len_in = wcslen(in); int len_out = WideCharToMultiByte( - code_page, + CP_ACP, 0, in, len_in, @@ -655,7 +655,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page) if(pout) { WideCharToMultiByte( - code_page, + CP_ACP, 0, in, len_in, @@ -669,38 +669,6 @@ std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page) } return out; } - -wchar_t* ll_convert_string_to_wide(const std::string& in, unsigned int code_page) -{ - // From review: - // We can preallocate a wide char buffer that is the same length (in wchar_t elements) as the utf8 input, - // plus one for a null terminator, and be guaranteed to not overflow. - - // Normally, I'd call that sort of thing premature optimization, - // but we *are* seeing string operations taking a bunch of time, especially when constructing widgets. -// int output_str_len = MultiByteToWideChar(code_page, 0, in.c_str(), in.length(), NULL, 0); - - // reserve place to NULL terminator - int output_str_len = in.length(); - wchar_t* w_out = new wchar_t[output_str_len + 1]; - - memset(w_out, 0, output_str_len + 1); - int real_output_str_len = MultiByteToWideChar (code_page, 0, in.c_str(), in.length(), w_out, output_str_len); - - //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858. - w_out[real_output_str_len] = 0; - - return w_out; -} - -std::string ll_convert_string_to_utf8_string(const std::string& in) -{ - wchar_t* w_mesg = ll_convert_string_to_wide(in, CP_ACP); - std::string out_utf8(ll_convert_wide_to_string(w_mesg, CP_UTF8)); - delete[] w_mesg; - - return out_utf8; -} #endif // LL_WINDOWS long LLStringOps::sPacificTimeOffset = 0; diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 41fac0f8cc..8071c8aa2d 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -564,20 +564,7 @@ using snprintf_hack::snprintf; * * This replaces the unsafe W2A macro from ATL. */ -LL_COMMON_API std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page); - -/** - * Converts a string to wide string. - * - * It will allocate memory for result string with "new []". Don't forget to release it with "delete []". - */ -LL_COMMON_API wchar_t* ll_convert_string_to_wide(const std::string& in, unsigned int code_page); - -/** - * Converts incoming string into urf8 string - * - */ -LL_COMMON_API std::string ll_convert_string_to_utf8_string(const std::string& in); +LL_COMMON_API std::string ll_convert_wide_to_string(const wchar_t* in); //@} #endif // LL_WINDOWS |