Commit Graph

94 Commits (8d154eaa8ccc5491fd25ecd27f5a14ac1d437bf8)

Author SHA1 Message Date
Ansariel 8d154eaa8c Merge branch 'contribute' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/llappearance/llavatarappearance.cpp
#	indra/llappearance/lldriverparam.cpp
#	indra/llappearance/llwearable.cpp
#	indra/llcommon/llerror.cpp
#	indra/llcommon/llqueuedthread.cpp
#	indra/llcommon/llsdserialize.h
#	indra/llcommon/llthreadsafequeue.h
#	indra/newview/app_settings/settings.xml
#	indra/newview/llpathfindingnavmesh.cpp
#	indra/newview/llviewerassetstorage.cpp
#	indra/newview/llviewerdisplay.cpp
#	indra/newview/skins/default/xui/de/floater_flickr.xml
#	indra/newview/skins/default/xui/de/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/en/floater_about_land.xml
#	indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
#	indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml
#	indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml
#	indra/newview/skins/default/xui/fr/floater_flickr.xml
#	indra/newview/skins/default/xui/fr/panel_flickr_account.xml
#	indra/newview/skins/default/xui/fr/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/it/floater_flickr.xml
#	indra/newview/skins/default/xui/it/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/ja/floater_flickr.xml
#	indra/newview/skins/default/xui/ja/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/pl/floater_avatar_render_settings.xml
#	indra/newview/skins/default/xui/pl/floater_ban_duration.xml
#	indra/newview/skins/default/xui/pl/floater_camera_presets.xml
#	indra/newview/skins/default/xui/pl/floater_classified.xml
#	indra/newview/skins/default/xui/pl/floater_create_landmark.xml
#	indra/newview/skins/default/xui/pl/floater_delete_pref_preset.xml
#	indra/newview/skins/default/xui/pl/floater_fixedenvironment.xml
#	indra/newview/skins/default/xui/pl/floater_flickr.xml
#	indra/newview/skins/default/xui/pl/floater_linkreplace.xml
#	indra/newview/skins/default/xui/pl/floater_load_pref_preset.xml
#	indra/newview/skins/default/xui/pl/floater_my_environments.xml
#	indra/newview/skins/default/xui/pl/floater_my_scripts.xml
#	indra/newview/skins/default/xui/pl/floater_notifications_tabbed.xml
#	indra/newview/skins/default/xui/pl/floater_pick_track.xml
#	indra/newview/skins/default/xui/pl/floater_preferences_graphics_advanced.xml
#	indra/newview/skins/default/xui/pl/floater_preferences_view_advanced.xml
#	indra/newview/skins/default/xui/pl/floater_preview_trash.xml
#	indra/newview/skins/default/xui/pl/floater_profile.xml
#	indra/newview/skins/default/xui/pl/floater_settings_picker.xml
#	indra/newview/skins/default/xui/pl/floater_simple_outfit_snapshot.xml
#	indra/newview/skins/default/xui/pl/menu_avatar_rendering_settings.xml
#	indra/newview/skins/default/xui/pl/menu_avatar_rendering_settings_add.xml
#	indra/newview/skins/default/xui/pl/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/pl/panel_progress.xml
#	indra/newview/skins/default/xui/pl/panel_settings_sky_atmos.xml
#	indra/newview/skins/default/xui/pl/panel_settings_sky_clouds.xml
#	indra/newview/skins/default/xui/pl/panel_settings_sky_sunmoon.xml
#	indra/newview/skins/default/xui/ru/floater_flickr.xml
#	indra/newview/skins/default/xui/ru/panel_flickr_account.xml
#	indra/newview/skins/default/xui/ru/panel_flickr_photo.xml
2023-01-13 15:19:29 +01:00
Nat Goodspeed 9522a0b7c1 DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes.
It's a little distressing how often we have historically coded S32 or U32 to
pass a length or index.

