SDL_GameControllerAddMapping needs zero-terminated string (#1234)
This commit is contained in:
parent
e62ffe9984
commit
f56687ee4b
@ -496,11 +496,14 @@ namespace entry
|
||||
{
|
||||
bx::AllocatorI* allocator = getAllocator();
|
||||
uint32_t size = (uint32_t)bx::getSize(reader);
|
||||
void* data = BX_ALLOC(allocator, size);
|
||||
void* data = BX_ALLOC(allocator, size + 1);
|
||||
bx::read(reader, data, size);
|
||||
bx::close(reader);
|
||||
((char*)data)[size] = '\0';
|
||||
|
||||
SDL_GameControllerAddMapping( (char*)data);
|
||||
if (SDL_GameControllerAddMapping( (char*)data) < 0) {
|
||||
DBG("SDL game controller add mapping failed: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
BX_FREE(allocator, data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user