@@ -14,14 +14,14 @@ void CInifile::Destroy(CInifile* ini) { xr_delete(ini); }
1414
1515bool sect_pred (const CInifile::Sect* x, pcstr val)
1616{
17- return xr_strcmp (x->Name . c_str () , val) < 0 ;
17+ return xr_strcmp (* x->Name , val) < 0 ;
1818}
1919
2020bool item_pred (const CInifile::Item& x, pcstr val)
2121{
2222 if (!x.first || !val)
2323 return x.first < val;
24- return xr_strcmp (x.first . c_str () , val) < 0 ;
24+ return xr_strcmp (* x.first , val) < 0 ;
2525}
2626
2727XRCORE_API bool _parse (pstr dest, pcstr src)
@@ -87,10 +87,10 @@ XRCORE_API void _decorate(pstr dest, pcstr src)
8787bool CInifile::Sect::line_exist (pcstr line, pcstr* value)
8888{
8989 auto A = std::lower_bound (Data.begin (), Data.end (), line, item_pred);
90- if (A != Data.end () && xr_strcmp (A->first . c_str () , line) == 0 )
90+ if (A != Data.end () && xr_strcmp (* A->first , line) == 0 )
9191 {
9292 if (value)
93- *value = A->second . c_str () ;
93+ *value = * A->second ;
9494 return true ;
9595 }
9696 return false ;
@@ -147,7 +147,7 @@ CInifile::~CInifile()
147147
148148static void insert_item (CInifile::Sect* tgt, const CInifile::Item& I)
149149{
150- auto sect_it = std::lower_bound (tgt->Data .begin (), tgt->Data .end (), I.first . c_str () , item_pred);
150+ auto sect_it = std::lower_bound (tgt->Data .begin (), tgt->Data .end (), * I.first , item_pred);
151151 if (sect_it != tgt->Data .end () && sect_it->first .equal (I.first ))
152152 {
153153 sect_it->second = I.second ;
@@ -240,9 +240,9 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f
240240 if (Current)
241241 {
242242 // store previous section
243- auto I = std::lower_bound (DATA.begin (), DATA.end (), Current->Name . c_str () , sect_pred);
243+ auto I = std::lower_bound (DATA.begin (), DATA.end (), * Current->Name , sect_pred);
244244 if (I != DATA.end () && (*I)->Name == Current->Name )
245- xrDebug::Fatal (DEBUG_INFO, " Duplicate section '%s' found." , Current->Name . c_str () );
245+ xrDebug::Fatal (DEBUG_INFO, " Duplicate section '%s' found." , * Current->Name );
246246 DATA.insert (I, Current);
247247 }
248248 Current = new Sect ();
@@ -329,11 +329,11 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f
329329 // #endif
330330
331331 if (m_flags.test (eReadOnly))
332- if (I.first . c_str () )
332+ if (* I.first )
333333 insert_item (Current, I);
334334 else
335335 {
336- if (I.first . c_str () || I.second . c_str ()
336+ if (* I.first || * I.second
337337 // #ifdef DEBUG
338338 // || *I.comment
339339 // #endif
@@ -345,9 +345,9 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f
345345 }
346346 if (Current)
347347 {
348- auto I = std::lower_bound (DATA.begin (), DATA.end (), Current->Name . c_str () , sect_pred);
348+ auto I = std::lower_bound (DATA.begin (), DATA.end (), * Current->Name , sect_pred);
349349 if (I != DATA.end () && (*I)->Name == Current->Name )
350- xrDebug::Fatal (DEBUG_INFO, " Duplicate section '%s' found." , Current->Name . c_str () );
350+ xrDebug::Fatal (DEBUG_INFO, " Duplicate section '%s' found." , * Current->Name );
351351 DATA.insert (I, Current);
352352 }
353353}
@@ -369,11 +369,11 @@ void CInifile::save_as(IWriter& writer, bool bcheck) const
369369 for (auto s_it = (*r_it)->Data .begin (); s_it != (*r_it)->Data .end (); ++s_it)
370370 {
371371 const Item& I = *s_it;
372- if (I.first . c_str () )
372+ if (* I.first )
373373 {
374- if (I.second . c_str () )
374+ if (* I.second )
375375 {
376- _decorate (val, I.second . c_str () );
376+ _decorate (val, * I.second );
377377 // only name and value
378378 xr_sprintf (temp, sizeof temp, " %8s%-32s = %-32s" , " " , I.first .c_str (), val);
379379 }
@@ -415,7 +415,7 @@ bool CInifile::save_as(pcstr new_fname)
415415bool CInifile::section_exist (pcstr S) const
416416{
417417 auto I = std::lower_bound (DATA.begin (), DATA.end (), S, sect_pred);
418- return I != DATA.end () && xr_strcmp ((*I)->Name . c_str () , S) == 0 ;
418+ return I != DATA.end () && xr_strcmp (* (*I)->Name , S) == 0 ;
419419}
420420
421421bool CInifile::line_exist (pcstr S, pcstr L) const
@@ -424,7 +424,7 @@ bool CInifile::line_exist(pcstr S, pcstr L) const
424424 return false ;
425425 Sect& I = r_section (S);
426426 auto A = std::lower_bound (I.Data .begin (), I.Data .end (), L, item_pred);
427- return A != I.Data .end () && xr_strcmp (A->first . c_str () , L) == 0 ;
427+ return A != I.Data .end () && xr_strcmp (* A->first , L) == 0 ;
428428}
429429
430430u32 CInifile::line_count (pcstr Sname) const
@@ -433,17 +433,17 @@ u32 CInifile::line_count(pcstr Sname) const
433433 auto I = S.Data .cbegin ();
434434 u32 C = 0 ;
435435 for (; I != S.Data .cend (); I++)
436- if (I->first . c_str () )
436+ if (* I->first )
437437 C++;
438438 return C;
439439}
440440
441441u32 CInifile::section_count () const { return DATA.size (); }
442442// --------------------------------------------------------------------------------------
443- CInifile::Sect& CInifile::r_section (const shared_str& S) const { return r_section (S. c_str () ); }
444- bool CInifile::line_exist (const shared_str& S, const shared_str& L)const { return line_exist (S. c_str (), L. c_str () ); }
445- u32 CInifile::line_count (const shared_str& S) const { return line_count (S. c_str () ); }
446- bool CInifile::section_exist (const shared_str& S) const { return section_exist (S. c_str () ); }
443+ CInifile::Sect& CInifile::r_section (const shared_str& S) const { return r_section (*S ); }
444+ bool CInifile::line_exist (const shared_str& S, const shared_str& L)const { return line_exist (*S, *L ); }
445+ u32 CInifile::line_count (const shared_str& S) const { return line_count (*S ); }
446+ bool CInifile::section_exist (const shared_str& S) const { return section_exist (*S ); }
447447// --------------------------------------------------------------------------------------
448448// Read functions
449449// --------------------------------------------------------------------------------------
@@ -453,7 +453,7 @@ CInifile::Sect& CInifile::r_section(pcstr S) const
453453 xr_strcpy (section, sizeof section, S);
454454 xr_strlwr (section);
455455 auto I = std::lower_bound (DATA.cbegin (), DATA.cend (), section, sect_pred);
456- if (!(I != DATA.cend () && xr_strcmp ((*I)->Name . c_str () , section) == 0 ))
456+ if (!(I != DATA.cend () && xr_strcmp (* (*I)->Name , section) == 0 ))
457457 {
458458 // g_pStringContainer->verify();
459459
@@ -477,8 +477,8 @@ pcstr CInifile::r_string(pcstr S, pcstr L) const
477477 Sect const & I = r_section (S);
478478 auto A = std::lower_bound (I.Data .cbegin (), I.Data .cend (), L, item_pred);
479479
480- if (A != I.Data .cend () && xr_strcmp (A->first . c_str () , L) == 0 )
481- return A->second . c_str () ;
480+ if (A != I.Data .cend () && xr_strcmp (* A->first , L) == 0 )
481+ return * A->second ;
482482
483483 xrDebug::Fatal (DEBUG_INFO, " Can't find variable %s in [%s]" , L, S);
484484 return nullptr ;
@@ -659,14 +659,14 @@ bool CInifile::r_line(pcstr S, int L, pcstr* N, pcstr* V) const
659659 for (auto I = SS.Data .cbegin (); I != SS.Data .cend (); I++)
660660 if (!L--)
661661 {
662- *N = I->first . c_str () ;
663- *V = I->second . c_str () ;
662+ *N = * I->first ;
663+ *V = * I->second ;
664664 return true ;
665665 }
666666 return false ;
667667}
668668
669- bool CInifile::r_line (const shared_str& S, int L, pcstr* N, pcstr* V) const { return r_line (S. c_str () , L, N, V); }
669+ bool CInifile::r_line (const shared_str& S, int L, pcstr* N, pcstr* V) const { return r_line (*S , L, N, V); }
670670// --------------------------------------------------------------------------------------------------------
671671// Write functions
672672// --------------------------------------------------------------------------------------
@@ -703,12 +703,12 @@ void CInifile::w_string(pcstr S, pcstr L, pcstr V, pcstr comment)
703703 // #ifdef DEBUG
704704 // I.comment = (comment?comment:0);
705705 // #endif
706- auto it = std::lower_bound (data.Data .begin (), data.Data .end (), I.first . c_str () , item_pred);
706+ auto it = std::lower_bound (data.Data .begin (), data.Data .end (), * I.first , item_pred);
707707
708708 if (it != data.Data .end ())
709709 {
710710 // Check for "first" matching
711- if (0 == xr_strcmp (it->first . c_str (), I.first . c_str () ))
711+ if (0 == xr_strcmp (* it->first , * I.first ))
712712 {
713713 bool b = m_flags.test (eOverrideNames);
714714 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)
849849 {
850850 Sect& data = r_section (S);
851851 auto A = std::lower_bound (data.Data .begin (), data.Data .end (), L, item_pred);
852- R_ASSERT (A != data.Data .end () && xr_strcmp (A->first . c_str () , L) == 0 );
852+ R_ASSERT (A != data.Data .end () && xr_strcmp (* A->first , L) == 0 );
853853 data.Data .erase (A);
854854 }
855855}
0 commit comments