diff options
author | sem <sem@FreeBSD.org> | 2005-12-11 18:33:44 +0800 |
---|---|---|
committer | sem <sem@FreeBSD.org> | 2005-12-11 18:33:44 +0800 |
commit | 312317035fcb0dffc76e9888d3fca39831d73495 (patch) | |
tree | 4222ba98c287615d8e4503e639844d0425149a65 /databases/pxlib/files | |
parent | 6136e22ff31ea7f3a74fba4fb65dd93b70e0af8f (diff) | |
download | freebsd-ports-gnome-312317035fcb0dffc76e9888d3fca39831d73495.tar.gz freebsd-ports-gnome-312317035fcb0dffc76e9888d3fca39831d73495.tar.zst freebsd-ports-gnome-312317035fcb0dffc76e9888d3fca39831d73495.zip |
pxlib is shared C library to read various Paradox files.
WWW: http://pxlib.sourceforge.net
Diffstat (limited to 'databases/pxlib/files')
-rw-r--r-- | databases/pxlib/files/patch-Makefile.in | 11 | ||||
-rw-r--r-- | databases/pxlib/files/patch-src-px_io.c | 85 |
2 files changed, 96 insertions, 0 deletions
diff --git a/databases/pxlib/files/patch-Makefile.in b/databases/pxlib/files/patch-Makefile.in new file mode 100644 index 000000000000..eb7bedabe07b --- /dev/null +++ b/databases/pxlib/files/patch-Makefile.in @@ -0,0 +1,11 @@ +--- Makefile.in.orig Sat Dec 10 22:27:50 2005 ++++ Makefile.in Sat Dec 10 22:29:15 2005 +@@ -250,7 +250,7 @@ + EXTRA_DIST = intltool-extract.in intltool-merge.in intltool-update.in $(spec) $(spec).in autogen.sh pxlib.pc.in + + #all-local: $(spec) +-pkgconfigdir = $(libdir)/pkgconfig ++pkgconfigdir = @prefix@/libdata/pkgconfig + pkgconfig_DATA = pxlib.pc + all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/databases/pxlib/files/patch-src-px_io.c b/databases/pxlib/files/patch-src-px_io.c new file mode 100644 index 000000000000..420df4a2f7ec --- /dev/null +++ b/databases/pxlib/files/patch-src-px_io.c @@ -0,0 +1,85 @@ +--- src/px_io.c.orig Sun Dec 11 13:12:58 2005 ++++ src/px_io.c Sun Dec 11 13:13:26 2005 +@@ -346,82 +346,6 @@ + */ + size_t px_mb_write(pxblob_t *p, pxstream_t *dummy, size_t len, void *buffer) { + return(p->mb_stream->write(p->pxdoc, p->mb_stream, len, buffer)); +- pxdoc_t *pxdoc; +- pxhead_t *pxh; +- pxstream_t *pxs; +- long pos; +- int ret; +- unsigned char *tmpbuf = NULL; +- unsigned int blockslen, blockoffset; +- +- pxdoc = p->pxdoc; +- pxh = pxdoc->px_head; +- pxs = p->mb_stream; +- +- if (pxh->px_encryption == 0) +- return pxs->write(pxdoc, pxs, len, buffer); +- +- pos = pxs->tell(pxdoc, pxs); +- if (pos < 0) { +- return pos; +- } +- +- blockoffset = (pos >> BLOCKSIZEEXP) << BLOCKSIZEEXP; +- /* We need to read at least chunk from the blockoffset till the +- * desired postion and the data itself which has len bytes. +- * e.g. if we want to read 20 bytes starting at position 300 in the +- * file, we will need to read 44+20 bytes starting at position 256. +- */ +- blockslen = len + pos - blockoffset; +- /* Check if the end of the data is within a 2^BLOCKSIZEEXP bytes block. +- * If that is the case, we will need to read the remainder of the +- * 2^BLOCKSIZEEXP bytes block as well. In the above example, we +- * will have to read 256 bytes instead of just 64. +- */ +- if(blockslen & 0xff) +- blockslen = ((blockslen >> BLOCKSIZEEXP) + 1) << BLOCKSIZEEXP; +- +- assert(blockslen >= len); +- assert(blockoffset <= (unsigned long)pos); +- assert((blockoffset+blockslen) >= (pos+len)); +- +- ret = pxs->seek(pxdoc, pxs, blockoffset, SEEK_SET); +- if (ret < 0) { +- return ret; +- } +- +- tmpbuf = (unsigned char *) malloc(blockslen); +- if (tmpbuf == NULL) { +- return -ENOMEM; +- } +- +- ret = pxs->read(pxdoc, pxs, blockslen, tmpbuf); +- if (ret < 0) { +- goto end; +- } +- +- px_decrypt_mb_block(tmpbuf, tmpbuf, pxh->px_encryption, blockslen); +- memcpy(tmpbuf + (pos - blockoffset), buffer, len); +- px_encrypt_mb_block(tmpbuf, tmpbuf, pxh->px_encryption, blockslen); +- +- ret = pxs->seek(pxdoc, pxs, blockoffset, SEEK_SET); +- if (ret < 0) { +- return ret; +- } +- ret = pxs->write(pxdoc, pxs, blockslen, tmpbuf); +- if (ret < 0) { +- goto end; +- } +- +- ret = pxs->seek(pxdoc, pxs, pos + len, SEEK_SET); +- if (ret < 0) { +- goto end; +- } +- +- ret = len; +-end: +- free(tmpbuf); +- return ret; + } + /* }}} */ + |