mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-22 05:09:13 +00:00
@ -21,6 +21,9 @@ endif(WIN32 AND NOT CYGWIN)
|
|||||||
if(UNIX)
|
if(UNIX)
|
||||||
add_definitions(-DHS_BUILD_FOR_UNIX)
|
add_definitions(-DHS_BUILD_FOR_UNIX)
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
if(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
add_definitions(-DHS_BUILD_FOR_OSX)
|
||||||
|
endif(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
# End HeadSpin Configuration
|
# End HeadSpin Configuration
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include "HeadSpin.h"
|
#include "HeadSpin.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
template<class T, size_t ALIGNMENT=16>
|
template<class T, size_t ALIGNMENT=16>
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ void plString::IConvertFromUtf16(const uint16_t *utf16, size_t size)
|
|||||||
while (sp < utf16 + size) {
|
while (sp < utf16 + size) {
|
||||||
if (*sp >= 0xD800 && *sp <= 0xDFFF) {
|
if (*sp >= 0xD800 && *sp <= 0xDFFF) {
|
||||||
// Surrogate pair
|
// Surrogate pair
|
||||||
UniChar unichar = 0x10000;
|
plUniChar unichar = 0x10000;
|
||||||
|
|
||||||
if (sp + 1 >= utf16 + size) {
|
if (sp + 1 >= utf16 + size) {
|
||||||
hsAssert(0, "Incomplete surrogate pair in UTF-16 data");
|
hsAssert(0, "Incomplete surrogate pair in UTF-16 data");
|
||||||
@ -209,11 +209,11 @@ void plString::IConvertFromWchar(const wchar_t *wstr, size_t size)
|
|||||||
// We assume that if sizeof(wchar_t) == 2, the data is UTF-16 already
|
// We assume that if sizeof(wchar_t) == 2, the data is UTF-16 already
|
||||||
IConvertFromUtf16((const uint16_t *)wstr, size);
|
IConvertFromUtf16((const uint16_t *)wstr, size);
|
||||||
#else
|
#else
|
||||||
IConvertFromUtf32((const UniChar *)wstr, size);
|
IConvertFromUtf32((const plUniChar *)wstr, size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void plString::IConvertFromUtf32(const UniChar *ustr, size_t size)
|
void plString::IConvertFromUtf32(const plUniChar *ustr, size_t size)
|
||||||
{
|
{
|
||||||
hsAssert(size == STRLEN_AUTO || size < FREAKING_BIG, "Your string is WAAAAAY too big");
|
hsAssert(size == STRLEN_AUTO || size < FREAKING_BIG, "Your string is WAAAAAY too big");
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ void plString::IConvertFromUtf32(const UniChar *ustr, size_t size)
|
|||||||
|
|
||||||
// Calculate the UTF-8 size
|
// Calculate the UTF-8 size
|
||||||
size_t convlen = 0;
|
size_t convlen = 0;
|
||||||
const UniChar *sp = ustr;
|
const plUniChar *sp = ustr;
|
||||||
while (sp < ustr + size) {
|
while (sp < ustr + size) {
|
||||||
if (*sp > 0x10FFFF) {
|
if (*sp > 0x10FFFF) {
|
||||||
hsAssert(0, "UTF-32 character out of range");
|
hsAssert(0, "UTF-32 character out of range");
|
||||||
@ -341,7 +341,7 @@ plStringBuffer<uint16_t> plString::ToUtf16() const
|
|||||||
uint16_t *dp = ustr;
|
uint16_t *dp = ustr;
|
||||||
sp = utf8;
|
sp = utf8;
|
||||||
while (sp < utf8 + srcSize) {
|
while (sp < utf8 + srcSize) {
|
||||||
UniChar unichar;
|
plUniChar unichar;
|
||||||
if ((*sp & 0xF8) == 0xF0) {
|
if ((*sp & 0xF8) == 0xF0) {
|
||||||
unichar = (*sp++ & 0x07) << 18;
|
unichar = (*sp++ & 0x07) << 18;
|
||||||
unichar |= (*sp++ & 0x3F) << 12;
|
unichar |= (*sp++ & 0x3F) << 12;
|
||||||
@ -408,7 +408,7 @@ plStringBuffer<char> plString::ToIso8859_1() const
|
|||||||
char *dp = astr;
|
char *dp = astr;
|
||||||
sp = utf8;
|
sp = utf8;
|
||||||
while (sp < utf8 + srcSize) {
|
while (sp < utf8 + srcSize) {
|
||||||
UniChar unichar;
|
plUniChar unichar;
|
||||||
if ((*sp & 0xF8) == 0xF0) {
|
if ((*sp & 0xF8) == 0xF0) {
|
||||||
unichar = (*sp++ & 0x07) << 18;
|
unichar = (*sp++ & 0x07) << 18;
|
||||||
unichar |= (*sp++ & 0x3F) << 12;
|
unichar |= (*sp++ & 0x3F) << 12;
|
||||||
@ -455,11 +455,11 @@ plUnicodeBuffer plString::GetUnicodeArray() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// And perform the actual conversion
|
// And perform the actual conversion
|
||||||
UniChar *ustr = result.CreateWritableBuffer(convlen);
|
plUniChar *ustr = result.CreateWritableBuffer(convlen);
|
||||||
UniChar *dp = ustr;
|
plUniChar *dp = ustr;
|
||||||
sp = utf8;
|
sp = utf8;
|
||||||
while (sp < utf8 + srcSize) {
|
while (sp < utf8 + srcSize) {
|
||||||
UniChar unichar;
|
plUniChar unichar;
|
||||||
if ((*sp & 0xF8) == 0xF0) {
|
if ((*sp & 0xF8) == 0xF0) {
|
||||||
unichar = (*sp++ & 0x07) << 18;
|
unichar = (*sp++ & 0x07) << 18;
|
||||||
unichar |= (*sp++ & 0x3F) << 12;
|
unichar |= (*sp++ & 0x3F) << 12;
|
||||||
@ -942,7 +942,7 @@ plStringStream &plStringStream::operator<<(double num)
|
|||||||
return operator<<(buffer);
|
return operator<<(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ustrlen(const UniChar *ustr)
|
size_t ustrlen(const plUniChar *ustr)
|
||||||
{
|
{
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
for ( ; *ustr++; ++length)
|
for ( ; *ustr++; ++length)
|
||||||
|
@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/** Single Unicode character code unit */
|
/** Single Unicode character code unit */
|
||||||
typedef unsigned int UniChar;
|
typedef unsigned int plUniChar;
|
||||||
|
|
||||||
#define SSO_CHARS (16)
|
#define SSO_CHARS (16)
|
||||||
#define STRING_STACK_SIZE (256)
|
#define STRING_STACK_SIZE (256)
|
||||||
@ -227,7 +227,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** A plStringBuffer for storing fully-expanded Unicode data */
|
/** A plStringBuffer for storing fully-expanded Unicode data */
|
||||||
typedef plStringBuffer<UniChar> plUnicodeBuffer;
|
typedef plStringBuffer<plUniChar> plUnicodeBuffer;
|
||||||
|
|
||||||
/** Unicode-capable and (mostly) binary safe string class.
|
/** Unicode-capable and (mostly) binary safe string class.
|
||||||
* plString stores SSO-optimized or reference counted strings (automatically
|
* plString stores SSO-optimized or reference counted strings (automatically
|
||||||
@ -251,7 +251,7 @@ private:
|
|||||||
void IConvertFromUtf8(const char *utf8, size_t size);
|
void IConvertFromUtf8(const char *utf8, size_t size);
|
||||||
void IConvertFromUtf16(const uint16_t *utf16, size_t size);
|
void IConvertFromUtf16(const uint16_t *utf16, size_t size);
|
||||||
void IConvertFromWchar(const wchar_t *wstr, size_t size);
|
void IConvertFromWchar(const wchar_t *wstr, size_t size);
|
||||||
void IConvertFromUtf32(const UniChar *ustr, size_t size);
|
void IConvertFromUtf32(const plUniChar *ustr, size_t size);
|
||||||
void IConvertFromIso8859_1(const char *astr, size_t size);
|
void IConvertFromIso8859_1(const char *astr, size_t size);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -357,7 +357,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Create a new plString object from the UTF-32 formatted data in \a utf32. */
|
/** Create a new plString object from the UTF-32 formatted data in \a utf32. */
|
||||||
static inline plString FromUtf32(const UniChar *utf32, size_t size = STRLEN_AUTO)
|
static inline plString FromUtf32(const plUniChar *utf32, size_t size = STRLEN_AUTO)
|
||||||
{
|
{
|
||||||
plString str;
|
plString str;
|
||||||
str.IConvertFromUtf32(utf32, size);
|
str.IConvertFromUtf32(utf32, size);
|
||||||
@ -799,7 +799,7 @@ private:
|
|||||||
bool ICanHasHeap() const { return fBufSize > STRING_STACK_SIZE; }
|
bool ICanHasHeap() const { return fBufSize > STRING_STACK_SIZE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \p strlen implementation for UniChar based C-style string buffers. */
|
/** \p strlen implementation for plUniChar based C-style string buffers. */
|
||||||
size_t ustrlen(const UniChar *ustr);
|
size_t ustrlen(const plUniChar *ustr);
|
||||||
|
|
||||||
#endif //plString_Defined
|
#endif //plString_Defined
|
||||||
|
@ -54,7 +54,7 @@ plString PyString_AsStringEx(PyObject* obj)
|
|||||||
#if (Py_UNICODE_SIZE == 2)
|
#if (Py_UNICODE_SIZE == 2)
|
||||||
return plString::FromUtf16(reinterpret_cast<const uint16_t *>(PyUnicode_AsUnicode(obj)));
|
return plString::FromUtf16(reinterpret_cast<const uint16_t *>(PyUnicode_AsUnicode(obj)));
|
||||||
#elif (Py_UNICODE_SIZE == 4)
|
#elif (Py_UNICODE_SIZE == 4)
|
||||||
return plString::FromUtf32(reinterpret_cast<const UniChar *>(PyUnicode_AsUnicode(obj)));
|
return plString::FromUtf32(reinterpret_cast<const plUniChar *>(PyUnicode_AsUnicode(obj)));
|
||||||
#else
|
#else
|
||||||
# error "Py_UNICODE is an unexpected size"
|
# error "Py_UNICODE is an unexpected size"
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,7 +22,7 @@ target_link_libraries(pnUUID CoreLib)
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(pnUUID pnUtils)
|
target_link_libraries(pnUUID pnUtils)
|
||||||
target_link_libraries(pnUUID rpcrt4)
|
target_link_libraries(pnUUID rpcrt4)
|
||||||
else(WIN32)
|
elseif(NOT APPLE)
|
||||||
target_link_libraries(pnUUID uuid)
|
target_link_libraries(pnUUID uuid)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ plUnifiedTime::operator timeval() const
|
|||||||
// tv_secs should be a time_t, but on Windows it is a long
|
// tv_secs should be a time_t, but on Windows it is a long
|
||||||
struct timeval t = {(long)fSecs, (long)fMicros};
|
struct timeval t = {(long)fSecs, (long)fMicros};
|
||||||
#else
|
#else
|
||||||
struct timeval t = {fSecs, fMicros};
|
struct timeval t = {fSecs, (suseconds_t)fMicros};
|
||||||
#endif
|
#endif
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user