From 5db5dd923c6dc3f4c24b592148060b258b295cde Mon Sep 17 00:00:00 2001 From: Sir Poggles Date: Tue, 12 Jun 2012 18:22:15 -0700 Subject: fgets(): refer to the buffer size (no literals) --- win/configure.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'win/configure.cpp') diff --git a/win/configure.cpp b/win/configure.cpp index 29b88d780..ee03b3659 100644 --- a/win/configure.cpp +++ b/win/configure.cpp @@ -61,7 +61,7 @@ int get_int_option(const char * text, int def) static char buffer[500]; int ret; printf_c("%s\n[\033[1;32m%u\033[0m] -> ", text, def); - fgets(buffer, 500, stdin); + fgets(buffer, sizeof(buffer), stdin); if(sscanf(buffer, "%u", &ret) != 1) ret = def; @@ -74,7 +74,7 @@ bool get_bool_option(const char * text, bool def) static char buffer[500]; char ret[100]; printf_c("%s [\033[1;32m%c\033[0m] -> ", text, def ? 'y' : 'n'); - fgets(buffer, 500, stdin); + fgets(buffer, sizeof(buffer), stdin); if(sscanf(buffer, "%s", ret) != 1) strcpy(ret, def ? "y" : "n"); @@ -159,7 +159,7 @@ void get_machine_info(char * buffer, size_t len) FILE * f = fopen("ver.txt.tmp", "r"); if (f) { - while (fgets(buf2, 500, f)) { } + while (fgets(buf2, sizeof(buf2), f)) { } fclose(f); unlink("ver.txt.tmp"); } @@ -261,8 +261,8 @@ void Run() FILE * fI = fopen("..\\src\\version.sh", "r"); if(fI) { - fgets(version, 514, fI); - fgets(version, 514, fI); + fgets(version, sizeof(version), fI); + fgets(version, sizeof(version), fI); char * p2 = version; while(*p2 != '\"') ++p2; -- cgit v1.2.3