Change a few prototypes to use SizeT.
Also, offsetof returns a SizeT value.
git-svn-id: svn://svn.valgrind.org/vex/trunk@3047 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/main_globals.c b/priv/main_globals.c
index e3d79c6..dbe6369 100644
--- a/priv/main_globals.c
+++ b/priv/main_globals.c
@@ -50,7 +50,7 @@
void (*vex_failure_exit) ( void ) = NULL;
/* logging output function */
-void (*vex_log_bytes) ( HChar*, Int nbytes ) = NULL;
+void (*vex_log_bytes) ( const HChar*, SizeT nbytes ) = NULL;
/* debug paranoia level */
Int vex_debuglevel = 0;
diff --git a/priv/main_globals.h b/priv/main_globals.h
index 3b16976..eb97ec1 100644
--- a/priv/main_globals.h
+++ b/priv/main_globals.h
@@ -51,7 +51,7 @@
extern void (*vex_failure_exit) ( void );
/* logging output function */
-extern void (*vex_log_bytes) ( HChar*, Int nbytes );
+extern void (*vex_log_bytes) ( const HChar*, SizeT nbytes );
/* debug paranoia level */
extern Int vex_debuglevel;
diff --git a/priv/main_main.c b/priv/main_main.c
index b007fa1..7dc538e 100644
--- a/priv/main_main.c
+++ b/priv/main_main.c
@@ -111,7 +111,7 @@
__attribute__ ((noreturn))
void (*failure_exit) ( void ),
/* logging output function */
- void (*log_bytes) ( HChar*, Int nbytes ),
+ void (*log_bytes) ( const HChar*, SizeT nbytes ),
/* debug paranoia level */
Int debuglevel,
/* Control ... */
diff --git a/priv/main_util.c b/priv/main_util.c
index 9edbe35..459ddba 100644
--- a/priv/main_util.c
+++ b/priv/main_util.c
@@ -203,7 +203,7 @@
translation of the current basic block is complete.
*/
-void* LibVEX_Alloc ( Int nbytes )
+void* LibVEX_Alloc ( SizeT nbytes )
{
struct align {
char c;
@@ -229,7 +229,7 @@
#else
HChar* curr;
HChar* next;
- Int ALIGN;
+ SizeT ALIGN;
ALIGN = offsetof(struct align,x) - 1;
nbytes = (nbytes + ALIGN) & ~ALIGN;
curr = private_LibVEX_alloc_curr;
@@ -280,9 +280,9 @@
New code for vex_util.c should go above this point. */
#include <stdarg.h>
-Int vex_strlen ( const HChar* str )
+SizeT vex_strlen ( const HChar* str )
{
- Int i = 0;
+ SizeT i = 0;
while (str[i] != 0) i++;
return i;
}
@@ -299,9 +299,9 @@
}
}
-void vex_bzero ( void* sV, UInt n )
+void vex_bzero ( void* sV, SizeT n )
{
- UInt i;
+ SizeT i;
UChar* s = (UChar*)sV;
/* No laughing, please. Just don't call this too often. Thank you
for your attention. */
@@ -379,7 +379,8 @@
const HChar* saved_format;
Bool longlong, ljustify, is_sizet;
HChar padchar;
- Int fwidth, nout, len1, len2, len3;
+ Int fwidth, nout, len1, len3;
+ SizeT len2;
HChar intbuf[100]; /* big enough for a 64-bit # in base 2 */
nout = 0;
@@ -413,6 +414,7 @@
}
if (*format == '*') {
fwidth = va_arg(ap, Int);
+ vassert(fwidth >= 0);
format++;
} else {
while (*format >= '0' && *format <= '9') {
diff --git a/priv/main_util.h b/priv/main_util.h
index 85f13a4..8904173 100644
--- a/priv/main_util.h
+++ b/priv/main_util.h
@@ -78,8 +78,8 @@
/* String ops */
extern Bool vex_streq ( const HChar* s1, const HChar* s2 );
-extern Int vex_strlen ( const HChar* str );
-extern void vex_bzero ( void* s, UInt n );
+extern SizeT vex_strlen ( const HChar* str );
+extern void vex_bzero ( void* s, SizeT n );
/* Storage management: clear the area, and allocate from it. */
diff --git a/pub/libvex.h b/pub/libvex.h
index 1f09de5..bf8fad0 100644
--- a/pub/libvex.h
+++ b/pub/libvex.h
@@ -453,7 +453,7 @@
callback that you have previously specified in a call to
LibVEX_Translate. The storage allocated will only stay alive until
translation of the current basic block is complete. */
-extern void* LibVEX_Alloc ( Int nbytes );
+extern void* LibVEX_Alloc ( SizeT nbytes );
/* Show Vex allocation statistics. */
extern void LibVEX_ShowAllocStats ( void );
@@ -532,7 +532,7 @@
void (*failure_exit) ( void ),
/* logging output function */
- void (*log_bytes) ( HChar*, Int nbytes ),
+ void (*log_bytes) ( const HChar*, SizeT nbytes ),
/* debug paranoia level */
Int debuglevel,
diff --git a/pub/libvex_basictypes.h b/pub/libvex_basictypes.h
index 09205bb..0bef9bb 100644
--- a/pub/libvex_basictypes.h
+++ b/pub/libvex_basictypes.h
@@ -141,7 +141,7 @@
/* This is so useful it should be visible absolutely everywhere. */
#if !defined(offsetof)
-# define offsetof(type,memb) ((Int)(HWord)&((type*)0)->memb)
+# define offsetof(type,memb) ((SizeT)(HWord)&((type*)0)->memb)
#endif
/* Our definition of offsetof is giving the same result as
the standard/predefined offsetof. So, we use the same name.