Changed: #825 Remove all warning when compiling Ryzom

This commit is contained in:
kervala 2010-08-01 10:39:41 +02:00
parent bb8cea02ea
commit a4b9d678ed
7 changed files with 53 additions and 16 deletions

View file

@ -1384,6 +1384,7 @@ void CSkeletonModel::renderCLod()
CRGBA plDiffuse;
// get the diffuse of the pointLight, attenuated from distance and importance.
plDiffuse.modulateFromuiRGBOnly(mainPL->getDiffuse(), lightContrib->AttFactor[0]);
plDiffuse.A = 255;
// compare the 2 diffuse
uint d0= mainDiffuse.R + mainDiffuse.G + mainDiffuse.B;
uint d1= plDiffuse.R + plDiffuse.G + plDiffuse.B;

View file

@ -213,7 +213,8 @@ void CAsyncFileManager::CFileLoad::run (void)
//nlSleep(5);
//fseek (f, 0, SEEK_SET);
ptr = new uint8[filesize];
fread (ptr, filesize, 1, f);
if (fread (ptr, filesize, 1, f) != 1)
nlwarning("AFM: Couldn't read '%s'", _FileName.c_str());
fclose (f);
*_ppFile = ptr;
@ -258,7 +259,8 @@ void CAsyncFileManager::CMultipleFileLoad::run (void)
//nlSleep(5);
//fseek (f, 0, SEEK_SET);
ptr = new uint8[filesize];
fread (ptr, filesize, 1, f);
if (fread (ptr, filesize, 1, f) != 1)
nlwarning("AFM: Couldn't read '%s'", _FileName[i].c_str());
fclose (f);
*_Ptrs[i] = ptr;

View file

@ -875,8 +875,15 @@ NLMISC_CATEGORISED_COMMAND(nel, system, "Execute the command line using system()
string cmd = args[0];
log.displayNL ("Executing '%s'", cmd.c_str());
system(cmd.c_str());
sint error = system(cmd.c_str());
if (error)
{
log.displayNL ("Execution of '%s' failed with error code %d", cmd.c_str(), error);
}
else
{
log.displayNL ("End of Execution of '%s'", cmd.c_str());
}
return true;
}

View file

@ -44,7 +44,8 @@ bool CCPUTimeStat::getCPUTicks(uint64& user, uint64& nice, uint64& system, uint6
// /proc/stat
// cpu [user] [nice] [system] [idle] [iowait] [irq] [softirq]
fscanf(f, "cpu %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u", &user, &nice, &system, &idle, &iowait);
if (fscanf(f, "cpu %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u", &user, &nice, &system, &idle, &iowait) != 5)
nlwarning("Failed to parse /proc/stat");
fclose(f);
@ -54,8 +55,6 @@ bool CCPUTimeStat::getCPUTicks(uint64& user, uint64& nice, uint64& system, uint6
#endif
}
// Get absolute ticks values for a specified pid
bool CCPUTimeStat::getPIDTicks(uint64& utime, uint64& stime, uint64& cutime, uint64& cstime, uint pid)
{
@ -69,7 +68,8 @@ bool CCPUTimeStat::getPIDTicks(uint64& utime, uint64& stime, uint64& cutime, uin
// /proc/<pid>/stat
// pid com sta ppi pgi ses tty tpg fla mif maf cmi cma [utime] [stime] [cutime] [cstime] ...
fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u", &utime, &stime, &cutime, &cstime);
if (fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u", &utime, &stime, &cutime, &cstime) != 4)
nlwarning("Failed to parse /proc/<pid>/stat");
fclose(f);

View file

@ -440,7 +440,8 @@ void cbInvalidEntityNamesFilename(const std::string &invalidEntityNamesFilename)
for(;;)
{
char str[512];
fgets(str, 511, fp);
if (fgets(str, 511, fp) == NULL)
break;
if(feof(fp))
break;
if (strlen(str) > 0)

View file

@ -1217,10 +1217,18 @@ void CFileContainer::addSearchBigFile (const string &sBigFilename, bool recurse,
//uint32 nFileSize = ftell (Handle);
nlfseek64 (Handle, nFileSize-4, SEEK_SET);
uint32 nOffsetFromBegining;
fread (&nOffsetFromBegining, sizeof(uint32), 1, Handle);
if (fread (&nOffsetFromBegining, sizeof(uint32), 1, Handle) != 1)
{
fclose(Handle);
return;
}
nlfseek64 (Handle, nOffsetFromBegining, SEEK_SET);
uint32 nNbFile;
fread (&nNbFile, sizeof(uint32), 1, Handle);
if (fread (&nNbFile, sizeof(uint32), 1, Handle) != 1)
{
fclose(Handle);
return;
}
for (uint32 i = 0; i < nNbFile; ++i)
{
// Progress bar
@ -1232,13 +1240,29 @@ void CFileContainer::addSearchBigFile (const string &sBigFilename, bool recurse,
char FileName[256];
uint8 nStringSize;
fread (&nStringSize, 1, 1, Handle);
fread (FileName, 1, nStringSize, Handle);
if (fread (&nStringSize, 1, 1, Handle) != 1)
{
fclose(Handle);
return;
}
if (fread (FileName, 1, nStringSize, Handle) != nStringSize)
{
fclose(Handle);
return;
}
FileName[nStringSize] = 0;
uint32 nFileSize2;
fread (&nFileSize2, sizeof(uint32), 1, Handle);
if (fread (&nFileSize2, sizeof(uint32), 1, Handle) != 1)
{
fclose(Handle);
return;
}
uint32 nFilePos;
fread (&nFilePos, sizeof(uint32), 1, Handle);
if (fread (&nFilePos, sizeof(uint32), 1, Handle) != 1)
{
fclose(Handle);
return;
}
string sTmp = toLower(string(FileName));
if (sTmp.empty())
{

View file

@ -1085,7 +1085,9 @@ string CSystemInfo::availableHDSpace (const string &filename)
else
cmd += filename;
cmd += " >/tmp/nelhdfs";
(void) system (cmd.c_str());
sint error = system (cmd.c_str());
if (error)
nlwarning("'%s' failed with error code %d", cmd.c_str(), error);
int fd = open("/tmp/nelhdfs", O_RDONLY);
if (fd == -1)