diff -ur pxlib-0.6.8-original/include/paradox.h pxlib-0.6.8-working2/include/paradox.h
--- pxlib-0.6.8-original/include/paradox.h	2018-03-14 23:00:06.000000000 -0700
+++ pxlib-0.6.8-working2/include/paradox.h	2018-08-21 05:50:39.934404178 -0700
@@ -155,10 +155,10 @@
 		GsfOutput *gsfout;
 #endif
 	} s;
-	size_t (*read)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*read)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 	int (*seek)(pxdoc_t *p, pxstream_t *stream, long offset, int whence);
 	long (*tell)(pxdoc_t *p, pxstream_t *stream);
-	size_t (*write)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*write)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 };
 
 struct px_doc {
@@ -188,7 +188,7 @@
 	int warnings;      /* Turn of/off output of warnings */
 
 	/* output function */
-	size_t (*writeproc)(pxdoc_t *p, void *data, size_t size);
+	ssize_t (*writeproc)(pxdoc_t *p, void *data, size_t size);
 
 	/* error handler function */
 	void (*errorhandler)(pxdoc_t *p, int level, const char* msg, void *data);
@@ -203,10 +203,10 @@
 	void  (*free)(pxdoc_t *p, void *mem);
 
 	/* input stream functions */
-	size_t (*read)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*read)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 	int (*seek)(pxdoc_t *p, pxstream_t *stream, long offset, int whence);
 	long (*tell)(pxdoc_t *p, pxstream_t *stream);
-	size_t (*write)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*write)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 
 	char *targetencoding;
 	char *inputencoding;
@@ -253,10 +253,10 @@
 	int subblockfree;
 	int subblockblobcount;
 	/* input stream functions */
-	size_t (*read)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*read)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 	int (*seek)(pxblob_t *p, pxstream_t *stream, long offset, int whence);
 	long (*tell)(pxblob_t *p, pxstream_t *stream);
-	size_t (*write)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*write)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 	/* Cache for the last read block */
 	pxblockcache_t blockcache;
 	/* Index of all blocks in the blob file */
diff -ur pxlib-0.6.8-original/include/paradox.h.in pxlib-0.6.8-working2/include/paradox.h.in
--- pxlib-0.6.8-original/include/paradox.h.in	2016-07-26 05:51:44.000000000 -0700
+++ pxlib-0.6.8-working2/include/paradox.h.in	2018-08-21 05:50:35.776392943 -0700
@@ -155,10 +155,10 @@
 		GsfOutput *gsfout;
 #endif
 	} s;
-	size_t (*read)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*read)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 	int (*seek)(pxdoc_t *p, pxstream_t *stream, long offset, int whence);
 	long (*tell)(pxdoc_t *p, pxstream_t *stream);
-	size_t (*write)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*write)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 };
 
 struct px_doc {
@@ -188,7 +188,7 @@
 	int warnings;      /* Turn of/off output of warnings */
 
 	/* output function */
-	size_t (*writeproc)(pxdoc_t *p, void *data, size_t size);
+	ssize_t (*writeproc)(pxdoc_t *p, void *data, size_t size);
 
 	/* error handler function */
 	void (*errorhandler)(pxdoc_t *p, int level, const char* msg, void *data);
@@ -203,10 +203,10 @@
 	void  (*free)(pxdoc_t *p, void *mem);
 
 	/* input stream functions */
-	size_t (*read)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*read)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 	int (*seek)(pxdoc_t *p, pxstream_t *stream, long offset, int whence);
 	long (*tell)(pxdoc_t *p, pxstream_t *stream);
-	size_t (*write)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*write)(pxdoc_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 
 	char *targetencoding;
 	char *inputencoding;
@@ -253,10 +253,10 @@
 	int subblockfree;
 	int subblockblobcount;
 	/* input stream functions */
-	size_t (*read)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*read)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 	int (*seek)(pxblob_t *p, pxstream_t *stream, long offset, int whence);
 	long (*tell)(pxblob_t *p, pxstream_t *stream);
-	size_t (*write)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
+	ssize_t (*write)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 	/* Cache for the last read block */
 	pxblockcache_t blockcache;
 	/* Index of all blocks in the blob file */
