From 2b69eb990255750b23893ccb2592b56b5fa258c4 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Tue, 20 Sep 2011 22:16:00 -0500 Subject: [PATCH] Misc little tidbits from V3. --- indra/llcommon/llsdserialize.cpp | 13 ++++++------- indra/llcommon/llstring.cpp | 13 +++++++++---- indra/llcommon/llworkerthread.cpp | 2 +- indra/llcommon/roles_constants.h | 1 + indra/newview/lltexturecache.cpp | 7 +++++-- indra/newview/lltexturecache.h | 7 ++++++- indra/newview/llvocache.cpp | 18 +++++++++++------- 7 files changed, 39 insertions(+), 22 deletions(-) diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 28700faae..fb5fb7cad 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -1454,12 +1454,9 @@ S32 LLSDBinaryFormatter::format(const LLSD& data, std::ostream& ostr, U32 option } case LLSD::TypeUUID: - { ostr.put('u'); - LLUUID d = data.asUUID(); - ostr.write((const char*)(&(d.mData)), UUID_BYTES); + ostr.write((const char*)(&(data.asUUID().mData)), UUID_BYTES); break; - } case LLSD::TypeString: ostr.put('s'); @@ -1512,7 +1509,7 @@ void LLSDBinaryFormatter::formatString( */ int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes) { - char c = istr.get(); + int c = istr.get(); if(istr.fail()) { // No data in stream, bail out but mention the character we @@ -1554,7 +1551,7 @@ int deserialize_string_delim( while (true) { - char next_char = istr.get(); + int next_byte = istr.get(); ++count; if(istr.fail()) @@ -1563,6 +1560,8 @@ int deserialize_string_delim( value = write_buffer.str(); return LLSDParser::PARSE_FAILURE; } + + char next_char = (char)next_byte; // Now that we know it's not EOF if(found_escape) { @@ -1651,7 +1650,7 @@ int deserialize_string_raw( char buf[BUF_LEN]; /* Flawfinder: ignore */ istr.get(buf, BUF_LEN - 1, ')'); count += istr.gcount(); - char c = istr.get(); + int c = istr.get(); c = istr.get(); count += 2; if(((c == '"') || (c == '\'')) && (buf[0] == '(')) diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 7423726cb..27bbf7e98 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -957,13 +957,18 @@ LLStringUtil::size_type LLStringUtil::getSubstitution(const std::string& instr, { const std::string delims (","); - // Find the first ] - size_type pos2 = instr.find(']', start); + // Find the first [ + size_type pos1 = instr.find('[', start); + if (pos1 == std::string::npos) + return std::string::npos; + + //Find the first ] after the initial [ + size_type pos2 = instr.find(']', pos1); if (pos2 == std::string::npos) return std::string::npos; - // Find the last [ before ] - size_type pos1 = instr.find_last_of('[', pos2-1); + // Find the last [ before ] in case of nested [[]] + pos1 = instr.find_last_of('[', pos2-1); if (pos1 == std::string::npos || pos1 < start) return std::string::npos; diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 65f27095b..d9adef5fc 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -202,9 +202,9 @@ void LLWorkerThread::WorkRequest::finishRequest(bool completed) LLWorkerClass::LLWorkerClass(LLWorkerThread* workerthread, const std::string& name) : mWorkerThread(workerthread), - mRequestPriority(LLWorkerThread::PRIORITY_NORMAL), mWorkerClassName(name), mRequestHandle(LLWorkerThread::nullHandle()), + mRequestPriority(LLWorkerThread::PRIORITY_NORMAL), mWorkFlags(0) { if (!mWorkerThread) diff --git a/indra/llcommon/roles_constants.h b/indra/llcommon/roles_constants.h index 854a153d1..a79d3e3bd 100644 --- a/indra/llcommon/roles_constants.h +++ b/indra/llcommon/roles_constants.h @@ -109,6 +109,7 @@ const U64 GP_LAND_ALLOW_FLY = 0x1 << 24; // Bypass Fly Restriction const U64 GP_LAND_ALLOW_CREATE = 0x1 << 25; // Bypass Create/Edit Objects Restriction const U64 GP_LAND_ALLOW_LANDMARK = 0x1 << 26; // Bypass Landmark Restriction const U64 GP_LAND_ALLOW_SET_HOME = 0x1 << 28; // Bypass Set Home Point Restriction +const U64 GP_LAND_ALLOW_HOLD_EVENT = 0x1LL << 41; // Allowed to hold events on group-owned land // Parcel Access const U64 GP_LAND_MANAGE_ALLOWED = 0x1 << 29; // Manage Allowed List diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index e388d16dc..06b3c5304 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -495,7 +495,8 @@ bool LLTextureCacheRemoteWorker::doRead() mReadData = data; // Read the data at last - S32 bytes_read = LLAPRFile::readEx(filename, mReadData + data_offset, + S32 bytes_read = LLAPRFile::readEx(filename, + mReadData + data_offset, file_offset, file_size); if (bytes_read != file_size) { @@ -646,7 +647,9 @@ bool LLTextureCacheRemoteWorker::doWrite() // build the cache file name from the UUID std::string filename = mCache->getTextureFileName(mID); // llinfos << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << llendl; - S32 bytes_written = LLAPRFile::writeEx(filename, mWriteData + TEXTURE_CACHE_ENTRY_SIZE, 0, file_size); + S32 bytes_written = LLAPRFile::writeEx( filename, + mWriteData + TEXTURE_CACHE_ENTRY_SIZE, + 0, file_size); if (bytes_written <= 0) { llwarns << "LLTextureCacheWorker: " << mID diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 3a4b1f25e..54f52df6a 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -59,7 +59,12 @@ private: }; struct Entry { - Entry() : mBodySize(0), mImageSize(0), mTime(0) { } + Entry() : + mBodySize(0), + mImageSize(0), + mTime(0) + { + } Entry(const LLUUID& id, S32 imagesize, S32 bodysize, U32 time) : mID(id), mImageSize(imagesize), mBodySize(bodysize), mTime(time) {} void init(const LLUUID& id, U32 time) { mID = id, mImageSize = 0; mBodySize = 0; mTime = time; } diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 32cd2607e..f21b876fa 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -625,16 +625,20 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca S32 num_entries; success = check_read(&apr_file, &num_entries, sizeof(S32)) ; - for (S32 i = 0; success && i < num_entries; i++) + if(success) { - LLVOCacheEntry* entry = new LLVOCacheEntry(&apr_file); - if (!entry->getLocalID()) + for (S32 i = 0; i < num_entries; i++) { - llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl; - delete entry ; - success = false ; + LLVOCacheEntry* entry = new LLVOCacheEntry(&apr_file); + if (!entry->getLocalID()) + { + llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl; + delete entry ; + success = false ; + break ; + } + cache_entry_map[entry->getLocalID()] = entry; } - cache_entry_map[entry->getLocalID()] = entry; } } }