]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
build: fix and ignore msvc warnings (ggml/805)
authorBorislav Stanimirov <redacted>
Thu, 25 Apr 2024 14:24:07 +0000 (17:24 +0300)
committerGeorgi Gerganov <redacted>
Mon, 13 May 2024 08:02:26 +0000 (11:02 +0300)
ggml-backend.c
ggml-quants.c

index 402d86ef3ac8b206d3acf602ec6dfb854d1f1bc4..a55967a6f169a75f7142cb47f58dca2207e1b90b 100644 (file)
@@ -1178,9 +1178,9 @@ static int ggml_backend_sched_backend_id_from_cur(ggml_backend_sched_t sched, st
 static char * fmt_size(size_t size) {
     static char buffer[128];
     if (size >= 1024*1024) {
-        sprintf(buffer, "%zuM", size/1024/1024);
+        snprintf(buffer, sizeof(buffer), "%zuM", size/1024/1024);
     } else {
-        sprintf(buffer, "%zuK", size/1024);
+        snprintf(buffer, sizeof(buffer), "%zuK", size/1024);
     }
     return buffer;
 }
index 32e84434a8c1b8b271ac44a75f76632726a1c99e..029511a60748a8cbb88179cee9995e95b436a017 100644 (file)
 #include <stdlib.h> // for qsort
 #include <stdio.h>  // for GGML_ASSERT
 
+#if defined(_MSC_VER)
+// disable "possible loss of data" to avoid warnings for hundreds of casts
+// we should just be careful :)
+#pragma warning(disable: 4244 4267)
+#endif
+
 #ifdef __ARM_NEON
 
 // if YCM cannot find <arm_neon.h>, make a symbolic link to it, for example: