quickjs 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b35606f03fd2d506d2f460873000dcfd75595a2639b4d921ed6f8d76e4fff118
4
- data.tar.gz: 3c42d67e4e6d57936a34e5ee93669722e5187f7f8b389fa789798fd3ec37abe8
3
+ metadata.gz: c5597f08f905e2fbd2f99177aeac90cf498c849b441e89420eefa4b3ada3ccc5
4
+ data.tar.gz: 21f543c418eb267a92780302d2aa2f1952270dc27614c8ac528421ea92d3c06a
5
5
  SHA512:
6
- metadata.gz: ff5cc1f531fe2c7c5ecc098a024fd6fe4ca62088565e2d6fe46be77e0aeea7db97eba84c1bfb2e032628e60805346f1f6ffafa885287a5c67e553e790668b7c2
7
- data.tar.gz: 1a4c6ae31c835475f4146531e7d19e08d5542331e37541832010a920b6510c27cc6512ef119c70a310d11786b535f2f71891f538e9a80a275afadf52c462bd9e
6
+ metadata.gz: 628e37ebfcabbab7e6f6fe67c724527424c8937c9b6f96a867af25fcfdf280b179dec5ad0531e88631172298911700618fd4be6b2e09c6bb928bbb1780105f73
7
+ data.tar.gz: 96f8640c72fc8b5ef9a73fde16bc2fd9f03484e3e65c942c5a8a2c55e70c8c984c43cd9c6c653fbebf86993c22b35bccbe733421f34d996a4b66543e7c03d128
@@ -176,6 +176,8 @@ int __attribute__((format(printf, 2, 3))) dbuf_printf(DynBuf *s,
176
176
  va_start(ap, fmt);
177
177
  len = vsnprintf(buf, sizeof(buf), fmt, ap);
178
178
  va_end(ap);
179
+ if (len < 0)
180
+ return -1;
179
181
  if (len < sizeof(buf)) {
180
182
  /* fast case */
181
183
  return dbuf_put(s, (uint8_t *)buf, len);
@@ -1147,6 +1147,9 @@ int js_dtoa(char *buf, double d, int radix, int n_digits, int flags,
1147
1147
  P = n_digits + 1;
1148
1148
  else
1149
1149
  P = n_digits;
1150
+ /* "-0" is displayed as "0" if JS_DTOA_MINUS_ZERO is not present */
1151
+ if (sgn && (flags & JS_DTOA_MINUS_ZERO))
1152
+ *q++ = '-';
1150
1153
  goto output;
1151
1154
  }
1152
1155
  /* denormal number: convert to a normal number */
@@ -1156,6 +1159,8 @@ int js_dtoa(char *buf, double d, int radix, int n_digits, int flags,
1156
1159
  } else {
1157
1160
  m |= (uint64_t)1 << 52;
1158
1161
  }
1162
+ if (sgn)
1163
+ *q++ = '-';
1159
1164
  /* remove the bias */
1160
1165
  e -= 1022;
1161
1166
  /* d = 2^(e-53)*m */
@@ -1167,8 +1172,6 @@ int js_dtoa(char *buf, double d, int radix, int n_digits, int flags,
1167
1172
  (flags & JS_DTOA_EXP_MASK) != JS_DTOA_EXP_ENABLED) {
1168
1173
  m >>= 53 - e;
1169
1174
  /* 'm' is never zero */
1170
- if (sgn)
1171
- *q++ = '-';
1172
1175
  q += u64toa_radix(q, m, radix);
1173
1176
  goto done;
1174
1177
  }
@@ -1244,10 +1247,6 @@ int js_dtoa(char *buf, double d, int radix, int n_digits, int flags,
1244
1247
  /* frac is rounded using RNDNA */
1245
1248
  mul_pow_round(tmp1, m, e - 53, radix1, radix_shift, n_digits, JS_RNDNA);
1246
1249
 
1247
- /* "-0" is displayed as "0" */
1248
- if (sgn && !(tmp1->tab[0] == 0 && tmp1->len == 1)) {
1249
- *q++ = '-';
1250
- }
1251
1250
  /* we add one extra digit on the left and remove it if needed
1252
1251
  to avoid testing if the result is < radix^P */
1253
1252
  len = output_digits(q, tmp1, radix, max_int(E + 1, 1) + n_digits,
@@ -1277,11 +1276,6 @@ int js_dtoa(char *buf, double d, int radix, int n_digits, int flags,
1277
1276
  }
1278
1277
  }
1279
1278
  output:
1280
- /* "-0" is displayed as "0" if JS_DTOA_MINUS_ZERO is not present */
1281
- if (sgn && ((flags & JS_DTOA_MINUS_ZERO) ||
1282
- !(tmp1->tab[0] == 0 && tmp1->len == 1))) {
1283
- *q++ = '-';
1284
- }
1285
1279
  if (fmt == JS_DTOA_FORMAT_FIXED)
1286
1280
  E_max = n_digits;
1287
1281
  else