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;
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;
}
}

View File

@ -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;
}
}

View File

@ -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<Texture> \n"
"\t\t<Integer name=\"width\" > %i </Integer>\n",
"\t\t<Integer name=\"height\" > %i </Integer>\n",
"\t\t<Integer name=\"width\" > %i </Integer>\n"
"\t\t<Integer name=\"height\" > %i </Integer>\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"));
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) {
const uint8_t* dat = reinterpret_cast<uint8_t*>(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<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;
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<unsigned int>(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<unsigned int>(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;
}