mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Add core_get_data_pinned(), use it where possible
Change-Id: I1b2f62f27780f99423085d2fffc972ea2701f998
This commit is contained in:
parent
9e53d5541f
commit
67cb2e3cdc
3 changed files with 19 additions and 6 deletions
|
@ -1635,8 +1635,7 @@ int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat,
|
|||
handle = core_alloc_ex(buf_size, ops);
|
||||
if (handle > 0)
|
||||
{
|
||||
core_pin(handle);
|
||||
bm->data = core_get_data(handle);
|
||||
bm->data = core_get_data_pinned(handle);
|
||||
lseek(fd, 0, SEEK_SET); /* reset to beginning of file */
|
||||
size_read = read_bmp_fd(fd, bm, buf_size, bmformat, NULL);
|
||||
|
||||
|
@ -1645,9 +1644,10 @@ int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat,
|
|||
core_shrink(handle, bm->data, size_read);
|
||||
*buf_reqd = size_read;
|
||||
}
|
||||
|
||||
core_put_data_pinned(bm->data);
|
||||
bm->data = NULL; /* do this to force a crash later if the
|
||||
caller doesnt call core_get_data() */
|
||||
core_unpin(handle);
|
||||
}
|
||||
else
|
||||
*buf_reqd = buf_size; /* couldn't allocate pass bytes needed */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue