summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstring.cpp
AgeCommit message (Collapse)Author
2018-12-14SL-10153: Fix previous commit for non-Windows systems.Nat Goodspeed
Move Windows-flavored llstring_getoptenv() to Windows-specific section of llstring.cpp. boost::optional type must be stated explicitly to initialize with a value. On platforms where llwchar is the same as wchar_t, LLWString is the same as std::wstring, so ll_convert specializations for std::wstring would duplicate those for LLWString. Defend against that. The compilers we use don't like 'return condition? { expr } : {}', in which we hope to construct and return an instance of the declared return type without having to restate the type. It works to use an explicit 'if' statement.
2018-12-14SL-10153: Introduce ll_convert, windows_message() templates.Nat Goodspeed
Add ll_convert<TO, FROM> template, used as (e.g.): ll_convert<std::string>(value_of_some_other_string_type); There is no generic template implementation -- the template exists solely to provide generic aliases for a bewildering family of llstring.h string- conversion functions with highly-specific names. There's a generic implementation, though, for the degenerate case where FROM and TO are identical. Add ll_convert<> specialization aliases for most of the string-conversion functions declared in llstring.h, including the Windows-specific ones involving llutf16string and std::wstring. Add a mini-lecture in llstring.h about appropriate use of string types on Windows. Add LL_WCHAR_T_NATIVE llpreprocessor.h macro so we can detect whether to provide separate conversions for llutf16string and std::wstring, or whether those would collide because the types are identical. Add inline ll_convert_wide_to_string(const std::wstring&) overloads so caller isn't required to call arg.c_str(), which naturally permits an ll_convert alias. Add ll_convert_wide_to_wstring(), ll_convert_wstring_to_wide() as placeholders for converting between Windows std::wstring and Linden LLWString, with corresponding ll_convert aliases. We don't yet have library code to perform such conversions officially; for now, just copy characters. Add LLStringUtil::getenv(key) and getoptenv(key) functions. The latter returns boost::optional<string_type> in case the caller needs to detect absence of a given environment variable rather than simply accepting a default value. Naturally getenv(), which accepts a default, is implemented using getoptenv(). getoptenv(), in turn, is implemented using an underlying llstring_getoptenv(). On Windows, llstring_getoptenv() returns boost::optional<std::wstring> (based on GetEnvironmentVariableW()), whereas elsewhere, llstring_getoptenv() returns boost::optional<std::string> (based on classic Posix getenv()). The beauty of generic ll_convert is that the portable LLStringUtilBase<T>:: getoptenv() template can call the platform-specific llstring_getoptenv() and transparently perform whatever conversion is necessary to return the desired string_type. Add windows_message<T>(error) template, with an overload that implicitly calls GetLastError(). We provide a single concrete windows_message<std::wstring>() implementation because that's what we get from Windows FormatMessageW() -- everything else is a generic conversion to the desired target string type. This obviates llprocess.cpp's previous WindowsErrorString() implementation -- reimplement using windows_message<std::string>().
2018-12-11SL-10153: Improve ll_convert_string_to_wide() and its converse.Nat Goodspeed
Instead of returning a wchar_t* and requiring the caller to delete it later, return a std::basic_string<wchar_t> that's self-cleaning. If the caller wants a wchar_t*, s/he can call c_str() on the returned string. Default the code_page parameter to CP_UTF8, since we try to be really consistent about using UTF-8 encoding for all our internal std::strings.
2017-10-03SL-808 - more work on arc display. area calculations still have some issues, ↵Brad Payne (Vir Linden)
especially for animated objects.
2016-06-01MAINT-6446 Correct password length handlingandreykproductengine
2015-11-10remove execute permission from many files that should not have itOz Linden
2015-04-10restore the ll[io]fstream because we need them as wrappers on Windows for ↵Oz Linden
wide char paths; on other platforms they are now just typedefs to the std classes
2015-04-07replace llifstream and llofstream with std::ifstream and std::ofstream ↵Oz Linden
respectively
2015-04-07convert llifstream and llofstream to std::ifstream and std::ofstream ↵Oz Linden
respectively
2014-10-22Update to build on Xcode 6.0 (fix unit tests): minor fix for debug only unit ↵callum_linden
test
2013-10-15renamed TimeBlock to BlockTimerStatHandleRichard Linden
2013-09-05changed fast timer over to using macroRichard Linden
another attempt to move mem stat into base class
2013-08-09second phase summer cleaningRichard Linden
replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc.
2013-07-19BUILDFIX: #include and dependency cleanupRichard Linden
2013-06-05merge with viewer-releaseRichard Linden
2013-05-22CHUI-967: fix display of % escapes in chatGilbert Gonzales
2013-03-29Update Mac and Windows breakpad builds to latestGraham Madarasz
2012-11-19merge with viewer-developmentRichard Linden
2012-11-14SH-3406 WIP convert fast timers to lltrace systemRichard Linden
cleaning up build moved most includes of windows.h to llwin32headers.h to disable min/max macros, etc streamlined Time class and consolidated functionality in BlockTimer class llfasttimer is no longer included via llstring.h, so had to add it manually in several places
2012-07-12Crashfix: in ll_safe_string not only guard against 0 pointer, but against ↵Nicky
illegal length of buffer too.
2012-02-24Add LLStringUtil::getTokens() overload handling quoted substrings.Nat Goodspeed
We didn't have any tokenizer suitable for scanning something like a bash command line. We do have a couple hacks, e.g. LLExternalEditor::tokenize() and LLCommandLineParser::parseCommandLineString(). Both try to work around boost::tokenizer limitations; but existing boost::tokenizer support just doesn't address this case. Neither of the above is available as a general scanner anyway, and parseCommandLineString() fails outright when passed "". New getTokens() also distinguishes between "drop delimiters" (e.g. space, return, newline) to be discarded from the token stream, versus "keep delimiters" (e.g. "+-*/") to be returned as tokens in their own right. There's an overload that honors escapes and a more efficient one that doesn't; each has a convenience overload that returns the scanned string vector rather than requiring a separate declaration. Tweak and comment older getTokens() implementation. Add unit tests for both old and new getTokens() implementations. Break out StringVec and std::ostream << StringVec from indra/llcommon/tests/listener.h to StringVec.h: that's coming in handy for a number of different TUT test sources.
2011-08-19fix for not properly handling nested brackets inRichard Linden
string replacement, e.g. [[FOO]]
2010-09-27MergeLeyla Farazha
2010-09-03Post-convert merge by convert_monolith.py from ↵Aimee Linden
/Users/Aimee/Documents/Work/Linden-Lab/Development/viewer/convert/viewer-identity-evolution
2010-09-16STORM-180 FIXED Fixed crash on login in Japanese locale.Andrew Dyukov
The crash was caused by erroneous getting of month name from vector with week day names in LLStringUtil::formatDatetime(). This code woth introduced in June, so though it didn't work properly, it didn't cause the crash(cause June is 5th month). But when number of current month exceeded number of days in week(this happened in August cause it is 8th) code started getting 8th element from vector with 7. This caused the crash. It reproduced only on Japanese locale because only there code that caused it was used(see STORM-177 for details). This changeset seems to fix STORM-177 too. - Used vector with months names where it should be.
2010-08-20Merge from dessie/viewer-releaseLeyla Farazha
2010-08-13Change license from GPL to LGPL (version 2.1)Oz Linden
2010-08-05EXT-8309 FIXED Incorrect French date format in place profile and status bar.Vadim Savchuk
Changes: - Added support for formatting day of the month without leading zero ("sday"). - Changed date format in place profile (landmark info) and in the top status bar according to bug reporter's request. Technical details: Actually implementation of strftime() in Linux and Windows supports stripping the leading zero (with "%-d" and "%#d" respectively). But that's not supported in MacOSX, so I had to reimplement it. Reviewed by Sergey Litovchuk at https://codereview.productengine.com/secondlife/r/842/ --HG-- branch : product-engine
2010-07-30Merge with dessie/viewer-releaseLeyla Farazha
2010-07-26EXT-8318 FIX IMPROVED converted EOLsMike Antipov
--HG-- branch : product-engine
2010-07-26EXT-8318 FIX IMPROVED Code is refactored - avoid using of a separate call of ↵Mike Antipov
the MultiByteToWideChar to get length of output string. Assumprion is: wide char buffer requires not more than input string length plus one for a null terminator. Reviewed by Richard Nelson at https://codereview.productengine.com/secondlife/r/775/ --HG-- branch : product-engine
2010-07-23EXT-8318 ADDITIONAL FIXED avoid an extra copy of std::stringMike Antipov
Reviewed by Richard Nelson at https://codereview.productengine.com/secondlife/r/775/ --HG-- branch : product-engine
2010-07-23EXT-8318 ADDITIONAL FIXED ensure that thousands separator is in utf8 format ↵Mike Antipov
(on Windows) before converting it to LLWString. Problem on Windows: ================== LLPanelMainInventory::updateItemcountText() formats number using viewer locale. non-break space is detected as unknown symbols while converting utf8str_to_wstring when formatted text is set to LLTextBox. FIX: === Added converting of string to multi-byte string and then to utf8 string while formatting on Windows. created opposite to "ll_convert_wide_to_string" function "ll_convert_string_to_wide" and helper function to call both of them. It is used now to convert result of formatted string while formatting integer number in locale. Fix affects Windows only. Reviewed by Richard Nelson at https://codereview.productengine.com/secondlife/r/775/ --HG-- branch : product-engine
2010-07-06Merge from dessie/viewer-releaseLeyla Farazha
2010-06-22EXT-7926: Remove unreferenced catch-clause variable (MSVC error).Nat Goodspeed
2010-06-22EXT-7926 FIXED Minor typo correction.Lynx Linden
2010-06-22EXT-7926 FIXED Fixed crash opening About for non-English locales.Lynx Linden
Calling std::locale("fr_FR.UTF-8") crashes on Linux and Mac. Or rather, it throws an exception when it doesn't know the locale and we didn't handle the exception. I now catch the exception and output an error rather than crash. Note, this happened because of change 703f3bcf7069, which made us actually pass a real locale string instead of just "C". So, we were never actually supporting a locale for LLStringUtil::formatNumber(). There is therefore an open task of making formatNumber() actually respect the locale. I'll report a separate JIRA to capture that task.
2010-06-01Merge with dessie/viewer-public in prep to land code thereJames Cook
2010-05-29FIXED Linux build.Sergei Litovchuk
Added forward specialization of LLStringUtil::format before use in LLStringUtil::formatDatetime. --HG-- branch : product-engine
2010-05-28EXT-7013 FIX time formatting function didn't work for some parameters for ↵Yuri Chebotarev
Japanise (like weekdays). reviewed by Vadim Savchuk https://codereview.productengine.com/secondlife/r/457/ --HG-- branch : product-engine
2010-05-27DEV-50013 Friendlier info if you can't change name due to time lockoutJames Cook
Reviewed with Leyla
2010-03-26Fixed bug EXT-6399 (System locale is the same for all languages).Vadim Savchuk
Problem: * English locale was set for all languages. * Specifying a correct locale didn't affect anything, including date/time formatting. My investigation has shown that LLStringUtil was instantiated twice: in the main binary and in libllcommon.so. Because LLStringUtil::setLocale() was called from newview and getLocale() was called from llcommon, they effectively used *different* instances of LLStringUtil::sLocale. Hence getLocale() always returned empty string. This seems to be caused by get/setLocale() methods not being dllexported. The fix instantiates get/setLocale() and sLocale in llcommon and exposes them to use from newview (i.e. prevents multiple instantiation). Besides, I specified correct locale names for all languages and platforms. Reviewed by Leyla: https://codereview.productengine.com/secondlife/r/104/ --HG-- branch : product-engine
2009-12-02fixed normal bug EXT-2738 ([BSI] 12-hour clock format should not have a ↵Paul Guslisty
leading zero) --HG-- branch : product-engine
2009-11-29Fix for Windows crash (incorrect date format crashes windows)Steve Bennetts
2009-11-27fixed normal bug EXT-2738. 12-hour clock format should not have a leading zeroPaul Guslisty
--HG-- branch : product-engine
2009-11-02Fix unclear function names around Pacific versus "SLT" time in string ↵James Cook
operations. Reviewed with Brad.
2009-10-30EXT-1565 Menu bar clock now shows Pacific (PDT/PST) time, as does any otherJames Cook
UI widget that references "slt" in the XML.
2009-10-08* EXT-1282 Fixed a crash when attempting to display strings with [] in themSteven Bennetts
(merged from viewer-2.0-qa-4)
2009-09-25SNOW-194 DEV-40415: pulling this snowglobe patch into viewer 2.0. ThisMartin Reddy
fixes all of the parentheses warnings in the code. Original patch was reviewed by merov (and others).
2009-09-11merge ↵Steven Bennetts
https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1634 https://svn.aws.productengine.com/secondlife/pe/stable-2@1648 -> viewer-2.0.0-3 * Bugs: EXT-888 EXT-866 EXT-861 EXT-858 EXT-864 EXT-875 EXT-884 EXT-718 EXT-786 EXT-885 EXT-910 EXT-845 EXT-312 EXT-823 EXT-868 * New Development: EXT-748 EXT-863 EXT-835 QA: Please test Recent List to verify it has no troubles.