From 15e9b09befaff82334a724fab7a04681edbcea61 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 30 Aug 2022 18:08:05 +0900 Subject: [PATCH] pack.c (hex2int): should return signed integer. --- mrbgems/mruby-pack/src/pack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mrbgems/mruby-pack/src/pack.c b/mrbgems/mruby-pack/src/pack.c index 3ae576dbe..a9818d9e7 100644 --- a/mrbgems/mruby-pack/src/pack.c +++ b/mrbgems/mruby-pack/src/pack.c @@ -82,7 +82,7 @@ const static unsigned char base64_dec_tab[] = "\xff\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28" "\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\xff\xff\xff\xff\xff"; -static unsigned int +static int hex2int(unsigned char ch) { if (ch >= '0' && ch <= '9') @@ -741,7 +741,8 @@ unpack_str(mrb_state *mrb, const void *src, int slen, mrb_value ary, int count, static int pack_hex(mrb_state *mrb, mrb_value src, mrb_value dst, mrb_int didx, int count, unsigned int flags) { - unsigned int a, ashift, b, bshift; + int a, b; + unsigned int ashift, bshift; long slen; char *dptr, *dptr0, *sptr;