Ticket #3011: 0012-Convert-wchar_t-wstring-arguments-to-UTF-8-strings-i.patch

File 0012-Convert-wchar_t-wstring-arguments-to-UTF-8-strings-i.patch, 40.9 KB (added by Philip Taylor, 9 years ago)
  • source/graphics/MapGenerator.cpp

    From f699b62e03fbc72aab41e74c5b0401d255cdb349 Mon Sep 17 00:00:00 2001
    From: Philip Taylor <philip@zaynar.co.uk>
    Date: Tue, 20 Jan 2015 23:16:20 +0000
    Subject: [PATCH 12/13] Convert wchar_t*/wstring arguments to UTF-8 strings in
     CLogger messages.
    
    ---
     source/graphics/MapGenerator.cpp                   |  4 +-
     source/graphics/MapReader.cpp                      |  4 +-
     source/graphics/ObjectEntry.cpp                    |  8 ++--
     source/graphics/ObjectManager.cpp                  |  2 +-
     source/graphics/TerrainProperties.cpp              |  8 ++--
     source/graphics/TerrainTextureEntry.cpp            |  2 +-
     source/gui/CGUI.cpp                                | 48 +++++++++++-----------
     source/gui/GUIManager.cpp                          | 12 +++---
     source/gui/GUIRenderer.cpp                         |  2 +-
     source/gui/GUItext.cpp                             | 24 +++++------
     source/network/NetClient.cpp                       |  2 +-
     source/network/NetServer.cpp                       |  2 +-
     source/network/NetTurnManager.cpp                  | 21 +++++++---
     source/ps/ConfigDB.cpp                             |  8 ++--
     source/ps/GameSetup/GameSetup.cpp                  |  6 +--
     source/ps/XML/Xeromyces.cpp                        |  4 +-
     source/scriptinterface/ScriptInterface.cpp         |  8 ++--
     source/simulation2/Simulation2.cpp                 |  2 +-
     source/simulation2/components/CCmpAIManager.cpp    | 10 ++---
     .../components/CCmpProjectileManager.cpp           |  2 +-
     .../simulation2/serialization/BinarySerializer.cpp |  2 +-
     source/simulation2/system/ComponentManager.cpp     |  6 +--
     source/simulation2/system/ParamNode.cpp            |  2 +-
     source/soundmanager/SoundManager.cpp               |  2 +-
     source/soundmanager/scripting/SoundGroup.cpp       |  2 +-
     25 files changed, 101 insertions(+), 92 deletions(-)
    
    diff --git a/source/graphics/MapGenerator.cpp b/source/graphics/MapGenerator.cpp
    index 91d26e9..ed9a8d0 100644
    a b std::vector<std::string> CMapGeneratorWorker::GetCivData(ScriptInterface::CxPriv  
    222222    {
    223223        // Some error reading directory
    224224        wchar_t error[200];
    225         LOGERROR("CMapGeneratorWorker::GetCivData: Error reading directory '%s': %s", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error)));
     225        LOGERROR("CMapGeneratorWorker::GetCivData: Error reading directory '%s': %s", path.string8(), utf8_from_wstring(StatusDescription(ret, error, ARRAY_SIZE(error))));
    226226    }
    227227
    228228    return data;
    bool CMapGeneratorWorker::LoadScripts(const std::wstring& libraryName)  
    284284    {
    285285        // Some error reading directory
    286286        wchar_t error[200];
    287         LOGERROR("CMapGeneratorWorker::LoadScripts: Error reading scripts in directory '%s': %s", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error)));
     287        LOGERROR("CMapGeneratorWorker::LoadScripts: Error reading scripts in directory '%s': %s", path.string8(), utf8_from_wstring(StatusDescription(ret, error, ARRAY_SIZE(error))));
    288288        return false;
    289289    }
    290290
  • source/graphics/MapReader.cpp

    diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp
    index fd11ee5..9683323 100644
    a b int CXMLReader::ReadEntities(XMBElement parent, double end_time)  
    10521052        entity_id_t player = cmpPlayerManager->GetPlayerByID(PlayerID);
    10531053        if (ent == INVALID_ENTITY || player == INVALID_ENTITY)
    10541054        {   // Don't add entities with invalid player IDs
    1055             LOGERROR("Failed to load entity template '%s'", TemplateName.c_str());
     1055            LOGERROR("Failed to load entity template '%s'", utf8_from_wstring(TemplateName));
    10561056        }
    10571057        else
    10581058        {
    int CMapReader::ParseEntities()  
    14301430        entity_id_t player = cmpPlayerManager->GetPlayerByID(currEnt.playerID);
    14311431        if (ent == INVALID_ENTITY || player == INVALID_ENTITY)
    14321432        {   // Don't add entities with invalid player IDs
    1433             LOGERROR("Failed to load entity template '%s'", currEnt.templateName.c_str());
     1433            LOGERROR("Failed to load entity template '%s'", utf8_from_wstring(currEnt.templateName));
    14341434        }
    14351435        else
    14361436        {
  • source/graphics/ObjectEntry.cpp

    diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp
    index e4c26a0..fcd5113 100644
    a b bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections  
    7373        str << variation.color;
    7474        int r, g, b;
    7575        if (! (str >> r >> g >> b)) // Any trailing data is ignored
    76             LOGERROR("Actor '%s' has invalid RGB colour '%s'", m_Base->m_ShortName.c_str(), variation.color.c_str());
     76            LOGERROR("Actor '%s' has invalid RGB colour '%s'", utf8_from_wstring(m_Base->m_ShortName), variation.color);
    7777        else
    7878            m_Color = CColor(r/255.0f, g/255.0f, b/255.0f, 1.0f);
    7979    }
    bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections  
    133133   
    134134    if (m_Samplers.size() == 0)
    135135    {
    136         LOGERROR("Actor '%s' has no textures.", m_Base->m_ShortName.c_str());
     136        LOGERROR("Actor '%s' has no textures.", utf8_from_wstring(m_Base->m_ShortName));
    137137    }
    138138   
    139139    std::vector<CObjectBase::Samp>::iterator samp;
    bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections  
    209209        CObjectEntry* oe = objectManager.FindObjectVariation(prop.m_ModelName.c_str(), selections);
    210210        if (!oe)
    211211        {
    212             LOGERROR("Failed to build prop model \"%s\" on actor \"%s\"", prop.m_ModelName.c_str(), m_Base->m_ShortName.c_str());
     212            LOGERROR("Failed to build prop model \"%s\" on actor \"%s\"", utf8_from_wstring(prop.m_ModelName), utf8_from_wstring(m_Base->m_ShortName));
    213213            continue;
    214214        }
    215215
    bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections  
    240240                propmodel->ToCModel()->SetAnimation(oe->GetRandomAnimation("idle"));
    241241        }
    242242        else
    243             LOGERROR("Failed to find matching prop point called \"%s\" in model \"%s\" for actor \"%s\"", ppn.c_str(), m_ModelName.string8(), m_Base->m_ShortName.c_str());
     243            LOGERROR("Failed to find matching prop point called \"%s\" in model \"%s\" for actor \"%s\"", ppn, m_ModelName.string8(), utf8_from_wstring(m_Base->m_ShortName));
    244244    }
    245245
    246246    // setup flags
  • source/graphics/ObjectManager.cpp

    diff --git a/source/graphics/ObjectManager.cpp b/source/graphics/ObjectManager.cpp
    index 5a0ab1a..9d23072 100644
    a b CObjectBase* CObjectManager::FindObjectBase(const CStrW& objectname)  
    9696    else
    9797        delete obj;
    9898
    99     LOGERROR("CObjectManager::FindObjectBase(): Cannot find object '%s'", objectname.c_str());
     99    LOGERROR("CObjectManager::FindObjectBase(): Cannot find object '%s'", utf8_from_wstring(objectname));
    100100
    101101    return 0;
    102102}
  • source/graphics/TerrainProperties.cpp

    diff --git a/source/graphics/TerrainProperties.cpp b/source/graphics/TerrainProperties.cpp
    index f5d7427..3be85b7 100644
    a b CTerrainPropertiesPtr CTerrainProperties::FromXML(const CTerrainPropertiesPtr& p  
    5656    if (rootName != "Terrains")
    5757    {
    5858        LOGERROR("TerrainProperties: Loading %s: Root node is not terrains (found \"%s\")",
    59             pathname.string().c_str(),
    60             rootName.c_str());
     59            pathname.string8(),
     60            rootName);
    6161        return CTerrainPropertiesPtr();
    6262    }
    6363   
    CTerrainPropertiesPtr CTerrainProperties::FromXML(const CTerrainPropertiesPtr& p  
    8080        else
    8181        {
    8282            LOGWARNING("TerrainProperties: Loading %s: Unexpected node %s\n",
    83                 pathname.string().c_str(),
    84                 XeroFile.GetElementString(child.GetNodeName()).c_str());
     83                pathname.string8(),
     84                XeroFile.GetElementString(child.GetNodeName()));
    8585            // Keep reading - typos shouldn't be showstoppers
    8686        }
    8787    }
  • source/graphics/TerrainTextureEntry.cpp

    diff --git a/source/graphics/TerrainTextureEntry.cpp b/source/graphics/TerrainTextureEntry.cpp
    index d1c8ce3..756fb2d 100644
    a b void CTerrainTextureEntry::LoadAlphaMaps(VfsPath &amtype)  
    253253        if (textures[i] < 0)
    254254        {
    255255            g_TexMan.m_TerrainAlphas.erase(it);
    256             LOGERROR("Failed to load alphamap: %s", amtype.string());
     256            LOGERROR("Failed to load alphamap: %s", amtype.string8());
    257257           
    258258            VfsPath standard("standard");
    259259            if (path != standard)
  • source/gui/CGUI.cpp

    diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp
    index cc88ff5..06e86d8 100644
    a b void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec  
    11851185        // Try setting the value
    11861186        if (object->SetSetting(pFile->GetAttributeString(attr.Name), attr.Value.FromUTF8(), true) != PSRETURN_OK)
    11871187        {
    1188             LOGERROR("GUI: (object: %s) Can't set \"%s\" to \"%s\"", object->GetPresentableName().c_str(), pFile->GetAttributeString(attr.Name).c_str(), attr.Value.FromUTF8().c_str());
     1188            LOGERROR("GUI: (object: %s) Can't set \"%s\" to \"%s\"", object->GetPresentableName(), pFile->GetAttributeString(attr.Name), attr.Value);
    11891189
    11901190            // This is not a fatal error
    11911191        }
    void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec  
    12481248                CVFSFile scriptfile;
    12491249                if (scriptfile.Load(g_VFS, filename) != PSRETURN_OK)
    12501250                {
    1251                     LOGERROR("Error opening GUI script action file '%s'", filename.c_str());
     1251                    LOGERROR("Error opening GUI script action file '%s'", utf8_from_wstring(filename));
    12521252                    throw PSERROR_GUI_JSOpenFailed();
    12531253                }
    12541254
    void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec  
    13481348            if (!filename.empty())
    13491349            {
    13501350                if (!directory.empty())
    1351                     LOGWARNING("GUI: Include element found with file name (%s) and directory name (%s). Only the file will be processed.", filename.c_str(), directory.c_str());
     1351                    LOGWARNING("GUI: Include element found with file name (%s) and directory name (%s). Only the file will be processed.", utf8_from_wstring(filename), utf8_from_wstring(directory));
    13521352
    13531353                Paths.insert(filename);
    13541354
    13551355                CXeromyces XeroIncluded;
    13561356                if (XeroIncluded.Load(g_VFS, filename) != PSRETURN_OK)
    13571357                {
    1358                     LOGERROR("GUI: Error reading included XML: '%s'", filename.c_str());
     1358                    LOGERROR("GUI: Error reading included XML: '%s'", utf8_from_wstring(filename));
    13591359                    continue;
    13601360                }
    13611361
    13621362                XMBElement node = XeroIncluded.GetRoot();
    13631363                if (node.GetNodeName() != XeroIncluded.GetElementID("object"))
    13641364                {
    1365                     LOGERROR("GUI: Error reading included XML: '%s', root element must have be of type 'object'.", filename.c_str());
     1365                    LOGERROR("GUI: Error reading included XML: '%s', root element must have be of type 'object'.", utf8_from_wstring(filename));
    13661366                    continue;
    13671367                }
    13681368                Xeromyces_ReadObject(node, &XeroIncluded, object, NameSubst, Paths, nesting_depth+1);
    void CGUI::Xeromyces_ReadScript(XMBElement Element, CXeromyces* pFile, boost::un  
    14911491        }
    14921492        catch (PSERROR_Scripting& e)
    14931493        {
    1494             LOGERROR("GUI: Error executing script %s: %s", file.c_str(), e.what());
     1494            LOGERROR("GUI: Error executing script %s: %s", utf8_from_wstring(file), e.what());
    14951495        }
    14961496    }
    14971497
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    16361636        {
    16371637            CClientArea ca;
    16381638            if (!GUI<CClientArea>::ParseString(attr_value, ca))
    1639                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1639                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    16401640            else Image->m_Size = ca;
    16411641        }
    16421642        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    16441644        {
    16451645            CClientArea ca;
    16461646            if (!GUI<CClientArea>::ParseString(attr_value, ca))
    1647                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1647                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    16481648            else Image->m_TextureSize = ca;
    16491649        }
    16501650        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    16521652        {
    16531653            CRect rect;
    16541654            if (!GUI<CRect>::ParseString(attr_value, rect))
    1655                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1655                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    16561656            else Image->m_TexturePlacementInFile = rect;
    16571657        }
    16581658        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    16601660        {
    16611661            CSize size;
    16621662            if (!GUI<CSize>::ParseString(attr_value, size))
    1663                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1663                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    16641664            else Image->m_CellSize = size;
    16651665        }
    16661666        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    16681668        {
    16691669            float val;
    16701670            if (!GUI<float>::ParseString(attr_value, val))
    1671                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1671                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    16721672            else Image->m_FixedHAspectRatio = val;
    16731673        }
    16741674        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    16761676        {
    16771677            bool b;
    16781678            if (!GUI<bool>::ParseString(attr_value, b))
    1679                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1679                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    16801680            else Image->m_RoundCoordinates = b;
    16811681        }
    16821682        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    16891689            else if (attr_value == L"clamp_to_edge")
    16901690                Image->m_WrapMode = GL_CLAMP_TO_EDGE;
    16911691            else
    1692                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1692                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    16931693        }
    16941694        else
    16951695        if (attr_name == "z_level")
    16961696        {
    16971697            float z_level;
    16981698            if (!GUI<float>::ParseString(attr_value, z_level))
    1699                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1699                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    17001700            else Image->m_DeltaZ = z_level/100.f;
    17011701        }
    17021702        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    17041704        {
    17051705            CColor color;
    17061706            if (!GUI<CColor>::ParseString(attr_value, color))
    1707                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1707                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    17081708            else Image->m_BackColor = color;
    17091709        }
    17101710        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    17121712        {
    17131713            CColor color;
    17141714            if (!GUI<CColor>::ParseString(attr_value, color))
    1715                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1715                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    17161716            else Image->m_BorderColor = color;
    17171717        }
    17181718        else
    void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite  
    17201720        {
    17211721            bool b;
    17221722            if (!GUI<bool>::ParseString(attr_value, b))
    1723                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1723                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    17241724            else Image->m_Border = b;
    17251725        }
    17261726        else
    void CGUI::Xeromyces_ReadEffects(XMBElement Element, CXeromyces* pFile, SGUIImag  
    17731773        {
    17741774            CColor color;
    17751775            if (!GUI<int>::ParseColor(attr_value, color, 0))
    1776                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1776                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
    17771777            else effects.m_AddColor = color;
    17781778        }
    17791779        else if (attr_name == "grayscale")
    void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)  
    18531853        {
    18541854            bool b;
    18551855            if (!GUI<bool>::ParseString(attr_value.FromUTF8(), b))
    1856                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1856                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value);
    18571857            else
    18581858                scrollbar.m_UseEdgeButtons = b;
    18591859        }
    void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)  
    18611861        {
    18621862            float f;
    18631863            if (!GUI<float>::ParseString(attr_value.FromUTF8(), f))
    1864                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1864                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value);
    18651865            else
    18661866                scrollbar.m_Width = f;
    18671867        }
    void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)  
    18701870        {
    18711871            float f;
    18721872            if (!GUI<float>::ParseString(attr_value.FromUTF8(), f))
    1873                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1873                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value);
    18741874            else
    18751875                scrollbar.m_MinimumBarSize = f;
    18761876        }
    void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)  
    18791879        {
    18801880            float f;
    18811881            if (!GUI<float>::ParseString(attr_value.FromUTF8(), f))
    1882                 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str());
     1882                LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value);
    18831883            else
    18841884                scrollbar.m_MaximumBarSize = f;
    18851885        }
    void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile)  
    19521952        {
    19531953            CSize size;
    19541954            if (!GUI<CSize>::ParseString(attr_value.FromUTF8(), size))
    1955                 LOGERROR("Error parsing '%s' (\"%s\") inside <icon>.", attr_name.c_str(), attr_value.c_str());
     1955                LOGERROR("Error parsing '%s' (\"%s\") inside <icon>.", attr_name, attr_value);
    19561956            else
    19571957                icon.m_Size = size;
    19581958        }
    void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile)  
    19601960        {
    19611961            int cell_id;
    19621962            if (!GUI<int>::ParseString(attr_value.FromUTF8(), cell_id))
    1963                 LOGERROR("GUI: Error parsing '%s' (\"%s\") inside <icon>.", attr_name.c_str(), attr_value.c_str());
     1963                LOGERROR("GUI: Error parsing '%s' (\"%s\") inside <icon>.", attr_name, attr_value);
    19641964            else
    19651965                icon.m_CellID = cell_id;
    19661966        }
  • source/gui/GUIManager.cpp

    diff --git a/source/gui/GUIManager.cpp b/source/gui/GUIManager.cpp
    index 55db7d6..4656f37 100644
    a b void CGUIManager::PopPageCB(shared_ptr<ScriptInterface::StructuredClone> args)  
    137137    JS::RootedValue global(cx, scriptInterface->GetGlobalObject());
    138138    if (!scriptInterface->HasProperty(global, callback.c_str()))
    139139    {
    140         LOGERROR("The specified callback function %s does not exist in the page %s", callback.c_str(), m_PageStack.back().name.c_str());
     140        LOGERROR("The specified callback function %s does not exist in the page %s", callback, utf8_from_wstring(m_PageStack.back().name));
    141141        return;
    142142    }
    143143
    void CGUIManager::PopPageCB(shared_ptr<ScriptInterface::StructuredClone> args)  
    146146        scriptInterface->ReadStructuredClone(args, &argVal);
    147147    if (!scriptInterface->CallFunctionVoid(global, callback.c_str(), argVal))
    148148    {
    149         LOGERROR("Failed to call the callback function %s in the page %s", callback.c_str(), m_PageStack.back().name.c_str());
     149        LOGERROR("Failed to call the callback function %s in the page %s", callback, utf8_from_wstring(m_PageStack.back().name));
    150150        return;
    151151    }
    152152}
    void CGUIManager::LoadPage(SGUIPage& page)  
    204204
    205205    if (root.GetNodeName() != elmt_page)
    206206    {
    207         LOGERROR("GUI page '%s' must have root element <page>", page.name.c_str());
     207        LOGERROR("GUI page '%s' must have root element <page>", utf8_from_wstring(page.name));
    208208        return;
    209209    }
    210210
    void CGUIManager::LoadPage(SGUIPage& page)  
    212212    {
    213213        if (node.GetNodeName() != elmt_include)
    214214        {
    215             LOGERROR("GUI page '%s' must only have <include> elements inside <page>", page.name.c_str());
     215            LOGERROR("GUI page '%s' must only have <include> elements inside <page>", utf8_from_wstring(page.name));
    216216            continue;
    217217        }
    218218
    void CGUIManager::LoadPage(SGUIPage& page)  
    252252            hotloadDataVal)
    253253        )
    254254    {
    255         LOGERROR("GUI page '%s': Failed to call init() function", page.name.c_str());
     255        LOGERROR("GUI page '%s': Failed to call init() function", utf8_from_wstring(page.name));
    256256    }
    257257
    258258    m_CurrentGUI = oldGUI;
    Status CGUIManager::ReloadChangedFile(const VfsPath& path)  
    264264    {
    265265        if (it->inputs.count(path))
    266266        {
    267             LOGMESSAGE("GUI file '%s' changed - reloading page '%s'", path.string8(), it->name.c_str());
     267            LOGMESSAGE("GUI file '%s' changed - reloading page '%s'", path.string8(), utf8_from_wstring(it->name));
    268268            LoadPage(*it);
    269269            // TODO: this can crash if LoadPage runs an init script which modifies the page stack and breaks our iterators
    270270        }
  • source/gui/GUIRenderer.cpp

    diff --git a/source/gui/GUIRenderer.cpp b/source/gui/GUIRenderer.cpp
    index ec5087b..88f3115 100644
    a b void GUIRenderer::UpdateDrawCallCache(DrawCalls &Calls, const CStr& SpriteName,  
    144144            // Check colour is valid
    145145            if (!GUI<CColor>::ParseString(value, color))
    146146            {
    147                 LOGERROR("GUI: Error parsing sprite 'colour' (\"%s\")", value.c_str());
     147                LOGERROR("GUI: Error parsing sprite 'colour' (\"%s\")", utf8_from_wstring(value));
    148148                return;
    149149            }
    150150
  • source/gui/GUItext.cpp

    diff --git a/source/gui/GUItext.cpp b/source/gui/GUItext.cpp
    index 15ca677..783bb30 100644
    a b void CGUIString::SetValue(const CStrW& str)  
    306306            closing = false;
    307307            if (++p == l)
    308308            {
    309                 LOGERROR("Partial tag at end of string '%s'", str.c_str());
     309                LOGERROR("Partial tag at end of string '%s'", utf8_from_wstring(str));
    310310                break;
    311311            }
    312312            if (str[p] == L'/')
    void CGUIString::SetValue(const CStrW& str)  
    314314                closing = true;
    315315                if (tags.empty())
    316316                {
    317                     LOGERROR("Encountered closing tag without having any open tags. At %d in '%s'", p, str.c_str());
     317                    LOGERROR("Encountered closing tag without having any open tags. At %d in '%s'", p, utf8_from_wstring(str));
    318318                    break;
    319319                }
    320320                if (++p == l)
    321321                {
    322                     LOGERROR("Partial closing tag at end of string '%s'", str.c_str());
     322                    LOGERROR("Partial closing tag at end of string '%s'", utf8_from_wstring(str));
    323323                    break;
    324324                }
    325325            }
    void CGUIString::SetValue(const CStrW& str)  
    332332                {
    333333                case L' ':
    334334                    if (closing) // We still parse them to make error handling cleaner
    335                         LOGERROR("Closing tags do not support parameters (at pos %d '%s')", p, str.c_str());
     335                        LOGERROR("Closing tags do not support parameters (at pos %d '%s')", p, utf8_from_wstring(str));
    336336
    337337                    // parse something="something else"
    338338                    for (++p; p < l && str[p] != L'='; ++p)
    void CGUIString::SetValue(const CStrW& str)  
    340340
    341341                    if (p == l)
    342342                    {
    343                         LOGERROR("Parameter without value at pos %d '%s'", p, str.c_str());
     343                        LOGERROR("Parameter without value at pos %d '%s'", p, utf8_from_wstring(str));
    344344                        break;
    345345                    }
    346346                    // fall-through
    347347                case L'=':
    348348                    // parse a quoted parameter
    349349                    if (closing) // We still parse them to make error handling cleaner
    350                         LOGERROR("Closing tags do not support parameters (at pos %d '%s')", p, str.c_str());
     350                        LOGERROR("Closing tags do not support parameters (at pos %d '%s')", p, utf8_from_wstring(str));
    351351
    352352                    if (++p == l)
    353353                    {
    354                         LOGERROR("Expected parameter, got end of string '%s'", str.c_str());
     354                        LOGERROR("Expected parameter, got end of string '%s'", utf8_from_wstring(str));
    355355                        break;
    356356                    }
    357357                    if (str[p] != L'"')
    358358                    {
    359                         LOGERROR("Unquoted parameters are not supported (at pos %d '%s')", p, str.c_str());
     359                        LOGERROR("Unquoted parameters are not supported (at pos %d '%s')", p, utf8_from_wstring(str));
    360360                        break;
    361361                    }
    362362                    for (++p; p < l && str[p] != L'"'; ++p)
    void CGUIString::SetValue(const CStrW& str)  
    366366                        case L'\\':
    367367                            if (++p == l)
    368368                            {
    369                                 LOGERROR("Escape character at end of string '%s'", str.c_str());
     369                                LOGERROR("Escape character at end of string '%s'", utf8_from_wstring(str));
    370370                                break;
    371371                            }
    372372                            // NOTE: We do not support \n in tag parameters
    void CGUIString::SetValue(const CStrW& str)  
    392392
    393393            if (!tag_.SetTagType(tag))
    394394            {
    395                 LOGERROR("Invalid tag '%s' at %d in '%s'", tag.c_str(), p, str.c_str());
     395                LOGERROR("Invalid tag '%s' at %d in '%s'", utf8_from_wstring(tag), p, utf8_from_wstring(str));
    396396                break;
    397397            }
    398398            if (!closing)
    void CGUIString::SetValue(const CStrW& str)  
    415415            {
    416416                if (tag != tags.back())
    417417                {
    418                     LOGERROR("Closing tag '%s' does not match last opened tag '%s' at %d in '%s'", tag.c_str(), tags.back().c_str(), p, str.c_str());
     418                    LOGERROR("Closing tag '%s' does not match last opened tag '%s' at %d in '%s'", utf8_from_wstring(tag), utf8_from_wstring(tags.back()), p, utf8_from_wstring(str));
    419419                    break;
    420420                }
    421421
    void CGUIString::SetValue(const CStrW& str)  
    426426        case L'\\':
    427427            if (++p == l)
    428428            {
    429                 LOGERROR("Escape character at end of string '%s'", str.c_str());
     429                LOGERROR("Escape character at end of string '%s'", utf8_from_wstring(str));
    430430                break;
    431431            }
    432432            if (str[p] == L'n')
  • source/network/NetClient.cpp

    diff --git a/source/network/NetClient.cpp b/source/network/NetClient.cpp
    index 68b253c..fec7a80 100644
    a b bool CNetClient::OnAuthenticate(void* context, CFsmEvent* event)  
    428428
    429429    CAuthenticateResultMessage* message = (CAuthenticateResultMessage*)event->GetParamRef();
    430430
    431     LOGMESSAGE("Net: Authentication result: host=%u, %s", message->m_HostID, message->m_Message.c_str());
     431    LOGMESSAGE("Net: Authentication result: host=%u, %s", message->m_HostID, utf8_from_wstring(message->m_Message));
    432432
    433433    bool  isRejoining = (message->m_Code == ARC_OK_REJOINING);
    434434
  • source/network/NetServer.cpp

    diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp
    index b3c14f3..1a8187a 100644
    a b bool CNetServerWorker::OnAuthenticate(void* context, CFsmEvent* event)  
    810810        // Players who weren't already in the game are not allowed to join now that it's started
    811811        if (!isRejoining)
    812812        {
    813             LOGMESSAGE("Refused connection after game start from not-previously-known user \"%s\"", username.c_str());
     813            LOGMESSAGE("Refused connection after game start from not-previously-known user \"%s\"", utf8_from_wstring(username));
    814814            session->Disconnect(NDR_SERVER_ALREADY_IN_GAME);
    815815            return true;
    816816        }
  • source/network/NetTurnManager.cpp

    diff --git a/source/network/NetTurnManager.cpp b/source/network/NetTurnManager.cpp
    index 5a57470..575dca3 100644
    a b static std::wstring Hexify(const std::string& s)  
    5757    return str.str();
    5858}
    5959
     60static std::string Hexify8(const std::string& s)
     61{
     62    std::stringstream str;
     63    str << std::hex;
     64    for (size_t i = 0; i < s.size(); ++i)
     65        str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i];
     66    return str.str();
     67}
     68
    6069CNetTurnManager::CNetTurnManager(CSimulation2& simulation, u32 defaultTurnLength, int clientId, IReplayLogger& replay) :
    6170    m_Simulation2(simulation), m_CurrentTurn(0), m_ReadyTurn(1), m_TurnLength(defaultTurnLength), m_DeltaSimTime(0),
    6271    m_PlayerId(-1), m_ClientId(clientId), m_HasSyncError(false), m_Replay(replay),
    void CNetTurnManager::OnSyncError(u32 turn, const std::string& expectedHash)  
    237246    m_Simulation2.DumpDebugState(file);
    238247    file.close();
    239248
    240     std::wstringstream msg;
    241     msg << L"Out of sync on turn " << turn << L": expected hash " << Hexify(expectedHash) << L"\n\n";
    242     msg << L"Current state: turn " << m_CurrentTurn << L", hash " << Hexify(hash) << L"\n\n";
    243     msg << L"Dumping current state to " << path;
     249    std::stringstream msg;
     250    msg << "Out of sync on turn " << turn << ": expected hash " << Hexify8(expectedHash) << "\n\n";
     251    msg << "Current state: turn " << m_CurrentTurn << ", hash " << Hexify8(hash) << "\n\n";
     252    msg << "Dumping current state to " << utf8_from_wstring(path.string());
    244253    if (g_GUI)
    245         g_GUI->DisplayMessageBox(600, 350, L"Sync error", msg.str());
     254        g_GUI->DisplayMessageBox(600, 350, L"Sync error", wstring_from_utf8(msg.str()));
    246255    else
    247         LOGERROR("%s", msg.str().c_str());
     256        LOGERROR("%s", msg.str());
    248257}
    249258
    250259void CNetTurnManager::Interpolate(float simFrameLength, float realFrameLength)
  • source/ps/ConfigDB.cpp

    diff --git a/source/ps/ConfigDB.cpp b/source/ps/ConfigDB.cpp
    index 2c14e15..ab4dca3 100644
    a b bool CConfigDB::Reload(EConfigNamespace ns)  
    337337            CStr key(header + name);
    338338            newMap[key] = values;
    339339            if (key == "lobby.password")
    340                 LOGMESSAGE("Loaded config string \"%s\"", key.c_str());
     340                LOGMESSAGE("Loaded config string \"%s\"", key);
    341341            else
    342342            {
    343343                std::string vals;
    344344                for (size_t i = 0; i < newMap[key].size() - 1; ++i)
    345345                    vals += "\"" + EscapeString(newMap[key][i]) + "\", ";
    346346                vals += "\"" + EscapeString(newMap[key][values.size()-1]) + "\"";
    347                 LOGMESSAGE("Loaded config string \"%s\" = %s", key.c_str(), vals.c_str());
     347                LOGMESSAGE("Loaded config string \"%s\" = %s", key, vals);
    348348            }
    349349        }
    350350        else if (!name.empty())
    351             LOGERROR("Encountered config setting '%s' without value while parsing '%s' on line %d", name.c_str(), m_ConfigFile[ns].string8(), line);
     351            LOGERROR("Encountered config setting '%s' without value while parsing '%s' on line %d", name, m_ConfigFile[ns].string8(), line);
    352352
    353353        name.clear();
    354354        values.clear();
    bool CConfigDB::Reload(EConfigNamespace ns)  
    356356    }
    357357
    358358    if (!name.empty())
    359         LOGERROR("Config file does not have a new line after the last config setting '%s'", name.c_str());
     359        LOGERROR("Config file does not have a new line after the last config setting '%s'", name);
    360360
    361361    m_Map[ns].swap(newMap);
    362362
  • source/ps/GameSetup/GameSetup.cpp

    diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp
    index d1fb63c..44b166e 100644
    a b void Render()  
    293293#warning TODO: cursors for Android
    294294#else
    295295            if (cursor_draw(g_VFS, cursorName.c_str(), g_mouse_x, g_yres-g_mouse_y, forceGL) < 0)
    296                 LOGWARNING("Failed to draw cursor '%s'", cursorName.c_str());
     296                LOGWARNING("Failed to draw cursor '%s'", utf8_from_wstring(cursorName));
    297297#endif
    298298
    299299#if CONFIG2_GLES
    bool Autostart(const CmdLineArgs& args)  
    12461246        else
    12471247        {
    12481248            // Problem with JSON file
    1249             LOGERROR("Autostart: Error reading random map script '%s'", scriptPath.c_str());
     1249            LOGERROR("Autostart: Error reading random map script '%s'", utf8_from_wstring(scriptPath));
    12501250            throw PSERROR_Game_World_MapLoadFailed("Error reading random map script.\nCheck application log for details.");
    12511251        }
    12521252
    bool Autostart(const CmdLineArgs& args)  
    13011301    }
    13021302    else
    13031303    {
    1304         LOGERROR("Autostart: Unrecognized map type '%s'", mapDirectory.c_str());
     1304        LOGERROR("Autostart: Unrecognized map type '%s'", utf8_from_wstring(mapDirectory));
    13051305        throw PSERROR_Game_World_MapLoadFailed("Unrecognized map type.\nConsult readme.txt for the currently supported types.");
    13061306    }
    13071307    scriptInterface.SetProperty(attrs, "mapType", mapType);
  • source/ps/XML/Xeromyces.cpp

    diff --git a/source/ps/XML/Xeromyces.cpp b/source/ps/XML/Xeromyces.cpp
    index 9e2709e..68ba0c6 100644
    a b static void errorHandler(void* UNUSED(userData), xmlErrorPtr error)  
    3939        message.erase(message.length()-1);
    4040
    4141    LOGERROR("CXeromyces: Parse %s: %s:%d: %s",
    42         error->level == XML_ERR_WARNING ? L"warning" : L"error",
    43         error->file, error->line, message.c_str());
     42        error->level == XML_ERR_WARNING ? "warning" : "error",
     43        error->file, error->line, message);
    4444    // TODO: The (non-fatal) warnings and errors don't get stored in the XMB,
    4545    // so the caching is less transparent than it should be
    4646}
  • source/scriptinterface/ScriptInterface.cpp

    diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp
    index 975cde1..a86ab5d 100644
    a b JSBool logmsg(JSContext* cx, uint argc, jsval* vp)  
    163163    std::wstring str;
    164164    if (!ScriptInterface::FromJSVal(cx, args.handleAt(0), str))
    165165        return JS_FALSE;
    166     LOGMESSAGE("%s", str.c_str());
     166    LOGMESSAGE("%s", utf8_from_wstring(str));
    167167    args.rval().setUndefined();
    168168    return JS_TRUE;
    169169}
    JSBool warn(JSContext* cx, uint argc, jsval* vp)  
    180180    std::wstring str;
    181181    if (!ScriptInterface::FromJSVal(cx, args.handleAt(0), str))
    182182        return JS_FALSE;
    183     LOGWARNING("%s", str.c_str());
     183    LOGWARNING("%s", utf8_from_wstring(str));
    184184    args.rval().setUndefined();
    185185    return JS_TRUE;
    186186}
    JSBool error(JSContext* cx, uint argc, jsval* vp)  
    197197    std::wstring str;
    198198    if (!ScriptInterface::FromJSVal(cx, args.handleAt(0), str))
    199199        return JS_FALSE;
    200     LOGERROR("%s", str.c_str());
     200    LOGERROR("%s", utf8_from_wstring(str));
    201201    args.rval().setUndefined();
    202202    return JS_TRUE;
    203203}
    bool ScriptInterface::ParseJSON(const std::string& string_utf8, JS::MutableHandl  
    946946
    947947    std::wstring error;
    948948    ScriptInterface::FromJSVal(m->m_cx, rval, error);
    949     LOGERROR("%s", error.c_str());
     949    LOGERROR("%s", utf8_from_wstring(error));
    950950    return false;
    951951}
    952952
  • source/simulation2/Simulation2.cpp

    diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp
    index fbb1664..ac70109 100644
    a b static std::vector<std::string> GetJSONData(const VfsPath& path)  
    828828    {
    829829        // Some error reading directory
    830830        wchar_t error[200];
    831         LOGERROR("Error reading directory '%s': %s", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error)));
     831        LOGERROR("Error reading directory '%s': %s", path.string8(), utf8_from_wstring(StatusDescription(ret, error, ARRAY_SIZE(error))));
    832832        return std::vector<std::string>();
    833833    }
    834834
  • source/simulation2/components/CCmpAIManager.cpp

    diff --git a/source/simulation2/components/CCmpAIManager.cpp b/source/simulation2/components/CCmpAIManager.cpp
    index ffe0fc4..e2a067a 100644
    a b private:  
    124124            if (!m_ScriptInterface->GetProperty(global, moduleName.c_str(), &objectWithConstructor)
    125125                || objectWithConstructor.isUndefined())
    126126            {
    127                 LOGERROR("Failed to create AI player: %s: can't find the module that should contain the constructor: '%s'", path.string8(), moduleName.c_str());
     127                LOGERROR("Failed to create AI player: %s: can't find the module that should contain the constructor: '%s'", path.string8(), moduleName);
    128128                return false;
    129129            }
    130130
    private:  
    138138            if (!m_ScriptInterface->GetProperty(objectWithConstructor, constructor.c_str(), &ctor)
    139139                || ctor.isNull())
    140140            {
    141                 LOGERROR("Failed to create AI player: %s: can't find constructor '%s'", path.string8(), constructor.c_str());
     141                LOGERROR("Failed to create AI player: %s: can't find constructor '%s'", path.string8(), constructor);
    142142                return false;
    143143            }
    144144
    private:  
    160160
    161161            if (obj.isNull())
    162162            {
    163                 LOGERROR("Failed to create AI player: %s: error calling constructor '%s'", path.string8(), constructor.c_str());
     163                LOGERROR("Failed to create AI player: %s: error calling constructor '%s'", path.string8(), constructor);
    164164                return false;
    165165            }
    166166
    public:  
    261261        VfsPaths pathnames;
    262262        if (vfs::GetPathnames(g_VFS, L"simulation/ai/" + moduleName + L"/", L"*.js", pathnames) < 0)
    263263        {
    264             LOGERROR("Failed to load AI scripts for module %s", moduleName.c_str());
     264            LOGERROR("Failed to load AI scripts for module %s", utf8_from_wstring(moduleName));
    265265            return false;
    266266        }
    267267
    public:  
    748748        std::pair<std::map<JSObject*, std::wstring>::iterator, bool> ret1 = m_SerializablePrototypes.insert(std::make_pair(obj, name));
    749749        std::pair<std::map<std::wstring, JSObject*>::iterator, bool> ret2 = m_DeserializablePrototypes.insert(std::make_pair(name, obj));
    750750        if (!ret1.second || !ret2.second)
    751             LOGERROR("RegisterSerializablePrototype called with same prototype multiple times: p=%p n='%s'", obj, name.c_str());
     751            LOGERROR("RegisterSerializablePrototype called with same prototype multiple times: p=%p n='%s'", (void *)obj, utf8_from_wstring(name));
    752752    }
    753753
    754754private:
  • source/simulation2/components/CCmpProjectileManager.cpp

    diff --git a/source/simulation2/components/CCmpProjectileManager.cpp b/source/simulation2/components/CCmpProjectileManager.cpp
    index d8af231..8e0d5c3 100644
    a b uint32_t CCmpProjectileManager::LaunchProjectile(entity_id_t source, CFixedVecto  
    175175    {
    176176        // If the actor was actually loaded, complain that it doesn't have a projectile
    177177        if (!cmpSourceVisual->GetActorShortName().empty())
    178             LOGERROR("Unit with actor '%s' launched a projectile but has no actor on 'projectile' attachpoint", cmpSourceVisual->GetActorShortName().c_str());
     178            LOGERROR("Unit with actor '%s' launched a projectile but has no actor on 'projectile' attachpoint", utf8_from_wstring(cmpSourceVisual->GetActorShortName()));
    179179        return 0;
    180180    }
    181181
  • source/simulation2/serialization/BinarySerializer.cpp

    diff --git a/source/simulation2/serialization/BinarySerializer.cpp b/source/simulation2/serialization/BinarySerializer.cpp
    index f6da94f..4878226 100644
    a b void CBinarySerializerScriptImpl::HandleScriptVal(JS::HandleValue val)  
    317317            }
    318318        }
    319319
    320         LOGERROR("Cannot serialise JS objects of type 'function': %s", funcname.c_str());
     320        LOGERROR("Cannot serialise JS objects of type 'function': %s", utf8_from_wstring(funcname));
    321321        throw PSERROR_Serialize_InvalidScriptValue();
    322322    }
    323323    case JSTYPE_STRING:
  • source/simulation2/system/ComponentManager.cpp

    diff --git a/source/simulation2/system/ComponentManager.cpp b/source/simulation2/system/ComponentManager.cpp
    index 53e69ee..0ee90a0 100644
    a b entity_id_t CComponentManager::AddEntity(const std::wstring& templateName, entit  
    887887        CComponentManager::ComponentTypeId cid = LookupCID(it->first);
    888888        if (cid == CID__Invalid)
    889889        {
    890             LOGERROR("Unrecognised component type name '%s' in entity template '%s'", it->first.c_str(), templateName.c_str());
     890            LOGERROR("Unrecognised component type name '%s' in entity template '%s'", it->first, utf8_from_wstring(templateName));
    891891            return INVALID_ENTITY;
    892892        }
    893893
    894894        if (!AddComponent(handle, cid, it->second))
    895895        {
    896             LOGERROR("Failed to construct component type name '%s' in entity template '%s'", it->first.c_str(), templateName.c_str());
     896            LOGERROR("Failed to construct component type name '%s' in entity template '%s'", it->first, utf8_from_wstring(templateName));
    897897            return INVALID_ENTITY;
    898898        }
    899899        // TODO: maybe we should delete already-constructed components if one of them fails?
    std::vector<std::string> CComponentManager::Script_FindJSONFiles(ScriptInterface  
    12261226    {
    12271227        // Some error reading directory
    12281228        wchar_t error[200];
    1229         LOGERROR("Error reading directory '%s': %s", cbData.path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error)));
     1229        LOGERROR("Error reading directory '%s': %s", cbData.path.string8(), utf8_from_wstring(StatusDescription(ret, error, ARRAY_SIZE(error))));
    12301230    }
    12311231   
    12321232    return cbData.templates;
  • source/simulation2/system/ParamNode.cpp

    diff --git a/source/simulation2/system/ParamNode.cpp b/source/simulation2/system/ParamNode.cpp
    index 0e5dc41..2e4b172 100644
    a b void CParamNode::ApplyLayer(const XMBFile& xmb, const XMBElement& element, const  
    124124                            tokens.erase(tokenIt);
    125125                        else
    126126                            LOGWARNING("[ParamNode] Could not remove token '%s' from node '%s'%s; not present in list nor inherited (possible typo?)",
    127                                 newTokens[i].substr(1).c_str(), name.c_str(), sourceIdentifier ? (L" in '" + std::wstring(sourceIdentifier) + L"'").c_str() : L"");
     127                                utf8_from_wstring(newTokens[i].substr(1)), name, sourceIdentifier ? (" in '" + utf8_from_wstring(sourceIdentifier) + "'").c_str() : "");
    128128                    }
    129129                    else
    130130                    {
  • source/soundmanager/SoundManager.cpp

    diff --git a/source/soundmanager/SoundManager.cpp b/source/soundmanager/SoundManager.cpp
    index 5bf843d..48d0917 100644
    a b Status CSoundManager::AlcInit()  
    354354        debug_printf(L"Sound: AlcInit success, using %hs\n", dev_name);
    355355    else
    356356    {
    357         LOGERROR("Sound: AlcInit failed, m_Device=%p m_Context=%p dev_name=%s err=%x\n", m_Device, m_Context, dev_name, err);
     357        LOGERROR("Sound: AlcInit failed, m_Device=%p m_Context=%p dev_name=%s err=%x\n", (void *)m_Device, (void *)m_Context, dev_name, err);
    358358
    359359// FIXME Hack to get around exclusive access to the sound device
    360360#if OS_UNIX
  • source/soundmanager/scripting/SoundGroup.cpp

    diff --git a/source/soundmanager/scripting/SoundGroup.cpp b/source/soundmanager/scripting/SoundGroup.cpp
    index 2b7a4be..0dc524c 100644
    a b static void HandleError(const CStrW& message, const VfsPath& pathname, Status er  
    227227{
    228228    if (err == ERR::AGAIN)
    229229        return; // open failed because sound is disabled (don't log this)
    230     LOGERROR("%s: pathname=%s, error=%s", message.c_str(), pathname.string8(), ErrorString(err));
     230    LOGERROR("%s: pathname=%s, error=%s", utf8_from_wstring(message), pathname.string8(), utf8_from_wstring(ErrorString(err)));
    231231}
    232232
    233233void CSoundGroup::PlayNext(const CVector3D& position, entity_id_t source)