Binary items are not required to be in utf8 format.
The previous code resulted in errors when parsing items with non-zero flags, and wrote items with non-zero flags incorrectly.
Unlike ApeTag_get_items, this does not require allocation of additional memory. While here, fix return codes in the man page, and some now incorrect comments.
Fixes a compiler warning.
This gives warnings for structures in system headers.
Only allow silent rules if automake supports it. Also, older versions of autoconf or automake don't seem to support AC_PROG_CC_C99, so make that conditional. RedHat EL5 seems to require AM_PROG_CC_C_O, so add that.
This causes warnings due to redundant declarations in system headers.
The compiler says that these assertions will never fail, probably because callers already check for the same conditions.
The old Makefile is gone. * lint checks preserved in Makefile.am (untested) * db_185.h / -ldb is detected on my Debian systems * "make check" passes * "make distcheck" passes * "make install" / "make uninstall" works * "pkg-config --cflags libapetag" outputs correct CFLAGS * "pkg-config --libs libpetag" outputs correct linker flags * PKG_CHECK_MODULES macro works in other projects: dnl place this in configure.ac PKG_CHECK_MODULES(APETAG, [libapetag], [have_apetag=true], [have_apetag=false]) * apeinfo binary installed * libapetag* shared and static libraries installed * apetag.3 and apeinfo.1 manpages installed
Just like get_items, return a ApeTag * instead of accepting a ApeTag ** as an argument. This does slightly complicate error handling, since NULL is now returned for both the -1 and 1 conditions. To differentiate the two, add a new APETAG_NOTPRESENT error code, and check for that explicitly in callers. While here, clean up some unnecessary DBT variables and setting of unnecessary values to DBT variables. Also, have remove_item call get_item to DRY up some code.
Keys can be up to 255 bytes in size, but you need an extra byte the terminator, so size could be 256, which doesn't fit in an unsigned char. Just use a size_t since that's the type used by memcpy.
This makes the error more general, so it can be used in more places. Use it in remove_item and get_item to ensure the size is not too large.
Add APETAG_NULLPTR error type, used if the user passes a NULL pointer to a function that requires the pointer be non-NULL, instead of using assert. Note that private API functions still use assert, as it is an internal library bug if those are called with NULL pointers.
Instead, just return -1. Assertions should be used to check internal library logic, not for input validation.
Instead of using -1, -2, and -3 to express the type of error that occurred, always return -1 on errors, and store the error type in the ApeTag struct, which the user can retreive via ApeTag_error_code. Add multiple different types of errors, so it's easy for a user to use a switch statement to detect and act appropriately on different error types.
On certain platforms, strncasecmp may depend on the user's locale. However, the calling code expects a pure-ASCII comparison. Use OpenBSD's strncasecmp code which uses a simple mapping table for values in the ASCII range.
This makes the internal structure use the same naming as the API.
Using *_p for non-predicate values may be confusing, so just rename the local variables to distinguish them.
When I originally wrote the first library, I must have picked up a typo from an existing list. Since all other libraries just used the same genre list, this typo was never caught.
Previously, libapetag could leak a small amount of memory in a very hard to hit race condition in threaded code.