Browse Source

[Pal/lib] Fix snprintf() function signature

Thomas Knauth 5 years ago
parent
commit
3174ec726c
3 changed files with 3 additions and 3 deletions
  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,
 void vfprintfmt (int (*_fputch)(void *, int, void *), void * f, void * putdat,
                  const char * fmt, va_list ap) __attribute__((format(printf, 4, 0)));
                  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 */
 /* 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;
     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;
     va_list ap;
     int rc;
     int rc;
 
 

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

@@ -37,7 +37,7 @@
 #define ERRNO_P INTERNAL_SYSCALL_ERRNO_P
 #define ERRNO_P INTERNAL_SYSCALL_ERRNO_P
 
 
 int printf(const char * fmt, ...) __attribute__((format(printf, 1, 2)));
 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
 /* constants and macros to help rounding addresses to page
    boundaries */
    boundaries */