src/scanner.c

changeset 76
d11c154e33e1
parent 66
be2084398c37
equal deleted inserted replaced
75:ba4bc497c6a7 76:d11c154e33e1
234 /* Count */ 234 /* Count */
235 unsigned res_value = 0; 235 unsigned res_value = 0;
236 bfile = false; 236 bfile = false;
237 bfile_reset(settings->bfileHeuristics); 237 bfile_reset(settings->bfileHeuristics);
238 regex_parser_reset(settings->regex); 238 regex_parser_reset(settings->regex);
239 char line_buffer[MAX_LINELENGTH]; 239 char line_buffer[MAX_LINELENGTH + 1];
240 unsigned line_buffer_pos = 0; 240 unsigned line_buffer_pos = 0;
241 241
242 FILE *file = fopen(filelist->filename, "r"); 242 FILE *file = fopen(filelist->filename, "r");
243 if (file == NULL) { 243 if (file == NULL) {
244 outbuf = (char*) malloc(81); 244 outbuf = (char*) malloc(81);
277 } else { 277 } else {
278 if (line_buffer_pos < MAX_LINELENGTH) { 278 if (line_buffer_pos < MAX_LINELENGTH) {
279 line_buffer[line_buffer_pos] = (char) a; 279 line_buffer[line_buffer_pos] = (char) a;
280 line_buffer_pos++; 280 line_buffer_pos++;
281 } else { 281 } else {
282 line_buffer[line_buffer_pos - 1] = 0; 282 line_buffer[line_buffer_pos] = 0;
283 settings->confusing_lnlen = true; 283 settings->confusing_lnlen = true;
284 } 284 }
285 } 285 }
286 } while (!bfile && a != EOF); 286 } while (!bfile && a != EOF);
287 fclose(file); 287 fclose(file);

mercurial