From 98bac7094b42c59e77015f6c932a8012591cda81 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Tue, 2 Mar 2010 21:45:28 +0000 Subject: [PATCH] Resolve GCC warnings in assimp_cmd git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@570 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- tools/assimp_cmd/ImageExtractor.cpp | 8 ++++---- tools/assimp_cmd/Main.cpp | 6 +++--- tools/assimp_cmd/WriteDumb.cpp | 24 ++++++++++++++---------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/tools/assimp_cmd/ImageExtractor.cpp b/tools/assimp_cmd/ImageExtractor.cpp index 464098e33..eacc6df47 100644 --- a/tools/assimp_cmd/ImageExtractor.cpp +++ b/tools/assimp_cmd/ImageExtractor.cpp @@ -131,7 +131,7 @@ int SaveAsBMP (FILE* file, const aiTexel* data, unsigned int width, unsigned int } BITMAPFILEHEADER header; - header.bfType = 'MB'; + header.bfType = 'B' | (int('M') << 8u); header.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); header.bfSize = header.bfOffBits+width*height*numc; header.bfReserved1 = header.bfReserved2 = 0; @@ -221,13 +221,13 @@ int Assimp_Extract (const char** params, unsigned int num) // --help if (!::strcmp( params[0], "-h") || !::strcmp( params[0], "--help") || !::strcmp( params[0], "-?") ) { - printf(AICMD_MSG_DUMP_HELP_E); + printf("%s",AICMD_MSG_DUMP_HELP_E); return 0; } // asssimp extract in out [options] if (num < 1) { - printf("assimp extract: Invalid number of arguments. See \'assimp dump --help\'\n"); + printf("assimp extract: Invalid number of arguments. See \'assimp extract --help\'\n"); return 1; } @@ -357,4 +357,4 @@ int Assimp_Extract (const char** params, unsigned int num) return m; } return 0; -} \ No newline at end of file +} diff --git a/tools/assimp_cmd/Main.cpp b/tools/assimp_cmd/Main.cpp index 25d1a7981..ae020d6ec 100644 --- a/tools/assimp_cmd/Main.cpp +++ b/tools/assimp_cmd/Main.cpp @@ -103,7 +103,7 @@ int main (int argc, char* argv[]) // Display some basic help if (! ::strcmp(argv[1], "help")) { - printf(AICMD_MSG_HELP); + printf("%s",AICMD_MSG_HELP); return 0; } @@ -117,7 +117,7 @@ int main (int argc, char* argv[]) aiString s; imp.GetExtensionList(s); - printf(s.data); + printf("%s",s.data); return 0; } @@ -357,4 +357,4 @@ int ProcessStandardArguments(ImportData& fill, const char** params, fill.log = true; return 0; -} \ No newline at end of file +} diff --git a/tools/assimp_cmd/WriteDumb.cpp b/tools/assimp_cmd/WriteDumb.cpp index 8e050cc6a..cd447b599 100644 --- a/tools/assimp_cmd/WriteDumb.cpp +++ b/tools/assimp_cmd/WriteDumb.cpp @@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. const char* AICMD_MSG_DUMP_HELP = "todo assimp dumb help"; + // ----------------------------------------------------------------------------------- // Compress a binary dump file (beginning at offset head_size) void CompressBinaryDump(const char* file, unsigned int head_size) @@ -623,25 +624,28 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // mesh header ::fprintf(out,"\t \n" - "\t\t %i \n", - "\t\t %i \n", + "\t\t %i \n" + "\t\t %i \n" "\t\t %s \n", - (compressed ? -1 : tex->mWidth),(compressed ? -1 : tex->mHeight), + (compressed ? -1 : tex->mWidth), + (compressed ? -1 : tex->mHeight), (compressed ? "true" : "false")); if (compressed) { - ::fprintf(out,"\t\t %i \n",tex->mWidth); + ::fprintf(out,"\t\t\n",tex->mWidth); if (!shortened) { + const uint8_t* dat = reinterpret_cast(tex->pcData); for (unsigned int n = 0; n < tex->mWidth;++n) { - ::fprintf(out,"\t\t\t%2x",tex->pcData[n]); - if (n && !(n % 50)) + ::fprintf(out,"\t\t\t%2x",dat[n]); + if (n && !(n % 50)) { ::fprintf(out,"\n"); + } } } } else if (!shortened){ - ::fprintf(out,"\t\t %i \n",tex->mWidth*tex->mHeight*4); + ::fprintf(out,"\t\t \n",tex->mWidth*tex->mHeight*4); const unsigned int width = (unsigned int)log10((double)std::max(tex->mHeight,tex->mWidth))+1; for (unsigned int y = 0; y < tex->mHeight;++y) { @@ -687,7 +691,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd if (prop->mType == aiPTI_Float) { ::fprintf(out, " size=\"%i\">\n\t\t\t", - prop->mDataLength/sizeof(float)); + static_cast(prop->mDataLength/sizeof(float))); for (unsigned int p = 0; p < prop->mDataLength/sizeof(float);++p) ::fprintf(out,"%f ",*((float*)(prop->mData+p*sizeof(float)))); @@ -695,7 +699,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd else if (prop->mType == aiPTI_Integer) { ::fprintf(out, " size=\"%i\">\n\t\t\t", - prop->mDataLength/sizeof(int)); + static_cast(prop->mDataLength/sizeof(int))); for (unsigned int p = 0; p < prop->mDataLength/sizeof(int);++p) ::fprintf(out,"%i ",*((int*)(prop->mData+p*sizeof(int)))); @@ -940,7 +944,7 @@ int Assimp_Dump (const char** params, unsigned int num) // --help if (!::strcmp( params[0], "-h") || !::strcmp( params[0], "--help") || !::strcmp( params[0], "-?") ) { - printf(AICMD_MSG_DUMP_HELP); + printf("%s",AICMD_MSG_DUMP_HELP); return 0; }