Fixed formatting errors

This commit is contained in:
BrettRToomey 2015-07-04 13:30:44 -07:00
parent 995716ff7e
commit 0ab09d769e
19 changed files with 216 additions and 216 deletions

View File

@ -67,14 +67,14 @@ static char* getDisplayName(CGDirectDisplayID displayID)
size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(value),
kCFStringEncodingUTF8);
name = calloc(size + 1, sizeof(char));
if (name == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Cocoa: Failed to allocate name");
if (name == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Cocoa: Failed to allocate name");
CFRelease(info);
return strdup("Unknown");
}
CFRelease(info);
return strdup("Unknown");
}
CFStringGetCString(value, name, size, kCFStringEncodingUTF8);
@ -262,22 +262,22 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
CGGetOnlineDisplayList(0, NULL, &displayCount);
displays = calloc(displayCount, sizeof(CGDirectDisplayID));
if (displays == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate displays");
return NULL;
}
if (displays == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate displays");
return NULL;
}
monitors = calloc(displayCount, sizeof(_GLFWmonitor*));
if (monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate monitors");
if (monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate monitors");
free(displays);
return NULL;
}
free(displays);
return NULL;
}
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
NSArray* screens = [NSScreen screens];

View File

@ -613,10 +613,10 @@ static int translateKey(unsigned int key)
{
NSEnumerator* e = [files objectEnumerator];
char** paths = calloc(count, sizeof(char*));
if (paths == NULL)
{
return NO;
}
if (paths == NULL)
{
return NO;
}
int i;

View File

@ -101,24 +101,24 @@ static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
}
nativeConfigs = calloc(nativeCount, sizeof(EGLConfig));
if (nativeConfigs == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"EGL: Failed to allocate native configs");
return GL_FALSE;
}
if (nativeConfigs == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"EGL: Failed to allocate native configs");
return GL_FALSE;
}
eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
if (usableConfigs == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"EGL: Failed to allocate usable configs");
if (usableConfigs == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"EGL: Failed to allocate usable configs");
free(nativeConfigs);
return GL_FALSE;
}
free(nativeConfigs);
return GL_FALSE;
}
usableCount = 0;

View File

@ -72,12 +72,12 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
}
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
if (usableConfigs == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"GLX: Failed to allocate usable configs");
return GL_FALSE;
}
if (usableConfigs == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"GLX: Failed to allocate usable configs");
return GL_FALSE;
}
usableCount = 0;

View File

@ -366,12 +366,12 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
cursor = calloc(1, sizeof(_GLFWcursor));
if (cursor == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate cursor");
return NULL;
}
if (cursor == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate cursor");
return NULL;
}
cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor;
@ -403,12 +403,12 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
}
cursor = calloc(1, sizeof(_GLFWcursor));
if (cursor == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate cursor");
return NULL;
}
if (cursor == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate cursor");
return NULL;
}
cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor;

View File

@ -110,12 +110,12 @@ static void addJoystickElement(_GLFWjoydevice* joystick,
if (elementsArray)
{
_GLFWjoyelement* element = calloc(1, sizeof(_GLFWjoyelement));
if (element == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"IOKit: Failed to allocate element");
return;
}
if (element == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"IOKit: Failed to allocate element");
return;
}
CFArrayAppendValue(elementsArray, element);
@ -319,25 +319,25 @@ static void matchCallback(void* context,
joystick->axes = calloc(CFArrayGetCount(joystick->axisElements),
sizeof(float));
if (joystick->axes == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"IOKit: Failed to allocate axes");
if (joystick->axes == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"IOKit: Failed to allocate axes");
joystick->present = GL_FALSE;
return;
}
joystick->present = GL_FALSE;
return;
}
joystick->buttons = calloc(CFArrayGetCount(joystick->buttonElements) +
CFArrayGetCount(joystick->hatElements) * 4, 1);
if (joystick->buttons == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"IOKit: Failed to allocate buttons");
if (joystick->buttons == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"IOKit: Failed to allocate buttons");
joystick->present = GL_FALSE;
return;
}
joystick->present = GL_FALSE;
return;
}
}
// Callback for user-initiated joystick removal

