Fix some coverity findings.

pull/2371/head
kimkulling 2019-03-14 17:37:28 +01:00
parent 650fadebe9
commit 61ffe017e8
3 changed files with 25 additions and 32 deletions

View File

@ -112,7 +112,9 @@ void ImproveCacheLocalityProcess::Execute( aiScene* pScene)
}
}
if (!DefaultLogger::isNullLogger()) {
ASSIMP_LOG_INFO_F("Cache relevant are ", numm, " meshes (", numf," faces). Average output ACMR is ", out / numf );
if (numf > 0) {
ASSIMP_LOG_INFO_F("Cache relevant are ", numm, " meshes (", numf, " faces). Average output ACMR is ", out / numf);
}
ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess finished. ");
}
}

View File

@ -51,27 +51,26 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string>
const char* AICMD_MSG_INFO_HELP_E =
"assimp info <file> [-r] [-v]\n"
"\tPrint basic structure of a 3D model\n"
"\t-r,--raw: No postprocessing, do a raw import\n"
"\t-v,--verbose: Print verbose info such as node transform data\n"
"\t-s, --silent: Print only minimal info\n";
"assimp info <file> [-r] [-v]\n"
"\tPrint basic structure of a 3D model\n"
"\t-r,--raw: No postprocessing, do a raw import\n"
"\t-v,--verbose: Print verbose info such as node transform data\n"
"\t-s, --silent: Print only minimal info\n";
const std::string TREE_BRANCH_ASCII = "|-";
const std::string TREE_BRANCH_UTF8 = "\xe2\x94\x9c\xe2\x95\xb4";
const std::string TREE_STOP_ASCII = "'-";
const std::string TREE_STOP_UTF8 = "\xe2\x94\x94\xe2\x95\xb4";
const std::string TREE_CONTINUE_ASCII = "| ";
const std::string TREE_CONTINUE_UTF8 = "\xe2\x94\x82 ";
const char *TREE_BRANCH_ASCII = "|-";
const char *TREE_BRANCH_UTF8 = "\xe2\x94\x9c\xe2\x95\xb4";
const char *TREE_STOP_ASCII = "'-";
const char *TREE_STOP_UTF8 = "\xe2\x94\x94\xe2\x95\xb4";
const char *TREE_CONTINUE_ASCII = "| ";
const char *TREE_CONTINUE_UTF8 = "\xe2\x94\x82 ";
// note: by default this is outputing utf-8 text.
// note: by default this is using utf-8 text.
// this is well supported on pretty much any linux terminal.
// if this causes problems on some platform,
// put an #ifdef to use the ascii version for that platform.
const std::string TREE_BRANCH = TREE_BRANCH_UTF8;
const std::string TREE_STOP = TREE_STOP_UTF8;
const std::string TREE_CONTINUE = TREE_CONTINUE_UTF8;
const char *TREE_BRANCH = TREE_BRANCH_UTF8;
const char *TREE_STOP = TREE_STOP_UTF8;
const char *TREE_CONTINUE = TREE_CONTINUE_UTF8;
// -----------------------------------------------------------------------------------
unsigned int CountNodes(const aiNode* root)
@ -280,14 +279,7 @@ void PrintHierarchy(
// -----------------------------------------------------------------------------------
// Implementation of the assimp info utility to print basic file info
int Assimp_Info (const char* const* params, unsigned int num)
{
if (num < 1) {
printf("assimp info: Invalid number of arguments. "
"See \'assimp info --help\'\n");
return 1;
}
int Assimp_Info (const char* const* params, unsigned int num) {
// --help
if (!strcmp( params[0],"-h")||!strcmp( params[0],"--help")||!strcmp( params[0],"-?") ) {
printf("%s",AICMD_MSG_INFO_HELP_E);

View File

@ -276,9 +276,12 @@ inline uint32_t WriteBounds(const T* in, unsigned int size)
void ChangeInteger(uint32_t ofs,uint32_t n)
{
const uint32_t cur = ftell(out);
fseek(out,ofs,SEEK_SET);
fwrite(&n,4,1,out);
fseek(out,cur,SEEK_SET);
int retCode;
retCode = fseek(out, ofs, SEEK_SET);
ai_assert(0 == retCode);
fwrite(&n, 4, 1, out);
retCode = fseek(out, cur, SEEK_SET);
ai_assert(0 == retCode);
}
// -----------------------------------------------------------------------------------
@ -1333,10 +1336,6 @@ int Assimp_Dump (const char* const* params, unsigned int num)
{
const char* fail = "assimp dump: Invalid number of arguments. "
"See \'assimp dump --help\'\r\n";
if (num < 1) {
printf("%s", fail);
return 1;
}
// --help
if (!strcmp( params[0], "-h") || !strcmp( params[0], "--help") || !strcmp( params[0], "-?") ) {