fixed res may not be initialized in read_size

This commit is contained in:
Bernhard Boser 2020-11-12 17:43:40 -08:00 committed by Scott Shawcroft
parent b805bf8a62
commit a310cde8c1
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
1 changed files with 2 additions and 1 deletions

View File

@ -90,11 +90,12 @@ STATIC uint32_t read4(msgpack_stream_t *s) {
} }
STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) {
size_t res; size_t res = 0;
switch (len_index) { switch (len_index) {
case 0: res = (size_t)read1(s); break; case 0: res = (size_t)read1(s); break;
case 1: res = (size_t)read2(s); break; case 1: res = (size_t)read2(s); break;
case 2: res = (size_t)read4(s); break; case 2: res = (size_t)read4(s); break;
default: mp_raise_ValueError(translate("too big"));
} }
return res; return res;
} }