Commit Graph

69 Commits (4349cb6165e983ff6bdd45ad1b82bb98bfc0436f)

Author SHA1 Message Date
Nat Goodspeed 4349cb6165 DRTVWR-575: Address review comments on Xcode 14.1 type tweaks.
Introduce LLSD template constructors and assignment operators to disambiguate
construction or assignment from any integer type to Integer, likewise any
floating point type to Real. Use new narrow() function to validate
conversions.

For LLSD method parameters converted from LLSD::Integer to size_t, where the
method previously checked for a negative argument, make it now check for
size_t converted from negative: in other words, more than S32_MAX. The risk of
having a parameter forced from negative to unsigned exceeds the risk of a
valid length or index over that max.

In lltracerecording.cpp's PeriodicRecording, now that mCurPeriod and
mNumRecordedPeriods are size_t instead of S32, defend against subtracting 1
from 0.

Use narrow() to validate newly-introduced narrowing conversions.

Make llclamp() return the type of the raw input value, even if the types of
the boundary values differ.

std::ostream::tellp() no longer returns a value we can directly report as a
number. Cast to U64.
2022-11-12 18:59:21 -10: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
Andrey Kleshchev 5af8f15a05 SL-14541 Replace zlib with zlib-ng 2021-09-08 23:18:07 +03:00
Nat Goodspeed a83da3a452 DRTVWR-476: Make LLSDFormatter::OPTIONS_PRETTY_BINARY uppercase
for compatibility with Python llbase.llsd.parse().

The Python parse() currently requires uppercase hex digits for b16"hex"
coding; lowercase hex digits cause it to raise LLSDParseError.
2020-05-14 08:54:15 -04:00
Nat Goodspeed 066fb5dafc DRTVWR-476: Default LLSDNotationFormatter now OPTIONS_PRETTY_BINARY.
LLSDNotationFormatter (also LLSDNotationStreamer that uses it, plus
operator<<(std::ostream&, const LLSD&) that uses LLSDNotationStreamer) is most
useful for displaying LLSD to a human, e.g. for logging. Having the default
dump raw binary bytes into the log file is not only suboptimal, it can
truncate the output if one of those bytes is '\0'. (This is a problem with the
logging subsystem, but that's a story for another day.)

Use OPTIONS_PRETTY_BINARY wherever there is a default LLSDFormatter
::EFormatterOptions argument.

Also, allow setting LLSDFormatter subclass boolalpha(), realFormat() and
format(options) using optional constructor arguments. Naturally, each subclass
that supports this must accept and forward these constructor arguments to its
LLSDFormatter base class constructor.

Fix a couple bugs in LLSDNotationFormatter::format_impl() for an LLSD::Binary
value with OPTIONS_PRETTY_BINARY:
- The code unconditionally emitted a b(len) type prefix followed by either raw
  binary or hex, depending on the option flag. OPTIONS_PRETTY_BINARY caused it
  to emit "0x" before the hex representation of the data. This is wrong in
  that it can't be read back by either the C++ or the Python LLSD parser.
  Correct OPTIONS_PRETTY_BINARY formatting consists of b16"hex digits" rather
  than b(len)"raw bytes".
- Although the code did set hex mode, it didn't set either the field width or
  the fill character, so that a byte value less than 16 would emit a single
  digit rather than two.

Instead of having one LLSDFormatter::format() method with an optional options
argument, declare two overloads. The format() overload without options passes
the mOptions data member to the overload accepting options.

Refactor the LLSDFormatter family, hoisting the recursive format_impl() method
(accepting level) to a pure virtual method at LLSDFormatter base-class level.
Most subclasses therefore need not override either base-class format() method,
only format_impl(). In fact the short format() overload isn't even virtual.

Consistently use LLSDFormatter::EFormatterOptions enum as the options
parameter wherever such options are accepted.
2020-05-13 16:37:12 -04:00
Andrey Lihatskiy c757c29c95 Merge branch 'master' into DRTVWR-500
# Conflicts:
#	indra/newview/pipeline.cpp
2020-04-20 21:23:34 +03:00
andreykproductengine 1b4d5492c6 SL-11727 Fix build warnings 2019-10-23 16:37:15 +03:00
Rider Linden 3888de9439 Merge 2018-05-22 13:16:37 -07:00
Rider Linden 7b56db31f9 Merge 2018-03-07 11:27:43 -08:00
Rider Linden b766466b30 Added settings inventory object with subtype 2018-02-26 09:27:14 -08:00
andreykproductengine e32b4f481a MAINT-8308 Additional logging for mesh processing 2018-02-19 21:01:34 +02:00
andreykproductengine f22c1bcf20 MAINT-8022 Handling memory errors in unzip_llsdNavMesh 2018-02-19 21:30:48 +02:00
andreykproductengine 64b9b4c771 MAINT-2338 Implemented binary parser depth control 2018-02-01 16:35:02 +02:00
andreykproductengine c56298d4ba MAINT-8022 Make unzip silent yet include failure reason into output 2018-01-03 16:30:57 +02:00
andreykproductengine a35008993e MAINT-8022 String crashes in unzip_llsd 2018-01-02 20:31:23 +02:00
andreykproductengine dcfccc6f43 MAINT-8022 Crashes in unzip_llsd #2 2017-11-28 15:55:40 +02:00
andreykproductengine 6d7c19623d MAINT-8022 Crashes in unzip_llsd 2017-11-27 19:04:41 +02:00
AndreyL ProductEngine 7cc9455fe1 MAINT-6697 Correct pointer freeing 2017-06-07 23:05:37 +03:00
AndreyL ProductEngine d9fe21f17f MAINT-6697 More nullchecks for zip/unzip functions 2017-06-07 19:30:32 +03:00
AndreyL ProductEngine f2780a93c0 MAINT-6697 Added a nullcheck to unzip_llsd() 2017-06-07 03:16:56 +03:00
andreykproductengine 26e73e2f58 MAINT-6825 Fixing bad_alloc crash 2016-10-28 17:29:30 +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 e15002a11c merge changes for 3.7.9-release 2014-06-16 11:42:37 -04:00
Brad Payne (Vir Linden) 7b9708a2e3 sunshine-external merge WIP 2014-05-13 10:02:26 -04:00
Oz Linden a98b4b6bee merge changes for 3.7.7-release 2014-05-07 11:09:04 -04:00
Oz Linden 776aadf4ef OPEN-199: replace the confusing STANDALONE switch with USESYSTEMLIBS 2014-03-19 17:30:07 -04: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
Brad Payne (Vir Linden) a04a706c1b merge 2013-05-21 16:18:48 -04:00
Oz Linden ddd5659f81 merge changes for DRTVWR-294 2013-04-19 10:11:29 -04:00
Graham Madarasz bf6182daa8 Update Mac and Windows breakpad builds to latest 2013-03-29 07:50:08 -07:00
Don Kjer f945415210 Large changes to the LLCurl::Responder API, as well as pulling in some changes to common libraries from the server codebase:
* Additional error checking in http handlers.
* Uniform log spam for http errors.
* Switch to using constants for http heads and status codes.
* Fixed bugs in incorrectly checking if parsing LLSD xml resulted in an error.
* Reduced spam regarding LLSD parsing errors in the default completedRaw http handler.  It should not longer be necessary to short-circuit completedRaw to avoid spam.
* Ported over a few bug fixes from the server code.
* Switch mode http status codes to use S32 instead of U32.
* Ported LLSD::asStringRef from server code; avoids copying strings all over the place.
* Ported server change to LLSD::asBinary; this always returns a reference now instead of copying the entire binary blob.
* Ported server pretty notation format (and pretty binary format) to llsd serialization.

* The new LLCurl::Responder API no longer has two error handlers to choose from.  Overriding the following methods have been deprecated:
** error - use httpFailure
** errorWithContent - use httpFailure
** result - use httpSuccess
** completed - use httpCompleted
** completedHeader - no longer necessary; call getResponseHeaders() from a completion method to obtain these headers.

* In order to 'catch' a completed http request, override one of these methods:
** httpSuccess - Called for any 2xx status code.
** httpFailure - Called for any non-2xx status code.
** httpComplete - Called for all status codes.  Default implementation is to call either httpSuccess or httpFailure.
* It is recommended to keep these methods protected/private in order to avoid triggering of these methods without using a 'push' method (see below).

* Uniform error handling should followed whenever possible by calling a variant of this during httpFailure:
** llwarns << dumpResponse() << llendl;
* Be sure to include LOG_CLASS(your_class_name) in your class in order for the log entry to give more context.

* In order to 'push' a result into the responder, you should no longer call error, errorWithContent, result, or completed.
* Nor should you directly call httpSuccess/Failure/Completed (unless passing a message up to a parent class).
* Instead, you can set the internal content of a responder and trigger a corresponding method using the following methods:
** successResult - Sets results and calls httpSuccess
** failureResult - Sets results and calls httpFailure
** completedResult - Sets results and calls httpCompleted

* To obtain information about a the response from a reponder method, use the following getters:
** getStatus - HTTP status code
** getReason - Reason string
** getContent - Content (Parsed body LLSD)
** getResponseHeaders - Response Headers (LLSD map)
** getHTTPMethod - HTTP method of the request
** getURL - URL of the request

* It is still possible to override completeRaw if you want to manipulate data directly out of LLPumpIO.

* See indra/llmessage/llcurl.h for more information.
2013-03-13 06:26:25 +00:00
Don Kjer c06c35609c Updating linux build to gcc4.6 2012-10-11 00:09:04 +00:00
Monty Brandenberg fdb2ae8335 Merge of viewer-development (3.4.1). 2012-08-03 11:57:51 -04:00
Monty Brandenberg 8e5197a71b Merge 3.3.3 release with Drano HTTP library at 3.3.0
Big delta was converting the new texture debugger support code
to the new library.  Viewer manifest should probably get an eyeball
before release.
2012-07-02 18:06:22 -04:00
Monty Brandenberg fb5a29c069 Platform fixups Linux: unused variables, make error strings constant. 2012-06-01 23:06:24 +00:00
Todd Stinson cbebd682f7 Removing windows line endings from .h and .cpp files. 2012-04-25 13:04:13 -07:00
prep fab57eea61 pull and merge from viewer-development 2012-03-13 15:48:24 -04:00
prep 95aa437160 Path-305: Added support for retrieving compressed navmeshes in a LLSD. 2012-02-22 12:00:37 -05:00
Richard Linden 5a14a67e06 converted a bunch of narrowing implicit conversions to explicit 2012-02-01 13:03:46 -08:00
Richard Nelson ff46a6f423 EXP-1107 FIX Crash in LLFastTimer::NamedTimer::accumulateTimings 2011-08-18 13:59:38 -07:00
Richard Nelson 11005a9d91 added fast timers to profile inventory LLSD deserialization 2011-08-10 10:52:56 -07:00
Dave Parks 3a409e6edc SH-1603 Replace every occurrence of "WTF" with something more appropriate. 2011-05-25 18:45:21 -05:00
Dave Parks 6b9a2d24cc SH-477 Better mesh streaming cost estimation. 2011-03-30 18:38:22 -05:00
Nyx (Neal Orman) be1fd73390 CTS-320 SH-465 FIX use system zlib for standalone builds
pulling boroondas' changes to change our includes to use the system versions
of zlib if doing a standalone build. Code changes are minimal, and appear to
work correctly. Approved. - Nyx
2010-11-22 18:42:34 -05:00
Boroondas Gupte 0aba56e2db CTS-320 (part 3 of 3) use system zlib for standalone 2010-10-25 11:39:56 +02:00
Boroondas Gupte 03acf85c36 CTS-320 (part 2 of 3) use system zlib for standalone 2010-10-25 11:38:33 +02:00
Oz Linden a5619d16f7 correct licenses (fix problem with license change merge) 2010-10-13 07:24:37 -04:00
Dave Parks 23b4dc6189 Fix for serialization deprecation problems. 2010-09-29 18:10:27 -05:00
Dave Parks 7c2b9221d6 merge 2010-09-27 15:20:27 -05:00
Dave Parks 35c81f75ac Fix for bad zipping of meshes and add mesh icon back to repository. 2010-09-24 23:52:32 -05:00