There are more such assumptions in other viewer subdirectories, but this is a
start.
2022-11-03 14:58:32 -04:00
Ansariel 0a0e2fe93e Merge branch 'DRTVWR-546' of https://bitbucket.org/lindenlab/viewer 2022-01-15 02:39:07 +01:00
Ptolemy 12fd860636 SL-16606: Add profiler category STRING 2022-01-14 11:50:21 -08:00
Ansariel 4a1ef323ae Merge branch 'DRTVWR-546' of https://bitbucket.org/lindenlab/viewer 2021-11-29 19:40:28 +01:00
Nat Goodspeed 3b8fc6b9b1 SL-16094: Merge llstring work from SL-16207 2021-11-23 10:09:26 -05:00
Ansariel 63cc972499 Merge branch 'DRTVWR-546' of https://bitbucket.org/lindenlab/viewer
# Conflicts:
#	indra/llappearance/lldriverparam.h
#	indra/llcommon/llmemory.h
#	indra/llcommon/llprofiler.h
#	indra/llrender/llvertexbuffer.cpp
#	indra/llwindow/llwindow.cpp
#	indra/llwindow/llwindowwin32.h
#	indra/newview/app_settings/settings.xml
#	indra/newview/lldrawable.cpp
#	indra/newview/lldrawable.h
#	indra/newview/lldrawpoolalpha.cpp
#	indra/newview/lldrawpoolavatar.cpp
#	indra/newview/lldrawpooltree.cpp
#	indra/newview/lldrawpoolwater.cpp
#	indra/newview/llface.cpp
#	indra/newview/llinventoryfilter.cpp
#	indra/newview/llselectmgr.h
#	indra/newview/llspatialpartition.cpp
#	indra/newview/llviewermenu.cpp
#	indra/newview/llviewerobject.cpp
#	indra/newview/llvieweroctree.cpp
#	indra/newview/llviewertexturelist.cpp
#	indra/newview/llvovolume.cpp
#	indra/newview/llvowlsky.cpp
#	indra/newview/pipeline.cpp
#	indra/newview/skins/default/xui/en/floater_stats.xml
2021-11-12 17:31:39 +01:00
Nat Goodspeed a33718ee4c SL-16207: Fix bug in ll_convert_string_to_utf8_string().
That function wants to pass a code_page to ll_convert_string_to_wide(), but
the code_page parameter was being mistaken for the length parameter, leading
to access violations.
2021-11-02 17:27:59 -04:00
Nat Goodspeed 10692ab4a4 SL-16207: Create uniform overload sets for wide-string conversions.
Use new ll_convert_forms() macro in llstring.h to declare, for each
wide-string conversion function of interest, four overloads. The real one, the
nontrivial one, is (const char*, size_t len), implemented in llstring.cpp. Then
(const string&, size_t len), (const char*) and (const string&) are each
trivially implemented with an inline call to (const char*, size_t len).

Notably, we change all S32 len parameters to size_t. Using S32 is old skool.

Tweak each nontrivial implementation in llstring.cpp to accept (const char*,
size_t len) instead of (const string&) with or without explicit length.
Eliminate from llstring.cpp trivial overloads (deriving length from either a
const char* or from a string), since those are now inline in the header.

Of course three of those overloads will be unified once we enable C++17 and
change each relevant parameter to std::string_view, but we're not yet there.
Meanwhile, this suite of overloads minimizes, to the best of our ability, new
string allocations solely for parameter passing. And use of a macro means we
need only change the macro once we get std::string_view.

We take this step because some use cases require (const char*), some require
(const string&, size_t len), others (const char*, size_t len) ... We were
missing some key overloads, and had to work around them by instantiating new
string objects (necessitating both allocation and character copying) just to
pass the desired parameter. Using the macro ensures this consistent set of
overloads for every wide-string conversion function.

Additionally, knowing that the ugly-name overloads exist, ll_convert_forms()
implicitly defines corresponding ll_convert<TARGET>() overloads.

Streamline declarations of utf16str_to_wstring(), wstring_to_utf16str(),
utf8str_to_utf16str(), utf16str_to_utf8str(), utf8str_to_wstring(),
wstring_to_utf8str(), ll_convert_wide_to_wstring() and
ll_convert_wstring_to_wide() using ll_convert_forms().

