[PATCH:libXaw 2/2] Just use C89 size_t instead of rolling our own Size_t

Alan Coopersmith alan.coopersmith at oracle.com
Wed Nov 5 18:05:18 PST 2014


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/AsciiSrc.c |   12 ++----------
 src/MultiSrc.c |   12 ++----------
 2 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c
index a37b6a1..87efdf2 100644
--- a/src/AsciiSrc.c
+++ b/src/AsciiSrc.c
@@ -59,14 +59,6 @@ in this Software without prior written authorization from The Open Group.
 #include <X11/Xaw/AsciiText.h>		/* for Widget Classes */
 #endif
 
-#ifdef X_NOT_POSIX
-#define Off_t long
-#define Size_t unsigned int
-#else
-#define Off_t off_t
-#define Size_t size_t
-#endif
-
 #define MAGIC_VALUE	((XawTextPosition)-1)
 #define streq(a, b)	(strcmp((a), (b)) == 0)
 
@@ -1525,8 +1517,8 @@ LoadPieces(AsciiSrcObject src, FILE *file, char *string)
 		fseek(file, 0, 0);
 		while (left < src->ascii_src.length) {
 		    ptr = XtMalloc((unsigned)src->ascii_src.piece_size);
-		    if ((len = fread(ptr, (Size_t)sizeof(unsigned char),
-				     (Size_t)src->ascii_src.piece_size, file)) < 0)
+		    if ((len = fread(ptr, sizeof(unsigned char),
+				     (size_t)src->ascii_src.piece_size, file)) < 0)
 			XtErrorMsg("readError", "asciiSourceCreate", "XawError",
 				   "fread returned error.", NULL, NULL);
 		    piece = AllocNewPiece(src, piece);
diff --git a/src/MultiSrc.c b/src/MultiSrc.c
index efa08b0..701fe2c 100644
--- a/src/MultiSrc.c
+++ b/src/MultiSrc.c
@@ -78,14 +78,6 @@ in this Software without prior written authorization from The Open Group.
 #define MAGIC_VALUE	((XawTextPosition)-1)
 #define streq(a, b)	(strcmp((a), (b)) == 0)
 
-#ifdef X_NOT_POSIX
-#define Off_t long
-#define Size_t unsigned int
-#else
-#define Off_t off_t
-#define Size_t size_t
-#endif
-
 
 /*
  * Class Methods
@@ -1331,8 +1323,8 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string)
 		XtMalloc((src->multi_src.length + 1) * sizeof(unsigned char));
 	    fseek(file, 0, 0);
 	    src->multi_src.length = fread(temp_mb_holder,
-					  (Size_t)sizeof(unsigned char),
-					  (Size_t)src->multi_src.length, file);
+					  sizeof(unsigned char),
+					  (size_t)src->multi_src.length, file);
 	    if (src->multi_src.length <= 0)
 		XtAppErrorMsg(XtWidgetToApplicationContext ((Widget) src),
 			      "readError", "multiSource", "XawError",
-- 
1.7.9.2



More information about the xorg-devel mailing list