View File

@ -98,22 +98,22 @@ static void openJoystickDevice(const char* path)
_glfw.linux_js.js[joy].buttonCount = (int) buttonCount;
_glfw.linux_js.js[joy].axes = calloc(axisCount, sizeof(float));
if (_glfw.linux_js.js[joy].axes == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Linux: Failed to allocate joystix axes");
close(fd);
return;
}
if (_glfw.linux_js.js[joy].axes == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Linux: Failed to allocate joystix axes");
close(fd);
return;
}
_glfw.linux_js.js[joy].buttons = calloc(buttonCount, 1);
if (_glfw.linux_js.js[joy].buttons == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Linux: Failed to allocate joystick buttons");
close(fd);
return;
}
if (_glfw.linux_js.js[joy].buttons == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Linux: Failed to allocate joystick buttons");
close(fd);
return;
}
_glfw.linux_js.js[joy].present = GL_TRUE;
#endif // __linux__

View File

@ -59,12 +59,12 @@ int _glfwPlatformInit(void)
_glfwInitJoysticks();
_glfw.mir.event_queue = calloc(1, sizeof(EventQueue));
if (_glfw.mir.event_queue == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Mir: Failed to allocate event queue");
return GL_FALSE;
}
if (_glfw.mir.event_queue == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Mir: Failed to allocate event queue");
return GL_FALSE;
}
_glfwInitEventQueue(_glfw.mir.event_queue);

View File

@ -100,14 +100,14 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
continue;
modes = calloc(out->num_modes, sizeof(GLFWvidmode));
if (modes == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Mir: Failed to allocate modes");
if (modes == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Mir: Failed to allocate modes");
mir_display_config_destroy(displayConfig);
return NULL;
}
mir_display_config_destroy(displayConfig);
return NULL;
}
for (*found = 0; *found < out->num_modes; (*found)++)
{

View File

@ -52,23 +52,23 @@ static int emptyEventQueue(EventQueue* queue)
static EventNode* newEventNode(MirEvent const* event, _GLFWwindow* context)
{
EventNode* new_node = calloc(1, sizeof(EventNode));
if (new_node == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Mir: Failed to allocate new node");
return NULL;
}
if (new_node == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Mir: Failed to allocate new node");
return NULL;
}
new_node->event = calloc(1, sizeof(MirEvent));
if (new_node->event == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Mir: failed to allocate new node event");
free(new_node);
return NULL;
}
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Mir: failed to allocate new node event");
free(new_node);
return NULL;
}
new_node->window = context;
new_node->window = context;
memcpy(new_node->event, event, sizeof(MirEvent));
return new_node;

View File

@ -166,12 +166,12 @@ void _glfwInputMonitorChange(void)
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
{
_GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
if (monitor == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate monitor");
return NULL;
}
if (monitor == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate monitor");
return NULL;
}
monitor->name = strdup(name);
monitor->widthMM = widthMM;
@ -199,13 +199,13 @@ void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
ramp->green = calloc(size, sizeof(unsigned short));
ramp->blue = calloc(size, sizeof(unsigned short));
if (ramp->red == NULL ||
ramp->green == NULL ||
ramp->blue == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate gamma arrays");
}
if (ramp->red == NULL ||
ramp->green == NULL ||
ramp->blue == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate gamma arrays");
}
ramp->size = size;
}

View File

@ -123,12 +123,12 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
}
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
if (usableConfigs == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"WGL: Failed to allocate usable configs");
return GL_FALSE;
}
if (usableConfigs == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"WGL: Failed to allocate usable configs");
return GL_FALSE;
}
usableCount = 0;

View File