Use corresponding new ll_convert_cp_forms() macro to declare consistent
overloads for conversion functions accepting an optional unsigned int
code_page parameter. We used to delegate to the .cpp file the implementation
of each overload accepting code_page so llstring.h need not include the
Windows header defining the CP_UTF8 default; this is more simply accomplished
by introducing a small ll_wstring_default_code_page() function to retrieve it
from the .cpp file. That lets us specify the code_page parameter as optional,
using that function as its default value.

Use ll_convert_cp_forms() to streamline declarations of
ll_convert_wide_to_string() and ll_convert_string_to_wide().

Introduce real implementations of ll_convert_wide_to_wstring() and
ll_convert_wstring_to_wide(). The previous implementations merely copied
individual characters, which is wrong: when we convert UTF16LE to UTF32, we
can and should fold multi-character UTF16LE encodings to the corresponding
single UTF32 character. The real implemenations leverage our awareness that
both llutf16string and Windows std::wstring (either variant) use UTF16LE
encoding, so we can reuse the corresponding llutf16string conversions.

Introduce generic ll_convert_length() function, specialized as either
std::strlen() or std::wcslen() depending on parameter type. (Even if
std::wcslen() is derived from classic C, why doesn't the C++ standard library
define a std::strlen(const wchar_t*) overload to call it?)

Fix ll_convert_alias()'s ll_convert_impl specialization's operator() to accept
boost::call_traits::param_type, so we can pass (e.g.) const std::wstring& but
also const wchar_t* instead of const wchar_t*&.
2021-11-02 10:35:34 -04:00
Dave Parks 8d20480c5f SL-16148 SL-16244 SL-16270 SL-16253 Remove most BlockTimers, remove LLMemTracked, introduce alignas, hook most/all reamining allocs, disable synchronous occlusion, and convert frequently accessed LLSingletons to LLSimpleton 2021-10-28 18:06:21 +00:00
Ansariel bd14ef42b3 FIRE-30495: Revert commit 3df26d1e24 because it's 2020 and internationalization is still a thing... 2020-11-17 01:22:46 +01:00
Ansariel 3df26d1e24 After discussion with Nicky: Use user's locale from OS if using system default language, otherwise use locale configured in particular language_settings.xml file 2020-11-15 10:58:06 +01:00
Ansariel 34d1334cd7 Comment this out instead somebody starts wondering... 2020-11-14 19:29:31 +01:00
Ansariel b01197c134 Still use the user's locale configured in the OS for number formatting 2020-11-14 17:40:53 +01:00
Nicky 45d588d50e FIRE-20337; Step one. Make sure windows correctly formats numbers by
using wide strings for format operations.
2020-11-14 17:00:17 +01:00
Ansariel d8ec4acb4d ll_convert_string_to_utf8_string() only exists on advanced Windows tech as of now... ;) 2020-11-10 20:12:56 +01:00
Ansariel c86ba9b2d9 FIRE-6070: Use user's system locale setting for number formatting 2020-11-10 19:39:21 +01:00
Ansariel 94dd7fe521 FIRE-6070: Fix random symbols in formatted numbers in some locales 2020-11-10 09:23:22 +01:00
Nat Goodspeed cbbe655f27 DRTVWR-476: Eliminate snprintf_hack::snprintf(). Use MS snprintf().
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2017
"Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf is no
longer identical to _snprintf. The snprintf function behavior is now C99
standard compliant."

In other words, VS 2015 et ff. snprintf() now promises to nul-terminate the
buffer even in the overflow case, which is what snprintf_hack::snprintf() was
for.

This removal was motivated by ambiguous-call errors generated by VS 2017 for
library snprintf() vs. snprintf_hack::snprintf().
2020-03-25 16:12:45 -04:00
Ansariel b75b1eb789 Merge viewer-vs2017 2019-03-31 01:37:56 +01:00
Ansariel 8b6392c0aa Merge viewer-bugsplat 2018-12-16 13:04:08 +01:00
Nat Goodspeed 132e708fec SL-10153: Fix previous commit for non-Windows systems.
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-14 12:01:51 -05:00
Nat Goodspeed 9ffcafb64b SL-10153: Introduce ll_convert, windows_message() templates.
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-14 10:48:43 -05:00
Nat Goodspeed 4e894eb2a7 SL-10153: Improve ll_convert_string_to_wide() and its converse.
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.
2018-12-11 20:48:20 -05:00
Nat Goodspeed 23fea97db1 DRTVWR-476: Eliminate snprintf_hack::snprintf(). Use MS snprintf().
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2017
"Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf is no
longer identical to _snprintf. The snprintf function behavior is now C99
standard compliant."

