Skip to content

Commit 5c2e188

Browse files
committed
hot fix
1 parent 8b6e024 commit 5c2e188

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/fread.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static void StrtoI64(FieldParseContext *ctx)
638638
const bool neg = (*ch == '-');
639639

640640
if (neg) ch++;
641-
if (*ch == '+') ch++;
641+
else if (*ch == '+') ch++;
642642

643643
const char *start = ch;
644644
while (*ch == '0') ch++;
@@ -700,7 +700,7 @@ static void parse_double_regular_core(const char **pch, double *target)
700700
const bool neg = (*ch == '-');
701701

702702
if (neg) ch++;
703-
if (*ch == '+') ch++;
703+
else if (*ch == '+') ch++;
704704

705705
const char *start = ch; // beginning of the number, without the initial sign
706706
uint_fast64_t acc = 0; // mantissa NNN.MMM as a single 64-bit integer NNNMMM
@@ -839,7 +839,7 @@ static void parse_double_extended(FieldParseContext *ctx)
839839

840840
if (quoted) ch++;
841841
if (neg) ch++;
842-
if (*ch == '+') ch++;
842+
else if (*ch == '+') ch++;
843843

844844
if (ch[0] == 'n' && ch[1] == 'a' && ch[2] == 'n' && (ch += 3)) goto return_nan;
845845
if (ch[0] == 'i' && ch[1] == 'n' && ch[2] == 'f' && (ch += 3)) goto return_inf;
@@ -925,7 +925,7 @@ static void parse_double_hexadecimal(FieldParseContext *ctx)
925925
const bool neg = (*ch == '-');
926926

927927
if (neg) ch++;
928-
if (*ch == '+') ch++;
928+
else if (*ch == '+') ch++;
929929

930930
const bool subnormal = ch[2] == '0';
931931

@@ -935,7 +935,7 @@ static void parse_double_hexadecimal(FieldParseContext *ctx)
935935
uint64_t acc = 0;
936936
uint8_t digit;
937937
const char *ch0 = ch;
938-
while ((digit = hexdigits[(uint8_t)(*ch)]) < 16) {
938+
while ((digit = hexdigits[(int)*ch]) < 16) {
939939
acc = (acc << 4) + digit;
940940
ch++;
941941
}
@@ -953,7 +953,7 @@ static void parse_double_hexadecimal(FieldParseContext *ctx)
953953
E = 1023 + (Eneg ? -E : E) - subnormal;
954954
if (subnormal ? E : (E < 1 || E > 2046)) return;
955955

956-
*((uint64_t*)target) = (neg << 63) | (E << 52) | (acc);
956+
*((uint64_t*)target) = ((1ULL * neg) << 63) | (E << 52) | (acc);
957957
*ctx->ch = ch;
958958
return;
959959
}

0 commit comments

Comments
 (0)