Reimplement isalnum(c,C locale) because I can't make AppVeyor see satndard version.
parent
39ab716e11
commit
24f03141d6
|
@ -93,8 +93,7 @@ void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* p
|
||||||
ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file) : mIOSystem(pIOSystem), mPath(path), mFile(file)
|
ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file) : mIOSystem(pIOSystem), mPath(path), mFile(file)
|
||||||
{
|
{
|
||||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||||
clocale = std::locale("C");
|
mOutput.imbue( std::locale("C") );
|
||||||
mOutput.imbue( clocale );
|
|
||||||
|
|
||||||
mScene = pScene;
|
mScene = pScene;
|
||||||
mSceneOwned = false;
|
mSceneOwned = false;
|
||||||
|
@ -527,6 +526,13 @@ void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// Reimplementation of isalnum(,C locale), because AppVeyor does not see standard version.
|
||||||
|
static bool isalnum_C(char c)
|
||||||
|
{
|
||||||
|
return strchr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Writes an image entry for the given surface
|
// Writes an image entry for the given surface
|
||||||
void ColladaExporter::WriteImageEntry( const Surface& pSurface, const std::string& pNameAdd)
|
void ColladaExporter::WriteImageEntry( const Surface& pSurface, const std::string& pNameAdd)
|
||||||
|
@ -541,7 +547,7 @@ void ColladaExporter::WriteImageEntry( const Surface& pSurface, const std::strin
|
||||||
std::stringstream imageUrlEncoded;
|
std::stringstream imageUrlEncoded;
|
||||||
for( std::string::const_iterator it = pSurface.texture.begin(); it != pSurface.texture.end(); ++it )
|
for( std::string::const_iterator it = pSurface.texture.begin(); it != pSurface.texture.end(); ++it )
|
||||||
{
|
{
|
||||||
if( isalnum( (unsigned char) *it, clocale) || *it == '_' || *it == '.' || *it == '/' || *it == '\\' )
|
if( isalnum_C( (unsigned char) *it) || *it == '_' || *it == '.' || *it == '/' || *it == '\\' )
|
||||||
imageUrlEncoded << *it;
|
imageUrlEncoded << *it;
|
||||||
else
|
else
|
||||||
imageUrlEncoded << '%' << std::hex << size_t( (unsigned char) *it) << std::dec;
|
imageUrlEncoded << '%' << std::hex << size_t( (unsigned char) *it) << std::dec;
|
||||||
|
@ -632,9 +638,7 @@ void ColladaExporter::WriteMaterials()
|
||||||
name = "mat";
|
name = "mat";
|
||||||
materials[a].name = std::string( "m") + boost::lexical_cast<std::string> (a) + name.C_Str();
|
materials[a].name = std::string( "m") + boost::lexical_cast<std::string> (a) + name.C_Str();
|
||||||
for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) {
|
for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) {
|
||||||
// isalnum on MSVC asserts for code points outside [0,255]. Thus prevent unwanted promotion
|
if( !isalnum_C( *it ) ) {
|
||||||
// of char to signed int and take the unsigned char value.
|
|
||||||
if( !isalnum( static_cast<uint8_t>(*it), clocale ) ) {
|
|
||||||
*it = '_';
|
*it = '_';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,9 +130,6 @@ public:
|
||||||
std::stringstream mOutput;
|
std::stringstream mOutput;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// C locale
|
|
||||||
std::locale clocale;
|
|
||||||
|
|
||||||
/// The IOSystem for output
|
/// The IOSystem for output
|
||||||
IOSystem* mIOSystem;
|
IOSystem* mIOSystem;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue