Remove ConvertI64FormatString()
It's a complex function that was used in just one place,and can be easily replaced with printf format specifiers from <cinttypes>.
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
|
#include <cinttypes>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameTextureAutoDeleteChildren, ActorFrameTexture );
|
REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameTextureAutoDeleteChildren, ActorFrameTexture );
|
||||||
@@ -18,7 +19,7 @@ ActorFrameTexture::ActorFrameTexture()
|
|||||||
m_bPreserveTexture = false;
|
m_bPreserveTexture = false;
|
||||||
static uint64_t i = 0;
|
static uint64_t i = 0;
|
||||||
++i;
|
++i;
|
||||||
m_sTextureName = ssprintf( ConvertI64FormatString("ActorFrameTexture %lli"), i );
|
m_sTextureName = ssprintf( "ActorFrameTexture %" PRIu64, i );
|
||||||
|
|
||||||
m_pRenderTarget = nullptr;
|
m_pRenderTarget = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -465,47 +465,6 @@ RString vssprintf( const char *szFormat, va_list argList )
|
|||||||
return sStr;
|
return sStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Windows uses %I64i to format a 64-bit int, instead of %lli. Convert "a b %lli %-3llu c d"
|
|
||||||
* to "a b %I64 %-3I64u c d". This assumes a well-formed format string; invalid format strings
|
|
||||||
* should not crash, but the results are undefined. */
|
|
||||||
#if defined(WIN32)
|
|
||||||
RString ConvertI64FormatString( const RString &sStr )
|
|
||||||
{
|
|
||||||
RString sRet;
|
|
||||||
sRet.reserve( sStr.size() + 16 );
|
|
||||||
|
|
||||||
size_t iOffset = 0;
|
|
||||||
while( iOffset < sStr.size() )
|
|
||||||
{
|
|
||||||
size_t iPercent = sStr.find( '%', iOffset );
|
|
||||||
if( iPercent != sStr.npos )
|
|
||||||
{
|
|
||||||
sRet.append( sStr, iOffset, iPercent - iOffset );
|
|
||||||
iOffset = iPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t iEnd = sStr.find_first_of( "diouxXeEfFgGaAcsCSpnm%", iOffset + 1 );
|
|
||||||
if( iEnd != sStr.npos && iEnd - iPercent >= 3 && iPercent > 2 && sStr[iEnd-2] == 'l' && sStr[iEnd-1] == 'l' )
|
|
||||||
{
|
|
||||||
sRet.append( sStr, iPercent, iEnd - iPercent - 2 ); // %
|
|
||||||
sRet.append( "I64" ); // %I64
|
|
||||||
sRet.append( sStr, iEnd, 1 ); // %I64i
|
|
||||||
iOffset = iEnd + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( iEnd == sStr.npos )
|
|
||||||
iEnd = sStr.size() - 1;
|
|
||||||
sRet.append( sStr, iOffset, iEnd - iOffset + 1 );
|
|
||||||
iOffset = iEnd + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sRet;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
RString ConvertI64FormatString( const RString &sStr ) { return sStr; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ISO-639-1 codes: http://www.loc.gov/standards/iso639-2/php/code_list.php
|
/* ISO-639-1 codes: http://www.loc.gov/standards/iso639-2/php/code_list.php
|
||||||
* We don't use 3-letter codes, so we don't bother supporting them. */
|
* We don't use 3-letter codes, so we don't bother supporting them. */
|
||||||
static const LanguageInfo g_langs[] =
|
static const LanguageInfo g_langs[] =
|
||||||
|
|||||||
@@ -355,7 +355,6 @@ struct tm GetLocalTime();
|
|||||||
|
|
||||||
RString ssprintf( const char *fmt, ...) PRINTF(1,2);
|
RString ssprintf( const char *fmt, ...) PRINTF(1,2);
|
||||||
RString vssprintf( const char *fmt, va_list argList );
|
RString vssprintf( const char *fmt, va_list argList );
|
||||||
RString ConvertI64FormatString( const RString &sStr );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Splits a Path into 4 parts (Directory, Drive, Filename, Extention). Supports UNC path names.
|
* Splits a Path into 4 parts (Directory, Drive, Filename, Extention). Supports UNC path names.
|
||||||
|
|||||||
Reference in New Issue
Block a user