stanimirovb commited on
Commit
c40b574
·
1 Parent(s): 340b9ae

build: fix and ignore msvc warnings (ggml/805)

Browse files
Files changed (2) hide show
  1. ggml-backend.c +2 -2
  2. ggml-quants.c +6 -0
ggml-backend.c CHANGED
@@ -1178,9 +1178,9 @@ static int ggml_backend_sched_backend_id_from_cur(ggml_backend_sched_t sched, st
1178
  static char * fmt_size(size_t size) {
1179
  static char buffer[128];
1180
  if (size >= 1024*1024) {
1181
- sprintf(buffer, "%zuM", size/1024/1024);
1182
  } else {
1183
- sprintf(buffer, "%zuK", size/1024);
1184
  }
1185
  return buffer;
1186
  }
 
1178
  static char * fmt_size(size_t size) {
1179
  static char buffer[128];
1180
  if (size >= 1024*1024) {
1181
+ snprintf(buffer, sizeof(buffer), "%zuM", size/1024/1024);
1182
  } else {
1183
+ snprintf(buffer, sizeof(buffer), "%zuK", size/1024);
1184
  }
1185
  return buffer;
1186
  }
ggml-quants.c CHANGED
@@ -14,6 +14,12 @@
14
  #include <stdlib.h> // for qsort
15
  #include <stdio.h> // for GGML_ASSERT
16
 
 
 
 
 
 
 
17
  #ifdef __ARM_NEON
18
 
19
  // if YCM cannot find <arm_neon.h>, make a symbolic link to it, for example:
 
14
  #include <stdlib.h> // for qsort
15
  #include <stdio.h> // for GGML_ASSERT
16
 
17
+ #if defined(_MSC_VER)
18
+ // disable "possible loss of data" to avoid warnings for hundreds of casts
19
+ // we should just be careful :)
20
+ #pragma warning(disable: 4244 4267)
21
+ #endif
22
+
23
  #ifdef __ARM_NEON
24
 
25
  // if YCM cannot find <arm_neon.h>, make a symbolic link to it, for example: