tests: Use mkstemp on Unix and QNX (BlackBerry) to avoid tmpnam deprecation warning

git-svn-id: http://pugixml.googlecode.com/svn/trunk@843 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine@gmail.com 2012-03-06 07:03:09 +00:00
parent eea13e4d72
commit f6c8613229

View File

@ -382,6 +382,8 @@ TEST_XML(document_save_declaration_latin1, "<node/>")
CHECK(writer.as_narrow() == "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<node />\n"); CHECK(writer.as_narrow() == "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<node />\n");
} }
#define USE_MKSTEMP defined(__unix) || defined(__QNX__)
struct temp_file struct temp_file
{ {
char path[512]; char path[512];
@ -389,7 +391,7 @@ struct temp_file
temp_file(): fd(0) temp_file(): fd(0)
{ {
#ifdef __unix #if USE_MKSTEMP
strcpy(path, "/tmp/pugiXXXXXX"); strcpy(path, "/tmp/pugiXXXXXX");
fd = mkstemp(path); fd = mkstemp(path);
@ -407,7 +409,7 @@ struct temp_file
CHECK(unlink(path) == 0); CHECK(unlink(path) == 0);
#endif #endif
#ifdef __unix #if USE_MKSTEMP
CHECK(close(fd) == 0); CHECK(close(fd) == 0);
#endif #endif
} }