Skip to content

Commit

Permalink
Fix several '-Wsign-conversion' warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
liweitianux committed Mar 22, 2023
1 parent 5782f0e commit 5e8ff4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions xtf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ xtf8_encode(void *dst, const void *src, size_t len, int error)
} else {
/* Valid UTF-8 sequence, copy it. */
DPRINTF("U+%04X", codepoint);
sz += 1 + s - pos;
sz += (size_t)(1 + s - pos);
if (d != NULL) {
while (pos <= s)
*d++ = *pos++;
Expand Down Expand Up @@ -205,7 +205,7 @@ xtf8_decode(void *dst, const void *src, size_t len, int error)
} else {
/* Valid UTF-8 sequence, copy it. */
DPRINTF("U+%04X", codepoint);
sz += 1 + s - pos;
sz += (size_t)(1 + s - pos);
if (d != NULL) {
while (pos <= s)
*d++ = *pos++;
Expand Down
3 changes: 2 additions & 1 deletion xtf8_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ json_unescape(void *dst, void *src, size_t len)
case 'u': /* u00XX */
{
uint32_t codepoint;
int i, x, ch;
uint8_t x, ch;
int i;

if (s + 5 >= end) {
DPRINTF("truncated \\u00XX sequence");
Expand Down

0 comments on commit 5e8ff4a

Please sign in to comment.