Last active
May 6, 2017 11:56
-
-
Save thendrix/858aa6c861aa6f916222174f1b26c4b6 to your computer and use it in GitHub Desktop.
Use this to help purge the world of tempnam such as in FBX -- yes I tweeted this a while back
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern "C" { | |
// '-Wl,-wrap,tempnam' | |
char *__wrap_tempnam( const char *dir, const char *pfx ) | |
{ | |
// You'll have to rewrite this part for your filesystem layer. | |
static unsigned int i = 0; | |
const unsigned int len = 512; | |
char path[ len ]; | |
KaFilePathToCachePathf( path, len, "%s%s-%d.tmp", | |
( dir != nullptr ) ? dir : "", | |
( pfx != nullptr ) ? pfx : "", i++ ); | |
KaLogTagf( KaFbxImporter, ">>> %s\n", path ); | |
char *s = (char*)malloc( len ); | |
strncpy( s, path, len ); | |
return s; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment