Permalink
Browse files

llcommon merge. Added LLUnits.

  • Loading branch information...
Shyotl committed Apr 6, 2016
1 parent 0fa7848 commit 0841479ccc424b39a252117977d620dc6ccd7afd
Showing with 1,896 additions and 622 deletions.
  1. +4 −0 indra/llcommon/CMakeLists.txt
  2. +5 −5 indra/llcommon/llalignedarray.h
  3. +23 −19 indra/llcommon/llbase64.cpp
  4. +3 −3 indra/llcommon/lldate.cpp
  5. +5 −4 indra/llcommon/lldate.h
  6. +1 −1 indra/llcommon/lleventtimer.cpp
  7. +1 −1 indra/llcommon/llfile.cpp
  8. +2 −2 indra/llcommon/llfindlocale.cpp
  9. +2 −1 indra/llcommon/llfixedbuffer.cpp
  10. +6 −7 indra/llcommon/llhandle.h
  11. +44 −39 indra/llcommon/lllivefile.cpp
  12. +6 −6 indra/llcommon/llmd5.cpp
  13. +29 −27 indra/llcommon/llmemory.cpp
  14. +102 −32 indra/llcommon/llmemory.h
  15. +1 −0 indra/llcommon/llmortician.h
  16. +2 −4 indra/llcommon/llprocessor.cpp
  17. +3 −1 indra/llcommon/llprocessor.h
  18. +6 −5 indra/llcommon/llqueuedthread.cpp
  19. +1 −3 indra/llcommon/llqueuedthread.h
  20. +9 −8 indra/llcommon/llrefcount.cpp
  21. +1 −2 indra/llcommon/llsdserialize_xml.cpp
  22. +1 −1 indra/llcommon/llstacktrace.cpp
  23. +23 −2 indra/llcommon/llstl.h
  24. +1 −3 indra/llcommon/llstring.cpp
  25. +22 −24 indra/llcommon/llsys.cpp
  26. +3 −3 indra/llcommon/llsys.h
  27. +70 −48 indra/llcommon/lltimer.cpp
  28. +36 −14 indra/llcommon/lltimer.h
  29. +129 −0 indra/llcommon/llunits.h
  30. +838 −0 indra/llcommon/llunittype.h
  31. +1 −3 indra/llcommon/lluuid.cpp
  32. +42 −0 indra/llcommon/llwin32headers.h
  33. +40 −0 indra/llcommon/llwin32headerslean.h
  34. +8 −3 indra/llcommon/llworkerthread.cpp
  35. +9 −8 indra/llmath/llvolume.cpp
  36. +1 −1 indra/llrender/llgltexture.cpp
  37. +1 −1 indra/llrender/llgltexture.h
  38. +26 −26 indra/llrender/llimagegl.cpp
  39. +12 −11 indra/llrender/llimagegl.h
  40. +3 −3 indra/llrender/llvertexbuffer.cpp
  41. +1 −1 indra/llui/llnotifications.cpp
  42. +7 −8 indra/newview/llappviewer.cpp
  43. +1 −1 indra/newview/llappviewer.h
  44. +1 −1 indra/newview/llfeaturemanager.cpp
  45. +1 −1 indra/newview/llfloaterabout.cpp
  46. +6 −2 indra/newview/llpaneldisplay.cpp
  47. +14 −0 indra/newview/llspatialpartition.h
  48. +3 −3 indra/newview/lltexturecache.h
  49. +5 −5 indra/newview/lltexturefetch.cpp
  50. +19 −19 indra/newview/lltextureview.cpp
  51. +1 −1 indra/newview/llviewercontrol.cpp
  52. +3 −3 indra/newview/llviewerdisplay.cpp
  53. +11 −10 indra/newview/llviewermessage.cpp
  54. +39 −30 indra/newview/llviewerstats.cpp
  55. +3 −3 indra/newview/llviewerstats.h
  56. +68 −63 indra/newview/llviewertexture.cpp
  57. +8 −7 indra/newview/llviewertexture.h
  58. +56 −71 indra/newview/llviewertexturelist.cpp
  59. +8 −9 indra/newview/llviewertexturelist.h
  60. +1 −1 indra/newview/llviewerwindow.cpp
  61. +5 −5 indra/newview/llvoavatar.cpp
  62. +1 −1 indra/newview/llvoavatar.h
  63. +8 −8 indra/newview/llvoavatarself.cpp
  64. +1 −1 indra/newview/llvoavatarself.h
  65. +102 −46 indra/newview/llvovolume.cpp
  66. +1 −1 indra/newview/pipeline.cpp
