summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-11-05 18:25:26 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-11-07 21:50:55 -0800
commite616514e74e8120869bb4b04f12e6c0fcb45d27f (patch)
treec0061bed15ff97f054f25ecec558a395e70fa991
parent739b63735f02434ee8553c75b8cc913203133a4a (diff)
Just use C89 size_t instead of rolling our own Size_t & Off_t
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/AsciiSrc.c15
-rw-r--r--src/MultiSrc.c16
2 files changed, 8 insertions, 23 deletions
diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c
index 2f59441..ff7b9df 100644
--- a/src/AsciiSrc.c
+++ b/src/AsciiSrc.c
@@ -115,13 +115,6 @@ static String StorePiecesInString(AsciiSrcObject);
static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *);
static Boolean WriteToFile(_Xconst _XtString, _Xconst _XtString);
-#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 superclass (&textSrcClassRec)
AsciiSrcClassRec asciiSrcClassRec = {
@@ -1039,7 +1032,7 @@ InitStringOrFile(AsciiSrcObject src, Boolean newString)
if (!src->ascii_src.is_tempfile) {
if ((file = fopen(src->ascii_src.string, open_mode)) != 0) {
- (void) fseek(file, (Off_t)0, 2);
+ (void) fseek(file, 0, 2);
src->ascii_src.length = (XawTextPosition) ftell(file);
return file;
} else {
@@ -1069,9 +1062,9 @@ LoadPieces(AsciiSrcObject src, FILE * file, char * string)
local_str = XtMalloc((unsigned) (src->ascii_src.length + 1)
* sizeof(unsigned char));
if (src->ascii_src.length != 0) {
- fseek(file, (Off_t)0, 0);
- src->ascii_src.length = fread(local_str, (Size_t)sizeof(unsigned char),
- (Size_t)src->ascii_src.length, file);
+ fseek(file, 0, 0);
+ src->ascii_src.length = fread(local_str, sizeof(unsigned char),
+ (size_t)src->ascii_src.length, file);
if (src->ascii_src.length <= 0)
XtErrorMsg("readError", "asciiSourceCreate", "XawError",
"fread returned error.", NULL, NULL);
diff --git a/src/MultiSrc.c b/src/MultiSrc.c
index c7cc2ac..3ea875b 100644
--- a/src/MultiSrc.c
+++ b/src/MultiSrc.c
@@ -139,14 +139,6 @@ static void (MyWStrncpy)();
extern char *tmpnam(String);
-#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
-
extern wchar_t* _XawTextMBToWC(Display *, char *, int *);
extern char *_XawTextWCToMB(Display *, wchar_t *, int *);
@@ -1126,7 +1118,7 @@ InitStringOrFile(MultiSrcObject src, Boolean newString)
if (!src->multi_src.is_tempfile) {
if ((file = fopen(src->multi_src.string, open_mode)) != 0) {
- (void) fseek(file, (Off_t)0, 2);
+ (void) fseek(file, 0, 2);
src->multi_src.length = ftell (file);
return file;
} else {
@@ -1190,10 +1182,10 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string)
if (src->multi_src.length != 0) {
temp_mb_holder =
XtMalloc((unsigned)(src->multi_src.length + 1) * sizeof(unsigned char));
- fseek(file, (Off_t)0, 0);
+ 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",