Skip to content

Commit 305a824

Browse files
authored
Merge pull request swig#1726 from vadz/unsigned-char
Fix reading options files on platforms with unsigned char
2 parents 02e967d + 45fdcc2 commit 305a824

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/Modules/swigmain.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static void merge_options_files(int *argc, char ***argv) {
163163
i = 1;
164164
while (i < new_argc) {
165165
if (new_argv[i] && new_argv[i][0] == '@' && (f = fopen(&new_argv[i][1], "r"))) {
166-
char c;
166+
int ci;
167167
char *b;
168168
char *be = &buffer[BUFFER_SIZE];
169169
int quote = 0;
@@ -174,7 +174,8 @@ static void merge_options_files(int *argc, char ***argv) {
174174
insert = i;
175175
b = buffer;
176176

177-
while ((c = fgetc(f)) != EOF) {
177+
while ((ci = fgetc(f)) != EOF) {
178+
const char c = static_cast<char>(ci);
178179
if (escape) {
179180
if (b != be) {
180181
*b = c;

0 commit comments

Comments
 (0)