Browse Source

Fix compilation with MSVC by using sprintf instead of snprintf

snprintf is part of c99 standard, not supported by MS compilers
Lambert Clara 13 năm trước cách đây
mục cha
commit
704e56fc81
3 tập tin đã thay đổi với 11 bổ sung11 xóa
  1. 3 3
      tests/accuracy.c
  2. 5 5
      tests/modes.c
  3. 3 3
      tests/tearing.c

+ 3 - 3
tests/accuracy.c

@@ -46,9 +46,9 @@ static void set_swap_interval(GLFWwindow window, int interval)
     swap_interval = interval;
     glfwSwapInterval(swap_interval);
 
-    snprintf(title, sizeof(title),
-             "Cursor Inaccuracy Detector (interval %i)",
-             swap_interval);
+    sprintf(title,
+            "Cursor Inaccuracy Detector (interval %i)",
+            swap_interval);
 
     glfwSetWindowTitle(window, title);
 }

+ 5 - 5
tests/modes.c

@@ -53,11 +53,11 @@ static const char* format_mode(GLFWvidmode* mode)
 {
     static char buffer[512];
 
-    snprintf(buffer, sizeof(buffer),
-             "%i x %i x %i (%i %i %i)",
-             mode->width, mode->height,
-             mode->redBits + mode->greenBits + mode->blueBits,
-             mode->redBits, mode->greenBits, mode->blueBits);
+    sprintf(buffer,
+            "%i x %i x %i (%i %i %i)",
+            mode->width, mode->height,
+            mode->redBits + mode->greenBits + mode->blueBits,
+            mode->redBits, mode->greenBits, mode->blueBits);
 
     buffer[sizeof(buffer) - 1] = '\0';
     return buffer;

+ 3 - 3
tests/tearing.c

@@ -43,9 +43,9 @@ static void set_swap_interval(GLFWwindow window, int interval)
     swap_interval = interval;
     glfwSwapInterval(swap_interval);
 
-    snprintf(title, sizeof(title),
-             "Tearing detector (interval %i)",
-             swap_interval);
+    sprintf(title,
+            "Tearing detector (interval %i)",
+            swap_interval);
 
     glfwSetWindowTitle(window, title);
 }