fix the warns that actually matter

This commit is contained in:
DarthArgus
2015-10-27 18:02:01 -05:00
parent 9e6f200300
commit f0160fe7ad
4 changed files with 45 additions and 43 deletions
@@ -59,9 +59,10 @@ void ServerConsole::run()
char inBuf[1024] = {"\0"};
while(! feof(stdin))
{
fread(inBuf, 1024, 1, stdin);
input += inBuf;
memset(inBuf, 0, sizeof(inBuf));
if (fread(inBuf, 1024, 1, stdin)) {
input += inBuf;
memset(inBuf, 0, sizeof(inBuf));
}
}
if(input.length() > 0)
@@ -119,10 +119,11 @@ void Os::installCommon(void)
char buffer[512];
while (!feof(f))
{
fgets(buffer, 512, f);
if (strncmp(buffer, "processor\t: ", 12)==0)
{
processorCount = atoi(buffer+12)+1;
if (fgets(buffer, 512, f) != NULL) {
if (strncmp(buffer, "processor\t: ", 12)==0)
{
processorCount = atoi(buffer+12)+1;
}
}
}
fclose(f);
+19 -20
View File
@@ -370,28 +370,27 @@ char buffer[1024];
x = 0;
while(!feof(fp))
{
fgets( buffer, 1023, fp);
// get rid of '\n' and '\r' for comparisons
strtok(buffer,"\r\n");
len = (int)strlen(buffer);
if( len > 0 )
{
if( nline == 0 )
if (fgets( buffer, 1023, fp) != NULL) {
// get rid of '\n' and '\r' for comparisons
strtok(buffer,"\r\n");
len = (int)strlen(buffer);
if( len > 0 )
{
passString = (char *)malloc( len + 1 );
strcpy(passString,buffer);
if( nline == 0 )
{
passString = (char *)malloc( len + 1 );
strcpy(passString,buffer);
}
else
{
allowedAddressList[x] = (char *)malloc( len + 1 );
strcpy(allowedAddressList[x],buffer);
x++;
}
}
else
{
allowedAddressList[x] = (char *)malloc( len + 1 );
strcpy(allowedAddressList[x],buffer);
x++;
}
}
nline++;
}
nline++;
}
}
// clean up
fclose(fp);
return true;
@@ -367,26 +367,27 @@ char buffer[1024];
x = 0;
while(!feof(fp))
{
fgets( buffer, 1023, fp);
if (fgets( buffer, 1023, fp) != NULL) {
// get rid of '\n' and '\r' for comparisons
strtok(buffer,"\r\n");
len = strlen(buffer);
if( len > 0 )
{
if( nline == 0 )
// get rid of '\n' and '\r' for comparisons
strtok(buffer,"\r\n");
len = strlen(buffer);
if( len > 0 )
{
passString = (char *)malloc( len + 1 );
strcpy(passString,buffer);
}
else
{
allowedAddressList[x] = (char *)malloc( len + 1 );
strcpy(allowedAddressList[x],buffer);
x++;
if( nline == 0 )
{
passString = (char *)malloc( len + 1 );
strcpy(passString,buffer);
}
else
{
allowedAddressList[x] = (char *)malloc( len + 1 );
strcpy(allowedAddressList[x],buffer);
x++;
}
}
nline++;
}
nline++;
}
// clean up