Sfoglia il codice sorgente

[Pal/lib] Fix snprintf() function signature

Thomas Knauth 4 anni fa
parent
commit
3174ec726c
3 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 1 1
      Pal/lib/api.h
  2. 1 1
      Pal/lib/stdlib/printfmt.c
  3. 1 1
      Pal/src/host/Linux-SGX/sgx_internal.h

+ 1 - 1
Pal/lib/api.h

@@ -185,7 +185,7 @@ void fprintfmt (int (*_fputch)(void *, int, void *), void * f, void * putdat,
 void vfprintfmt (int (*_fputch)(void *, int, void *), void * f, void * putdat,
                  const char * fmt, va_list ap) __attribute__((format(printf, 4, 0)));
 
-int snprintf (char * buf, int n, const char * fmt, ...) __attribute__((format(printf, 3, 4)));
+int snprintf (char * buf, size_t n, const char * fmt, ...) __attribute__((format(printf, 3, 4)));
 
 /* Miscelleneous */
 

+ 1 - 1
Pal/lib/stdlib/printfmt.c

@@ -296,7 +296,7 @@ static int vsprintf(char* buf, int n, const char* fmt, va_list ap) {
     return b.cnt;
 }
 
-int snprintf(char* buf, int n, const char* fmt, ...) {
+int snprintf(char* buf, size_t n, const char* fmt, ...) {
     va_list ap;
     int rc;
 

+ 1 - 1
Pal/src/host/Linux-SGX/sgx_internal.h

@@ -37,7 +37,7 @@
 #define ERRNO_P INTERNAL_SYSCALL_ERRNO_P
 
 int printf(const char * fmt, ...) __attribute__((format(printf, 1, 2)));
-int snprintf(char * str, int size, const char * fmt, ...) __attribute__((format(printf, 3, 4)));
+int snprintf(char * str, size_t size, const char * fmt, ...) __attribute__((format(printf, 3, 4)));
 
 /* constants and macros to help rounding addresses to page
    boundaries */