summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-30 13:28:46 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-30 13:28:46 +0000
commit625dac9da817af72bb35414c226dadeb2d915f21 (patch)
tree6584acdce582dc67c475e29212ca3bae104b3f56
parent86c5d995f6ffb0e2543edef6c652cde2171570df (diff)
downloadperl-625dac9da817af72bb35414c226dadeb2d915f21.tar.gz
Fix casting warnings related to snprintf/vsnprintf
p4raw-id: //depot/perl@28459
-rw-r--r--perl.h4
-rw-r--r--util.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/perl.h b/perl.h
index 4921b7373d..3a762fa907 100644
--- a/perl.h
+++ b/perl.h
@@ -1466,7 +1466,7 @@ int sockatmark(int);
#if defined(HAS_SNPRINTF) && defined(HAS_C99_VARIADIC_MACROS) && !(defined(DEBUGGING) && !defined(PERL_USE_GCC_BRACE_GROUPS))
# ifdef PERL_USE_GCC_BRACE_GROUPS
-# define my_snprintf(buffer, len, ...) ({ int __len__ = snprintf(buffer, len, __VA_ARGS__); if ((len) > 0 && __len__ >= (len)) Perl_croak(aTHX_ "panic: snprintf buffer overflow"); __len__; })
+# define my_snprintf(buffer, len, ...) ({ int __len__ = snprintf(buffer, len, __VA_ARGS__); if ((len) > 0 && (Size_t)__len__ >= (len)) Perl_croak(aTHX_ "panic: snprintf buffer overflow"); __len__; })
# define PERL_MY_SNPRINTF_GUARDED
# else
# define my_snprintf(buffer, len, ...) snprintf(buffer, len, __VA_ARGS__)
@@ -1478,7 +1478,7 @@ int sockatmark(int);
#if defined(HAS_VSNPRINTF) && defined(HAS_C99_VARIADIC_MACROS) && !(defined(DEBUGGING) && !defined(PERL_USE_GCC_BRACE_GROUPS))
# ifdef PERL_USE_GCC_BRACE_GROUPS
-# define my_vsnprintf(buffer, len, ...) ({ int __len__ = vsnprintf(buffer, len, __VA_ARGS__); if ((len) > 0 && __len__ >= (len)) Perl_croak(aTHX_ "panic: vsnprintf buffer overflow"); __len__; })
+# define my_vsnprintf(buffer, len, ...) ({ int __len__ = vsnprintf(buffer, len, __VA_ARGS__); if ((len) > 0 && (Size_t)__len__ >= (len)) Perl_croak(aTHX_ "panic: vsnprintf buffer overflow"); __len__; })
# define PERL_MY_VSNPRINTF_GUARDED
# else
# define my_vsnprintf(buffer, len, ...) vsnprintf(buffer, len, __VA_ARGS__)
diff --git a/util.c b/util.c
index 07dd4d4650..cecec9c878 100644
--- a/util.c
+++ b/util.c
@@ -5393,7 +5393,7 @@ Perl_my_snprintf(char *buffer, const Size_t len, const char *format, ...)
#endif
va_end(ap);
/* vsnprintf() shows failure with >= len, vsprintf() with < 0 */
- if (retval < 0 || (len > 0 && retval >= len))
+ if (retval < 0 || (len > 0 && (Size_t)retval >= len))
Perl_croak(aTHX_ "panic: my_snprintf buffer overflow");
return retval;
}
@@ -5430,7 +5430,7 @@ Perl_my_vsnprintf(char *buffer, const Size_t len, const char *format, va_list ap
# endif
#endif /* #ifdef NEED_VA_COPY */
/* vsnprintf() shows failure with >= len, vsprintf() with < 0 */
- if (retval < 0 || (len > 0 && retval >= len))
+ if (retval < 0 || (len > 0 && (Size_t)retval >= len))
Perl_croak(aTHX_ "panic: my_vsnprintf buffer overflow");
return retval;
}