In other words, VS 2015 et ff. snprintf() now promises to nul-terminate the
buffer even in the overflow case, which is what snprintf_hack::snprintf() was
for.

This removal was motivated by ambiguous-call errors generated by VS 2017 for
library snprintf() vs. snprintf_hack::snprintf().
2018-10-24 16:26:05 -04:00
Ansariel 02f6ce9964 Merge Firestorm LGPL 2018-05-30 22:43:01 +02:00
Ansariel 4ff01e5361 Merge axon 2017-10-11 20:28:21 +02:00
Brad Payne (Vir Linden) 36c4424213 SL-808 - more work on arc display. area calculations still have some issues, especially for animated objects. 2017-10-03 22:26:00 +01:00
Kitty Barnett 4a07c81196 Make string splitting code generally available so it can be reused elsehwere
--HG--
branch : RLVa
2016-12-07 19:57:54 +01:00
Kitty Barnett c07bfee1f2 Added the @list and @stopim IM queries
--HG--
branch : RLVa
2016-11-20 21:03:32 +01:00
andreykproductengine 1adfaa081f MAINT-6446 Correct password length handling 2016-06-01 16:56:04 +03:00
Oz Linden c8726aba30 remove execute permission from many files that should not have it 2015-11-10 09:48:56 -05:00
Oz Linden 5c6cf3e7fb restore the ll[io]fstream because we need them as wrappers on Windows for wide char paths; on other platforms they are now just typedefs to the std classes 2015-04-10 11:02:37 -04:00
Oz Linden 8b42c7898e replace llifstream and llofstream with std::ifstream and std::ofstream respectively 2015-04-07 17:59:28 -04:00
Oz Linden 3a57b18896 convert llifstream and llofstream to std::ifstream and std::ofstream respectively 2015-04-07 17:28:05 -04:00
callum_linden e66844570e Update to build on Xcode 6.0 (fix unit tests): minor fix for debug only unit test 2014-10-22 21:31:15 -07:00
Richard Linden 697d2e720b renamed TimeBlock to BlockTimerStatHandle 2013-10-15 20:24:42 -07:00
Richard Linden cbe397ad13 changed fast timer over to using macro
another attempt to move mem stat into base class
2013-09-05 14:04:13 -07:00
Richard Linden e340009fc5 second phase summer cleaning
replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc.
2013-08-09 17:11:19 -07:00
Richard Linden e40065f82c BUILDFIX: #include and dependency cleanup 2013-07-19 15:03:05 -07:00
Richard Linden 0a96b47663 merge with viewer-release 2013-06-05 19:05:43 -07:00
Gilbert Gonzales 892f3cdd2c CHUI-967: fix display of % escapes in chat 2013-05-22 06:26:54 -04:00
Graham Madarasz bf6182daa8 Update Mac and Windows breakpad builds to latest 2013-03-29 07:50:08 -07:00
Richard Linden c0224cc47a merge with viewer-development 2012-11-19 19:06:36 -08:00
Richard Linden 9d77e030d9 SH-3406 WIP convert fast timers to lltrace system
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-11-14 23:52:27 -08:00
Nicky 2005b4fed4 Crashfix: in ll_safe_string not only guard against 0 pointer, but against illegal length of buffer too. 2012-07-12 18:04:53 +02:00
Nat Goodspeed 025329b6a2 Add LLStringUtil::getTokens() overload handling quoted substrings.
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.
2012-02-24 15:06:44 -05:00
Richard Linden 93645cf55c fix for not properly handling nested brackets in
string replacement, e.g. [[FOO]]
2011-08-19 16:41:53 -07:00
Leyla Farazha a4b223248e Merge 2010-09-27 17:54:52 -07:00
Aimee Linden ffae589843 Post-convert merge by convert_monolith.py from /Users/Aimee/Documents/Work/Linden-Lab/Development/viewer/convert/viewer-identity-evolution 2010-09-03 17:41:39 +01:00