From f6c8613229f6d24804c94839254947d21391a9d0 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine@gmail.com" Date: Tue, 6 Mar 2012 07:03:09 +0000 Subject: [PATCH] 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 --- tests/test_document.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 3dc2d02..a34513e 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -382,6 +382,8 @@ TEST_XML(document_save_declaration_latin1, "") CHECK(writer.as_narrow() == "\n\n"); } +#define USE_MKSTEMP defined(__unix) || defined(__QNX__) + struct temp_file { char path[512]; @@ -389,7 +391,7 @@ struct temp_file temp_file(): fd(0) { - #ifdef __unix + #if USE_MKSTEMP strcpy(path, "/tmp/pugiXXXXXX"); fd = mkstemp(path); @@ -407,7 +409,7 @@ struct temp_file CHECK(unlink(path) == 0); #endif - #ifdef __unix + #if USE_MKSTEMP CHECK(close(fd) == 0); #endif }