Fixed some g++ compile issues
This commit is contained in:
parent
fdf51e672f
commit
d9adfc4b69
|
@ -2,7 +2,7 @@
|
||||||
#define _guid_h_
|
#define _guid_h_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "types.h"
|
#include "../types.h"
|
||||||
#include "valuearray.h"
|
#include "valuearray.h"
|
||||||
|
|
||||||
struct FCEU_Guid : public ValueArray<uint8,16>
|
struct FCEU_Guid : public ValueArray<uint8,16>
|
||||||
|
|
|
@ -18,3 +18,4 @@ struct ValueArray
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -479,8 +479,38 @@ unsigned int uintDecFromIstream(std::istream* is)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME: itoa isn't ANSI C compliant. Perhaps sprintf would be better here?
|
||||||
|
#ifdef WIN32
|
||||||
std::string stditoa(int n)
|
std::string stditoa(int n)
|
||||||
{
|
{
|
||||||
char tempbuf[16];
|
char tempbuf[16];
|
||||||
return itoa(n,tempbuf,10);
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue