1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-15 00:24:19 +00:00

Eradicated the last vestiges of printf from the library. String::formatted and String::printf are now gone - please use the << operators instead!

This commit is contained in:
Julian Storer 2010-03-11 14:33:40 +00:00
parent 4ed63991e2
commit e07c59c8f4
12 changed files with 250 additions and 374 deletions

View file

@ -1093,52 +1093,6 @@ bool String::matchesWildcard (const tchar* wildcard, const bool ignoreCase) cons
}
}
//==============================================================================
const String String::formatted (const tchar* const pf, ...) throw()
{
va_list list;
va_start (list, pf);
String result;
result.vprintf (pf, list);
return result;
}
//==============================================================================
void String::vprintf (const tchar* const pf, va_list& args) throw()
{
int bufferSize = 256;
String result (bufferSize, 0);
do
{
#if JUCE_LINUX && JUCE_64BIT
va_list tempArgs;
va_copy (tempArgs, args);
const int num = CharacterFunctions::vprintf (result.text->text, bufferSize - 1, pf, tempArgs);
va_end (tempArgs);
#else
const int num = CharacterFunctions::vprintf (result.text->text, bufferSize - 1, pf, args);
#endif
if (num > 0)
{
*this = result;
break;
}
else if (num == 0)
{
*this = String::empty;
break;
}
bufferSize += 256;
result.preallocateStorage (bufferSize);
}
while (bufferSize < 65536); // this is a sanity check to avoid situations where vprintf repeatedly
// returns -1 because of an error rather than because it needs more space.
}
//==============================================================================
const String String::repeatedString (const tchar* const stringToRepeat,
int numberOfTimesToRepeat)