@ -284,12 +284,12 @@ WCHAR* _glfwCreateWideStringFromUTF8(const char* source)
return NULL;
target = calloc(length, sizeof(WCHAR));
if (target == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Win32 Init: Failed to allocate target");
return NULL;
}
if (target == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Win32 Init: Failed to allocate target");
return NULL;
}
if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, length))
{
@ -312,12 +312,12 @@ char* _glfwCreateUTF8FromWideString(const WCHAR* source)
return NULL;
target = calloc(length, sizeof(char));
if (target == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Win32 Init: Failed to allocate target");
return NULL;
}
if (target == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Win32 Init: Failed to allocate target");
return NULL;
}
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, length, NULL, NULL))
{

View File

@ -602,13 +602,13 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
const int count = DragQueryFileW(hDrop, 0xffffffff, NULL, 0);
char** paths = calloc(count, sizeof(char*));
if (paths == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Win32: Failed to allocate paths");
if (paths == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Win32: Failed to allocate paths");
return 0;
}
return 0;
}
// Move the mouse to the position of the drop
DragQueryPoint(hDrop, &pt);
@ -618,13 +618,13 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
{
const UINT length = DragQueryFileW(hDrop, i, NULL, 0);
WCHAR* buffer = calloc(length + 1, sizeof(WCHAR));
if (buffer == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Win32: Failed to allocate buffer");
free(paths);
return 0;
}
if (buffer == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Win32: Failed to allocate buffer");
free(paths);
return 0;
}
DragQueryFileW(hDrop, i, buffer, length + 1);
paths[i] = _glfwCreateUTF8FromWideString(buffer);

View File

@ -154,12 +154,12 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
return NULL;
window = calloc(1, sizeof(_GLFWwindow));
if (window == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate window");
return NULL;
}
if (window == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Failed to allocate window");
return NULL;
}
window->next = _glfw.windowListHead;
_glfw.windowListHead = window;

View File

@ -555,12 +555,12 @@ int _glfwPlatformInit(void)
wl_registry_add_listener(_glfw.wl.registry, &registryListener, NULL);
_glfw.wl.monitors = calloc(4, sizeof(_GLFWmonitor*));
if (_glfw.wl.monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"WL: Failed to allocate monitors");
return GL_FALSE;
}
if (_glfw.wl.monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"WL: Failed to allocate monitors");
return GL_FALSE;
}
_glfw.wl.monitorsSize = 4;
_glfw.wl.xkb.context = xkb_context_new(0);

View File

@ -140,12 +140,12 @@ void _glfwAddOutput(uint32_t name, uint32_t version)
}
monitor->wl.modes = calloc(4, sizeof(_GLFWvidmodeWayland));
if (monitor->wl.modes == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Wayland: Failed to allocate modes");
return;
}
if (monitor->wl.modes == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Wayland: Failed to allocate modes");
return;
}
monitor->wl.modesSize = 4;
@ -158,12 +158,12 @@ void _glfwAddOutput(uint32_t name, uint32_t version)
int size = _glfw.wl.monitorsSize * 2;
monitors = realloc(monitors, size * sizeof(_GLFWmonitor*));
if (monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Wayland: Failed to allocate monitors");
return;
}
if (monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Wayland: Failed to allocate monitors");
return;
}
_glfw.wl.monitors = monitors;
_glfw.wl.monitorsSize = size;

View File

@ -215,14 +215,14 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
_glfw.x11.root);
monitors = calloc(sr->noutput, sizeof(_GLFWmonitor*));
if (monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate monitors");
if (monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate monitors");
*count = 0;
return NULL;
}
*count = 0;
return NULL;
}
if (_glfw.x11.xinerama.available)
screens = XineramaQueryScreens(_glfw.x11.display, &screenCount);
@ -302,13 +302,13 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
if (!monitors)
{
monitors = calloc(1, sizeof(_GLFWmonitor*));
if (monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate monitors");
*count = 0;
return NULL;
}
if (monitors == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate monitors");
*count = 0;
return NULL;
}
monitors[0] = _glfwAllocMonitor("Display",
DisplayWidthMM(_glfw.x11.display,

View File

@ -224,23 +224,23 @@ static char** parseUriList(char* text, int* count)
(*count)++;
char* path = calloc(strlen(line) + 1, 1);
if (path == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate path");
return NULL;
}
if (path == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate path");
return NULL;
}
paths = realloc(paths, *count * sizeof(char*));
if (paths == NULL)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate paths");
free(path);
return NULL;
}
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate paths");
free(path);
return NULL;
}
paths[*count - 1] = path;
paths[*count - 1] = path;
while (*line)
{