diff -ur pxlib-0.6.8-original/src/paradox.c pxlib-0.6.8-working2/src/paradox.c
--- pxlib-0.6.8-original/src/paradox.c	2018-03-14 22:43:28.000000000 -0700
+++ pxlib-0.6.8-working2/src/paradox.c	2018-08-21 07:19:19.383795177 -0700
@@ -1161,7 +1161,6 @@
 PXLIB_API int PXLIB_CALL
 PX_write_primary_index(pxdoc_t *pxdoc, pxdoc_t *pxindex) {
 	pxpindex_t *indexdata;
-	pxfield_t *pxf;
 	pxhead_t *pxh, *pih;
 	char *data;
 	int i, j;
@@ -1170,7 +1169,6 @@
 	int blocknumber = 1;
 
 	pxh = pxdoc->px_head;
-	pxf = pxh->px_fields;
 	pih = pxindex->px_head;
 
 	/* Allocate memory for a complete data record. Actually it would be
@@ -1259,7 +1257,7 @@
  */
 int
 px_get_record_pos_with_index(pxdoc_t *pxdoc, int recno, int *deleted, pxdatablockinfo_t *pxdbinfo) {
-	int j, numrecords, n, recsperdatablock;
+	int j, numrecords, n;
 //	pxdoc_t *pindexdoc;
 	pxhead_t *pxh; //, *pxih;
 	pxpindex_t *pindex_data;
@@ -1276,7 +1274,6 @@
 	}
 
 	numrecords = 0 ;
-	recsperdatablock = (pxh->px_maxtablesize*0x400-sizeof(TDataBlock))/pxh->px_recordsize;
 	for(j=0; j<pxdoc->px_indexdatalen; j++) {
 		/* We currently just take level 1 index blocks into account.
 		 * This is only for large databases a speed disadvantage.
@@ -2229,7 +2226,7 @@
 	pxf = pxh->px_fields;
 	for(i=0; i<pxh->px_numfields; i++) {
 		char *data;
-		int hsize, size, blobsize, index, mod_nr, bloboffset;
+		int hsize, size, blobsize, index, bloboffset;
 
 		if(pxf[i].px_ftype == pxfMemoBLOb ||
 		   pxf[i].px_ftype == pxfFmtMemoBLOb ||
@@ -2278,7 +2275,7 @@
 			else
 				blobsize = size;
 			index = get_long_le(&data[leader]) & 0x000000ff;
-			mod_nr = get_short_le(&data[leader+8]);
+			get_short_le(&data[leader+8]);
 
 			if(blobsize <= 0) {
 				continue;
@@ -2386,8 +2383,6 @@
 PXLIB_API int PXLIB_CALL
 PX_delete_record(pxdoc_t *pxdoc, int recno) {
 	pxhead_t *pxh;
-	pxstream_t *pxs;
-	pxblob_t *pxblob;
 	pxdatablockinfo_t tmppxdbinfo;
 	int found;
 	int deleted = 0;
@@ -2402,8 +2397,6 @@
 		return -1;
 	}
 	pxh = pxdoc->px_head;
-	pxs = pxdoc->px_stream;
-	pxblob = pxdoc->px_blob;
 
 	if((recno < 0) || (recno >= pxh->px_numrecords)) {
 		px_error(pxdoc, PX_RuntimeError, _("Record number out of range."));
@@ -2459,13 +2452,12 @@
 PXLIB_API int PXLIB_CALL
 PX_pack(pxdoc_t *pxdoc) {
 	pxhead_t *pxh;
-	pxstream_t *pxs;
 	pxpindex_t *pindex_data;
 	long blockpos, blockoutpos;
 	long recordpos, recordoutpos;
 	long blocknumber, blockoutnumber;
 	int recsperblock;
-	int i, j, n, jout, nout;
+	int i, j, jout, nout;
 
 	if(pxdoc == NULL) {
 		px_error(pxdoc, PX_RuntimeError, _("Did not pass a paradox database."));
@@ -2477,7 +2469,6 @@
 		return -1;
 	}
 	pxh = pxdoc->px_head;
-	pxs = pxdoc->px_stream;
 	pindex_data = pxdoc->px_indexdata;
 	recsperblock = (pxh->px_maxtablesize*0x400-sizeof(TDataBlock)) / pxh->px_recordsize;
 
@@ -2580,9 +2571,9 @@
 		recode_delete_request(pxdoc->in_recode_request);
 #else
 #if PX_USE_ICONV
-	if((int) pxdoc->out_iconvcd > 0)
+	if(pxdoc->out_iconvcd != (iconv_t) -1)
 		iconv_close(pxdoc->out_iconvcd);
-	if((int) pxdoc->in_iconvcd > 0)
+	if(pxdoc->in_iconvcd != (iconv_t) -1)
 		iconv_close(pxdoc->in_iconvcd);
 #endif
 #endif
diff -ur pxlib-0.6.8-original/src/px_head.c pxlib-0.6.8-working2/src/px_head.c
--- pxlib-0.6.8-original/src/px_head.c	2016-07-26 05:57:06.000000000 -0700
+++ pxlib-0.6.8-working2/src/px_head.c	2018-08-21 05:50:35.777392946 -0700
@@ -237,7 +237,6 @@
 	int nullint = 0;
 	int i, len;
 	int sumfieldlen;   /* sum of all field name length include the 0 */
-	char *basehead;
 	int base, offset, dataheadoffset;
 	short int tmp;
 	int isindex;
@@ -247,7 +246,6 @@
 	memset(&pxhead, 0, sizeof(pxhead));
 	memset(&pxdatahead, 0, sizeof(pxdatahead));
 
-	basehead = (char *) &pxhead;
 	isindex = !((pxh->px_filetype == pxfFileTypIndexDB) ||
 		        (pxh->px_filetype == pxfFileTypNonIndexDB) ||
 		        (pxh->px_filetype == pxfFileTypNonIncSecIndex) ||
@@ -287,8 +285,8 @@
 			 * In several files it was just 12 in .DB and 17 in .PX files. */
 			put_short_le((char *)&pxhead.unknown12x13, 12);
 			put_short_le((char *)&pxhead.primaryKeyFields, pxh->px_primarykeyfields);
-			put_long_le((char *)&pxhead.primaryIndexWorkspace, (int) (basehead-100));  /* just to set a value */
-			put_long_le((char *)&pxhead.unknownPtr1A, (int) (basehead-500));  /* just to set a value */
+			put_long_le((char *)&pxhead.primaryIndexWorkspace, -100);  /* just to set a value */
+			put_long_le((char *)&pxhead.unknownPtr1A, -500);  /* just to set a value */
 			break;
 		case pxfFileTypPrimIndex:
 			put_short_le((char *)&pxhead.unknown12x13, 17);
@@ -321,8 +319,8 @@
 		dataheadoffset = 0x58;
 	}
 	/* All the pointers, though we probably don't need them for a valid file */
-	put_long_le((char *)&pxhead.fldInfoPtr, (int) (basehead+dataheadoffset));
-	put_long_le((char *)&pxhead.tableNamePtrPtr, (int) (basehead+dataheadoffset+pxh->px_numfields*2));
+	put_long_le((char *)&pxhead.fldInfoPtr, dataheadoffset);
+	put_long_le((char *)&pxhead.tableNamePtrPtr, dataheadoffset+pxh->px_numfields*2);
 	switch(pxh->px_fileversion) {
 		case 70:
 			pxhead.fileVersionID = 0x0C;
@@ -433,7 +431,7 @@
 	 * with numfields fields specifications (each 2 Bytes), followed
 	 * by this pointer (tableNamePtr) and numfield pointers to the
 	 * field names. */
-	put_long_le((char *)&ptr, (int) (basehead+dataheadoffset+pxh->px_numfields*(2+4)+4));
+	put_long_le((char *)&ptr, dataheadoffset+pxh->px_numfields*(2+4)+4);
 	if(pxdoc->write(pxdoc, pxs, 4, &ptr) < 1) {
 		px_error(pxdoc, PX_RuntimeError, _("Could not write pointer to tablename."));
 		return -1;
@@ -443,7 +441,7 @@
 	 * numfields sizeof(* Fieldname) + sizeof(* Tablename) + strlen(tablename)
 	 */
 	if(!isindex) {
-		base = (int) basehead+dataheadoffset+pxh->px_numfields*(2+4)+4+tablenamelen;
+		base = dataheadoffset+pxh->px_numfields*(2+4)+4+tablenamelen;
 		pxf = pxh->px_fields;
 		offset = 0;
 		for(i=0; i<pxh->px_numfields; i++, pxf++) {
diff -ur pxlib-0.6.8-original/src/px_memprof.c pxlib-0.6.8-working2/src/px_memprof.c
--- pxlib-0.6.8-original/src/px_memprof.c	2007-07-05 10:39:14.000000000 -0700
+++ pxlib-0.6.8-working2/src/px_memprof.c	2018-08-21 07:14:03.157939178 -0700
@@ -62,7 +62,7 @@
 		}
 	}
 	if(i == MAXMEM) {
-		fprintf(stderr, _("Aiii, did not find memory block at 0x%X to enlarge."), (unsigned int) mem);
+		fprintf(stderr, _("Aiii, did not find memory block at 0x%p to enlarge."), mem);
 		fprintf(stderr, "\n");
 	}
 	return(a);
@@ -76,7 +76,7 @@
 		i++;
 	}
 	if(i == MAXMEM) {
-		fprintf(stderr, _("Aiii, did not find memory block at 0x%X to free."), (unsigned int) mem);
+		fprintf(stderr, _("Aiii, did not find memory block at 0x%p to free."), mem);
 		fprintf(stderr, "\n");
 	} else {
 		memlist[i].ptr = NULL;
@@ -93,7 +93,7 @@
 	i = j = 0;
 	while(i < MAXMEM) {
 		if(memlist[i].ptr) {
-			fprintf(stderr, _("%d. Memory at address 0x%X (%d) not freed: '%s'."), j, (unsigned int) memlist[i].ptr, memlist[i].size, memlist[i].caller);
+			fprintf(stderr, _("%d. Memory at address 0x%p (%d) not freed: '%s'."), j, memlist[i].ptr, memlist[i].size, memlist[i].caller);
 			fprintf(stderr, "\n");
 			j++;
 		}
diff -ur pxlib-0.6.8-original/src/px_misc.c pxlib-0.6.8-working2/src/px_misc.c
--- pxlib-0.6.8-original/src/px_misc.c	2007-07-05 10:39:20.000000000 -0700
+++ pxlib-0.6.8-working2/src/px_misc.c	2018-08-21 07:15:09.158117836 -0700
@@ -324,7 +324,7 @@
 
 	for(i=0; i<len; i++) {
 		if(i%16 == 0)
-			fprintf(outfp, "\n%08X: ", (int) &p[i]);
+			fprintf(outfp, "\n%p: ", &p[i]);
 		fprintf(outfp, "%02X ", p[i]);
 	}
 	fprintf(outfp, "\n");

