Major breaking changes

This commit is contained in:
Drake Arconis
2016-01-16 08:05:47 -05:00
parent 05ec61d0b0
commit 2f2e1fbe8f
94 changed files with 5594 additions and 6149 deletions

View File

@@ -7,7 +7,11 @@ include(00-Common)
include(LLCommon)
include(APR)
include(Linking)
include(Boost)
include(LLSharedLibs)
include(GoogleBreakpad)
include(Copy3rdPartyLibs)
include(ZLIB)
include_directories(
${EXPAT_INCLUDE_DIRS}
@@ -251,11 +255,22 @@ set_source_files_properties(${llcommon_HEADER_FILES}
list(APPEND llcommon_SOURCE_FILES ${cwdebug_SOURCE_FILES})
list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
if(WINDOWS)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
endif(WINDOWS)
add_dependencies(llcommon prepare)
if(LLCOMMON_LINK_SHARED)
add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
if(NOT WORD_SIZE EQUAL 32)
if(NOT WINDOWS)
add_definitions(-fPIC)
endif(NOT WINDOWS)
endif(NOT WORD_SIZE EQUAL 32)
if(WINDOWS)
# always generate llcommon.pdb, even for "Release" builds
set_target_properties(llcommon PROPERTIES LINK_FLAGS "/DEBUG")
endif(WINDOWS)
ll_stage_sharedlib(llcommon)
else(LLCOMMON_LINK_SHARED)
add_library (llcommon ${llcommon_SOURCE_FILES})
endif(LLCOMMON_LINK_SHARED)
target_link_libraries(
llcommon
${BREAKPAD_EXCEPTION_HANDLER_LIBRARIES}
@@ -280,3 +295,5 @@ if (DARWIN)
INSTALL_NAME_DIR "@executable_path/../Resources"
)
endif (DARWIN)
add_dependencies(llcommon stage_third_party_libs)

View File

@@ -174,10 +174,10 @@ S32 wchar_to_utf8chars(llwchar in_char, char* outchars)
return outchars - base;
}
S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar)
S32 utf16chars_to_wchar(const utf16strtype* inchars, llwchar* outchar)
{
const U16* base = inchars;
U16 cur_char = *inchars++;
const utf16strtype* base = inchars;
utf16strtype cur_char = *inchars++;
llwchar char32 = cur_char;
if ((cur_char >= 0xD800) && (cur_char <= 0xDFFF))
{
@@ -236,7 +236,7 @@ LLWString utf16str_to_wstring(const llutf16string &utf16str, S32 len)
S32 i = 0;
// craziness to make gcc happy (llutf16string.c_str() is tweaked on linux):
const U16* chars16 = &(*(utf16str.begin()));
const utf16strtype* chars16 = &(*(utf16str.begin()));
while (i < len)
{
llwchar cur_char;
@@ -257,18 +257,18 @@ S32 utf16str_wstring_length(const llutf16string &utf16str, const S32 utf16_len)
{
S32 surrogate_pairs = 0;
// ... craziness to make gcc happy (llutf16string.c_str() is tweaked on linux):
const U16 *const utf16_chars = &(*(utf16str.begin()));
const utf16strtype *const utf16_chars = &(*(utf16str.begin()));
S32 i = 0;
while (i < utf16_len)
{
const U16 c = utf16_chars[i++];
const utf16strtype c = utf16_chars[i++];
if (c >= 0xD800 && c <= 0xDBFF) // See http://en.wikipedia.org/wiki/UTF-16
{ // Have first byte of a surrogate pair
if (i >= utf16_len)
{
break;
}
const U16 d = utf16_chars[i];
const utf16strtype d = utf16_chars[i];
if (d >= 0xDC00 && d <= 0xDFFF)
{ // Have valid second byte of a surrogate pair
surrogate_pairs++;
@@ -621,22 +621,6 @@ bool LLStringOps::isHexString(const std::string& str)
}
#if LL_WINDOWS
// documentation moved to header. Phoenix 2007-11-27
namespace snprintf_hack
{
int snprintf(char *str, size_t size, const char *format, ...)
{
va_list args;
va_start(args, format);
int num_written = _vsnprintf(str, size, format, args); /* Flawfinder: ignore */
va_end(args);
str[size-1] = '\0'; // always null terminate
return num_written;
}
}
std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page)
{
std::string out;

View File

@@ -501,7 +501,14 @@ LL_COMMON_API std::string rawstr_to_utf8(const std::string& raw);
//
// We should never use UTF16 except when communicating with Win32!
//
typedef std::basic_string<U16> llutf16string;
#if _WIN32 && _NATIVE_WCHAR_T_DEFINED
typedef wchar_t utf16strtype;
#else
typedef U16 utf16strtype;
#endif
typedef std::basic_string<utf16strtype> llutf16string;
LL_COMMON_API LLWString utf16str_to_wstring(const llutf16string &utf16str, S32 len);
LL_COMMON_API LLWString utf16str_to_wstring(const llutf16string &utf16str);
@@ -586,32 +593,6 @@ LL_COMMON_API std::string utf8str_removeCRLF(const std::string& utf8str);
*/
//@{
/**
* @brief Implementation the expected snprintf interface.
*
* If the size of the passed in buffer is not large enough to hold the string,
* two bad things happen:
* 1. resulting formatted string is NOT null terminated
* 2. Depending on the platform, the return value could be a) the required
* size of the buffer to copy the entire formatted string or b) -1.
* On Windows with VS.Net 2003, it returns -1 e.g.
*
* safe_snprintf always adds a NULL terminator so that the caller does not
* need to check for return value or need to add the NULL terminator.
* It does not, however change the return value - to let the caller know
* that the passed in buffer size was not large enough to hold the
* formatted string.
*
*/
// Deal with the differeneces on Windows
namespace snprintf_hack
{
LL_COMMON_API int snprintf(char *str, size_t size, const char *format, ...);
}
using snprintf_hack::snprintf;
/**
* @brief Convert a wide string to std::string
*