]> granicus.if.org Git - taglib/commitdiff
Modify the test code to work on MSVC/Windows.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Wed, 20 May 2015 10:57:08 +0000 (19:57 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Wed, 20 May 2015 11:19:20 +0000 (20:19 +0900)
tests/utils.h

index a935f983e182b7978a92eec02dd09c1559cfdd2e..8be65ac04ce90c165c46c87f7f8793d02ea13213 100644 (file)
@@ -30,9 +30,9 @@ inline string copyFile(const string &filename, const string &ext)
   char testFileName[1024];
 
 #ifdef _WIN32
-  char *testFileNameBody = tempnam(NULL, NULL);
-  snprintf(testFileName, sizeof(testFileName), "%s%s", testFileNameBody, ext.c_str());
-  free(testFileNameBody);
+  GetTempPathA(sizeof(testFileName), testFileName);
+  GetTempFileNameA(testFileName, "tag", 0, testFileName);
+  strcat(testFileName, ext.c_str());
 #else
   snprintf(testFileName, sizeof(testFileName), "/%s/taglib-test-XXXXXX%s", P_tmpdir, ext.c_str());
   mkstemps(testFileName, 6);