From 7b342eec600ae8896a2946faf9674acfbd747e87 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Mon, 13 Nov 2017 18:01:27 +0500 Subject: [PATCH] Replace shared_str operator* by c_str() for xrCore --- src/xrCore/FS.h | 6 +-- src/xrCore/FS_internal.h | 14 +++--- src/xrCore/FileSystem.cpp | 2 +- src/xrCore/LocatorAPI.cpp | 6 +-- src/xrCore/PostProcess/PostProcess.hpp | 2 +- src/xrCore/XML/XMLDocument.cpp | 2 +- src/xrCore/log.cpp | 2 +- src/xrCore/net_utils.h | 4 +- src/xrCore/xr_ini.cpp | 60 +++++++++++++------------- src/xrCore/xr_ini.h | 38 ++++++++-------- src/xrCore/xr_resource.h | 2 +- src/xrCore/xr_trims.cpp | 4 +- src/xrCore/xrstring.h | 6 +-- src/xrMisc/string_functions.cpp | 4 +- 14 files changed, 76 insertions(+), 76 deletions(-) diff --git a/src/xrCore/FS.h b/src/xrCore/FS.h index 4dc98c7eef9..1e1c77a9f51 100644 --- a/src/xrCore/FS.h +++ b/src/xrCore/FS.h @@ -45,7 +45,7 @@ class XRCORE_API IWriter public: IWriter() {} - virtual ~IWriter() { R_ASSERT3(chunk_pos.empty(), "Opened chunk not closed.", *fName); } + virtual ~IWriter() { R_ASSERT3(chunk_pos.empty(), "Opened chunk not closed.", fName.c_str()); } // kernel virtual void seek(u32 pos) = 0; virtual u32 tell() = 0; @@ -71,12 +71,12 @@ class XRCORE_API IWriter IC void w_stringZ(const char* p) { w(p, (u32)xr_strlen(p) + 1); } IC void w_stringZ(const shared_str& p) { - w(*p ? *p : "", p.size()); + w(p.c_str() ? p.c_str() : "", p.size()); w_u8(0); } IC void w_stringZ(shared_str& p) { - w(*p ? *p : "", p.size()); + w(p.c_str() ? p.c_str() : "", p.size()); w_u8(0); } IC void w_stringZ(const xr_string& p) diff --git a/src/xrCore/FS_internal.h b/src/xrCore/FS_internal.h index 35c5f025170..b7ed97865a7 100644 --- a/src/xrCore/FS_internal.h +++ b/src/xrCore/FS_internal.h @@ -22,21 +22,21 @@ class CFileWriter : public IWriter { R_ASSERT(name && name[0]); fName = name; - VerifyPath(*fName); + VerifyPath(fName.c_str()); if (exclusive) { - int handle = _sopen(*fName, _O_WRONLY | _O_TRUNC | _O_CREAT | _O_BINARY, SH_DENYWR); + int handle = _sopen(fName.c_str(), _O_WRONLY | _O_TRUNC | _O_CREAT | _O_BINARY, SH_DENYWR); #ifdef _EDITOR if (handle == -1) - Msg("!Can't create file: '%s'. Error: '%s'.", *fName, _sys_errlist[errno]); + Msg("!Can't create file: '%s'. Error: '%s'.", fName.c_str(), _sys_errlist[errno]); #endif hf = _fdopen(handle, "wb"); } else { - hf = fopen(*fName, "wb"); + hf = fopen(fName.c_str(), "wb"); if (hf == 0) - Msg("!Can't write file: '%s'. Error: '%s'.", *fName, _sys_errlist[errno]); + Msg("!Can't write file: '%s'. Error: '%s'.", fName.c_str(), _sys_errlist[errno]); } } @@ -46,11 +46,11 @@ class CFileWriter : public IWriter { fclose(hf); // release RO attrib - DWORD dwAttr = GetFileAttributes(*fName); + DWORD dwAttr = GetFileAttributes(fName.c_str()); if ((dwAttr != u32(-1)) && (dwAttr & FILE_ATTRIBUTE_READONLY)) { dwAttr &= ~FILE_ATTRIBUTE_READONLY; - SetFileAttributes(*fName, dwAttr); + SetFileAttributes(fName.c_str(), dwAttr); } } } diff --git a/src/xrCore/FileSystem.cpp b/src/xrCore/FileSystem.cpp index a37c755e95d..8d92e2f2759 100644 --- a/src/xrCore/FileSystem.cpp +++ b/src/xrCore/FileSystem.cpp @@ -299,7 +299,7 @@ LPCSTR EFS_Utils::AppendFolderToName( { *d = 0; if (depth < sv_depth) - xr_strcat(dest_name, dest_name_size, *tmp); + xr_strcat(dest_name, dest_name_size, tmp.c_str()); } else { diff --git a/src/xrCore/LocatorAPI.cpp b/src/xrCore/LocatorAPI.cpp index 29ce81a9ac9..7d5167cc322 100644 --- a/src/xrCore/LocatorAPI.cpp +++ b/src/xrCore/LocatorAPI.cpp @@ -381,7 +381,7 @@ void CLocatorAPI::archive::open() if (hSrcFile && hSrcMap) return; - hSrcFile = CreateFile(*path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); + hSrcFile = CreateFile(path.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); R_ASSERT(hSrcFile != INVALID_HANDLE_VALUE); hSrcMap = CreateFileMapping(hSrcFile, nullptr, PAGE_READONLY, 0, 0, nullptr); R_ASSERT(hSrcMap != INVALID_HANDLE_VALUE); @@ -1137,7 +1137,7 @@ void CLocatorAPI::file_from_archive(IReader*& R, pcstr fname, const file& desc) VERIFY3(ptr, "cannot create file mapping on file", fname); string512 temp; - xr_sprintf(temp, sizeof temp, "%s:%s", *A.path, fname); + xr_sprintf(temp, sizeof temp, "%s:%s", A.path.c_str(), fname); #ifdef FS_DEBUG register_file_mapping(ptr, sz, temp); @@ -1371,7 +1371,7 @@ void CLocatorAPI::w_close(IWriter*& S) { R_ASSERT(S->fName.size()); string_path fname; - xr_strcpy(fname, sizeof fname, *S->fName); + xr_strcpy(fname, sizeof fname, S->fName.c_str()); bool bReg = S->valid(); xr_delete(S); diff --git a/src/xrCore/PostProcess/PostProcess.hpp b/src/xrCore/PostProcess/PostProcess.hpp index ecc843fd2cd..73bf2fbad2c 100644 --- a/src/xrCore/PostProcess/PostProcess.hpp +++ b/src/xrCore/PostProcess/PostProcess.hpp @@ -133,7 +133,7 @@ class XRCORE_API BasicPostProcessAnimator virtual ~BasicPostProcessAnimator(); void Clear(); virtual void Load(LPCSTR name, bool internalFs = true); - IC LPCSTR Name() { return *m_Name; } + IC LPCSTR Name() { return m_Name.c_str(); } virtual void Stop(float speed); void SetDesiredFactor(float f, float sp); void SetCurrentFactor(float f); diff --git a/src/xrCore/XML/XMLDocument.cpp b/src/xrCore/XML/XMLDocument.cpp index 000da2cd1da..88d15275beb 100644 --- a/src/xrCore/XML/XMLDocument.cpp +++ b/src/xrCore/XML/XMLDocument.cpp @@ -50,7 +50,7 @@ void XMLDocument::Load(pcstr path_alias, pcstr path, pcstr _xml_filename) shared_str fn = correct_file_name(path, _xml_filename); string_path str; - xr_sprintf(str, "%s\\%s", path, *fn); + xr_sprintf(str, "%s\\%s", path, fn.c_str()); return Load(path_alias, str); } diff --git a/src/xrCore/log.cpp b/src/xrCore/log.cpp index 1ae4358bb64..6fbd6b4b793 100644 --- a/src/xrCore/log.cpp +++ b/src/xrCore/log.cpp @@ -31,7 +31,7 @@ void FlushLog() { for (u32 it = 0; it < LogFile->size(); it++) { - LPCSTR s = *((*LogFile)[it]); + pcstr s = (*LogFile)[it].c_str(); f->w_string(s ? s : ""); } FS.w_close(f); diff --git a/src/xrCore/net_utils.h b/src/xrCore/net_utils.h index 283c00705c0..7bb2e07980f 100644 --- a/src/xrCore/net_utils.h +++ b/src/xrCore/net_utils.h @@ -221,8 +221,8 @@ class XRCORE_API NET_Packet IC void w_stringZ(const shared_str& p) { W_guard g(&w_allow); - if (*p) - w(*p, p.size() + 1); + if (p.c_str()) + w(p.c_str(), p.size() + 1); else { IIniFileStream* tmp = inistream; diff --git a/src/xrCore/xr_ini.cpp b/src/xrCore/xr_ini.cpp index 849db3e478c..83a2023897a 100644 --- a/src/xrCore/xr_ini.cpp +++ b/src/xrCore/xr_ini.cpp @@ -14,14 +14,14 @@ void CInifile::Destroy(CInifile* ini) { xr_delete(ini); } bool sect_pred(const CInifile::Sect* x, pcstr val) { - return xr_strcmp(*x->Name, val) < 0; + return xr_strcmp(x->Name.c_str(), val) < 0; } bool item_pred(const CInifile::Item& x, pcstr val) { if (!x.first || !val) return x.first < val; - return xr_strcmp(*x.first, val) < 0; + return xr_strcmp(x.first.c_str(), val) < 0; } XRCORE_API bool _parse(pstr dest, pcstr src) @@ -87,10 +87,10 @@ XRCORE_API void _decorate(pstr dest, pcstr src) bool CInifile::Sect::line_exist(pcstr line, pcstr* value) { auto A = std::lower_bound(Data.begin(), Data.end(), line, item_pred); - if (A != Data.end() && xr_strcmp(*A->first, line) == 0) + if (A != Data.end() && xr_strcmp(A->first.c_str(), line) == 0) { if (value) - *value = *A->second; + *value = A->second.c_str(); return true; } return false; @@ -147,7 +147,7 @@ CInifile::~CInifile() static void insert_item(CInifile::Sect* tgt, const CInifile::Item& I) { - auto sect_it = std::lower_bound(tgt->Data.begin(), tgt->Data.end(), *I.first, item_pred); + auto sect_it = std::lower_bound(tgt->Data.begin(), tgt->Data.end(), I.first.c_str(), item_pred); if (sect_it != tgt->Data.end() && sect_it->first.equal(I.first)) { sect_it->second = I.second; @@ -240,9 +240,9 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f if (Current) { // store previous section - auto I = std::lower_bound(DATA.begin(), DATA.end(), *Current->Name, sect_pred); + auto I = std::lower_bound(DATA.begin(), DATA.end(), Current->Name.c_str(), sect_pred); if (I != DATA.end() && (*I)->Name == Current->Name) - xrDebug::Fatal(DEBUG_INFO, "Duplicate section '%s' found.", *Current->Name); + xrDebug::Fatal(DEBUG_INFO, "Duplicate section '%s' found.", Current->Name.c_str()); DATA.insert(I, Current); } Current = new Sect(); @@ -329,11 +329,11 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f //#endif if (m_flags.test(eReadOnly)) - if (*I.first) + if (I.first.c_str()) insert_item(Current, I); else { - if (*I.first || *I.second + if (I.first.c_str() || I.second.c_str() //#ifdef DEBUG // || *I.comment //#endif @@ -345,9 +345,9 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f } if (Current) { - auto I = std::lower_bound(DATA.begin(), DATA.end(), *Current->Name, sect_pred); + auto I = std::lower_bound(DATA.begin(), DATA.end(), Current->Name.c_str(), sect_pred); if (I != DATA.end() && (*I)->Name == Current->Name) - xrDebug::Fatal(DEBUG_INFO, "Duplicate section '%s' found.", *Current->Name); + xrDebug::Fatal(DEBUG_INFO, "Duplicate section '%s' found.", Current->Name.c_str()); DATA.insert(I, Current); } } @@ -369,11 +369,11 @@ void CInifile::save_as(IWriter& writer, bool bcheck) const for (auto s_it = (*r_it)->Data.begin(); s_it != (*r_it)->Data.end(); ++s_it) { const Item& I = *s_it; - if (*I.first) + if (I.first.c_str()) { - if (*I.second) + if (I.second.c_str()) { - _decorate(val, *I.second); + _decorate(val, I.second.c_str()); // only name and value xr_sprintf(temp, sizeof temp, "%8s%-32s = %-32s", " ", I.first.c_str(), val); } @@ -415,7 +415,7 @@ bool CInifile::save_as(pcstr new_fname) bool CInifile::section_exist(pcstr S) const { auto I = std::lower_bound(DATA.begin(), DATA.end(), S, sect_pred); - return I != DATA.end() && xr_strcmp(*(*I)->Name, S) == 0; + return I != DATA.end() && xr_strcmp((*I)->Name.c_str(), S) == 0; } bool CInifile::line_exist(pcstr S, pcstr L) const @@ -424,7 +424,7 @@ bool CInifile::line_exist(pcstr S, pcstr L) const return false; Sect& I = r_section(S); auto A = std::lower_bound(I.Data.begin(), I.Data.end(), L, item_pred); - return A != I.Data.end() && xr_strcmp(*A->first, L) == 0; + return A != I.Data.end() && xr_strcmp(A->first.c_str(), L) == 0; } u32 CInifile::line_count(pcstr Sname) const @@ -433,17 +433,17 @@ u32 CInifile::line_count(pcstr Sname) const auto I = S.Data.cbegin(); u32 C = 0; for (; I != S.Data.cend(); I++) - if (*I->first) + if (I->first.c_str()) C++; return C; } u32 CInifile::section_count() const { return DATA.size(); } //-------------------------------------------------------------------------------------- -CInifile::Sect& CInifile::r_section(const shared_str& S) const { return r_section(*S); } -bool CInifile::line_exist(const shared_str& S, const shared_str& L)const { return line_exist(*S, *L); } -u32 CInifile::line_count(const shared_str& S) const { return line_count(*S); } -bool CInifile::section_exist(const shared_str& S) const { return section_exist(*S); } +CInifile::Sect& CInifile::r_section(const shared_str& S) const { return r_section(S.c_str()); } +bool CInifile::line_exist(const shared_str& S, const shared_str& L)const { return line_exist(S.c_str(), L.c_str()); } +u32 CInifile::line_count(const shared_str& S) const { return line_count(S.c_str()); } +bool CInifile::section_exist(const shared_str& S) const { return section_exist(S.c_str()); } //-------------------------------------------------------------------------------------- // Read functions //-------------------------------------------------------------------------------------- @@ -453,7 +453,7 @@ CInifile::Sect& CInifile::r_section(pcstr S) const xr_strcpy(section, sizeof section, S); xr_strlwr(section); auto I = std::lower_bound(DATA.cbegin(), DATA.cend(), section, sect_pred); - if (!(I != DATA.cend() && xr_strcmp(*(*I)->Name, section) == 0)) + if (!(I != DATA.cend() && xr_strcmp((*I)->Name.c_str(), section) == 0)) { // g_pStringContainer->verify(); @@ -477,8 +477,8 @@ pcstr CInifile::r_string(pcstr S, pcstr L) const Sect const& I = r_section(S); auto A = std::lower_bound(I.Data.cbegin(), I.Data.cend(), L, item_pred); - if (A != I.Data.cend() && xr_strcmp(*A->first, L) == 0) - return *A->second; + if (A != I.Data.cend() && xr_strcmp(A->first.c_str(), L) == 0) + return A->second.c_str(); xrDebug::Fatal(DEBUG_INFO, "Can't find variable %s in [%s]", L, S); return nullptr; @@ -659,14 +659,14 @@ bool CInifile::r_line(pcstr S, int L, pcstr* N, pcstr* V) const for (auto I = SS.Data.cbegin(); I != SS.Data.cend(); I++) if (!L--) { - *N = *I->first; - *V = *I->second; + *N = I->first.c_str(); + *V = I->second.c_str(); return true; } return false; } -bool CInifile::r_line(const shared_str& S, int L, pcstr* N, pcstr* V) const { return r_line(*S, L, N, V); } +bool CInifile::r_line(const shared_str& S, int L, pcstr* N, pcstr* V) const { return r_line(S.c_str(), L, N, V); } //-------------------------------------------------------------------------------------------------------- // Write functions //-------------------------------------------------------------------------------------- @@ -703,12 +703,12 @@ void CInifile::w_string(pcstr S, pcstr L, pcstr V, pcstr comment) //#ifdef DEBUG // I.comment = (comment?comment:0); //#endif - auto it = std::lower_bound(data.Data.begin(), data.Data.end(), *I.first, item_pred); + auto it = std::lower_bound(data.Data.begin(), data.Data.end(), I.first.c_str(), item_pred); if (it != data.Data.end()) { // Check for "first" matching - if (0 == xr_strcmp(*it->first, *I.first)) + if (0 == xr_strcmp(it->first.c_str(), I.first.c_str())) { bool b = m_flags.test(eOverrideNames); R_ASSERT2(b, make_string("name[%s] already exist in section[%s]", line, sect).c_str()); @@ -849,7 +849,7 @@ void CInifile::remove_line(pcstr S, pcstr L) { Sect& data = r_section(S); auto A = std::lower_bound(data.Data.begin(), data.Data.end(), L, item_pred); - R_ASSERT(A != data.Data.end() && xr_strcmp(*A->first, L) == 0); + R_ASSERT(A != data.Data.end() && xr_strcmp(A->first.c_str(), L) == 0); data.Data.erase(A); } } diff --git a/src/xrCore/xr_ini.h b/src/xrCore/xr_ini.h index 65baea9229e..1041be74a53 100644 --- a/src/xrCore/xr_ini.h +++ b/src/xrCore/xr_ini.h @@ -85,45 +85,45 @@ class XRCORE_API CInifile Root& sections() { return DATA; } Root const& sections() const { return DATA; } CLASS_ID r_clsid(pcstr S, pcstr L) const; - CLASS_ID r_clsid(const shared_str& S, pcstr L) const { return r_clsid(*S, L); } + CLASS_ID r_clsid(const shared_str& S, pcstr L) const { return r_clsid(S.c_str(), L); } pcstr r_string(pcstr S, pcstr L) const; // Left quotes in place - pcstr r_string(const shared_str& S, pcstr L) const { return r_string(*S, L); } // Left quotes in place + pcstr r_string(const shared_str& S, pcstr L) const { return r_string(S.c_str(), L); } // Left quotes in place shared_str r_string_wb(pcstr S, pcstr L) const; // Remove quotes - shared_str r_string_wb(const shared_str& S, pcstr L) const { return r_string_wb(*S, L); } // Remove quotes + shared_str r_string_wb(const shared_str& S, pcstr L) const { return r_string_wb(S.c_str(), L); } // Remove quotes u8 r_u8(pcstr S, pcstr L) const; - u8 r_u8(const shared_str& S, pcstr L) const { return r_u8(*S, L); } + u8 r_u8(const shared_str& S, pcstr L) const { return r_u8(S.c_str(), L); } u16 r_u16(pcstr S, pcstr L) const; - u16 r_u16(const shared_str& S, pcstr L) const { return r_u16(*S, L); } + u16 r_u16(const shared_str& S, pcstr L) const { return r_u16(S.c_str(), L); } u32 r_u32(pcstr S, pcstr L) const; - u32 r_u32(const shared_str& S, pcstr L) const { return r_u32(*S, L); } + u32 r_u32(const shared_str& S, pcstr L) const { return r_u32(S.c_str(), L); } u64 r_u64(pcstr S, pcstr L) const; s8 r_s8(pcstr S, pcstr L) const; - s8 r_s8(const shared_str& S, pcstr L) const { return r_s8(*S, L); } + s8 r_s8(const shared_str& S, pcstr L) const { return r_s8(S.c_str(), L); } s16 r_s16(pcstr S, pcstr L) const; - s16 r_s16(const shared_str& S, pcstr L) const { return r_s16(*S, L); } + s16 r_s16(const shared_str& S, pcstr L) const { return r_s16(S.c_str(), L); } s32 r_s32(pcstr S, pcstr L) const; - s32 r_s32(const shared_str& S, pcstr L) const { return r_s32(*S, L); } + s32 r_s32(const shared_str& S, pcstr L) const { return r_s32(S.c_str(), L); } s64 r_s64(pcstr S, pcstr L) const; float r_float(pcstr S, pcstr L) const; - float r_float(const shared_str& S, pcstr L) const { return r_float(*S, L); } + float r_float(const shared_str& S, pcstr L) const { return r_float(S.c_str(), L); } Fcolor r_fcolor(pcstr S, pcstr L) const; - Fcolor r_fcolor(const shared_str& S, pcstr L) const { return r_fcolor(*S, L); } + Fcolor r_fcolor(const shared_str& S, pcstr L) const { return r_fcolor(S.c_str(), L); } u32 r_color(pcstr S, pcstr L) const; - u32 r_color(const shared_str& S, pcstr L) const { return r_color(*S, L); } + u32 r_color(const shared_str& S, pcstr L) const { return r_color(S.c_str(), L); } Ivector2 r_ivector2(pcstr S, pcstr L) const; - Ivector2 r_ivector2(const shared_str& S, pcstr L) const { return r_ivector2(*S, L); } + Ivector2 r_ivector2(const shared_str& S, pcstr L) const { return r_ivector2(S.c_str(), L); } Ivector3 r_ivector3(pcstr S, pcstr L) const; - Ivector3 r_ivector3(const shared_str& S, pcstr L) const { return r_ivector3(*S, L); } + Ivector3 r_ivector3(const shared_str& S, pcstr L) const { return r_ivector3(S.c_str(), L); } Ivector4 r_ivector4(pcstr S, pcstr L) const; - Ivector4 r_ivector4(const shared_str& S, pcstr L) const { return r_ivector4(*S, L); } + Ivector4 r_ivector4(const shared_str& S, pcstr L) const { return r_ivector4(S.c_str(), L); } Fvector2 r_fvector2(pcstr S, pcstr L) const; - Fvector2 r_fvector2(const shared_str& S, pcstr L) const { return r_fvector2(*S, L); } + Fvector2 r_fvector2(const shared_str& S, pcstr L) const { return r_fvector2(S.c_str(), L); } Fvector3 r_fvector3(pcstr S, pcstr L) const; - Fvector3 r_fvector3(const shared_str& S, pcstr L) const { return r_fvector3(*S, L); } + Fvector3 r_fvector3(const shared_str& S, pcstr L) const { return r_fvector3(S.c_str(), L); } Fvector4 r_fvector4(pcstr S, pcstr L) const; - Fvector4 r_fvector4(const shared_str& S, pcstr L) const { return r_fvector4(*S, L); } + Fvector4 r_fvector4(const shared_str& S, pcstr L) const { return r_fvector4(S.c_str(), L); } bool r_bool(pcstr S, pcstr L) const; - bool r_bool(const shared_str& S, pcstr L) const { return r_bool(*S, L); } + bool r_bool(const shared_str& S, pcstr L) const { return r_bool(S.c_str(), L); } int r_token(pcstr S, pcstr L, const xr_token* token_list) const; bool r_line(pcstr S, int L, pcstr* N, pcstr* V) const; bool r_line(const shared_str& S, int L, pcstr* N, pcstr* V) const; diff --git a/src/xrCore/xr_resource.h b/src/xrCore/xr_resource.h index e6644e47b31..25aeeb1e4f5 100644 --- a/src/xrCore/xr_resource.h +++ b/src/xrCore/xr_resource.h @@ -38,7 +38,7 @@ class XRCORE_API xr_resource_named : public xr_resource_flagged const char* set_name(const char* name) { cName = name; - return *cName; + return cName.c_str(); } xr_resource_named() : cName(0) {} ~xr_resource_named() {} diff --git a/src/xrCore/xr_trims.cpp b/src/xrCore/xr_trims.cpp index e8a51a03dc5..9b7aeacc231 100644 --- a/src/xrCore/xr_trims.cpp +++ b/src/xrCore/xr_trims.cpp @@ -510,11 +510,11 @@ shared_str _ListToSequence(const RStringVec& lst) xr_string out; if (lst.size()) { - out = *lst.front(); + out = lst.front().c_str(); for (RStringVec::const_iterator s_it = lst.begin() + 1; s_it != lst.end(); s_it++) { out += ","; - out += **s_it; + out += (*s_it).c_str(); } } return shared_str(out.c_str()); diff --git a/src/xrCore/xrstring.h b/src/xrCore/xrstring.h index 041b6430089..2bf5bd304d5 100644 --- a/src/xrCore/xrstring.h +++ b/src/xrCore/xrstring.h @@ -150,14 +150,14 @@ IC bool operator>(shared_str const& a, shared_str const& b) { return a._get() > // externally visible standard functionality IC void swap(shared_str& lhs, shared_str& rhs) { lhs.swap(rhs); } IC u32 xr_strlen(const shared_str& a) throw() { return a.size(); } -IC int xr_strcmp(const shared_str& a, const char* b) throw() { return xr_strcmp(*a, b); } -IC int xr_strcmp(const char* a, const shared_str& b) throw() { return xr_strcmp(a, *b); } +IC int xr_strcmp(const shared_str& a, const char* b) throw() { return xr_strcmp(a.c_str(), b); } +IC int xr_strcmp(const char* a, const shared_str& b) throw() { return xr_strcmp(a, b.c_str()); } IC int xr_strcmp(const shared_str& a, const shared_str& b) throw() { if (a.equal(b)) return 0; else - return xr_strcmp(*a, *b); + return xr_strcmp(a.c_str(), b.c_str()); } // void xr_strlwr(xr_string& src) // in xrCommon/xr_string.h, since it depends on xr_string defined there. diff --git a/src/xrMisc/string_functions.cpp b/src/xrMisc/string_functions.cpp index ec53b93ef29..eb26cd02edd 100644 --- a/src/xrMisc/string_functions.cpp +++ b/src/xrMisc/string_functions.cpp @@ -4,9 +4,9 @@ void xr_strlwr(shared_str& src) { - if (*src) + if (src.c_str()) { - char* lp = xr_strdup(*src); + char* lp = xr_strdup(src.c_str()); xr_strlwr(lp); src = lp; xr_free(lp);