From 5dc66f746902ebb0df06de4d5e062b9b364ce757 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Thu, 6 Nov 2014 16:21:12 -0500 Subject: [PATCH] Use std::string to increase portability --- ASTCEncoder/test/TestASTCDecompression.cpp | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ASTCEncoder/test/TestASTCDecompression.cpp b/ASTCEncoder/test/TestASTCDecompression.cpp index 7d874f8..789c017 100644 --- a/ASTCEncoder/test/TestASTCDecompression.cpp +++ b/ASTCEncoder/test/TestASTCDecompression.cpp @@ -58,29 +58,31 @@ #include "ImageFile.h" #include "Image.h" +#include + class ImageTester { private: - static void GenerateTestFilenames(const char *suffix, char *outASTC, char *outPNG) { - const char *basename = "mandrill"; - sprintf(outASTC, "%s_%s.astc", basename, suffix); - sprintf(outPNG, "%s_decompressed_%s.png", basename, suffix); + static std::string GenerateTestFilename(const std::string &basename, + const std::string &suffix, + const std::string &ext) { + return basename + suffix + std::string(".") + ext; } public: explicit ImageTester(const char *suffix) { - char astcFilename[256]; - char pngFilename[256]; + std::string astcFilename = + GenerateTestFilename("mandrill_", std::string(suffix), "astc"); + std::string pngFilename = + GenerateTestFilename("mandrill_decompressed_", std::string(suffix), "png"); - GenerateTestFilenames(suffix, astcFilename, pngFilename); - - ImageFile astc (astcFilename); + ImageFile astc (astcFilename.c_str()); bool success = astc.Load(); EXPECT_TRUE(success); if (!success) { return; } - ImageFile png (pngFilename); + ImageFile png (pngFilename.c_str()); success = png.Load(); EXPECT_TRUE(success); if (!success) { @@ -92,7 +94,6 @@ class ImageTester { } }; -// 4x4 12x12 8x8 6x5 10x8 TEST(Decompressor, Decompress4x4) { ImageTester("4x4"); }