Fix reading options files on platforms with unsigned char
This fixes EOF detection on platforms where char is unsigned, as comparing it with EOF could never return true there. Thanks gcc for the warning "comparison is always true due to limited range of data type [-Wtype-limits]".
This commit is contained in:
parent
b465531141
commit
45fdcc2fec
1 changed files with 3 additions and 2 deletions
|
|
@ -163,7 +163,7 @@ static void merge_options_files(int *argc, char ***argv) {
|
|||
i = 1;
|
||||
while (i < new_argc) {
|
||||
if (new_argv[i] && new_argv[i][0] == '@' && (f = fopen(&new_argv[i][1], "r"))) {
|
||||
char c;
|
||||
int ci;
|
||||
char *b;
|
||||
char *be = &buffer[BUFFER_SIZE];
|
||||
int quote = 0;
|
||||
|
|
@ -174,7 +174,8 @@ static void merge_options_files(int *argc, char ***argv) {
|
|||
insert = i;
|
||||
b = buffer;
|
||||
|
||||
while ((c = fgetc(f)) != EOF) {
|
||||
while ((ci = fgetc(f)) != EOF) {
|
||||
const char c = static_cast<char>(ci);
|
||||
if (escape) {
|
||||
if (b != be) {
|
||||
*b = c;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue