Skip to content

Commit

Permalink
modified API to reach a final state for the upcoming libmpq version
Browse files Browse the repository at this point in the history
modified API to reach a final state for the upcoming libmpq version
  • Loading branch information
mbroemme authored and ge0rg committed Nov 8, 2011
1 parent 4959583 commit 60c1e1a
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 71 deletions.
2 changes: 1 addition & 1 deletion FAQ
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ A: Of course :) The example below takes first parameter as mpq archive
libmpq__archive_open(&mpq_archive, argv[1], -1);

/* get size of first file (0) and malloc output buffer. */
libmpq__file_unpacked_size(mpq_archive, 0, &out_size);
libmpq__file_size_unpacked(mpq_archive, 0, &out_size);
out_buf = malloc(out_size);

/* read, decrypt and unpack file to output buffer. */
Expand Down
10 changes: 5 additions & 5 deletions bindings/d/mpq.d
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ char *libmpq__version();
/* libmpq__generic mpq archive information. */
int libmpq__archive_open(mpq_archive_s **mpq_archive, char *mpq_filename, off_t archive_offset);
int libmpq__archive_close(mpq_archive_s *mpq_archive);
int libmpq__archive_packed_size(mpq_archive_s *mpq_archive, off_t *packed_size);
int libmpq__archive_unpacked_size(mpq_archive_s *mpq_archive, off_t *unpacked_size);
int libmpq__archive_size_packed(mpq_archive_s *mpq_archive, off_t *packed_size);
int libmpq__archive_size_unpacked(mpq_archive_s *mpq_archive, off_t *unpacked_size);
int libmpq__archive_offset(mpq_archive_s *mpq_archive, off_t *offset);
int libmpq__archive_version(mpq_archive_s *mpq_archive, uint *version_);
int libmpq__archive_files(mpq_archive_s *mpq_archive, uint *files);

/* libmpq__generic file processing functions. */
int libmpq__file_packed_size(mpq_archive_s *mpq_archive, uint file_number, off_t *packed_size);
int libmpq__file_unpacked_size(mpq_archive_s *mpq_archive, uint file_number, off_t *unpacked_size);
int libmpq__file_size_packed(mpq_archive_s *mpq_archive, uint file_number, off_t *packed_size);
int libmpq__file_size_unpacked(mpq_archive_s *mpq_archive, uint file_number, off_t *unpacked_size);
int libmpq__file_offset(mpq_archive_s *mpq_archive, uint file_number, off_t *offset);
int libmpq__file_blocks(mpq_archive_s *mpq_archive, uint file_number, uint *blocks);
int libmpq__file_encrypted(mpq_archive_s *mpq_archive, uint file_number, uint *encrypted);
Expand All @@ -78,7 +78,7 @@ int libmpq__file_read(mpq_archive_s *mpq_archive, uint file_number, ubyte *out_b
/* libmpq__generic block processing functions. */
int libmpq__block_open_offset(mpq_archive_s *mpq_archive, uint file_number);
int libmpq__block_close_offset(mpq_archive_s *mpq_archive, uint file_number);
int libmpq__block_unpacked_size(mpq_archive_s *mpq_archive, uint file_number, uint block_number, off_t *unpacked_size);
int libmpq__block_size_unpacked(mpq_archive_s *mpq_archive, uint file_number, uint block_number, off_t *unpacked_size);
int libmpq__block_read(mpq_archive_s *mpq_archive, uint file_number, uint block_number, ubyte *out_buf, off_t out_size, off_t *transferred);

}
Expand Down
12 changes: 6 additions & 6 deletions bindings/python/mpq.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ def check_error(result, func, arguments, errors=errors):

libmpq.libmpq__archive_open.errcheck = check_error
libmpq.libmpq__archive_close.errcheck = check_error
libmpq.libmpq__archive_packed_size.errcheck = check_error
libmpq.libmpq__archive_unpacked_size.errcheck = check_error
libmpq.libmpq__archive_size_packed.errcheck = check_error
libmpq.libmpq__archive_size_unpacked.errcheck = check_error
libmpq.libmpq__archive_offset.errcheck = check_error
libmpq.libmpq__archive_version.errcheck = check_error
libmpq.libmpq__archive_files.errcheck = check_error

libmpq.libmpq__file_packed_size.errcheck = check_error
libmpq.libmpq__file_unpacked_size.errcheck = check_error
libmpq.libmpq__file_size_packed.errcheck = check_error
libmpq.libmpq__file_size_unpacked.errcheck = check_error
libmpq.libmpq__file_offset.errcheck = check_error
libmpq.libmpq__file_blocks.errcheck = check_error
libmpq.libmpq__file_encrypted.errcheck = check_error
Expand All @@ -68,7 +68,7 @@ def check_error(result, func, arguments, errors=errors):

libmpq.libmpq__block_open_offset.errcheck = check_error
libmpq.libmpq__block_close_offset.errcheck = check_error
libmpq.libmpq__block_unpacked_size.errcheck = check_error
libmpq.libmpq__block_size_unpacked.errcheck = check_error
libmpq.libmpq__block_read.errcheck = check_error

__version__ = libmpq.libmpq__version()
Expand Down Expand Up @@ -112,7 +112,7 @@ def tell(self):

def _read_block(self, ctypes=ctypes, libmpq=libmpq):
block_size = ctypes.c_uint64()
libmpq.libmpq__block_unpacked_size(self._file._archive._mpq,
libmpq.libmpq__block_size_unpacked(self._file._archive._mpq,
self._file.number, self._cur_block, ctypes.byref(block_size))
block_data = ctypes.create_string_buffer(block_size.value)
libmpq.libmpq__block_read(self._file._archive._mpq,
Expand Down
10 changes: 5 additions & 5 deletions doc/man3/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ man_MANS = \
libmpq__archive_files.3 \
libmpq__archive_offset.3 \
libmpq__archive_open.3 \
libmpq__archive_packed_size.3 \
libmpq__archive_unpacked_size.3 \
libmpq__archive_size_packed.3 \
libmpq__archive_size_unpacked.3 \
libmpq__archive_version.3 \
libmpq__block_close_offset.3 \
libmpq__block_open_offset.3 \
libmpq__block_read.3 \
libmpq__block_unpacked_size.3 \
libmpq__block_size_unpacked.3 \
libmpq__file_blocks.3 \
libmpq__file_compressed.3 \
libmpq__file_encrypted.3 \
libmpq__file_imploded.3 \
libmpq__file_number.3 \
libmpq__file_offset.3 \
libmpq__file_packed_size.3 \
libmpq__file_read.3 \
libmpq__file_unpacked_size.3 \
libmpq__file_size_packed.3 \
libmpq__file_size_unpacked.3 \
libmpq__strerror.3 \
libmpq__version.3
24 changes: 12 additions & 12 deletions doc/man3/libmpq.3
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.BI " mpq_archive_s *" "mpq_archive"
.BI ");"
.sp
.BI "int32_t libmpq__archive_packed_size("
.BI "int32_t libmpq__archive_size_packed("
.BI " mpq_archive_s *" "mpq_archive",
.BI " off_t *" "packed_size"
.BI ");"
.sp
.BI "int32_t libmpq__archive_unpacked_size("
.BI "int32_t libmpq__archive_size_unpacked("
.BI " mpq_archive_s *" "mpq_archive",
.BI " off_t *" "unpacked_size"
.BI ");"
Expand All @@ -66,13 +66,13 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.BI " uint32_t *" "files"
.BI ");"
.sp
.BI "int32_t libmpq__file_packed_size("
.BI "int32_t libmpq__file_size_packed("
.BI " mpq_archive_s *" "mpq_archive",
.BI " uint32_t " "file_number",
.BI " off_t *" "packed_size"
.BI ");"
.sp
.BI "int32_t libmpq__file_unpacked_size("
.BI "int32_t libmpq__file_size_unpacked("
.BI " mpq_archive_s *" "mpq_archive",
.BI " uint32_t " "file_number",
.BI " off_t *" "unpacked_size"
Expand Down Expand Up @@ -132,14 +132,14 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.BI " uint32_t " "file_number"
.BI ");"
.sp
.BI "int32_t libmpq__block_packed_size("
.BI "int32_t libmpq__block_size_packed("
.BI " mpq_archive_s *" "mpq_archive",
.BI " uint32_t " "file_number",
.BI " uint32_t " "block_number",
.BI " off_t *" "packed_size"
.BI ");"
.sp
.BI "int32_t libmpq__block_unpacked_size("
.BI "int32_t libmpq__block_size_unpacked("
.BI " mpq_archive_s *" "mpq_archive",
.BI " uint32_t " "file_number",
.BI " uint32_t " "block_number",
Expand Down Expand Up @@ -177,13 +177,13 @@ The \fIlibmpq\fP library supports decrypting, decompressing, exploding and vario
.BR libmpq__strerror (3),
.BR libmpq__archive_open (3),
.BR libmpq__archive_close (3),
.BR libmpq__archive_packed_size (3),
.BR libmpq__archive_unpacked_size (3),
.BR libmpq__archive_size_packed (3),
.BR libmpq__archive_size_unpacked (3),
.BR libmpq__archive_offset (3),
.BR libmpq__archive_version (3),
.BR libmpq__archive_files (3),
.BR libmpq__file_packed_size (3),
.BR libmpq__file_unpacked_size (3),
.BR libmpq__file_size_packed (3),
.BR libmpq__file_size_unpacked (3),
.BR libmpq__file_offset (3),
.BR libmpq__file_blocks (3),
.BR libmpq__file_encrypted (3),
Expand All @@ -193,8 +193,8 @@ The \fIlibmpq\fP library supports decrypting, decompressing, exploding and vario
.BR libmpq__file_read (3),
.BR libmpq__block_open_offset (3),
.BR libmpq__block_close_offset (3),
.BR libmpq__block_packed_size (3),
.BR libmpq__block_unpacked_size (3),
.BR libmpq__block_size_packed (3),
.BR libmpq__block_size_unpacked (3),
.BR libmpq__block_offset (3),
.BR libmpq__block_seed (3),
.BR libmpq__block_read (3)
Expand Down
4 changes: 2 additions & 2 deletions doc/man3/libmpq__archive_close.3
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ On success, a zero is returned and on error one of the following constants.
The given file could not be closed.
.SH SEE ALSO
.BR libmpq__archive_open (3),
.BR libmpq__archive_packed_size (3),
.BR libmpq__archive_unpacked_size (3),
.BR libmpq__archive_size_packed (3),
.BR libmpq__archive_size_unpacked (3),
.BR libmpq__archive_offset (3),
.BR libmpq__archive_version (3),
.BR libmpq__archive_files (3)
Expand Down
4 changes: 2 additions & 2 deletions doc/man3/libmpq__archive_open.3
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ The given file is no valid mpq archive.
Reading in archive failed.
.SH SEE ALSO
.BR libmpq__archive_close (3),
.BR libmpq__archive_packed_size (3),
.BR libmpq__archive_unpacked_size (3),
.BR libmpq__archive_size_packed (3),
.BR libmpq__archive_size_unpacked (3),
.BR libmpq__archive_offset (3),
.BR libmpq__archive_version (3),
.BR libmpq__archive_files (3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.B
#include <mpq.h>
.sp
.BI "int32_t libmpq__archive_packed_size("
.BI "int32_t libmpq__archive_size_packed("
.BI " mpq_archive_s *" "mpq_archive",
.BI " off_t *" "packed_size"
.BI ");"
.fi
.SH DESCRIPTION
.PP
Call \fBlibmpq__archive_packed_size\fP() to get the packed size of all files in the archive. It will count compressed and imploded files as well as stored only.
Call \fBlibmpq__archive_size_packed\fP() to get the packed size of all files in the archive. It will count compressed and imploded files as well as stored only.
.LP
The \fBlibmpq__archive_packed_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the compressed, imploded or stored size \fIpacked_size\fP of file.
The \fBlibmpq__archive_size_packed\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the compressed, imploded or stored size \fIpacked_size\fP of file.
.SH RETURN VALUE
On success, a zero is returned.
.SH SEE ALSO
.BR libmpq__file_packed_size (3),
.BR libmpq__block_packed_size (3)
.BR libmpq__file_size_packed (3),
.BR libmpq__block_size_packed (3)
.SH AUTHOR
Check documentation.
.TP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.B
#include <mpq.h>
.sp
.BI "int32_t libmpq__archive_unpacked_size("
.BI "int32_t libmpq__archive_size_unpacked("
.BI " mpq_archive_s *" "mpq_archive",
.BI " off_t *" "unpacked_size"
.BI ");"
.fi
.SH DESCRIPTION
.PP
Call \fBlibmpq__archive_unpacked_size\fP() to get the unpacked size of all files in the archive. It will count uncompressed and exploded files as well as stored only.
Call \fBlibmpq__archive_size_unpacked\fP() to get the unpacked size of all files in the archive. It will count uncompressed and exploded files as well as stored only.
.LP
The \fBlibmpq__archive_unpacked_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of file.
The \fBlibmpq__archive_size_unpacked\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of file.
.SH RETURN VALUE
On success, a zero is returned.
.SH SEE ALSO
.BR libmpq__file_unpacked_size (3),
.BR libmpq__block_unpacked_size (3)
.BR libmpq__file_size_unpacked (3),
.BR libmpq__block_size_unpacked (3)
.SH AUTHOR
Check documentation.
.TP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.B
#include <mpq.h>
.sp
.BI "int32_t libmpq__block_unpacked_size("
.BI "int32_t libmpq__block_size_unpacked("
.BI " mpq_archive_s *" "mpq_archive",
.BI " uint32_t " "file_number",
.BI " uint32_t " "block_number",
Expand All @@ -36,9 +36,9 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.fi
.SH DESCRIPTION
.PP
Call \fBlibmpq__block_unpacked_size\fP() to get the unpacked size of a given block in the file. It will return a valid size for compressed and imploded blocks as well as stored only.
Call \fBlibmpq__block_size_unpacked\fP() to get the unpacked size of a given block in the file. It will return a valid size for compressed and imploded blocks as well as stored only.
.LP
The \fBlibmpq__block_unpacked_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file, the third argument \fIblock_number\fP is the number of block and the fourth argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of block.
The \fBlibmpq__block_size_unpacked\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file, the third argument \fIblock_number\fP is the number of block and the fourth argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of block.
.SH RETURN VALUE
On success, a zero is returned and on error one of the following constants.
.TP
Expand All @@ -48,8 +48,8 @@ File or block does not exist in archive.
.B LIBMPQ_ERROR_OPEN
Block offset table was not opened by calling \fBlibmpq__block_open_offset\fP(), or it was closed by an \fBlibmpq__block_close_offset\fP() call.
.SH SEE ALSO
.BR libmpq__archive_unpacked_size (3),
.BR libmpq__file_unpacked_size (3)
.BR libmpq__archive_size_unpacked (3),
.BR libmpq__file_size_unpacked (3)
.SH AUTHOR
Check documentation.
.TP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.B
#include <mpq.h>
.sp
.BI "int32_t libmpq__file_packed_size("
.BI "int32_t libmpq__file_size_packed("
.BI " mpq_archive_s *" "mpq_archive",
.BI " uint32_t " "file_number",
.BI " off_t *" "packed_size"
.BI ");"
.fi
.SH DESCRIPTION
.PP
Call \fBlibmpq__file_packed_size\fP() to get the packed size of a given file in the archive. It will return a valid size for compressed and imploded files as well as stored only.
Call \fBlibmpq__file_size_packed\fP() to get the packed size of a given file in the archive. It will return a valid size for compressed and imploded files as well as stored only.
.LP
The \fBlibmpq__file_packed_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the compressed, imploded or stored size \fIpacked_size\fP of file.
The \fBlibmpq__file_size_packed\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the compressed, imploded or stored size \fIpacked_size\fP of file.
.SH RETURN VALUE
On success, a zero is returned and on error one of the following constants.
.TP
.B LIBMPQ_ERROR_EXIST
File does not exist in archive.
.SH SEE ALSO
.BR libmpq__archive_packed_size (3),
.BR libmpq__block_packed_size (3)
.BR libmpq__archive_size_packed (3),
.BR libmpq__block_size_packed (3)
.SH AUTHOR
Check documentation.
.TP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ libmpq \- cross-platform C library for manipulating mpq archives.
.B
#include <mpq.h>
.sp
.BI "int32_t libmpq__file_unpacked_size("
.BI "int32_t libmpq__file_size_unpacked("
.BI " mpq_archive_s *" "mpq_archive",
.BI " uint32_t " "file_number",
.BI " off_t *" "unpacked_size"
.BI ");"
.fi
.SH DESCRIPTION
.PP
Call \fBlibmpq__file_unpacked_size\fP() to get the unpacked size of a given file in the archive. It will return a valid size for compressed and imploded files as well as stored only.
Call \fBlibmpq__file_size_unpacked\fP() to get the unpacked size of a given file in the archive. It will return a valid size for compressed and imploded files as well as stored only.
.LP
The \fBlibmpq__file_unpacked_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of file.
The \fBlibmpq__file_size_unpacked\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of file.
.SH RETURN VALUE
On success, a zero is returned and on error one of the following constants.
.TP
.B LIBMPQ_ERROR_EXIST
File does not exist in archive.
.SH SEE ALSO
.BR libmpq__archive_unpacked_size (3),
.BR libmpq__block_unpacked_size (3)
.BR libmpq__archive_size_unpacked (3),
.BR libmpq__block_size_unpacked (3)
.SH AUTHOR
Check documentation.
.TP
Expand Down
Loading

0 comments on commit 60c1e1a

Please sign in to comment.