Squelch a compiler warning and get rid of an unnecessary variable.

Just use "sizeof line" for the size of that array; don't have a separate
variable with the number of elements of the array (which at least is
equal to the size of the array, as it's an array of char), as that means
that you have to remember to change both of them.

Then cast "sizeof line" to int, as the second argument to fgets() is an
int, not a size_t (fgets(), as I remember, existed before size_t).

Change-Id: I3c65774527f4fcd824d7ae39208ab6e8e33eb9b4
Reviewed-on: https://code.wireshark.org/review/4023
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-09-07 02:15:45 -07:00
parent 419de19c1d
commit ef444d33fa
1 changed files with 1 additions and 2 deletions

View File

@ -132,12 +132,11 @@ void SCTPChunkStatisticsDialog::fillTable(bool all)
}
} else {
char line[100];
size_t cap = 100;
char *token, id[5];
int i = 0, j = 0;
struct chunkTypes temp;
while (fgets(line, cap, fp)) {
while (fgets(line, (int)sizeof line, fp)) {
if (line[0] == '#')
continue;
token = strtok(line, ",");