@@ -230,9 +230,13 @@ set(llcommon_HEADER_FILES
llthreadsafequeue.h
lltimer.h
lltreeiterators.h
llunits.h
llunittype.h
lltypeinfolookup.h
lluri.h
lluuid.h
llwin32headers.h
llwin32headerslean.h
llworkerthread.h
metaclass.h
metaclasst.h
@@ -64,7 +64,7 @@ LLAlignedArray<T, alignment>::LLAlignedArray()
template <class T, U32 alignment>
LLAlignedArray<T, alignment>::~LLAlignedArray()
{
ll_aligned_free(mArray);
ll_aligned_free<alignment>(mArray);
mArray = NULL;
mElementCount = 0;
mCapacity = 0;
@@ -78,7 +78,7 @@ void LLAlignedArray<T, alignment>::push_back(const T& elem)
{
mCapacity++;
mCapacity *= 2;
T* new_buf = (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment);
T* new_buf = (T*) ll_aligned_malloc<alignment>(mCapacity*sizeof(T));
if (mArray)
{
ll_memcpy_nonaliased_aligned_16((char*)new_buf, (char*)mArray, sizeof(T)*mElementCount);
@@ -90,7 +90,7 @@ void LLAlignedArray<T, alignment>::push_back(const T& elem)
mArray[mElementCount++] = elem;
//delete old array here to prevent error on a.push_back(a[0])
ll_aligned_free(old_buf);
ll_aligned_free<alignment>(old_buf);
}
template <class T, U32 alignment>
@@ -99,11 +99,11 @@ void LLAlignedArray<T, alignment>::resize(U32 size)
if (mCapacity < size)
{
mCapacity = size+mCapacity*2;
T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment) : NULL;
T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc<alignment>(mCapacity*sizeof(T)) : NULL;
if (mArray)
{
ll_memcpy_nonaliased_aligned_16((char*) new_buf, (char*) mArray, sizeof(T)*mElementCount);
ll_aligned_free(mArray);
ll_aligned_free<alignment>(mArray);
}
/*for (U32 i = mElementCount; i < mCapacity; ++i)
@@ -30,32 +30,36 @@
#include "llbase64.h"
#include <string>
#include "apr_base64.h"
// static
std::string LLBase64::encode(const U8* input, size_t input_size)
{
if (!(input && input_size > 0)) return LLStringUtil::null;
// Yes, it returns int.
int b64_buffer_length = apr_base64_encode_len(input_size);
char* b64_buffer = new char[b64_buffer_length];
// This is faster than apr_base64_encode() if you know
// you're not on an EBCDIC machine. Also, the output is
// null terminated, even though the documentation doesn't
// specify. See apr_base64.c for details. JC
b64_buffer_length = apr_base64_encode_binary(
b64_buffer,
input,
input_size);
std::string result;
result.assign(b64_buffer);
delete[] b64_buffer;
return result;
std::string output;
if (input
&& input_size > 0)
{
// Yes, it returns int.
int b64_buffer_length = apr_base64_encode_len(input_size);
char* b64_buffer = new char[b64_buffer_length];
// This is faster than apr_base64_encode() if you know
// you're not on an EBCDIC machine. Also, the output is
// null terminated, even though the documentation doesn't
// specify. See apr_base64.c for details. JC
b64_buffer_length = apr_base64_encode_binary(
b64_buffer,
input,
input_size);
output.assign(b64_buffer);
delete[] b64_buffer;
}
return output;
}
// static
std::string LLBase64::encode(const std::string& in_str)
{
@@ -55,8 +55,8 @@ LLDate::LLDate(const LLDate& date) :
mSecondsSinceEpoch(date.mSecondsSinceEpoch)
{}
LLDate::LLDate(F64 seconds_since_epoch) :
mSecondsSinceEpoch(seconds_since_epoch)
LLDate::LLDate(F64SecondsImplicit seconds_since_epoch) :
mSecondsSinceEpoch(seconds_since_epoch.value())
{}
LLDate::LLDate(const std::string& iso8601_date)
@@ -83,7 +83,7 @@ std::string LLDate::asString() const
// is one of the standards used and the prefered format
std::string LLDate::asRFC1123() const
{
return toHTTPDateString(LLStringExplicit("%A, %d %b %Y %H:%M:%S GMT"));
return toHTTPDateString (std::string ("%A, %d %b %Y %H:%M:%S GMT"));
}
LLFastTimer::DeclareTimer FT_DATE_FORMAT("Date Format");
View
@@ -38,9 +38,8 @@
#include <iosfwd>
#include <string>
#include "llpreprocessor.h"
#include "stdtypes.h"
#include "llunits.h"
/**
* @class LLDate
@@ -64,9 +63,9 @@ class LL_COMMON_API LLDate
/**
* @brief Construct a date from a seconds since epoch value.
*
* @pararm seconds_since_epoch The number of seconds since UTC epoch.
* @param seconds_since_epoch The number of seconds since UTC epoch.
*/
LLDate(F64 seconds_since_epoch);
LLDate(F64SecondsImplicit seconds_since_epoch);
/**
* @brief Construct a date from a string representation
@@ -163,4 +162,6 @@ LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLDate& date);
// Helper function to stream in a date
LL_COMMON_API std::istream& operator>>(std::istream& s, LLDate& date);
#endif // LL_LLDATE_H
@@ -65,7 +65,7 @@ LLEventTimer::~LLEventTimer()
void LLEventTimer::updateClass()
{
std::list<LLEventTimer*> completed_timers;
for (instance_iter iter = beginInstances(), iter_end = endInstances(); iter != iter_end;)
for (instance_iter iter = beginInstances(), end_iter = endInstances(); iter != end_iter;)
{
LLEventTimer& timer = *iter++;
F32 et = timer.mEventTimer.getElapsedTimeF32();
@@ -28,7 +28,7 @@
*/
#if LL_WINDOWS
#include <windows.h>
#include "llwin32headerslean.h"
#include <stdlib.h> // Windows errno
#else
#include <errno.h>
@@ -39,7 +39,7 @@
#include <ctype.h>
#ifdef WIN32
#include <windows.h>
#include "llwin32headers.h"
#include <winnt.h>
#endif
@@ -183,7 +183,7 @@ canonise_fl(FL_Locale *l) {
#define RML(pn,sn) MAKELANGID(LANG_##pn, SUBLANG_##sn)
struct IDToCode {
LANGID id;
char* code;
const char* code;
};
static const IDToCode both_to_code[] = {
{ML(ENGLISH,US), "en_US.ISO_8859-1"},
@@ -30,7 +30,8 @@
LLFixedBuffer::LLFixedBuffer(const U32 max_lines)
: LLLineBuffer(),
mMaxLines(max_lines)
mMaxLines(max_lines),
mMutex()
{
mTimer.reset();
}
View
@@ -194,13 +194,6 @@ class LLHandleProvider
return mHandle;
}
protected:
typedef LLHandle<T> handle_type_t;
LLHandleProvider()
{
// provided here to enforce T deriving from LLHandleProvider<T>
}
template <typename U>
LLHandle<U> getDerivedHandle(typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) const
{
@@ -209,6 +202,12 @@ class LLHandleProvider
return downcast_handle;
}
protected:
typedef LLHandle<T> handle_type_t;
LLHandleProvider()
{
// provided here to enforce T deriving from LLHandleProvider<T>
}
private:
mutable LLRootHandle<T> mHandle;
@@ -88,46 +88,51 @@ LLLiveFile::~LLLiveFile()
bool LLLiveFile::Impl::check()
{
if (!mForceCheck && mRefreshTimer.getElapsedTimeF32() < mRefreshPeriod)
bool detected_change = false;
// Skip the check if not enough time has elapsed and we're not
// forcing a check of the file
if (mForceCheck || mRefreshTimer.getElapsedTimeF32() >= mRefreshPeriod)
{
// Skip the check if not enough time has elapsed and we're not
// forcing a check of the file
return false;
}
mForceCheck = false;
mRefreshTimer.reset();
// Stat the file to see if it exists and when it was last modified.
llstat stat_data;
int res = LLFile::stat(mFilename, &stat_data);
if (res)
{
// Couldn't stat the file, that means it doesn't exist or is
// broken somehow. Clear flags and return.
if (mLastExists)
{
mLastExists = false;
return true; // no longer existing is a change!
}
return false;
}
// The file exists, decide if we want to load it.
if (mLastExists)
{
// The file existed last time, don't read it if it hasn't changed since
// last time.
if (stat_data.st_mtime <= mLastModTime)
{
return false;
}
}
// We want to read the file. Update status info for the file.
mLastExists = true;
mLastStatTime = stat_data.st_mtime;
return true;
mForceCheck = false; // force only forces one check
mRefreshTimer.reset(); // don't check again until mRefreshPeriod has passed
// Stat the file to see if it exists and when it was last modified.
llstat stat_data;
if (LLFile::stat(mFilename, &stat_data))
{
// Couldn't stat the file, that means it doesn't exist or is
// broken somehow.
if (mLastExists)
{
mLastExists = false;
detected_change = true; // no longer existing is a change!
LL_DEBUGS() << "detected deleted file '" << mFilename << "'" << LL_ENDL;
}
}
else
{
// The file exists
if ( ! mLastExists )
{
// last check, it did not exist - that counts as a change
LL_DEBUGS() << "detected created file '" << mFilename << "'" << LL_ENDL;
detected_change = true;
}
else if ( stat_data.st_mtime > mLastModTime )
{
// file modification time is newer than last check
LL_DEBUGS() << "detected updated file '" << mFilename << "'" << LL_ENDL;
detected_change = true;
}
mLastExists = true;
mLastStatTime = stat_data.st_mtime;
}
}
if (detected_change)
{
LL_INFOS() << "detected file change '" << mFilename << "'" << LL_ENDL;
}
return detected_change;
}
void LLLiveFile::Impl::changed()
View
@@ -119,6 +119,12 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
buffer_space = 64 - buffer_index; // how much space is left in buffer
// now, transform each 64-byte piece of the input, bypassing the buffer
if (input == NULL || input_length == 0){
std::cerr << "LLMD5::update: Invalid input!" << std::endl;
return;
}
// Transform as many times as possible.
if (input_length >= buffer_space) { // ie. we have enough to fill the buffer
// fill the rest of the buffer and transform
@@ -128,12 +134,6 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
buffer_space);
transform (buffer);
// now, transform each 64-byte piece of the input, bypassing the buffer
if (input == NULL || input_length == 0){
std::cerr << "LLMD5::update: Invalid input!" << std::endl;
return;
}
for (input_index = buffer_space; input_index + 63 < input_length;
input_index += 64)
transform (input+input_index);
Oops, something went wrong.

0 comments on commit 0841479

Please sign in to comment.