ColladaExporter: fix assertion in ::isalnum() when a special character > 0x7f is present in material names.
parent
deeeaf5c05
commit
5a0b40db92
|
@ -235,9 +235,13 @@ void ColladaExporter::WriteMaterials()
|
||||||
if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS )
|
if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS )
|
||||||
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 ) {
|
||||||
if( !isalnum( *it) )
|
// isalnum on MSVC asserts for code points in [0,255]. Thus prevent unwanted promotion
|
||||||
|
// of char to signed int and take the unsigned char value.
|
||||||
|
if( !isalnum( static_cast<uint8_t>(*it) ) ) {
|
||||||
*it = '_';
|
*it = '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ReadMaterialSurface( materials[a].ambient, mat, aiTextureType_AMBIENT, AI_MATKEY_COLOR_AMBIENT);
|
ReadMaterialSurface( materials[a].ambient, mat, aiTextureType_AMBIENT, AI_MATKEY_COLOR_AMBIENT);
|
||||||
if( !materials[a].ambient.texture.empty() ) numTextures++;
|
if( !materials[a].ambient.texture.empty() ) numTextures++;
|
||||||
|
|
Loading…
Reference in New Issue