svn merge -r 79445:79449 svn+ssh://svn.lindenlab.com/svn/linden/qa/maintenance-5-merge-79386

QAR-242 merge of maintenance-5 (QAR-203)
* DEV-6548 Copy To Inventory fail to execute without any output feedback when Notecard has changes but not saved
* DEV-7600 Deleting someone else's object in god mode crashes sim
* DEV-5329 LLSD parsers should determine and set maximum parse sizes
* DEV-7473 Resolve instant message crash report
* DEV-2904 Presence Issues not (apparently) caused by scripted attachments
* DEV-7083 Investigate Null Folder IDs Bug that caused 470K inventory items with Null Folder IDS on the Grid
* DEV-2865 Textures/Snapshots in a notecard are opened again when you click copy to inventory.
* DEV-6612 VWR-3290: Linux scons build script doesn't work with distcc
* DEV-8002 c++ llsd notation parser accepts malformed data
* DEV-8001 c++ xml parse returns wrong number of elements parsed
* DEV-8089 Double delete in statc structured data parse functions
* DEV-5326 Any viewer can request presence information for any agent
* DEV-2378 python service builder does not sort query string
* DEV-7872 Block teleport off teen grid sub-estates like Schome Park / Open University
* DEV-4465 Add a "logfile" command line option to the sim to create log files
master
Josh Bell 2008-02-07 17:15:18 +00:00
parent 3314f78a36
commit 8bd6a0b321
28 changed files with 982 additions and 401 deletions

View File

@ -33,6 +33,7 @@ Alissa Sabre
VWR-1410
VWR-2116
VWR-2826
VWR-3290
VWR-4010
Angus Boyd
VWR-592

View File

@ -136,7 +136,15 @@ def _build_query_string(query_dict):
@returns Returns an urlencoded query string including leading '?'.
"""
if query_dict:
return '?' + urllib.urlencode(query_dict)
keys = query_dict.keys()
keys.sort()
def stringize(value):
if type(value) in (str,unicode):
return value
else:
return str(value)
query_list = [urllib.quote(str(key)) + '=' + urllib.quote(stringize(query_dict[key])) for key in keys]
return '?' + '&'.join(query_list)
else:
return ''

View File

@ -166,7 +166,16 @@ bool LLApp::parseCommandOptions(int argc, char** argv)
// we found another option after this one or we have
// reached the end. simply record that this option was
// found and continue.
commands[name] = true;
int flag = name.compare("logfile");
if (0 == flag)
{
commands[name] = "log";
}
else
{
commands[name] = true;
}
continue;
}
++ii;

View File

@ -292,7 +292,7 @@ bool ll_apr_file_remove(const LLString& filename, apr_pool_t* pool)
s = apr_file_remove(filename.c_str(), pool);
if (s != APR_SUCCESS)
{
llwarns << "ll_apr_file_remove failed on file: " << filename << llendl;
lldebugs << "ll_apr_file_remove failed on file: " << filename << llendl;
return false;
}
return true;
@ -305,7 +305,7 @@ bool ll_apr_file_rename(const LLString& filename, const LLString& newname, apr_p
s = apr_file_rename(filename.c_str(), newname.c_str(), pool);
if (s != APR_SUCCESS)
{
llwarns << "ll_apr_file_rename failed on file: " << filename << llendl;
lldebugs << "ll_apr_file_rename failed on file: " << filename << llendl;
return false;
}
return true;
@ -361,7 +361,7 @@ bool ll_apr_dir_make(const LLString& dirname, apr_pool_t* pool)
s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool);
if (s != APR_SUCCESS)
{
llwarns << "ll_apr_file_remove failed on file: " << dirname << llendl;
lldebugs << "ll_apr_dir_make failed on file: " << dirname << llendl;
return false;
}
return true;
@ -374,7 +374,7 @@ bool ll_apr_dir_remove(const LLString& dirname, apr_pool_t* pool)
s = apr_file_remove(dirname.c_str(), pool);
if (s != APR_SUCCESS)
{
llwarns << "ll_apr_file_remove failed on file: " << dirname << llendl;
lldebugs << "ll_apr_dir_remove failed on file: " << dirname << llendl;
return false;
}
return true;

View File

@ -291,3 +291,30 @@ llofstream::~llofstream()
#endif // #if USE_LLFILESTREAMS
/************** helper functions ********************************/
std::streamsize llifstream_size(llifstream& ifstr)
{
if(!ifstr.is_open()) return 0;
std::streampos pos_old = ifstr.tellg();
ifstr.seekg(0, ios_base::beg);
std::streampos pos_beg = ifstr.tellg();
ifstr.seekg(0, ios_base::end);
std::streampos pos_end = ifstr.tellg();
ifstr.seekg(pos_old, ios_base::beg);
return pos_end - pos_beg;
}
std::streamsize llofstream_size(llofstream& ofstr)
{
if(!ofstr.is_open()) return 0;
std::streampos pos_old = ofstr.tellp();
ofstr.seekp(0, ios_base::beg);
std::streampos pos_beg = ofstr.tellp();
ofstr.seekp(0, ios_base::end);
std::streampos pos_end = ofstr.tellp();
ofstr.seekp(pos_old, ios_base::beg);
return pos_end - pos_beg;
}

View File

@ -168,5 +168,14 @@ private:
#endif
/**
* @breif filesize helpers.
*
* The file size helpers are not considered particularly efficient,
* and should only be used for config files and the like -- not in a
* loop.
*/
std::streamsize llifstream_size(llifstream& fstr);
std::streamsize llofstream_size(llofstream& fstr);
#endif // not LL_LLFILE_H

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
/**
* @class LLSDParser
* @brief Abstract base class for simple LLSD parsers.
* @brief Abstract base class for LLSD parsers.
*/
class LLSDParser : public LLRefCount
{
@ -51,6 +51,14 @@ protected:
virtual ~LLSDParser();
public:
/**
* @brief Anonymous enum to indicate parsing failure.
*/
enum
{
PARSE_FAILURE = -1
};
/**
* @brief Constructor
*/
@ -67,12 +75,122 @@ public:
* caller.
* @param istr The input stream.
* @param data[out] The newly parse structured data.
* @return Returns The number of LLSD objects parsed into data.
* @param max_bytes The maximum number of bytes that will be in
* the stream. Pass in LLSDSerialize::SIZE_UNLIMITED (-1) to set no
* byte limit.
* @return Returns the number of LLSD objects parsed into
* data. Returns PARSE_FAILURE (-1) on parse failure.
*/
virtual S32 parse(std::istream& istr, LLSD& data) const = 0;
S32 parse(std::istream& istr, LLSD& data, S32 max_bytes);
protected:
/**
* @brief Pure virtual base for doing the parse.
*
* This method parses the istream for a structured data. This
* method assumes that the istream is a complete llsd object --
* for example an opened and closed map with an arbitrary nesting
* of elements. This method will return after reading one data
* object, allowing continued reading from the stream by the
* caller.
* @param istr The input stream.
* @param data[out] The newly parse structured data.
* @return Returns the number of LLSD objects parsed into
* data. Returns PARSE_FAILURE (-1) on parse failure.
*/
virtual S32 doParse(std::istream& istr, LLSD& data) const = 0;
/* @name Simple istream helper methods
*
* These helper methods exist to help correctly use the
* mMaxBytesLeft without really thinking about it for most simple
* operations. Use of the streamtools in llstreamtools.h will
* require custom wrapping.
*/
//@{
/**
* @brief get a byte off the stream
*
* @param istr The istream to work with.
* @return returns the next character.
*/
int get(std::istream& istr) const;
/**
* @brief get several bytes off the stream into a buffer.
*
* @param istr The istream to work with.
* @param s The buffer to get into
* @param n Extract maximum of n-1 bytes and null temrinate.
* @param delim Delimiter to get until found.
* @return Returns istr.
*/
std::istream& get(
std::istream& istr,
char* s,
std::streamsize n,
char delim) const;
/**
* @brief get several bytes off the stream into a streambuf
*
* @param istr The istream to work with.
* @param sb The streambuf to read into
* @param delim Delimiter to get until found.
* @return Returns istr.
*/
std::istream& get(
std::istream& istr,
std::streambuf& sb,
char delim) const;
/**
* @brief ignore the next byte on the istream
*
* @param istr The istream to work with.
* @return Returns istr.
*/
std::istream& ignore(std::istream& istr) const;
/**
* @brief put the last character retrieved back on the stream
*
* @param istr The istream to work with.
* @param c The character to put back
* @return Returns istr.
*/
std::istream& putback(std::istream& istr, char c) const;
/**
* @brief read a block of n characters into a buffer
*
* @param istr The istream to work with.
* @param s The buffer to read into
* @param n The number of bytes to read.
* @return Returns istr.
*/
std::istream& read(std::istream& istr, char* s, std::streamsize n) const;
//@}
protected:
/**
* @brief Accunt for bytes read outside of the istream helpers.
*
* Conceptually const since it only modifies mutable members.
* @param bytes The number of bytes read.
*/
void account(S32 bytes) const;
protected:
/**
* @brief boolean to set if byte counts should be checked during parsing.
*/
bool mCheckLimits;
/**
* @brief The maximum number of bytes left to be parsed.
*/
mutable S32 mMaxBytesLeft;
};
/**
@ -91,8 +209,9 @@ public:
/**
* @brief Constructor
*/
LLSDNotationParser() {}
LLSDNotationParser();
protected:
/**
* @brief Call this method to parse a stream for LLSD.
*
@ -105,21 +224,9 @@ public:
* @param istr The input stream.
* @param data[out] The newly parse structured data. Undefined on failure.
* @return Returns the number of LLSD objects parsed into
* data. Returns -1 on parse failure.
* data. Returns PARSE_FAILURE (-1) on parse failure.
*/
virtual S32 parse(std::istream& istr, LLSD& data) const;
/**
* @brief Simple notation parse.
*
* This simplified parser cannot not distinguish between a failed
* parse and a parse which yields a single undefined LLSD. You can
* use this if error checking will be implicit in the use of the
* results of the parse.
* @param istr The input stream.
* @return Returns the parsed LLSD object.
*/
static LLSD parse(std::istream& istr);
virtual S32 doParse(std::istream& istr, LLSD& data) const;
private:
/**
@ -145,16 +252,18 @@ private:
*
* @param istr The input stream.
* @param data[out] The data to assign.
* @return Retuns true if a complete string was parsed.
*/
void parseString(std::istream& istr, LLSD& data) const;
bool parseString(std::istream& istr, LLSD& data) const;
/**
* @brief Parse binary data from the stream.
*
* @param istr The input stream.
* @param data[out] The data to assign.
* @return Retuns true if a complete blob was parsed.
*/
void parseBinary(std::istream& istr, LLSD& data) const;
bool parseBinary(std::istream& istr, LLSD& data) const;
};
/**
@ -175,6 +284,7 @@ public:
*/
LLSDXMLParser();
protected:
/**
* @brief Call this method to parse a stream for LLSD.
*
@ -186,15 +296,16 @@ public:
* caller.
* @param istr The input stream.
* @param data[out] The newly parse structured data.
* @return Returns the number of LLSD objects parsed into data.
* @return Returns the number of LLSD objects parsed into
* data. Returns PARSE_FAILURE (-1) on parse failure.
*/
virtual S32 parse(std::istream& istr, LLSD& data) const;
virtual S32 doParse(std::istream& istr, LLSD& data) const;
private:
class Impl;
Impl& impl;
void parsePart(const char *buf, int len);
void parsePart(const char* buf, int len);
friend class LLSDSerialize;
};
@ -216,6 +327,7 @@ public:
*/
LLSDBinaryParser();
protected:
/**
* @brief Call this method to parse a stream for LLSD.
*
@ -227,21 +339,10 @@ public:
* caller.
* @param istr The input stream.
* @param data[out] The newly parse structured data.
* @return Returns the number of LLSD objects parsed into data.
* @return Returns the number of LLSD objects parsed into
* data. Returns -1 on parse failure.
*/
virtual S32 parse(std::istream& istr, LLSD& data) const;
/**
* @brief Simple notation parse.
*
* This simplified parser cannot not distinguish between a failed
* parse and a parse which yields a single undefined LLSD. You can
* use this if error checking will be implicit in the use of the
* results of the parse.
* @param istr The input stream.
* @return Returns the parsed LLSD object.
*/
static LLSD parse(std::istream& istr);
virtual S32 doParse(std::istream& istr, LLSD& data) const;
private:
/**
@ -267,8 +368,9 @@ private:
*
* @param istr The input stream.
* @param value[out] The string to assign.
* @return Retuns true if a complete string was parsed.
*/
void parseString(std::istream& istr, std::string& value) const;
bool parseString(std::istream& istr, std::string& value) const;
};
@ -544,7 +646,7 @@ typedef LLSDOStreamer<LLSDXMLFormatter> LLSDXMLStreamer;
/**
* @class LLSDSerialize
* @Serializer / deserializer for the various LLSD formats
* @brief Serializer / deserializer for the various LLSD formats
*/
class LLSDSerialize
{
@ -554,12 +656,32 @@ public:
LLSD_BINARY, LLSD_XML
};
/**
* @brief anonymouse enumeration for useful max_bytes constants.
*/
enum
{
// Setting an unlimited size is discouraged and should only be
// used when reading cin or another stream source which does
// not provide access to size.
SIZE_UNLIMITED = -1,
};
/*
* Generic in/outs
*/
static void serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize,
U32 options = LLSDFormatter::OPTIONS_NONE);
static bool deserialize(LLSD& sd, std::istream& str);
/**
* @breif Examine a stream, and parse 1 sd object out based on contents.
*
* @param sd [out] The data found on the stream
* @param str The incoming stream
* @param max_bytes the maximum number of bytes to parse
* @return Returns true if the stream appears to contain valid data
*/
static bool deserialize(LLSD& sd, std::istream& str, S32 max_bytes);
/*
* Notation Methods
@ -569,10 +691,17 @@ public:
LLPointer<LLSDNotationFormatter> f = new LLSDNotationFormatter;
return f->format(sd, str, LLSDFormatter::OPTIONS_NONE);
}
static S32 fromNotation(LLSD& sd, std::istream& str)
static S32 fromNotation(LLSD& sd, std::istream& str, S32 max_bytes)
{
LLPointer<LLSDNotationParser> p = new LLSDNotationParser;
return p->parse(str, sd);
return p->parse(str, sd, max_bytes);
}
static LLSD fromNotation(std::istream& str, S32 max_bytes)
{
LLPointer<LLSDNotationParser> p = new LLSDNotationParser;
LLSD sd;
(void)p->parse(str, sd, max_bytes);
return sd;
}
/*
@ -588,10 +717,13 @@ public:
LLPointer<LLSDXMLFormatter> f = new LLSDXMLFormatter;
return f->format(sd, str, LLSDFormatter::OPTIONS_PRETTY);
}
static S32 fromXML(LLSD& sd, std::istream& str)
{
// no need for max_bytes since xml formatting is not
// subvertable by bad sizes.
LLPointer<LLSDXMLParser> p = new LLSDXMLParser;
return p->parse(str, sd);
return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED);
}
/*
@ -602,14 +734,18 @@ public:
LLPointer<LLSDBinaryFormatter> f = new LLSDBinaryFormatter;
return f->format(sd, str, LLSDFormatter::OPTIONS_NONE);
}
static S32 fromBinary(LLSD& sd, std::istream& str)
static S32 fromBinary(LLSD& sd, std::istream& str, S32 max_bytes)
{
LLPointer<LLSDBinaryParser> p = new LLSDBinaryParser;
return p->parse(str, sd);
return p->parse(str, sd, max_bytes);
}
static LLSD fromBinary(std::istream& str, S32 max_bytes)
{
LLPointer<LLSDBinaryParser> p = new LLSDBinaryParser;
LLSD sd;
(void)p->parse(str, sd, max_bytes);
return sd;
}
private:
static const char *LLSDBinaryHeader;
static const char *LLSDXMLHeader;
};
#endif // LL_LLSDSERIALIZE_H

View File

@ -305,6 +305,7 @@ private:
XML_Parser mParser;
LLSD mResult;
S32 mParseCount;
bool mInLLSDElement;
bool mGracefullStop;
@ -411,12 +412,12 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data)
}
llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl;
data = LLSD();
return -1;
return LLSDParser::PARSE_FAILURE;
}
clear_eol(input);
data = mResult;
return 1;
return mParseCount;
}
void LLSDXMLParser::Impl::reset()
@ -428,6 +429,7 @@ void LLSDXMLParser::Impl::reset()
}
mResult.clear();
mParseCount = 0;
mInLLSDElement = false;
mDepth = 0;
@ -472,7 +474,7 @@ LLSDXMLParser::Impl::findAttribute(const XML_Char* name, const XML_Char** pairs)
return NULL;
}
void LLSDXMLParser::Impl::parsePart(const char *buf, int len)
void LLSDXMLParser::Impl::parsePart(const char* buf, int len)
{
void * buffer = XML_GetBuffer(mParser, len);
if (buffer != NULL && buf != NULL)
@ -486,7 +488,7 @@ void LLSDXMLParser::Impl::parsePart(const char *buf, int len)
void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Char** attributes)
{
mDepth += 1;
++mDepth;
if (mSkipping)
{
return;
@ -554,6 +556,7 @@ void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Ch
return startSkipping();
}
++mParseCount;
switch (element)
{
case ELEMENT_MAP:
@ -572,7 +575,7 @@ void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Ch
void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
{
mDepth -= 1;
--mDepth;
if (mSkipping)
{
if (mDepth < mSkipThrough)
@ -715,10 +718,10 @@ LLSDXMLParser::Impl::Element LLSDXMLParser::Impl::readElement(const XML_Char* na
LLSDXMLParser::LLSDXMLParser()
: impl(* new Impl)
/**
* LLSDXMLParser
*/
LLSDXMLParser::LLSDXMLParser() : impl(* new Impl)
{
}
@ -733,7 +736,7 @@ void LLSDXMLParser::parsePart(const char *buf, int len)
}
// virtual
S32 LLSDXMLParser::parse(std::istream& input, LLSD& data) const
S32 LLSDXMLParser::doParse(std::istream& input, LLSD& data) const
{
return impl.parse(input, data);
}

View File

@ -538,23 +538,32 @@ void get_keyword_and_value(std::string& keyword,
}
}
std::istream& fullread(std::istream& str, char *buf, std::streamsize requested)
std::streamsize fullread(
std::istream& istr,
char* buf,
std::streamsize requested)
{
std::streamsize got;
std::streamsize total = 0;
str.read(buf, requested); /*Flawfinder: ignore*/
got = str.gcount();
istr.read(buf, requested); /*Flawfinder: ignore*/
got = istr.gcount();
total += got;
while (got && total < requested)
while(got && total < requested)
{
if (str.fail())
str.clear();
str.read(buf + total, requested - total); /*Flawfinder: ignore*/
got = str.gcount();
if(istr.fail())
{
// If bad is true, not much we can doo -- it implies loss
// of stream integrity. Bail in that case, and otherwise
// clear and attempt to continue.
if(istr.bad()) return total;
istr.clear();
}
istr.read(buf + total, requested - total); /*Flawfinder: ignore*/
got = istr.gcount();
total += got;
}
return str;
return total;
}
std::istream& operator>>(std::istream& str, const char *tocheck)

View File

@ -114,7 +114,12 @@ void get_keyword_and_value(std::string& keyword,
// continue to read from the stream until you really can't
// read anymore or until we hit the count. Some istream
// implimentations have a max that they will read.
std::istream& fullread(std::istream& str, char *buf, std::streamsize requested);
// Returns the number of bytes read.
std::streamsize fullread(
std::istream& istr,
char* buf,
std::streamsize requested);
std::istream& operator>>(std::istream& str, const char *tocheck);

View File

@ -117,8 +117,10 @@ void LLCrashLogger::gatherFiles()
updateApplication("Gathering logs...");
// Figure out the filename of the debug log
LLString db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log").c_str();
std::ifstream debug_log_file(db_file_name.c_str());
std::string db_file_name = gDirUtilp->getExpandedFilename(
LL_PATH_LOGS,
"debug_info.log");
llifstream debug_log_file(db_file_name.c_str());
// Look for it in the debug_info.log file
if (debug_log_file.is_open())

View File

@ -410,6 +410,18 @@ public:
*/
S32 countAfter(S32 channel, U8* start) const;
/**
* @brief Count all bytes on channel.
*
* Helper method which just calls countAfter().
* @param channel The channel to count.
* @return Returns the number of bytes in the channel.
*/
S32 count(S32 channel) const
{
return countAfter(channel, NULL);
}
/**
* @brief Read bytes in the buffer array on the specified channel
*

View File

@ -336,7 +336,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(
LLBufferStream stream(channels, buffer.get());
stream << XML_HEADER << XMLRPC_METHOD_RESPONSE_HEADER;
LLSD sd;
LLSDSerialize::fromNotation(sd, stream);
LLSDSerialize::fromNotation(sd, stream, buffer->count(channels.in()));
PUMP_DEBUG;
LLIOPipe::EStatus rv = STATUS_ERROR;
@ -408,7 +408,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(
// See if we can parse it
LLBufferStream stream(channels, buffer.get());
LLSD sd;
LLSDSerialize::fromNotation(sd, stream);
LLSDSerialize::fromNotation(sd, stream, buffer->count(channels.in()));
if(stream.fail())
{
llinfos << "STREAM FAILURE reading structure data." << llendl;

View File

@ -71,8 +71,11 @@ void LLHTTPClient::Responder::result(const LLSD& content)
}
// virtual
void LLHTTPClient::Responder::completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer)
void LLHTTPClient::Responder::completedRaw(
U32 status,
const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer)
{
LLBufferStream istr(channels, buffer.get());
LLSD content;
@ -94,7 +97,10 @@ void LLHTTPClient::Responder::completedRaw(U32 status, const std::string& reason
}
// virtual
void LLHTTPClient::Responder::completed(U32 status, const std::string& reason, const LLSD& content)
void LLHTTPClient::Responder::completed(
U32 status,
const std::string& reason,
const LLSD& content)
{
if(isGoodStatus(status))
{

View File

@ -72,11 +72,18 @@ public:
virtual void result(const LLSD& content);
// Override point for clients that may want to use this class when the response is some other format besides LLSD
virtual void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer);
// Override point for clients that may want to use this class
// when the response is some other format besides LLSD
virtual void completedRaw(
U32 status,
const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer);
virtual void completed(U32 status, const std::string& reason, const LLSD& content);
virtual void completed(
U32 status,
const std::string& reason,
const LLSD& content);
/**< The default implemetnation calls
either:
* result(), or

View File

@ -156,7 +156,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
// assume deferred unless mResponse does otherwise
mResponse = Response::create(this);
// TODO: Babbage: Parameterize parser?
// *TODO: Babbage: Parameterize parser?
// *TODO: We should look at content-type and do the right
// thing. Phoenix 2007-12-31
LLBufferStream istr(channels, buffer.get());
static LLTimer timer;
@ -171,14 +173,12 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
{
LLSD input;
LLSDSerialize::fromXML(input, istr);
mNode.put(LLHTTPNode::ResponsePtr(mResponse), context, input);
}
else if(verb == HTTP_VERB_POST)
{
LLSD input;
LLSDSerialize::fromXML(input, istr);
mNode.post(LLHTTPNode::ResponsePtr(mResponse), context, input);
}
else if(verb == HTTP_VERB_DELETE)

View File

@ -221,7 +221,7 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl(
// << llendl;
LLBufferStream resp(channels, buffer.get());
LLSD sd;
LLSDSerialize::fromNotation(sd, resp);
LLSDSerialize::fromNotation(sd, resp, buffer->count(channels.in()));
LLSDRPCResponse* response = (LLSDRPCResponse*)mResponse.get();
if (!response)
{

View File

@ -182,7 +182,10 @@ LLIOPipe::EStatus LLSDRPCServer::process_impl(
PUMP_DEBUG;
LLBufferStream istr(channels, buffer.get());
mRequest.clear();
LLSDSerialize::fromNotation(mRequest, istr);
LLSDSerialize::fromNotation(
mRequest,
istr,
buffer->count(channels.in()));
// { 'method':'...', 'parameter': ... }
method_name = mRequest[LLSDRPC_METHOD_SD_NAME].asString();

View File

@ -1,33 +1,33 @@
/**
* @file llservicebuilder.cpp
* @brief Implementation of the LLServiceBuilder class.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
* Copyright (c) 2007, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
* @file llservicebuilder.cpp
* @brief Implementation of the LLServiceBuilder class.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
* Copyright (c) 2007, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llapp.h"

View File

@ -390,7 +390,6 @@ static const char USAGE[] = "\n"
" -set <variable> <value> specify the value of a particular\n"
" configuration variable that\n"
" overrides all other settings\n"
" -user <user_server_ip> specify userserver in dotted quad\n"
#if !LL_RELEASE_FOR_DOWNLOAD
" -sim <simulator_ip> specify the simulator ip address\n"
#endif
@ -658,21 +657,6 @@ int parse_args(int argc, char **argv)
gGridChoice = GRID_INFO_YAMI;
sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
}
else if (!strcmp(argv[j], "-user") && (++j < argc))
{
if (!strcmp(argv[j], "-"))
{
gGridChoice = GRID_INFO_LOCAL;
snprintf(gGridName, MAX_STRING, "%s", LOOPBACK_ADDRESS_STRING); // Flawfinder: ignore
}
else
{
gGridChoice = GRID_INFO_OTHER;
ip_string.assign( argv[j] );
LLString::trim(ip_string);
snprintf(gGridName, MAX_STRING, "%s", ip_string.c_str()); // Flawfinder: ignore
}
}
else if (!strcmp(argv[j], "-loginpage") && (++j < argc))
{
LLAppViewer::instance()->setLoginPage(utf8str_trim(argv[j]));
@ -1927,17 +1911,6 @@ bool LLAppViewer::initEarlyConfiguration()
{
sprintf(gGridName,"%s", gGridInfo[GRID_INFO_ARUNA].mName);
}
else if (!strcmp(argv[j], "-user") && (++j < argc))
{
if (!strcmp(argv[j], "-"))
{
snprintf(gGridName, MAX_STRING, "%s", LOOPBACK_ADDRESS_STRING); // Flawfinder: ignore
}
else
{
snprintf(gGridName, MAX_STRING, "%s", argv[j]); // Flawfinder: ignore
}
}
else if (!strcmp(argv[j], "-multiple"))
{
// Hack to detect -multiple so we can disable the marker file check (which will always fail)

View File

@ -1126,7 +1126,7 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data)
std::string sdstring = combobox->getSelectedValue();
LLSD sdres;
std::stringstream sstream(sdstring);
LLSDSerialize::fromNotation(sdres, sstream);
LLSDSerialize::fromNotation(sdres, sstream, sdstring.size());
S32 width = sdres[0];
S32 height = sdres[1];

View File

@ -468,6 +468,7 @@ void LLPreview::onBtnCopyToInv(void* userdata)
cb);
}
}
self->close();
}
// static

View File

@ -1377,8 +1377,13 @@ BOOL idle_startup()
const char* look_at_str = gUserAuthp->getResponse("look_at");
if (look_at_str)
{
LLMemoryStream mstr((U8*)look_at_str, strlen(look_at_str)); /* Flawfinder: ignore */
LLSD sd = LLSDNotationParser::parse(mstr);
#if !LL_WINDOWS && !LL_DARWIN
size_t len = strnlen(look_at_str, MAX_STRING);
#else
size_t len = strlen(look_at_str);
#endif
LLMemoryStream mstr((U8*)look_at_str, len);
LLSD sd = LLSDSerialize::fromNotation(mstr, len);
agent_start_look_at = ll_vector3_from_sd(sd);
}
@ -1399,8 +1404,13 @@ BOOL idle_startup()
const char* home_location = gUserAuthp->getResponse("home");
if(home_location)
{
LLMemoryStream mstr((U8*)home_location, strlen(home_location)); /* Flawfinder: ignore */
LLSD sd = LLSDNotationParser::parse(mstr);
#if !LL_WINDOWS && !LL_DARWIN
size_t len = strnlen(home_location, MAX_STRING);
#else
size_t len = strlen(home_location);
#endif
LLMemoryStream mstr((U8*)home_location, len);
LLSD sd = LLSDSerialize::fromNotation(mstr, len);
S32 region_x = sd["region_handle"][0].asInteger();
S32 region_y = sd["region_handle"][1].asInteger();
U64 region_handle = to_region_handle(region_x, region_y);

View File

@ -1194,8 +1194,8 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
LLString::format_map_t args;
args["[OBJECTNAME]"] = info->mDesc;
// must protect against a NULL return from lookupHumanReadable()
const char* typestr = LLAssetType::lookupHumanReadable(info->mType);
if (typestr)
std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType));
if (!typestr.empty())
{
args["[OBJECTTYPE]"] = typestr;
}

View File

@ -942,7 +942,13 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
S32 dy = y - mMouseDownY;
if (-2 < dx && dx < 2 && -2 < dy && dy < 2)
{
openEmbeddedItem(mDragItem, mDragItemSaved);
if(mDragItemSaved)
{
openEmbeddedItem(mDragItem);
}else
{
showUnsavedAlertDialog(mDragItem);
}
}
}
mDragItem = NULL;
@ -1311,15 +1317,23 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos)
if( item )
{
BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( mWText[pos] );
return openEmbeddedItem(item, saved);
if (saved)
{
return openEmbeddedItem(item);
}
else
{
showUnsavedAlertDialog(item);
}
}
}
return FALSE;
}
BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, BOOL saved)
BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item)
{
switch( item->getType() )
{
case LLAssetType::AT_TEXTURE:
@ -1329,15 +1343,15 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, BOOL saved)
case LLAssetType::AT_SOUND:
openEmbeddedSound( item );
return TRUE;
case LLAssetType::AT_NOTECARD:
openEmbeddedNotecard( item, saved );
openEmbeddedNotecard( item );
return TRUE;
case LLAssetType::AT_LANDMARK:
openEmbeddedLandmark( item );
return TRUE;
case LLAssetType::AT_LSL_TEXT:
case LLAssetType::AT_CLOTHING:
case LLAssetType::AT_OBJECT:
@ -1345,10 +1359,11 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, BOOL saved)
case LLAssetType::AT_ANIMATION:
case LLAssetType::AT_GESTURE:
showCopyToInvDialog( item );
return TRUE;
return TRUE;
default:
return FALSE;
}
}
@ -1401,23 +1416,30 @@ void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item )
open_landmark((LLViewerInventoryItem*)item, title, FALSE, item->getUUID(), TRUE);
}
void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item, BOOL saved )
void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item )
{
if (saved)
{
//if (saved)
//{
// An LLInventoryItem needs to be in an inventory to be opened.
// This will give the item to the viewer's agent.
// The callback will attempt to open it if its not already opened.
copyInventory(item, gInventoryCallbacks.registerCB(mInventoryCallback));
}
else
{
LLNotecardCopyInfo *info = new LLNotecardCopyInfo(this, item);
gViewerWindow->alertXml("ConfirmNotecardSave",
LLViewerTextEditor::onNotecardDialog, (void*)info);
}
copyInventory(item, gInventoryCallbacks.registerCB(mInventoryCallback));
//}
//else
//{
// LLNotecardCopyInfo *info = new LLNotecardCopyInfo(this, item);
// gViewerWindow->alertXml("ConfirmNotecardSave",
// LLViewerTextEditor::onNotecardDialog, (void*)info);
//}
}
void LLViewerTextEditor::showUnsavedAlertDialog( LLInventoryItem* item )
{
LLNotecardCopyInfo *info = new LLNotecardCopyInfo(this, item);
gViewerWindow->alertXml( "ConfirmNotecardSave",
LLViewerTextEditor::onNotecardDialog, (void*)info);
}
// static
void LLViewerTextEditor::onNotecardDialog( S32 option, void* userdata )
{

View File

@ -107,15 +107,16 @@ protected:
BOOL getEmbeddedItemToolTipAtPos(S32 pos, LLWString &wmsg);
BOOL openEmbeddedItemAtPos( S32 pos );
BOOL openEmbeddedItem(LLInventoryItem* item, BOOL saved);
BOOL openEmbeddedItem(LLInventoryItem* item);
S32 insertEmbeddedItem(S32 pos, LLInventoryItem* item);
void openEmbeddedTexture( LLInventoryItem* item );
void openEmbeddedSound( LLInventoryItem* item );
void openEmbeddedLandmark( LLInventoryItem* item );
void openEmbeddedNotecard( LLInventoryItem* item, BOOL saved );
void openEmbeddedNotecard( LLInventoryItem* item);
void showCopyToInvDialog( LLInventoryItem* item );
void showUnsavedAlertDialog( LLInventoryItem* item );
static void onCopyToInvDialog( S32 option, void* userdata );
static void onNotecardDialog( S32 option, void* userdata );

View File

@ -634,7 +634,7 @@ namespace tut
ensure_equals("size of buffer", count, total_size);
LLBufferStream istr(ch, &mBuffer);
LLSD data;
count = LLSDSerialize::fromNotation(data, istr);
count = LLSDSerialize::fromNotation(data, istr, total_size);
ensure("sd parsed", data.isDefined());
for(S32 j = 0; j < 3; ++j)
@ -699,7 +699,7 @@ namespace tut
ensure_equals("size of buffer", count, total_size);
LLBufferStream istr(ch, &mBuffer);
LLSD data;
count = LLSDSerialize::fromNotation(data, istr);
count = LLSDSerialize::fromNotation(data, istr, total_size);
ensure("sd parsed", data.isDefined());
}
@ -735,7 +735,10 @@ namespace tut
ch = mBuffer.nextChannel();
LLBufferStream istr(ch, &mBuffer);
LLSD data;
S32 count = LLSDSerialize::fromNotation(data, istr);
S32 count = LLSDSerialize::fromNotation(
data,
istr,
mBuffer.count(ch.in()));
ensure("parsed something", (count > 0));
ensure("sd parsed", data.isDefined());
ensure_equals("sd type", data.type(), LLSD::TypeMap);
@ -780,7 +783,7 @@ namespace tut
std::istringstream istr;
istr.str(val);
LLSD sd;
S32 count = LLSDSerialize::fromNotation(sd, istr);
S32 count = LLSDSerialize::fromNotation(sd, istr, val.size());
ensure_equals("parser error return value", count, -1);
ensure("data undefined", sd.isUndefined());
}
@ -792,7 +795,7 @@ namespace tut
std::istringstream istr;
istr.str(val);
LLSD sd;
S32 count = LLSDSerialize::fromNotation(sd, istr);
S32 count = LLSDSerialize::fromNotation(sd, istr, val.size());
ensure_equals("parser error return value", count, -1);
ensure("data undefined", sd.isUndefined());
}
@ -1324,7 +1327,10 @@ namespace tut
<< "}]";
LLSD request;
S32 count = LLSDSerialize::fromNotation(request, stream);
S32 count = LLSDSerialize::fromNotation(
request,
stream,
stream.str().size());
ensure("parsed something", (count > 0));
pump_loop(request);
@ -1425,7 +1431,10 @@ namespace tut
LLChannelDescriptors read_channel = buffer.nextChannel();
LLBufferStream read_stream(read_channel, &buffer);
LLSD request;
S32 count = LLSDSerialize::fromNotation(request, read_stream);
S32 count = LLSDSerialize::fromNotation(
request,
read_stream,
buffer.count(read_channel.in()));
ensure("parsed something", (count > 0));
ensure("deserialized", request.isDefined());
@ -1487,7 +1496,10 @@ namespace tut
str << "{'message':'" << LLSDNotationFormatter::escapeString(message)
<< "'}";
LLSD request;
S32 count = LLSDSerialize::fromNotation(request, str);
S32 count = LLSDSerialize::fromNotation(
request,
str,
str.str().size());
ensure_equals("parse count", count, 2);
ensure_equals("request type", request.type(), LLSD::TypeMap);
pump_loop(request);
@ -1510,7 +1522,7 @@ namespace tut
std::istringstream istr;
istr.str(val);
LLSD sd;
LLSDSerialize::fromNotation(sd, istr);
LLSDSerialize::fromNotation(sd, istr, val.size());
pump_loop(sd);
ensure("valid response", mResponse.isDefined());
ensure_equals("parsed type", mResponse.type(), LLSD::TypeMap);