vlc | branch: master | Erwan Tulou <[email protected]> | Sat Jun 13 15:29:25 2015 +0200| [27cb7a2eddae5bd4e730ca7fff5b05cffd1b691c] | committer: Erwan Tulou
skins2(Linux): replace tempnam() with mkdtemp() Linux manual strongly advises against using tempnam(). > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=27cb7a2eddae5bd4e730ca7fff5b05cffd1b691c --- modules/gui/skins2/src/theme_loader.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp index a8d2725..e54f999 100644 --- a/modules/gui/skins2/src/theme_loader.cpp +++ b/modules/gui/skins2/src/theme_loader.cpp @@ -817,29 +817,27 @@ string ThemeLoader::getTmpDir( ) { #if defined( _WIN32 ) wchar_t *tmpdir = _wtempnam( NULL, L"vlt" ); -#else - char *tmpdir = tempnam( NULL, "vlt" ); -#endif if( tmpdir == NULL ) return ""; - -#if defined( _WIN32 ) char* utf8 = FromWide( tmpdir ); - if( utf8 == NULL ) - { - free( tmpdir ); - return ""; - } - string tempPath( utf8 ); + free( tmpdir ); + string tempPath( utf8 ? utf8 : "" ); free( utf8 ); + return tempPath; + #elif defined( __OS2__ ) + char *tmpdir = tempnam( NULL, "vlt" ); + if( tmpdir == NULL ) + return ""; string tempPath( sFromLocale( tmpdir )); -#else - string tempPath( tmpdir ); -#endif - free( tmpdir ); return tempPath; + +#else + char templ[] = "/tmp/vltXXXXXX"; + char *tmpdir = mkdtemp( templ ); + return string( tmpdir ? tmpdir : ""); +#endif } #endif _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
