From a9b59dc535e11b9a323e0b55c0bc1d3075f36d83 Mon Sep 17 00:00:00 2001 From: Dawid Jagiela Date: Sat, 26 May 2012 18:25:22 +0200 Subject: [PATCH] void cast on fgets & fscanf in compinfo.c --- source/unres/src_MD-M/compinfo.c | 14 +++++++------- source/unres/src_MD/compinfo.c | 12 ++++++------ source/wham/src-M/compinfo.c | 8 ++++---- source/wham/src/compinfo.c | 8 ++++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/source/unres/src_MD-M/compinfo.c b/source/unres/src_MD-M/compinfo.c index d20b2c9..cbe8ed9 100644 --- a/source/unres/src_MD-M/compinfo.c +++ b/source/unres/src_MD-M/compinfo.c @@ -14,10 +14,10 @@ time_t Tp; in=fopen("cinfo.f","r"); out=fopen("cinfo.f.new","w"); -if (fgets(buf,498,in) != NULL) - fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n"); -if (fgets(buf,498,in) != NULL) - sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3); +(void)fgets(buf,498,in); +fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n"); +(void)fgets(buf,498,in); +sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3); iv3++; fprintf(out,"C %d %d %d\n",iv1,iv2,iv3); fprintf(out," subroutine cinfo\n"); @@ -28,7 +28,7 @@ uname(&Name); time(&Tp); system("whoami > tmptmp"); in1=fopen("tmptmp","r"); -fscanf(in1,"%s",buf1); +(void)fscanf(in1,"%s",buf1); fclose(in1); system("rm tmptmp"); p1=ctime(&Tp); @@ -57,8 +57,8 @@ while(fgets(buf,498,in1) != NULL) { strcat(buf,"\\"); fprintf(out," write(iout,*)'%s'\n",buf); - fgets(buf,498,in1); - buf[strlen(buf)-1]='\0'; + if (fgets(buf,498,in1) != NULL ) + buf[strlen(buf)-1]='\0'; if(strlen(buf) > 49) { buf[47]='\0'; diff --git a/source/unres/src_MD/compinfo.c b/source/unres/src_MD/compinfo.c index d20b2c9..33cf08c 100644 --- a/source/unres/src_MD/compinfo.c +++ b/source/unres/src_MD/compinfo.c @@ -14,10 +14,10 @@ time_t Tp; in=fopen("cinfo.f","r"); out=fopen("cinfo.f.new","w"); -if (fgets(buf,498,in) != NULL) - fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n"); -if (fgets(buf,498,in) != NULL) - sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3); +(void)fgets(buf,498,in); +fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n"); +(void)fgets(buf,498,in); +sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3); iv3++; fprintf(out,"C %d %d %d\n",iv1,iv2,iv3); fprintf(out," subroutine cinfo\n"); @@ -28,7 +28,7 @@ uname(&Name); time(&Tp); system("whoami > tmptmp"); in1=fopen("tmptmp","r"); -fscanf(in1,"%s",buf1); +(void)fscanf(in1,"%s",buf1); fclose(in1); system("rm tmptmp"); p1=ctime(&Tp); @@ -57,7 +57,7 @@ while(fgets(buf,498,in1) != NULL) { strcat(buf,"\\"); fprintf(out," write(iout,*)'%s'\n",buf); - fgets(buf,498,in1); + (void)fgets(buf,498,in1); buf[strlen(buf)-1]='\0'; if(strlen(buf) > 49) { diff --git a/source/wham/src-M/compinfo.c b/source/wham/src-M/compinfo.c index 177dbd3..33cf08c 100644 --- a/source/wham/src-M/compinfo.c +++ b/source/wham/src-M/compinfo.c @@ -14,9 +14,9 @@ time_t Tp; in=fopen("cinfo.f","r"); out=fopen("cinfo.f.new","w"); -fgets(buf,498,in); +(void)fgets(buf,498,in); fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n"); -fgets(buf,498,in); +(void)fgets(buf,498,in); sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3); iv3++; fprintf(out,"C %d %d %d\n",iv1,iv2,iv3); @@ -28,7 +28,7 @@ uname(&Name); time(&Tp); system("whoami > tmptmp"); in1=fopen("tmptmp","r"); -fscanf(in1,"%s",buf1); +(void)fscanf(in1,"%s",buf1); fclose(in1); system("rm tmptmp"); p1=ctime(&Tp); @@ -57,7 +57,7 @@ while(fgets(buf,498,in1) != NULL) { strcat(buf,"\\"); fprintf(out," write(iout,*)'%s'\n",buf); - fgets(buf,498,in1); + (void)fgets(buf,498,in1); buf[strlen(buf)-1]='\0'; if(strlen(buf) > 49) { diff --git a/source/wham/src/compinfo.c b/source/wham/src/compinfo.c index 177dbd3..33cf08c 100644 --- a/source/wham/src/compinfo.c +++ b/source/wham/src/compinfo.c @@ -14,9 +14,9 @@ time_t Tp; in=fopen("cinfo.f","r"); out=fopen("cinfo.f.new","w"); -fgets(buf,498,in); +(void)fgets(buf,498,in); fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n"); -fgets(buf,498,in); +(void)fgets(buf,498,in); sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3); iv3++; fprintf(out,"C %d %d %d\n",iv1,iv2,iv3); @@ -28,7 +28,7 @@ uname(&Name); time(&Tp); system("whoami > tmptmp"); in1=fopen("tmptmp","r"); -fscanf(in1,"%s",buf1); +(void)fscanf(in1,"%s",buf1); fclose(in1); system("rm tmptmp"); p1=ctime(&Tp); @@ -57,7 +57,7 @@ while(fgets(buf,498,in1) != NULL) { strcat(buf,"\\"); fprintf(out," write(iout,*)'%s'\n",buf); - fgets(buf,498,in1); + (void)fgets(buf,498,in1); buf[strlen(buf)-1]='\0'; if(strlen(buf) > 49) { -- 1.7.9.5