Browse Source

Use the UTF-8 version of Expat

Michael Hansen 11 years ago
parent
commit
7c0c1635ab
  1. 3
      CMakeLists.txt
  2. 5
      Sources/Plasma/FeatureLib/pfLocalizationMgr/CMakeLists.txt
  3. 8
      Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp

3
CMakeLists.txt

@ -63,6 +63,9 @@ if(CURL_IS_STATIC)
add_definitions(-DCURL_STATICLIB) add_definitions(-DCURL_STATICLIB)
endif(CURL_IS_STATIC) endif(CURL_IS_STATIC)
# Same story for expat
option(EXPAT_IS_STATIC "Using the static version of libexpat" ON)
option(PLASMA_EXTERNAL_RELEASE "Is this release intended for the general public?" OFF) option(PLASMA_EXTERNAL_RELEASE "Is this release intended for the general public?" OFF)
if(PLASMA_EXTERNAL_RELEASE) if(PLASMA_EXTERNAL_RELEASE)
add_definitions(-DPLASMA_EXTERNAL_RELEASE) add_definitions(-DPLASMA_EXTERNAL_RELEASE)

5
Sources/Plasma/FeatureLib/pfLocalizationMgr/CMakeLists.txt

@ -3,9 +3,10 @@ include_directories(../../PubUtilLib)
include_directories(${EXPAT_INCLUDE_DIR}) include_directories(${EXPAT_INCLUDE_DIR})
add_definitions(-DXML_UNICODE_WCHAR_T)
add_definitions(-DXML_STATIC)
add_definitions(-DWIN32) add_definitions(-DWIN32)
if(EXPAT_IS_STATIC)
add_definitions(-DXML_STATIC)
endif()
set(pfLocalizationMgr_SOURCES set(pfLocalizationMgr_SOURCES
pfLocalizationDataMgr.cpp pfLocalizationDataMgr.cpp

8
Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp

@ -171,12 +171,12 @@ XML_Memory_Handling_Suite gHeapAllocator = {
void XMLCALL LocalizationXMLFile::StartTag(void *userData, const XML_Char *element, const XML_Char **attributes) void XMLCALL LocalizationXMLFile::StartTag(void *userData, const XML_Char *element, const XML_Char **attributes)
{ {
plString wElement = plString::FromWchar(element); plString wElement = element;
LocalizationXMLFile *file = (LocalizationXMLFile*)userData; LocalizationXMLFile *file = (LocalizationXMLFile*)userData;
std::map<plString, plString> wAttributes; std::map<plString, plString> wAttributes;
for (int i = 0; attributes[i]; i += 2) for (int i = 0; attributes[i]; i += 2)
wAttributes[plString::FromWchar(attributes[i])] = plString::FromWchar(attributes[i+1]); wAttributes[attributes[i]] = attributes[i+1];
LocalizationXMLFile::tagInfo parentTag; LocalizationXMLFile::tagInfo parentTag;
if (!file->fTagStack.empty()) if (!file->fTagStack.empty())
@ -208,7 +208,7 @@ void XMLCALL LocalizationXMLFile::StartTag(void *userData, const XML_Char *eleme
void XMLCALL LocalizationXMLFile::EndTag(void *userData, const XML_Char *element) void XMLCALL LocalizationXMLFile::EndTag(void *userData, const XML_Char *element)
{ {
plString wElement = plString::FromWchar(element); plString wElement = element;
LocalizationXMLFile *file = (LocalizationXMLFile*)userData; LocalizationXMLFile *file = (LocalizationXMLFile*)userData;
if (file->fSkipDepth != -1) // we're currently skipping if (file->fSkipDepth != -1) // we're currently skipping
@ -243,7 +243,7 @@ void XMLCALL LocalizationXMLFile::HandleData(void *userData, const XML_Char *dat
// This gets all data between tags, including indentation and newlines // This gets all data between tags, including indentation and newlines
// so we'll have to ignore data when we aren't expecting it (not in a translation tag) // so we'll have to ignore data when we aren't expecting it (not in a translation tag)
plString contents = plString::FromWchar(data, stringLength); plString contents = plString::FromUtf8(data, stringLength);
// we must be in a translation tag since that's the only tag that doesn't ignore the contents // we must be in a translation tag since that's the only tag that doesn't ignore the contents
file->fData[file->fCurrentAge][file->fCurrentSet][file->fCurrentElement][file->fCurrentTranslation] += contents; file->fData[file->fCurrentAge][file->fCurrentSet][file->fCurrentElement][file->fCurrentTranslation] += contents;

Loading…
Cancel
Save