summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/CMakeLists.txt2
-rw-r--r--indra/llcommon/llapp.h2
-rw-r--r--indra/llcommon/llapr.cpp11
-rw-r--r--indra/llcommon/llapr.h8
-rw-r--r--indra/llcommon/llassettype.cpp86
-rw-r--r--indra/llcommon/llassettype.h3
-rw-r--r--indra/llcommon/llchat.h2
-rw-r--r--indra/llcommon/llcommonutils.cpp61
-rw-r--r--indra/llcommon/llcommonutils.h56
-rw-r--r--indra/llcommon/llcursortypes.cpp3
-rw-r--r--indra/llcommon/llcursortypes.h3
-rw-r--r--indra/llcommon/llerror.cpp16
-rw-r--r--indra/llcommon/llfasttimer.h24
-rw-r--r--indra/llcommon/llfasttimer_class.cpp6
-rw-r--r--indra/llcommon/llprocessor.cpp11
-rw-r--r--indra/llcommon/llqueuedthread.cpp5
-rw-r--r--indra/llcommon/llstring.cpp14
-rw-r--r--indra/llcommon/llstring.h4
-rw-r--r--indra/llcommon/llsys.cpp14
-rw-r--r--indra/llcommon/llsys.h5
-rw-r--r--indra/llcommon/lltimer.cpp2
-rw-r--r--indra/llcommon/lluri.cpp3
-rw-r--r--indra/llcommon/lluuid.cpp162
-rw-r--r--indra/llcommon/lluuid.h1
-rw-r--r--indra/llcommon/llversionserver.h2
-rw-r--r--indra/llcommon/llversionviewer.h4
-rw-r--r--indra/llcommon/llworkerthread.cpp4
27 files changed, 381 insertions, 133 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 4481d334b2..3c689930b8 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -35,6 +35,7 @@ set(llcommon_SOURCE_FILES
llbase32.cpp
llbase64.cpp
llcommon.cpp
+ llcommonutils.cpp
llcoros.cpp
llcrc.cpp
llcriticaldamp.cpp
@@ -124,6 +125,7 @@ set(llcommon_HEADER_FILES
llchat.h
llclickaction.h
llcommon.h
+ llcommonutils.h
llcoros.h
llcrc.h
llcriticaldamp.h
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index 27a52cdd99..e5b8edf9c3 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -235,7 +235,7 @@ public:
// Child process handling (Unix only for now)
//
// Set a callback to be run on exit of a child process
- // WARNING! This callback is run from the signal handler due to the extreme crappiness of
+ // WARNING! This callback is run from the signal handler due to
// Linux threading requiring waitpid() to be called from the thread that spawned the process.
// At some point I will make this more behaved, but I'm not going to fix this right now - djs
void setChildCallback(pid_t pid, LLAppChildCallback callback);
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index ed70b1d9f2..7330b00bcf 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -543,14 +543,13 @@ S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nb
return 0;
}
- S32 off;
- if (offset < 0)
- off = LLAPRFile::seek(file_handle, APR_END, 0);
- else
- off = LLAPRFile::seek(file_handle, APR_SET, offset);
+ llassert(offset >= 0);
+
+ if (offset > 0)
+ offset = LLAPRFile::seek(file_handle, APR_SET, offset);
apr_size_t bytes_read;
- if (off < 0)
+ if (offset < 0)
{
bytes_read = 0;
}
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index b05a222b33..08cf11e593 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -182,7 +182,7 @@ typedef LLAtomic32<U32> LLAtomicU32;
typedef LLAtomic32<S32> LLAtomicS32;
// File IO convenience functions.
-// Returns NULL if the file fails to openm sets *sizep to file size of not NULL
+// Returns NULL if the file fails to open, sets *sizep to file size if not NULL
// abbreviated flags
#define LL_APR_R (APR_READ) // "r"
#define LL_APR_W (APR_CREATE|APR_TRUNCATE|APR_WRITE) // "w"
@@ -200,7 +200,7 @@ typedef LLAtomic32<S32> LLAtomicS32;
// especially do not put some time-costly operations between open() and close().
// otherwise it might lock the APRFilePool.
//there are two different apr_pools the APRFile can use:
-// 1, a temperary pool passed to an APRFile function, which is used within this function and only once.
+// 1, a temporary pool passed to an APRFile function, which is used within this function and only once.
// 2, a global pool.
//
@@ -255,12 +255,12 @@ public:
// Returns bytes read/written, 0 if read/write fails:
static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
- static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
+ static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); // offset<0 means append
//*******************************************************************************************************************************
};
/**
- * @brief Function which approprately logs error or remains quiet on
+ * @brief Function which appropriately logs error or remains quiet on
* APR_SUCCESS.
* @return Returns <code>true</code> if status is an error condition.
*/
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index 6d5b12d840..2cd29448ae 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -45,12 +45,16 @@ struct AssetEntry : public LLDictionaryEntry
AssetEntry(const char *desc_name,
const char *type_name, // 8 character limit!
const char *human_name, // for decoding to human readable form; put any and as many printable characters you want in each one
- bool can_link) // can you create a link to this type?
+ bool can_link, // can you create a link to this type?
+ bool can_fetch, // can you fetch this asset by ID?
+ bool can_know) // can you see this asset's ID?
:
LLDictionaryEntry(desc_name),
mTypeName(type_name),
mHumanName(human_name),
- mCanLink(can_link)
+ mCanLink(can_link),
+ mCanFetch(can_fetch),
+ mCanKnow(can_know)
{
llassert(strlen(mTypeName) <= 8);
}
@@ -58,6 +62,8 @@ struct AssetEntry : public LLDictionaryEntry
const char *mTypeName;
const char *mHumanName;
bool mCanLink;
+ bool mCanFetch;
+ bool mCanKnow;
};
class LLAssetDictionary : public LLSingleton<LLAssetDictionary>,
@@ -69,32 +75,32 @@ public:
LLAssetDictionary::LLAssetDictionary()
{
- // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK?
- // |--------------------|-----------|-------------------|-----------|
- addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", FALSE));
- addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", FALSE));
- addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", FALSE));
- addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", FALSE));
- addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", FALSE));
- addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", TRUE));
- addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", TRUE));
- addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", FALSE));
- addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", TRUE));
- addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", FALSE));
- addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", FALSE));
- addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", FALSE));
- addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", TRUE));
- addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", FALSE));
- addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", FALSE));
- addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", FALSE));
- addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", FALSE));
- addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", TRUE));
- addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", FALSE));
-
- addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", FALSE));
- addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", FALSE));
-
- addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE));
+ // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK? CAN FETCH? CAN KNOW?
+ // |--------------------|-----------|-------------------|-----------|-----------|---------|
+ addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", true, false, true));
+ addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", true, true, true));
+ addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", true, false, false));
+ addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", true, true, true));
+ addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", true, false, false));
+ addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", true, true, true));
+ addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", true, false, false));
+ addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", true, false, true));
+ addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", true, false, false));
+ addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", true, false, false));
+ addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", true, false, false));
+ addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", true, false, false));
+ addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", true, true, true));
+ addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", true, false, false));
+ addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", true, false, false));
+ addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", true, false, false));
+ addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", true, true, true));
+ addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", true, true, true));
+ addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", false, false, false));
+
+ addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "sym link", false, false, true));
+ addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "sym folder link", false, false, true));
+
+ addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, false, false, false));
};
// static
@@ -225,3 +231,27 @@ const std::string &LLAssetType::badLookup()
return sBadLookup;
}
+
+// static
+bool LLAssetType::lookupIsAssetFetchByIDAllowed(EType asset_type)
+{
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
+ {
+ return entry->mCanFetch;
+ }
+ return false;
+}
+
+// static
+bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
+{
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
+ {
+ return entry->mCanKnow;
+ }
+ return false;
+}
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index c7bbc2e74a..2c2dc27aaa 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -146,6 +146,9 @@ public:
static bool lookupCanLink(EType asset_type);
static bool lookupIsLinkType(EType asset_type);
+ static bool lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download
+ static bool lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer
+
static const std::string& badLookup(); // error string when a lookup fails
protected:
diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h
index f1b9091298..63cce24005 100644
--- a/indra/llcommon/llchat.h
+++ b/indra/llcommon/llchat.h
@@ -82,6 +82,7 @@ public:
mFromName(),
mFromID(),
mNotifId(),
+ mOwnerID(),
mSourceType(CHAT_SOURCE_AGENT),
mChatType(CHAT_TYPE_NORMAL),
mAudible(CHAT_AUDIBLE_FULLY),
@@ -98,6 +99,7 @@ public:
std::string mFromName; // agent or object name
LLUUID mFromID; // agent id or object id
LLUUID mNotifId;
+ LLUUID mOwnerID;
EChatSourceType mSourceType;
EChatType mChatType;
EChatAudible mAudible;
diff --git a/indra/llcommon/llcommonutils.cpp b/indra/llcommon/llcommonutils.cpp
new file mode 100644
index 0000000000..0022dc6915
--- /dev/null
+++ b/indra/llcommon/llcommonutils.cpp
@@ -0,0 +1,61 @@
+/**
+ * @file llcommonutils.h
+ * @brief Commin utils
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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 "llcommonutils.h"
+
+void LLCommonUtils::computeDifference(
+ const uuid_vec_t& vnew,
+ const uuid_vec_t& vcur,
+ uuid_vec_t& vadded,
+ uuid_vec_t& vremoved)
+{
+ uuid_vec_t vnew_copy(vnew);
+ uuid_vec_t vcur_copy(vcur);
+
+ std::sort(vnew_copy.begin(), vnew_copy.end());
+ std::sort(vcur_copy.begin(), vcur_copy.end());
+
+ size_t maxsize = llmax(vnew_copy.size(), vcur_copy.size());
+ vadded.resize(maxsize);
+ vremoved.resize(maxsize);
+
+ uuid_vec_t::iterator it;
+ // what was removed
+ it = set_difference(vcur_copy.begin(), vcur_copy.end(), vnew_copy.begin(), vnew_copy.end(), vremoved.begin());
+ vremoved.erase(it, vremoved.end());
+
+ // what was added
+ it = set_difference(vnew_copy.begin(), vnew_copy.end(), vcur_copy.begin(), vcur_copy.end(), vadded.begin());
+ vadded.erase(it, vadded.end());
+}
+
+// EOF
diff --git a/indra/llcommon/llcommonutils.h b/indra/llcommon/llcommonutils.h
new file mode 100644
index 0000000000..ad0d884e37
--- /dev/null
+++ b/indra/llcommon/llcommonutils.h
@@ -0,0 +1,56 @@
+/**
+ * @file llcommonutils.h
+ * @brief Common utils
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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$
+ */
+
+#ifndef LL_LLCOMMONUTILS_H
+#define LL_LLCOMMONUTILS_H
+
+namespace LLCommonUtils
+{
+ /**
+ * Computes difference between 'vnew' and 'vcur' vectors.
+ * Items present in 'vnew' and missing in 'vcur' are treated as added and are copied into 'vadded'
+ * Items missing in 'vnew' and present in 'vcur' are treated as removed and are copied into 'vremoved'
+ *
+ * @param vnew[in] - incoming IDs
+ * @param vcur[in] - current IDs
+ * @param vadded[out] - difference between incoming and current IDS - added IDs
+ * @param vremoved[out] - difference between incoming and current IDS - removed IDs
+ */
+ LL_COMMON_API void computeDifference(
+ const uuid_vec_t& vnew,
+ const uuid_vec_t& vcur,
+ uuid_vec_t& vadded,
+ uuid_vec_t& vremoved);
+};
+
+#endif //LL_LLCOMMONUTILS_H
+
+// EOF
diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp
index 23ede97af3..6751c235f6 100644
--- a/indra/llcommon/llcursortypes.cpp
+++ b/indra/llcommon/llcursortypes.cpp
@@ -72,6 +72,9 @@ ECursorType getCursorFromString(const std::string& cursor_string)
cursor_string_table["UI_CURSOR_TOOLPAUSE"] = UI_CURSOR_TOOLPAUSE;
cursor_string_table["UI_CURSOR_TOOLMEDIAOPEN"] = UI_CURSOR_TOOLMEDIAOPEN;
cursor_string_table["UI_CURSOR_PIPETTE"] = UI_CURSOR_PIPETTE;
+ cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT;
+ cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY;
+ cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN;
}
std::map<std::string,U32>::const_iterator iter = cursor_string_table.find(cursor_string);
diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h
index a1b8178bfe..143c2c64cf 100644
--- a/indra/llcommon/llcursortypes.h
+++ b/indra/llcommon/llcursortypes.h
@@ -68,6 +68,9 @@ enum ECursorType {
UI_CURSOR_TOOLPAUSE,
UI_CURSOR_TOOLMEDIAOPEN,
UI_CURSOR_PIPETTE,
+ UI_CURSOR_TOOLSIT,
+ UI_CURSOR_TOOLBUY,
+ UI_CURSOR_TOOLOPEN,
UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor)
};
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index bd334a6654..41ff5849f4 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -1225,17 +1225,32 @@ namespace LLError
char** LLCallStacks::sBuffer = NULL ;
S32 LLCallStacks::sIndex = 0 ;
+#define SINGLE_THREADED 1
+
class CallStacksLogLock
{
public:
CallStacksLogLock();
~CallStacksLogLock();
+
+#if SINGLE_THREADED
+ bool ok() const { return true; }
+#else
bool ok() const { return mOK; }
private:
bool mLocked;
bool mOK;
+#endif
};
+#if SINGLE_THREADED
+ CallStacksLogLock::CallStacksLogLock()
+ {
+ }
+ CallStacksLogLock::~CallStacksLogLock()
+ {
+ }
+#else
CallStacksLogLock::CallStacksLogLock()
: mLocked(false), mOK(false)
{
@@ -1271,6 +1286,7 @@ namespace LLError
apr_thread_mutex_unlock(gCallStacksLogMutexp);
}
}
+#endif
//static
void LLCallStacks::push(const char* function, const int line)
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index 48461df6ae..840d09d970 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -36,6 +36,10 @@
// pull in the actual class definition
#include "llfasttimer_class.h"
+//
+// Important note: These implementations must be FAST!
+//
+
#if LL_WINDOWS
//
// Windows implementation of CPU clock
@@ -99,15 +103,17 @@ inline U64 LLFastTimer::getCPUClockCount64()
#endif
-#if LL_LINUX || LL_SOLARIS
+#if (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__))
//
-// Linux and Solaris implementation of CPU clock - all architectures.
+// Linux and Solaris implementation of CPU clock - non-x86.
+// This is accurate but SLOW! Only use out of desperation.
//
// Try to use the MONOTONIC clock if available, this is a constant time counter
-// with nanosecond resolution (but not necessarily accuracy) and attempts are made
-// to synchronize this value between cores at kernel start. It should not be affected
-// by CPU frequency. If not available use the REALTIME clock, but this may be affected by
-// NTP adjustments or other user activity affecting the system time.
+// with nanosecond resolution (but not necessarily accuracy) and attempts are
+// made to synchronize this value between cores at kernel start. It should not
+// be affected by CPU frequency. If not available use the REALTIME clock, but
+// this may be affected by NTP adjustments or other user activity affecting
+// the system time.
inline U64 LLFastTimer::getCPUClockCount64()
{
struct timespec tp;
@@ -124,12 +130,12 @@ inline U32 LLFastTimer::getCPUClockCount32()
{
return (U32)(LLFastTimer::getCPUClockCount64() >> 8);
}
-#endif // (LL_LINUX || LL_SOLARIS))
+#endif // (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__))
-#if (LL_DARWIN) && (defined(__i386__) || defined(__amd64__))
+#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__))
//
-// Mac x86 implementation of CPU clock
+// Mac+Linux+Solaris FAST x86 implementation of CPU clock
inline U32 LLFastTimer::getCPUClockCount32()
{
U64 x;
diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp
index 2e5edb1f3b..f39a4e6619 100644
--- a/indra/llcommon/llfasttimer_class.cpp
+++ b/indra/llcommon/llfasttimer_class.cpp
@@ -230,17 +230,17 @@ void LLFastTimer::DeclareTimer::updateCachedPointers()
}
//static
-#if LL_LINUX || LL_SOLARIS || ( LL_DARWIN && !(defined(__i386__) || defined(__amd64__)) )
+#if (LL_DARWIN || LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__))
U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer
{
return sClockResolution >> 8;
}
-#else // windows or x86-mac
+#else // windows or x86-mac or x86-linux or x86-solaris
U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer
{
static U64 sCPUClockFrequency = U64(CProcessor().GetCPUFrequency(50));
- // we drop the low-order byte in out timers, so report a lower frequency
+ // we drop the low-order byte in our timers, so report a lower frequency
return sCPUClockFrequency >> 8;
}
#endif
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index 8a4a4a8f9a..f6ab55a6b5 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -60,6 +60,10 @@
# include <windows.h>
#endif
+#if LL_LINUX
+#include "llsys.h"
+#endif // LL_LINUX
+
#if !LL_DARWIN && !LL_SOLARIS
#ifdef PROCESSOR_FREQUENCY_MEASURE_AVAILABLE
@@ -116,6 +120,11 @@ CProcessor::CProcessor()
////////////////////////////////////////////////////////////////////////////
F64 CProcessor::GetCPUFrequency(unsigned int uiMeasureMSecs)
{
+#if LL_LINUX
+ // use the shinier LLCPUInfo interface
+ return 1000000.0F * gSysCPU.getMHz();
+#endif
+
#ifndef PROCESSOR_FREQUENCY_MEASURE_AVAILABLE
return 0;
#else
@@ -781,7 +790,7 @@ bool CProcessor::AnalyzeAMDProcessor()
case 5: // Family = 5: K5 / K6 processor family
switch (CPUInfo.uiModel)
{
- case 0: // Model = 0: K5 SSA 5 (Pentium Rating *ggg* 75, 90 and 100 Mhz)
+ case 0: // Model = 0: K5 SSA 5 (Pentium Rating *ggg* 75, 90 and 100 MHz)
strcpy(CPUInfo.strModel, "AMD K5 SSA5 (PR75, PR90, PR100)"); /* Flawfinder: ignore */
strncat(strCPUName, "AMD K5 SSA5 (PR75, PR90, PR100)", sizeof(strCPUName) - strlen(strCPUName) -1); /* Flawfinder: ignore */
break;
diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp
index 06ceeb2bc3..809a626c93 100644
--- a/indra/llcommon/llqueuedthread.cpp
+++ b/indra/llcommon/llqueuedthread.cpp
@@ -133,8 +133,11 @@ S32 LLQueuedThread::updateQueue(U32 max_time_ms)
if (mThreaded)
{
pending = getPending();
+ if(pending > 0)
+ {
unpause();
}
+ }
else
{
while (pending > 0)
@@ -459,7 +462,7 @@ S32 LLQueuedThread::processNextRequest()
req->setStatus(STATUS_QUEUED);
mRequestQueue.insert(req);
unlockData();
- if (mThreaded && start_priority <= PRIORITY_LOW)
+ if (mThreaded && start_priority < PRIORITY_NORMAL)
{
ms_sleep(1); // sleep the thread a little
}
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 5f3d9d6582..b5a73ec1d1 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -911,6 +911,20 @@ bool LLStringUtil::simpleReplacement(std::string &replacement, std::string token
return false;
}
+//static
+template<>
+void LLStringUtil::setLocale(std::string inLocale)
+{
+ sLocale = inLocale;
+};
+
+//static
+template<>
+std::string LLStringUtil::getLocale(void)
+{
+ return sLocale;
+};
+
// static
template<>
void LLStringUtil::formatNumber(std::string& numStr, std::string decimals)
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 62cedcde4e..96588b29b9 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -241,8 +241,8 @@ public:
LL_COMMON_API static S32 format(std::basic_string<T>& s, const LLSD& substitutions);
LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const format_map_t& substitutions);
LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const LLSD& substitutions);
- static void setLocale (std::string inLocale) {sLocale = inLocale;};
- static std::string getLocale (void) {return sLocale;};
+ LL_COMMON_API static void setLocale (std::string inLocale);
+ LL_COMMON_API static std::string getLocale (void);
static bool isValidIndex(const std::basic_string<T>& string, size_type i)
{
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 0272c55db2..52b1b63209 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -519,15 +519,15 @@ LLCPUInfo::LLCPUInfo()
mHasSSE = info->_Ext.SSE_StreamingSIMD_Extensions;
mHasSSE2 = info->_Ext.SSE2_StreamingSIMD2_Extensions;
mHasAltivec = info->_Ext.Altivec_Extensions;
- mCPUMhz = (S32)(proc.GetCPUFrequency(50)/1000000.0);
+ mCPUMHz = (F64)(proc.GetCPUFrequency(50)/1000000.0F);
mFamily.assign( info->strFamily );
mCPUString = "Unknown";
#if LL_WINDOWS || LL_DARWIN || LL_SOLARIS
out << proc.strCPUName;
- if (200 < mCPUMhz && mCPUMhz < 10000) // *NOTE: cpu speed is often way wrong, do a sanity check
+ if (200 < mCPUMHz && mCPUMHz < 10000) // *NOTE: cpu speed is often way wrong, do a sanity check
{
- out << " (" << mCPUMhz << " MHz)";
+ out << " (" << mCPUMHz << " MHz)";
}
mCPUString = out.str();
@@ -572,7 +572,7 @@ LLCPUInfo::LLCPUInfo()
if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz)
&& 200.0 < mhz && mhz < 10000.0)
{
- mCPUMhz = (S32)llrint(mhz);
+ mCPUMHz = (F64)(mhz);
}
if (!cpuinfo["model name"].empty())
mCPUString = cpuinfo["model name"];
@@ -595,9 +595,9 @@ bool LLCPUInfo::hasSSE2() const
return mHasSSE2;
}
-S32 LLCPUInfo::getMhz() const
+F64 LLCPUInfo::getMHz() const
{
- return mCPUMhz;
+ return mCPUMHz;
}
std::string LLCPUInfo::getCPUString() const
@@ -644,7 +644,7 @@ void LLCPUInfo::stream(std::ostream& s) const
s << "->mHasSSE: " << (U32)mHasSSE << std::endl;
s << "->mHasSSE2: " << (U32)mHasSSE2 << std::endl;
s << "->mHasAltivec: " << (U32)mHasAltivec << std::endl;
- s << "->mCPUMhz: " << mCPUMhz << std::endl;
+ s << "->mCPUMHz: " << mCPUMHz << std::endl;
s << "->mCPUString: " << mCPUString << std::endl;
}
diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h
index f1dda1b2e2..0b34951149 100644
--- a/indra/llcommon/llsys.h
+++ b/indra/llcommon/llsys.h
@@ -81,7 +81,7 @@ public:
bool hasAltivec() const;
bool hasSSE() const;
bool hasSSE2() const;
- S32 getMhz() const;
+ F64 getMHz() const;
// Family is "AMD Duron" or "Intel Pentium Pro"
const std::string& getFamily() const { return mFamily; }
@@ -90,7 +90,7 @@ private:
bool mHasSSE;
bool mHasSSE2;
bool mHasAltivec;
- S32 mCPUMhz;
+ F64 mCPUMHz;
std::string mFamily;
std::string mCPUString;
};
@@ -122,6 +122,7 @@ public:
U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes
};
+
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLOSInfo& info);
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info);
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info);
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 25b768079b..6111db2bfa 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -209,7 +209,7 @@ F64 calc_clock_frequency(U32 uiMeasureMSecs)
// Both Linux and Mac use gettimeofday for accurate time
F64 calc_clock_frequency(unsigned int uiMeasureMSecs)
{
- return 1000000.0; // microseconds, so 1 Mhz.
+ return 1000000.0; // microseconds, so 1 MHz.
}
U64 get_clock_count()
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index 9d4f3a98f0..0e8f3f0f73 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -231,7 +231,8 @@ static BOOL isDefault(const std::string& scheme, U16 port)
void LLURI::parseAuthorityAndPathUsingOpaque()
{
if (mScheme == "http" || mScheme == "https" ||
- mScheme == "ftp" || mScheme == "secondlife" )
+ mScheme == "ftp" || mScheme == "secondlife" ||
+ mScheme == "x-grid-location-info")
{
if (mEscapedOpaque.substr(0,2) != "//")
{
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index bcbae06ec5..583c1e589b 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -33,9 +33,12 @@
// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
#if LL_WINDOWS
-# undef WIN32_LEAN_AND_MEAN
-# include <winsock2.h>
-# include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#include <winsock2.h>
+#include <windows.h>
+// ugh, this is ugly. We need to straighten out our linking for this library
+#pragma comment(lib, "IPHLPAPI.lib")
+#include <iphlpapi.h>
#endif
#include "lldefs.h"
@@ -452,67 +455,102 @@ static void get_random_bytes(void *buf, int nbytes)
return;
}
-#if LL_WINDOWS
-typedef struct _ASTAT_
-{
- ADAPTER_STATUS adapt;
- NAME_BUFFER NameBuff [30];
-}ASTAT, * PASTAT;
+#if LL_WINDOWS
+// Code copied from http://msdn.microsoft.com/en-us/library/aa365939(VS.85).aspx
+// This code grabs the first hardware address, rather than the first interface.
+// Using a VPN can cause the first returned interface to be changed.
+
+const S32 MAC_ADDRESS_BYTES=6;
+
// static
-S32 LLUUID::getNodeID(unsigned char * node_id)
-{
- ASTAT Adapter;
- NCB Ncb;
- UCHAR uRetCode;
- LANA_ENUM lenum;
- int i;
- int retval = 0;
-
- memset( &Ncb, 0, sizeof(Ncb) );
- Ncb.ncb_command = NCBENUM;
- Ncb.ncb_buffer = (UCHAR *)&lenum;
- Ncb.ncb_length = sizeof(lenum);
- uRetCode = Netbios( &Ncb );
- // printf( "The NCBENUM return code is: 0x%x \n", uRetCode );
-
- for(i=0; i < lenum.length ;i++)
- {
- memset( &Ncb, 0, sizeof(Ncb) );
- Ncb.ncb_command = NCBRESET;
- Ncb.ncb_lana_num = lenum.lana[i];
-
- uRetCode = Netbios( &Ncb );
- // printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
- // lenum.lana[i], uRetCode );
-
- memset( &Ncb, 0, sizeof (Ncb) );
- Ncb.ncb_command = NCBASTAT;
- Ncb.ncb_lana_num = lenum.lana[i];
-
- strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */
- Ncb.ncb_buffer = (unsigned char *)&Adapter;
- Ncb.ncb_length = sizeof(Adapter);
-
- uRetCode = Netbios( &Ncb );
-// printf( "The NCBASTAT on LANA %d return code is: 0x%x \n",
-// lenum.lana[i], uRetCode );
- if ( uRetCode == 0 )
- {
-// printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
-// lenum.lana[i],
-// Adapter.adapt.adapter_address[0],
-// Adapter.adapt.adapter_address[1],
-// Adapter.adapt.adapter_address[2],
-// Adapter.adapt.adapter_address[3],
-// Adapter.adapt.adapter_address[4],
-// Adapter.adapt.adapter_address[5] );
- memcpy(node_id,Adapter.adapt.adapter_address,6); /* Flawfinder: ignore */
- retval = 1;
-
- }
- }
- return retval;
+S32 LLUUID::getNodeID(unsigned char *node_id)
+{
+
+ // Declare and initialize variables.
+ DWORD dwSize = 0;
+ DWORD dwRetVal = 0;
+ int i;
+
+/* variables used for GetIfTable and GetIfEntry */
+ MIB_IFTABLE *pIfTable;
+ MIB_IFROW *pIfRow;
+
+ // Allocate memory for our pointers.
+ pIfTable = (MIB_IFTABLE *) malloc(sizeof (MIB_IFTABLE));
+ if (pIfTable == NULL)
+ {
+ printf("Error allocating memory needed to call GetIfTable\n");
+ return 0;
+ }
+
+ // Before calling GetIfEntry, we call GetIfTable to make
+ // sure there are entries to get and retrieve the interface index.
+
+ // Make an initial call to GetIfTable to get the
+ // necessary size into dwSize
+ if (GetIfTable(pIfTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER) {
+ free(pIfTable);
+ pIfTable = (MIB_IFTABLE *) malloc(dwSize);
+ if (pIfTable == NULL)
+ {
+ printf("Error allocating memory\n");
+ return 0;
+ }
+ }
+ // Make a second call to GetIfTable to get the actual
+ // data we want.
+ if ((dwRetVal = GetIfTable(pIfTable, &dwSize, 0)) == NO_ERROR)
+ {
+ if (pIfTable->dwNumEntries > 0)
+ {
+ pIfRow = (MIB_IFROW *) malloc(sizeof (MIB_IFROW));
+ if (pIfRow == NULL)
+ {
+ printf("Error allocating memory\n");
+ if (pIfTable != NULL)
+ {
+ free(pIfTable);
+ pIfTable = NULL;
+ }
+ return 0;
+ }
+
+ int limit = MAC_ADDRESS_BYTES;
+ memcpy(node_id, "\0\0\0\0\0\0", limit); // zero out array of bytes
+ for (i = 0; i < (int) pIfTable->dwNumEntries; i++)
+ {
+ pIfRow->dwIndex = pIfTable->table[i].dwIndex;
+ if ((dwRetVal = GetIfEntry(pIfRow)) == NO_ERROR)
+ {
+ switch (pIfRow->dwType)
+ {
+ case IF_TYPE_ETHERNET_CSMACD:
+ case IF_TYPE_IEEE80211:
+ limit = min((int) pIfRow->dwPhysAddrLen, limit);
+ if (pIfRow->dwPhysAddrLen == 0)
+ break;
+ memcpy(node_id, (UCHAR *)&pIfRow->bPhysAddr[0], limit); // just incase the PhysAddr is not the expected MAC_Address size
+ free(pIfTable);
+ return 1; //return first hardware device found.
+ break;
+
+ case IF_TYPE_OTHER:
+ case IF_TYPE_PPP:
+ case IF_TYPE_SOFTWARE_LOOPBACK:
+ case IF_TYPE_ISO88025_TOKENRING:
+ case IF_TYPE_IEEE1394:
+ case IF_TYPE_ATM:
+ case IF_TYPE_TUNNEL:
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ free(pIfTable);
+ return 0;
}
#elif LL_DARWIN
diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h
index c78fb12018..3a0d66e4a5 100644
--- a/indra/llcommon/lluuid.h
+++ b/indra/llcommon/lluuid.h
@@ -133,6 +133,7 @@ public:
U8 mData[UUID_BYTES];
};
+typedef std::vector<LLUUID> uuid_vec_t;
// Construct
inline LLUUID::LLUUID()
diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h
index 0f1e59a18c..e3663544db 100644
--- a/indra/llcommon/llversionserver.h
+++ b/indra/llcommon/llversionserver.h
@@ -36,7 +36,7 @@
const S32 LL_VERSION_MAJOR = 1;
const S32 LL_VERSION_MINOR = 31;
const S32 LL_VERSION_PATCH = 0;
-const S32 LL_VERSION_BUILD = 200030;
+const S32 LL_VERSION_BUILD = 203110;
const char * const LL_CHANNEL = "Second Life Server";
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 540aea4252..fc3ce6df7e 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -35,8 +35,8 @@
const S32 LL_VERSION_MAJOR = 2;
const S32 LL_VERSION_MINOR = 0;
-const S32 LL_VERSION_PATCH = 0;
-const S32 LL_VERSION_BUILD = 200030;
+const S32 LL_VERSION_PATCH = 2;
+const S32 LL_VERSION_BUILD = 0;
const char * const LL_CHANNEL = "Second Life Developer";
diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp
index 411977474b..a29e9a348e 100644
--- a/indra/llcommon/llworkerthread.cpp
+++ b/indra/llcommon/llworkerthread.cpp
@@ -347,12 +347,12 @@ bool LLWorkerClass::checkWork(bool aborting)
{
mRequestHandle = LLWorkerThread::nullHandle();
clearFlags(WCF_HAVE_WORK);
- return true ;
}
else
{
llassert_always(workreq);
}
+ return true ;
}
LLQueuedThread::status_t status = workreq->getStatus();
@@ -404,7 +404,7 @@ void LLWorkerClass::scheduleDelete()
void LLWorkerClass::setPriority(U32 priority)
{
mMutex.lock();
- if (mRequestHandle != LLWorkerThread::nullHandle())
+ if (mRequestHandle != LLWorkerThread::nullHandle() && mRequestPriority != priority)
{
mRequestPriority = priority;
mWorkerThread->setPriority(mRequestHandle, priority);