skin_engine fix invalid buflib handle checks

buflib considers handles <= 0 as invalid
skin engine was using handles < 0

Change-Id: Ie156223a43039d48ef4846fe31e6191630fa7c04
This commit is contained in:
William Wilgus 2022-10-15 11:17:52 -04:00
parent f3d679aefe
commit ffdc64bea2
2 changed files with 2 additions and 3 deletions

View file

@ -1830,7 +1830,6 @@ abort:
wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */ wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */
wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL); wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL);
wps_data->buflib_handle = core_free(wps_data->buflib_handle); wps_data->buflib_handle = core_free(wps_data->buflib_handle);
wps_data->buflib_handle = -1;
#endif #endif
} }
@ -1998,7 +1997,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
strcpy(path, img->bm.data); strcpy(path, img->bm.data);
handle = load_skin_bmp(wps_data, &img->bm, bmpdir); handle = load_skin_bmp(wps_data, &img->bm, bmpdir);
img->buflib_handle = handle; img->buflib_handle = handle;
img->loaded = img->buflib_handle >= 0; img->loaded = img->buflib_handle > 0;
if (img->loaded) if (img->loaded)
{ {

View file

@ -372,7 +372,7 @@ struct wps_data
#ifndef __PCTOOL__ #ifndef __PCTOOL__
static inline char* get_skin_buffer(struct wps_data* data) static inline char* get_skin_buffer(struct wps_data* data)
{ {
if (data->buflib_handle >= 0) if (data->buflib_handle > 0)
return core_get_data(data->buflib_handle); return core_get_data(data->buflib_handle);
return NULL; return NULL;
} }