Fixed some g++ compile issues

This commit is contained in:
punkrockguy318 2008-06-17 16:42:02 +00:00
parent fdf51e672f
commit d9adfc4b69
3 changed files with 36 additions and 5 deletions

View File

@ -2,7 +2,7 @@
#define _guid_h_
#include <string>
#include "types.h"
#include "../types.h"
#include "valuearray.h"
struct FCEU_Guid : public ValueArray<uint8,16>
@ -15,4 +15,4 @@ struct FCEU_Guid : public ValueArray<uint8,16>
};
#endif
#endif

View File

@ -17,4 +17,5 @@ struct ValueArray
}
};
#endif
#endif

View File

@ -478,9 +478,39 @@ unsigned int uintDecFromIstream(std::istream* is)
is->unget();
return ret;
}
//FIXME: itoa isn't ANSI C compliant. Perhaps sprintf would be better here?
#ifdef WIN32
std::string stditoa(int n)
{
char tempbuf[16];
return itoa(n,tempbuf,10);
}
}
#else
std::string stditoa(int n) {
enum { kMaxDigits = 35 };
std::string buf;
buf.reserve( kMaxDigits ); // Pre-allocate enough space.
int quotient = n;
// Translating number to string with base
do {
buf += "0123456789abcdef"[ std::abs( quotient % 10 ) ];
quotient /= 10;
} while ( quotient );
// Append the negative sign for base 10
if ( n < 0) buf += '-';
std::reverse( buf.begin(), buf.end() );
return buf;
}
#endif