ISO8601: Removed cowardly segfault fix

This commit is contained in:
Paul Beckingham 2015-11-01 17:04:08 -05:00
parent 78b8fc5dc7
commit d8c5927362

View file

@ -1085,15 +1085,11 @@ void ISO8601d::toMDY (int& m, int& d, int& y) const
const std::string ISO8601d::toString (
const std::string& format /*= "m/d/Y" */) const
{
// Making this local copy seems to fix a bug. Remove the local copy and
// you'll see segmentation faults and all kinds of gibberish.
std::string localFormat = format;
char buffer[12];
std::string formatted;
for (unsigned int i = 0; i < localFormat.length (); ++i)
for (unsigned int i = 0; i < format.length (); ++i)
{
int c = localFormat[i];
int c = format[i];
switch (c)
{
case 'm': sprintf (buffer, "%d", this->month ()); break;