Skip to content

Commit

Permalink
Fix string literal exceeding max length
Browse files Browse the repository at this point in the history
Fixes glfw#1145.
  • Loading branch information
elmindreda committed Nov 23, 2017
1 parent fe9c7a0 commit 3169179
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 257 deletions.
2 changes: 1 addition & 1 deletion CMake/GenerateMappings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endif()
file(STRINGS "${source_path}" lines)
foreach(line ${lines})
if ("${line}" MATCHES "^[0-9a-fA-F].*$")
set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\\n\"\n")
set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n")
endif()
endforeach()

Expand Down
13 changes: 10 additions & 3 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,17 @@ GLFWAPI int glfwInit(void)

glfwDefaultWindowHints();

if (!glfwUpdateGamepadMappings(_glfwDefaultMappings))
{
terminate();
return GLFW_FALSE;
int i;

for (i = 0; _glfwDefaultMappings[i]; i++)
{
if (!glfwUpdateGamepadMappings(_glfwDefaultMappings[i]))
{
terminate();
return GLFW_FALSE;
}
}
}

return GLFW_TRUE;
Expand Down
Loading

0 comments on commit 3169179

Please sign in to comment.