Resolve GCC warnings in assimp_cmd

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@570 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-03-02 21:45:28 +00:00
parent f7aa189118
commit 98bac7094b
3 changed files with 21 additions and 17 deletions

View File

@ -131,7 +131,7 @@ int SaveAsBMP (FILE* file, const aiTexel* data, unsigned int width, unsigned int
} }
BITMAPFILEHEADER header; BITMAPFILEHEADER header;
header.bfType = 'MB'; header.bfType = 'B' | (int('M') << 8u);
header.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); header.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
header.bfSize = header.bfOffBits+width*height*numc; header.bfSize = header.bfOffBits+width*height*numc;
header.bfReserved1 = header.bfReserved2 = 0; header.bfReserved1 = header.bfReserved2 = 0;
@ -221,13 +221,13 @@ int Assimp_Extract (const char** params, unsigned int num)
// --help // --help
if (!::strcmp( params[0], "-h") || !::strcmp( params[0], "--help") || !::strcmp( params[0], "-?") ) { 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; return 0;
} }
// asssimp extract in out [options] // asssimp extract in out [options]
if (num < 1) { 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; return 1;
} }

View File

@ -103,7 +103,7 @@ int main (int argc, char* argv[])
// Display some basic help // Display some basic help
if (! ::strcmp(argv[1], "help")) { if (! ::strcmp(argv[1], "help")) {
printf(AICMD_MSG_HELP); printf("%s",AICMD_MSG_HELP);
return 0; return 0;
} }
@ -117,7 +117,7 @@ int main (int argc, char* argv[])
aiString s; aiString s;
imp.GetExtensionList(s); imp.GetExtensionList(s);
printf(s.data); printf("%s",s.data);
return 0; return 0;
} }

View File

@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
const char* AICMD_MSG_DUMP_HELP = const char* AICMD_MSG_DUMP_HELP =
"todo assimp dumb help"; "todo assimp dumb help";
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
// Compress a binary dump file (beginning at offset head_size) // Compress a binary dump file (beginning at offset head_size)
void CompressBinaryDump(const char* file, unsigned int 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 // mesh header
::fprintf(out,"\t<Texture> \n" ::fprintf(out,"\t<Texture> \n"
"\t\t<Integer name=\"width\" > %i </Integer>\n", "\t\t<Integer name=\"width\" > %i </Integer>\n"
"\t\t<Integer name=\"height\" > %i </Integer>\n", "\t\t<Integer name=\"height\" > %i </Integer>\n"
"\t\t<Boolean name=\"compressed\" > %s </Boolean>\n", "\t\t<Boolean name=\"compressed\" > %s </Boolean>\n",
(compressed ? -1 : tex->mWidth),(compressed ? -1 : tex->mHeight), (compressed ? -1 : tex->mWidth),
(compressed ? -1 : tex->mHeight),
(compressed ? "true" : "false")); (compressed ? "true" : "false"));
if (compressed) { if (compressed) {
::fprintf(out,"\t\t<Data length=\"%i\"> %i \n",tex->mWidth); ::fprintf(out,"\t\t<Data length=\"%i\">\n",tex->mWidth);
if (!shortened) { if (!shortened) {
const uint8_t* dat = reinterpret_cast<uint8_t*>(tex->pcData);
for (unsigned int n = 0; n < tex->mWidth;++n) { for (unsigned int n = 0; n < tex->mWidth;++n) {
::fprintf(out,"\t\t\t%2x",tex->pcData[n]); ::fprintf(out,"\t\t\t%2x",dat[n]);
if (n && !(n % 50)) if (n && !(n % 50)) {
::fprintf(out,"\n"); ::fprintf(out,"\n");
}
} }
} }
} }
else if (!shortened){ else if (!shortened){
::fprintf(out,"\t\t<Data length=\"%i\"> %i \n",tex->mWidth*tex->mHeight*4); ::fprintf(out,"\t\t<Data length=\"%i\"> \n",tex->mWidth*tex->mHeight*4);
const unsigned int width = (unsigned int)log10((double)std::max(tex->mHeight,tex->mWidth))+1; const unsigned int width = (unsigned int)log10((double)std::max(tex->mHeight,tex->mWidth))+1;
for (unsigned int y = 0; y < tex->mHeight;++y) { 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) { if (prop->mType == aiPTI_Float) {
::fprintf(out, ::fprintf(out,
" size=\"%i\">\n\t\t\t", " size=\"%i\">\n\t\t\t",
prop->mDataLength/sizeof(float)); static_cast<unsigned int>(prop->mDataLength/sizeof(float)));
for (unsigned int p = 0; p < prop->mDataLength/sizeof(float);++p) for (unsigned int p = 0; p < prop->mDataLength/sizeof(float);++p)
::fprintf(out,"%f ",*((float*)(prop->mData+p*sizeof(float)))); ::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) { else if (prop->mType == aiPTI_Integer) {
::fprintf(out, ::fprintf(out,
" size=\"%i\">\n\t\t\t", " size=\"%i\">\n\t\t\t",
prop->mDataLength/sizeof(int)); static_cast<unsigned int>(prop->mDataLength/sizeof(int)));
for (unsigned int p = 0; p < prop->mDataLength/sizeof(int);++p) for (unsigned int p = 0; p < prop->mDataLength/sizeof(int);++p)
::fprintf(out,"%i ",*((int*)(prop->mData+p*sizeof(int)))); ::fprintf(out,"%i ",*((int*)(prop->mData+p*sizeof(int))));
@ -940,7 +944,7 @@ int Assimp_Dump (const char** params, unsigned int num)
// --help // --help
if (!::strcmp( params[0], "-h") || !::strcmp( params[0], "--help") || !::strcmp( params[0], "-?") ) { 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; return 0;
} }