diff --git a/examples/boing.c b/examples/boing.c index 3cc09730..a2094c5f 100644 --- a/examples/boing.c +++ b/examples/boing.c @@ -330,7 +330,7 @@ void DrawBoingBall( void ) /***************************************************************************** * Bounce the ball. *****************************************************************************/ -void BounceBall( double dt ) +void BounceBall( double delta_t ) { GLfloat sign; GLfloat deg; @@ -358,8 +358,8 @@ void BounceBall( double dt ) } /* Update ball position */ - ball_x += ball_x_inc * ((float)dt*ANIMATION_SPEED); - ball_y += ball_y_inc * ((float)dt*ANIMATION_SPEED); + ball_x += ball_x_inc * ((float)delta_t*ANIMATION_SPEED); + ball_y += ball_y_inc * ((float)delta_t*ANIMATION_SPEED); /* * Simulate the effects of gravity on Y movement. diff --git a/examples/splitview.c b/examples/splitview.c index c602d0c4..4a48a383 100644 --- a/examples/splitview.c +++ b/examples/splitview.c @@ -442,7 +442,6 @@ static void mouseButtonFun(GLFWwindow window, int button, int action) int main(void) { GLFWwindow window; - int width, height; // Initialise GLFW if (!glfwInit()) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 446d718e..d7764f92 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -866,8 +866,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!initializeAppKit()) return GL_FALSE; - window->resizable = wndconfig->resizable; - // We can only have one application delegate, but we only allocate it the // first time we create a window to keep all window code in this file if (_glfwLibrary.NS.delegate == nil) @@ -927,14 +925,10 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, withOptions:nil]; } - glfwMakeContextCurrent(window); - NSPoint point = [[NSCursor currentCursor] hotSpot]; window->cursorPosX = point.x; window->cursorPosY = point.y; - window->resizable = wndconfig->resizable; - return GL_TRUE; } diff --git a/src/error.c b/src/error.c index c7926e9c..d64cb7cc 100644 --- a/src/error.c +++ b/src/error.c @@ -59,8 +59,6 @@ void _glfwSetError(int error, const char* format, ...) char buffer[16384]; const char* description; - // We would use vasprintf here if msvcrt supported it - if (format) { int count; diff --git a/src/win32_window.c b/src/win32_window.c index 00fb269d..65122eef 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -959,7 +959,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, GLboolean recreateContext = GL_FALSE; window->Win32.desiredRefreshRate = wndconfig->refreshRate; - window->resizable = wndconfig->resizable; if (!_glfwLibrary.Win32.classAtom) { diff --git a/src/window.c b/src/window.c index df592751..8da2f580 100644 --- a/src/window.c +++ b/src/window.c @@ -300,6 +300,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, window->width = width; window->height = height; window->mode = mode; + window->resizable = wndconfig.resizable; window->cursorMode = GLFW_CURSOR_NORMAL; window->systemKeys = GL_TRUE; diff --git a/src/x11_joystick.c b/src/x11_joystick.c index 444c479f..9fc921fd 100644 --- a/src/x11_joystick.c +++ b/src/x11_joystick.c @@ -83,7 +83,7 @@ void _glfwInitJoysticks(void) { #ifdef _GLFW_USE_LINUX_JOYSTICKS int k, n, fd, joy_count; - char* joy_base_name; + const char* joy_base_name; char joy_dev_name[20]; int driver_version = 0x000800; char ret_data; diff --git a/src/x11_window.c b/src/x11_window.c index 05d1be83..442e76c0 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -889,7 +889,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWfbconfig* fbconfig) { window->refreshRate = wndconfig->refreshRate; - window->resizable = wndconfig->resizable; if (!_glfwCreateContext(window, wndconfig, fbconfig)) return GL_FALSE; diff --git a/support/getopt.c b/support/getopt.c index 712cf28a..6ff6ef99 100644 --- a/support/getopt.c +++ b/support/getopt.c @@ -41,7 +41,10 @@ #include #include "getopt.h" - +/* 2012-08-12 Lambert Clara + * + * Constify third argument of getopt. + */ /* 2011-07-27 Camilla Berglund * * Added _CRT_SECURE_NO_WARNINGS macro. @@ -102,7 +105,7 @@ static int permute_argv_once() } -int getopt(int argc, char** argv, char* optstr) +int getopt(int argc, char** argv, const char* optstr) { int c = 0; diff --git a/support/getopt.h b/support/getopt.h index 0b78650a..6d2e4afe 100644 --- a/support/getopt.h +++ b/support/getopt.h @@ -48,7 +48,7 @@ extern int optind; extern int opterr; extern int optopt; -int getopt(int argc, char** argv, char* optstr); +int getopt(int argc, char** argv, const char* optstr); #ifdef __cplusplus diff --git a/tests/accuracy.c b/tests/accuracy.c index c9a82ec7..f3fb752b 100644 --- a/tests/accuracy.c +++ b/tests/accuracy.c @@ -46,9 +46,7 @@ static void set_swap_interval(GLFWwindow window, int interval) swap_interval = interval; glfwSwapInterval(swap_interval); - sprintf(title, - "Cursor Inaccuracy Detector (interval %i)", - swap_interval); + sprintf(title, "Cursor Inaccuracy Detector (interval %i)", swap_interval); glfwSetWindowTitle(window, title); } diff --git a/tests/defaults.c b/tests/defaults.c index 5e3f3890..391b4984 100644 --- a/tests/defaults.c +++ b/tests/defaults.c @@ -30,25 +30,22 @@ //======================================================================== #include +#include #include #include -#ifndef GL_ARB_multisample - #define GL_SAMPLES_ARB 0x80A9 -#endif - typedef struct { int param; - char* ext; - char* name; + const char* ext; + const char* name; } ParamGL; typedef struct { int param; - char* name; + const char* name; } ParamGLFW; static ParamGL gl_params[] = diff --git a/tests/gamma.c b/tests/gamma.c index 7d93ed06..e74d5b43 100644 --- a/tests/gamma.c +++ b/tests/gamma.c @@ -37,7 +37,7 @@ #define STEP_SIZE 0.1f -static GLfloat gamma = 1.0f; +static GLfloat gamma_value = 1.0f; static void usage(void) { @@ -46,9 +46,9 @@ static void usage(void) static void set_gamma(float value) { - gamma = value; - printf("Gamma: %f\n", gamma); - glfwSetGamma(gamma); + gamma_value = value; + printf("Gamma: %f\n", gamma_value); + glfwSetGamma(gamma_value); } static void key_callback(GLFWwindow window, int key, int action) @@ -67,15 +67,15 @@ static void key_callback(GLFWwindow window, int key, int action) case GLFW_KEY_KP_ADD: case GLFW_KEY_Q: { - set_gamma(gamma + STEP_SIZE); + set_gamma(gamma_value + STEP_SIZE); break; } case GLFW_KEY_KP_SUBTRACT: case GLFW_KEY_W: { - if (gamma - STEP_SIZE > 0.f) - set_gamma(gamma - STEP_SIZE); + if (gamma_value - STEP_SIZE > 0.f) + set_gamma(gamma_value - STEP_SIZE); break; } @@ -119,10 +119,10 @@ int main(int argc, char** argv) if (mode == GLFW_FULLSCREEN) { - GLFWvidmode mode; - glfwGetDesktopMode(&mode); - width = mode.width; - height = mode.height; + GLFWvidmode desktop_mode; + glfwGetDesktopMode(&desktop_mode); + width = desktop_mode.width; + height = desktop_mode.height; } else { diff --git a/tests/iconify.c b/tests/iconify.c index d1a505b5..33b6f058 100644 --- a/tests/iconify.c +++ b/tests/iconify.c @@ -100,10 +100,10 @@ int main(int argc, char** argv) if (mode == GLFW_FULLSCREEN) { - GLFWvidmode mode; - glfwGetDesktopMode(&mode); - width = mode.width; - height = mode.height; + GLFWvidmode desktop_mode; + glfwGetDesktopMode(&desktop_mode); + width = desktop_mode.width; + height = desktop_mode.height; } else { @@ -130,8 +130,6 @@ int main(int argc, char** argv) while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) { - int width, height; - if (iconified != glfwGetWindowParam(window, GLFW_ICONIFIED) || active != glfwGetWindowParam(window, GLFW_ACTIVE)) { diff --git a/tests/modes.c b/tests/modes.c index b5912ed7..5ce65abb 100644 --- a/tests/modes.c +++ b/tests/modes.c @@ -68,7 +68,7 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -static void window_size_callback(GLFWwindow window, int width, int height) +static void window_size_callback(GLFWwindow in_window, int width, int height) { printf("Window resized to %ix%i\n", width, height);