History

avcodec/xpmdec: Avoid unnecessary size_t->int conversion

Andreas Rheinhardt committed 2 years ago

Commit 357e3391 parent 64634e81 file · +3 −4Browse files

Unified · Split

libavcodec/xpmdec.c+3−4
@@ -233,14 +233,12 @@ static size_t mod_strcspn(const char *string, const char *reject) · 232 unmodified lines
233233 return i;
234234 }
235235
236−static uint32_t color_string_to_rgba(const char *p, int len)
236+static uint32_t color_string_to_rgba(const char *p, size_t len)
237237 {
238238 uint32_t ret = 0xFF000000;
239239 const ColorEntry *entry;
240240 char color_name[100];
241241
242− len = FFMIN(FFMAX(len, 0), sizeof(color_name) - 1);
243−
244242 if (*p == '#') {
245243 p++;
246244 len--;
@@ -271,6 +269,7 @@ static uint32_t color_string_to_rgba(const char *p, int len) · 24 unmodified lines
271269 (hex_char_to_number(p[0]) << 28);
272270 }
273271 } else {
272+ len = FFMIN(len, sizeof(color_name) - 1);
274273 strncpy(color_name, p, len);
275274 color_name[len] = '\0';
276275
@@ -375,7 +374,7 @@ static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p, · 98 unmodified lines
375374
376375 for (i = 0; i < ncolors; i++) {
377376 const uint8_t *index;
378− int len;
377+ size_t len;
379378
380379 ptr += mod_strcspn(ptr, "\"") + 1;
381380 if (end - ptr < cpp)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t