You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(47) |
Aug
(21) |
Sep
(5) |
Oct
(17) |
Nov
|
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
2003 |
Jan
|
Feb
(6) |
Mar
(7) |
Apr
(8) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
|
2004 |
Jan
(8) |
Feb
(46) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(27) |
Feb
(2) |
Mar
|
Apr
(64) |
May
|
Jun
|
Jul
(11) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(2) |
From: Robert K. <may...@us...> - 2001-07-11 18:56:29
|
Update of /cvsroot/bitcollider/supercollider In directory usw-pr-cvs1:/tmp/cvs-serv26589 Log Message: First rev Status: Vendor Tag: bitzi Release Tags: start N supercollider/AUTHORS No conflicts created by this import ***** Bogus filespec: - ***** Bogus filespec: Imported ***** Bogus filespec: sources |
From: Robert K. <may...@us...> - 2001-07-09 21:19:55
|
Update of /cvsroot/bitcollider/bitcollider In directory usw-pr-cvs1:/tmp/cvs-serv10439 Modified Files: Makefile.am autogen.sh configure.in Log Message: Converted the dlopen stuff to use the libtool ltdlopen stuff for greater portability. Index: Makefile.am =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Makefile.am 2001/05/31 21:57:38 1.8 --- Makefile.am 2001/07/09 21:19:52 1.9 *************** *** 7,11 **** AUTOMAKE_OPTIONS = foreign ! SUBDIRS = lib src vorbis wav image cvsclean: distclean --- 7,11 ---- AUTOMAKE_OPTIONS = foreign ! SUBDIRS = libltdl lib src vorbis wav image cvsclean: distclean Index: autogen.sh =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/autogen.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** autogen.sh 2001/03/04 21:31:37 1.2 --- autogen.sh 2001/07/09 21:19:52 1.3 *************** *** 32,37 **** echo " autoheader" autoheader ! echo " libtoolize --automake" ! libtoolize --automake echo " automake --add-missing" automake --add-missing --- 32,37 ---- echo " autoheader" autoheader ! echo " libtoolize --automake --ltdl" ! libtoolize --automake --ltdl echo " automake --add-missing" automake --add-missing Index: configure.in =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/configure.in,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** configure.in 2001/05/31 21:57:38 1.9 --- configure.in 2001/07/09 21:19:52 1.10 *************** *** 14,17 **** --- 14,21 ---- AC_PROG_AWK AC_PROG_CC + AC_LIBLTDL_CONVENIENCE + AC_SUBST(INCLTDL) + AC_SUBST(LIBLTDL) + AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) *************** *** 46,48 **** --- 50,53 ---- AC_DEFINE_UNQUOTED(PREFIX, "${prefix}") AM_CONFIG_HEADER(config.h) + AC_CONFIG_SUBDIRS(libltdl) AC_OUTPUT(Makefile lib/Makefile src/Makefile vorbis/Makefile wav/Makefile image/Makefile, echo timestamp > stamp-h) |
From: Robert K. <may...@us...> - 2001-07-09 21:19:55
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv10439/lib Modified Files: Makefile.am plugin_man.c Log Message: Converted the dlopen stuff to use the libtool ltdlopen stuff for greater portability. Index: Makefile.am =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** Makefile.am 2001/04/06 04:49:12 1.9 --- Makefile.am 2001/07/09 21:19:52 1.10 *************** *** 7,15 **** AUTOMAKE_OPTIONS = foreign ! INCLUDES = -I$(top_srcdir)/.. -I$(top_srcdir)/ver -I$(top_srcdir)/include lib_LTLIBRARIES = libbitcollider.la libbitcollider_la_SOURCES = main.c sha1.c tiger.c tigertree.c sboxes.c browser.c mp3.c id3.c plugin_man.c plugin_man.h dirsearch.c dir.h libbitcollider_la_LDFLAGS = -version-info 1:0:0 ! libbitcollider_la_LIBADD = -ldl noinst_HEADERS = browser.h mp3.h id3.h --- 7,15 ---- AUTOMAKE_OPTIONS = foreign ! INCLUDES = $(INCLTDL) -I$(top_srcdir)/.. -I$(top_srcdir)/ver -I$(top_srcdir)/include lib_LTLIBRARIES = libbitcollider.la libbitcollider_la_SOURCES = main.c sha1.c tiger.c tigertree.c sboxes.c browser.c mp3.c id3.c plugin_man.c plugin_man.h dirsearch.c dir.h libbitcollider_la_LDFLAGS = -version-info 1:0:0 ! libbitcollider_la_LIBADD = $(LIBLTDL) noinst_HEADERS = browser.h mp3.h id3.h Index: plugin_man.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/plugin_man.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** plugin_man.c 2001/04/06 04:49:12 1.10 --- plugin_man.c 2001/07/09 21:19:52 1.11 *************** *** 11,15 **** #include <sys/types.h> #include <dirent.h> ! #include <dlfcn.h> #include "bitcollider.h" --- 11,15 ---- #include <sys/types.h> #include <dirent.h> ! #include <ltdl.h> #include "bitcollider.h" *************** *** 69,77 **** /* Found one, lets open it */ ! bc->plugins[bc->numPluginsLoaded].handle = dlopen(file, RTLD_NOW); if (bc->plugins[bc->numPluginsLoaded].handle == NULL) { if (printDebugInfo) ! printf("Cannot load plugin %s. (%s)\n", file, dlerror()); continue; } --- 69,77 ---- /* Found one, lets open it */ ! bc->plugins[bc->numPluginsLoaded].handle = lt_dlopen(file); if (bc->plugins[bc->numPluginsLoaded].handle == NULL) { if (printDebugInfo) ! printf("Cannot load plugin %s. (%s)\n", file, lt_dlerror()); continue; } *************** *** 79,87 **** /* Opened plugin ok, now locate our entry function */ ! init_function = dlsym(bc->plugins[bc->numPluginsLoaded].handle, "init_plugin"); if (init_function == NULL) { ! dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) printf("Cannot find entry point in %s.\n", file); --- 79,87 ---- /* Opened plugin ok, now locate our entry function */ ! init_function = lt_dlsym(bc->plugins[bc->numPluginsLoaded].handle, "init_plugin"); if (init_function == NULL) { ! lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) printf("Cannot find entry point in %s.\n", file); *************** *** 93,97 **** if (bc->plugins[bc->numPluginsLoaded].methods == NULL) { ! dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) printf("Cannot retrieve supported methods from %s.\n", file); --- 93,97 ---- if (bc->plugins[bc->numPluginsLoaded].methods == NULL) { ! lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) printf("Cannot retrieve supported methods from %s.\n", file); *************** *** 122,126 **** bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); ! dlclose(bc->plugins[bc->numPluginsLoaded].handle); bc->plugins[bc->numPluginsLoaded].handle = NULL; bc->plugins[bc->numPluginsLoaded].methods = NULL; --- 122,126 ---- bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); ! lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); bc->plugins[bc->numPluginsLoaded].handle = NULL; bc->plugins[bc->numPluginsLoaded].methods = NULL; *************** *** 155,159 **** { bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); ! dlclose(bc->plugins[bc->numPluginsLoaded].handle); bc->plugins[bc->numPluginsLoaded].handle = NULL; bc->plugins[bc->numPluginsLoaded].methods = NULL; --- 155,159 ---- { bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); ! lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); bc->plugins[bc->numPluginsLoaded].handle = NULL; bc->plugins[bc->numPluginsLoaded].methods = NULL; |
From: Robert K. <may...@us...> - 2001-07-09 19:47:15
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv17326 Modified Files: id3.c Log Message: This should make this file compile under FreeBSD Index: id3.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/id3.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** id3.c 2001/06/14 21:28:09 1.5 --- id3.c 2001/07/09 19:47:12 1.6 *************** *** 18,21 **** --- 18,22 ---- #else #include <netinet/in.h> + #include <sys/param.h> #endif |
From: Robert K. <may...@us...> - 2001-07-05 21:39:55
|
Update of /cvsroot/bitcollider/bitprint In directory usw-pr-cvs1:/tmp/cvs-serv25756 Modified Files: bitprint.c Log Message: Added safety check to make sure that people correctly define the endianess of the target platform. Index: bitprint.c =================================================================== RCS file: /cvsroot/bitcollider/bitprint/bitprint.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** bitprint.c 2001/07/05 20:42:40 1.2 --- bitprint.c 2001/07/05 21:39:52 1.3 *************** *** 6,10 **** /* =================================================================== */ ! /* Note: The actual code in this file starts around line 135! */ /* =================================================================== */ #include <string.h> --- 6,10 ---- /* =================================================================== */ ! /* Note: The actual code in this file starts around line 70! */ /* =================================================================== */ #include <string.h> *************** *** 17,20 **** --- 17,79 ---- /* =================================================================== */ + /* Endian issues */ + /* =================================================================== */ + + /* This section specifies the endianness of the target platform. Right + now, all windows platforms are little endian. However, for other platforms, + this assumption cannot be made. */ + + #ifdef _WIN32 + #undef WORDS_BIGENDIAN + #define SIZEOF_LONG 4 + #else + + #error Please define the endianness of the platform that will run this code. + /* Notes for non-windows users: + If you are using autoconf, then add the following lines to your + configure.in script: + + AC_C_BIGENDIAN + AC_CHECK_SIZEOF(long) + + and then, add these lines to your config.h.in file: + + #undef WORDS_BIGENDIAN + #undef SIZEOF_LONG + + and then, uncomment the line below and your endian issues should + be taken care of! + + #include "config.h" + + If you are not using autoconf, then define WORDS_BIGENDIAN if this code + will run on a big-endian machine. Also, define SIZEOF_LONG to be + the size of a long variable on your platform. Set it to 4 on a 32bit + processor and 8 on a 64 bit processor. + + */ + #endif + + #ifdef WORDS_BIGENDIAN + # define BIG_ENDIAN 1 + #else + # define BIG_ENDIAN 0 + #endif + + #ifdef WORDS_BIGENDIAN + # if SIZEOF_LONG == 4 + # define SHA_BYTE_ORDER 4321 + # elif SIZEOF_LONG == 8 + # define SHA_BYTE_ORDER 87654321 + # endif + #else + # if SIZEOF_LONG == 4 + # define SHA_BYTE_ORDER 1234 + # elif SIZEOF_LONG == 8 + # define SHA_BYTE_ORDER 12345678 + # endif + #endif + + /* =================================================================== */ /* FILE: sha1.h */ /* =================================================================== */ *************** *** 24,28 **** /* Applied Cryptography by Bruce Schneier */ /* This code is in the public domain */ - /* $Id$ */ typedef unsigned char BYTE; /* 8-bit quantity */ --- 83,86 ---- *************** *** 38,42 **** #define SHA_VERSION 1 - #define SHA_BYTE_ORDER 1234 /* =================================================================== */ --- 96,99 ---- *************** *** 404,413 **** * http://www.cs.technion.ac.il/~biham/Reports/Tiger/ */ - - #ifdef WORDS_BIGENDIAN - # define BIG_ENDIAN 1 - #else - # define BIG_ENDIAN 0 - #endif /* The following macro denotes that an optimization */ --- 461,464 ---- |
From: Robert K. <may...@us...> - 2001-07-05 20:42:43
|
Update of /cvsroot/bitcollider/bitprint In directory usw-pr-cvs1:/tmp/cvs-serv12700 Modified Files: bitprint.c bitprint.h Added Files: COPYING Log Message: Updated the file banners and included the COPYING file --- NEW FILE: COPYING --- (PD) 2001 The Bitzi Corporation 1. This work and others bearing the above label were created by, or on behalf of, the Bitzi Corporation. 2. The Bitzi Corporation places these works into the public domain, disclaiming all rights granted us by copyright law. You are completely free to copy, use, redistribute and modify this work, though you should be aware of points (3) and (4), below. 3. The Bitzi Corporation reserves all rights with regard to any of its trademarks which may appear herein, such as "Bitzi" or "Bitcollider". Please take care that your uses of this work do not infringe on our trademarks or imply our endorsement, for example by changing labels and identifying strings in your derivative works. 4. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Please see http://bitzi.com/publicdomain or write in...@bi... for more info. Index: bitprint.c =================================================================== RCS file: /cvsroot/bitcollider/bitprint/bitprint.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** bitprint.c 2001/07/05 20:24:15 1.1 --- bitprint.c 2001/07/05 20:42:40 1.2 *************** *** 1,4 **** --- 1,6 ---- /* (PD) 2001 The Bitzi Corporation * Please see http://bitzi.com/publicdomain for more info. + * + * $Id$ */ Index: bitprint.h =================================================================== RCS file: /cvsroot/bitcollider/bitprint/bitprint.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** bitprint.h 2001/07/05 20:24:14 1.1 --- bitprint.h 2001/07/05 20:42:40 1.2 *************** *** 1,6 **** - /* (PD) 2001 The Bitzi Corporation ! * Please see file COPYING or http://bitzi.com/publicdomain ! * for more info. * * $Id$ --- 1,4 ---- /* (PD) 2001 The Bitzi Corporation ! * Please see http://bitzi.com/publicdomain for more info. * * $Id$ |
From: Robert K. <may...@us...> - 2001-07-05 20:24:18
|
Update of /cvsroot/bitcollider/bitprint In directory usw-pr-cvs1:/tmp/cvs-serv5852 Log Message: Initial version. Status: Vendor Tag: bitzi Release Tags: start N bitprint/bitprint.h N bitprint/bitprint.c No conflicts created by this import ***** Bogus filespec: - ***** Bogus filespec: Imported ***** Bogus filespec: sources |
From: Robert K. <may...@us...> - 2001-06-18 07:27:20
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv692/lib Modified Files: main.c Log Message: Trying to get rid of more warnings... Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** main.c 2001/05/18 01:00:54 1.22 --- main.c 2001/06/18 07:27:17 1.23 *************** *** 609,613 **** unsigned char shaHash[SHA_DIGESTSIZE]; b_bool ret = true; ! Context context = NULL; tt_init(&tcontext); --- 609,613 ---- unsigned char shaHash[SHA_DIGESTSIZE]; b_bool ret = true; ! Context *context = NULL; tt_init(&tcontext); |
From: Robert K. <may...@us...> - 2001-06-18 07:27:20
|
Update of /cvsroot/bitcollider/bitcollider/wav In directory usw-pr-cvs1:/tmp/cvs-serv692/wav Modified Files: wav.c Log Message: Trying to get rid of more warnings... Index: wav.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/wav/wav.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** wav.c 2001/06/18 07:08:23 1.8 --- wav.c 2001/06/18 07:27:17 1.9 *************** *** 24,31 **** static const char *wav_get_version(void); static Context *wav_analyze_init(void); ! static void wav_analyze_update(Context context, const unsigned char *buf, unsigned bufLen); ! static Attribute *wav_analyze_final(Context context); static char *wav_get_error(void); --- 24,31 ---- static const char *wav_get_version(void); static Context *wav_analyze_init(void); ! static void wav_analyze_update(Context *context, const unsigned char *buf, unsigned bufLen); ! static Attribute *wav_analyze_final(Context *context); static char *wav_get_error(void); *************** *** 122,126 **** 24 4 bytes <sample rate> // Samples per second: e.g., 44100 */ ! static void wav_analyze_update(Context contextArg, const unsigned char *buf, unsigned bufLen) --- 122,126 ---- 24 4 bytes <sample rate> // Samples per second: e.g., 44100 */ ! static void wav_analyze_update(Context *contextArg, const unsigned char *buf, unsigned bufLen) *************** *** 186,190 **** } ! static Attribute *wav_analyze_final(Context contextArg) { WavContext *context = (WavContext *)contextArg; --- 186,190 ---- } ! static Attribute *wav_analyze_final(Context *contextArg) { WavContext *context = (WavContext *)contextArg; |
From: Robert K. <may...@us...> - 2001-06-18 07:27:20
|
Update of /cvsroot/bitcollider/bitcollider/include In directory usw-pr-cvs1:/tmp/cvs-serv692/include Modified Files: plugin.h Log Message: Trying to get rid of more warnings... Index: plugin.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/plugin.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** plugin.h 2001/06/18 07:08:23 1.6 --- plugin.h 2001/06/18 07:27:17 1.7 *************** *** 26,30 **** } Attribute; ! typedef void *Context; typedef struct _PluginMethods --- 26,30 ---- } Attribute; ! typedef void Context; typedef struct _PluginMethods *************** *** 39,46 **** Context *(*mem_analyze_init) (void); ! void (*mem_analyze_update) (Context context, ! const unsigned char *, ! unsigned bufLen); ! Attribute *(*mem_analyze_final) (Context context); void (*free_attributes) (Attribute *attrList); --- 39,46 ---- Context *(*mem_analyze_init) (void); ! void (*mem_analyze_update) (Context *context, ! const unsigned char *buf, ! unsigned bufLen); ! Attribute *(*mem_analyze_final) (Context *context); void (*free_attributes) (Attribute *attrList); |
From: Robert K. <may...@us...> - 2001-06-18 07:08:27
|
Update of /cvsroot/bitcollider/bitcollider/include In directory usw-pr-cvs1:/tmp/cvs-serv29463/include Modified Files: plugin.h Log Message: Fixed some stupid warnings that have been bugging me... Index: plugin.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/plugin.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** plugin.h 2001/03/19 23:38:29 1.5 --- plugin.h 2001/06/18 07:08:23 1.6 *************** *** 38,42 **** Attribute *(*file_analyze) (const char *fileName); ! Context (*mem_analyze_init) (void); void (*mem_analyze_update) (Context context, const unsigned char *, --- 38,42 ---- Attribute *(*file_analyze) (const char *fileName); ! Context *(*mem_analyze_init) (void); void (*mem_analyze_update) (Context context, const unsigned char *, |
From: Robert K. <may...@us...> - 2001-06-18 07:08:27
|
Update of /cvsroot/bitcollider/bitcollider/wav In directory usw-pr-cvs1:/tmp/cvs-serv29463/wav Modified Files: wav.c Log Message: Fixed some stupid warnings that have been bugging me... Index: wav.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/wav/wav.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** wav.c 2001/03/21 01:44:17 1.7 --- wav.c 2001/06/18 07:08:23 1.8 *************** *** 23,27 **** static const char *wav_get_name(void); static const char *wav_get_version(void); ! static Context wav_analyze_init(void); static void wav_analyze_update(Context context, const unsigned char *buf, --- 23,27 ---- static const char *wav_get_name(void); static const char *wav_get_version(void); ! static Context *wav_analyze_init(void); static void wav_analyze_update(Context context, const unsigned char *buf, *************** *** 105,109 **** } ! static Context wav_analyze_init(void) { WavContext *context; --- 105,109 ---- } ! static Context *wav_analyze_init(void) { WavContext *context; *************** *** 113,117 **** sha_init(&context->audioSha1); ! return (Context)context; } --- 113,117 ---- sha_init(&context->audioSha1); ! return (Context *)context; } |
From: Robert K. <may...@us...> - 2001-06-16 03:28:45
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv29769 Modified Files: dirsearch.c Log Message: Finished fixing the bug from Scott Hernandez where the bitcollider was crashing on compressed directories. Index: dirsearch.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/dirsearch.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** dirsearch.c 2001/06/16 03:17:51 1.3 --- dirsearch.c 2001/06/16 03:28:43 1.4 *************** *** 154,158 **** /* If its not a directory, then remove everything after the last slash */ ! if ((GetFileAttributes(savedPath) & FILE_ATTRIBUTE_DIRECTORY) != 0) { char *ptr; --- 154,158 ---- /* If its not a directory, then remove everything after the last slash */ ! if ((GetFileAttributes(savedPath) & FILE_ATTRIBUTE_DIRECTORY) == 0) { char *ptr; |
From: Robert K. <may...@us...> - 2001-06-16 03:17:54
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv28086 Modified Files: dirsearch.c Log Message: Fixed an issue where GetFileAttributes was used wrongly Index: dirsearch.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/dirsearch.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** dirsearch.c 2001/04/05 23:38:13 1.2 --- dirsearch.c 2001/06/16 03:17:51 1.3 *************** *** 146,150 **** /* if a path was specified, then add a \*.* */ ! if (GetFileAttributes(newPath) == FILE_ATTRIBUTE_DIRECTORY) strcat(newPath, "\\*.*"); --- 146,150 ---- /* if a path was specified, then add a \*.* */ ! if ((GetFileAttributes(newPath) & FILE_ATTRIBUTE_DIRECTORY) != 0) strcat(newPath, "\\*.*"); *************** *** 154,158 **** /* If its not a directory, then remove everything after the last slash */ ! if (GetFileAttributes(savedPath) != FILE_ATTRIBUTE_DIRECTORY) { char *ptr; --- 154,158 ---- /* If its not a directory, then remove everything after the last slash */ ! if ((GetFileAttributes(savedPath) & FILE_ATTRIBUTE_DIRECTORY) != 0) { char *ptr; |
From: Robert K. <may...@us...> - 2001-06-14 23:05:53
|
Update of /cvsroot/bitcollider/bitcollider/image In directory usw-pr-cvs1:/tmp/cvs-serv2531 Modified Files: image.c Log Message: Updated image.c -- it now supports bmp, gif and jpg! Index: image.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/image/image.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** image.c 2001/06/06 21:49:04 1.3 --- image.c 2001/06/14 23:05:49 1.4 *************** *** 1,306 **** ! /* (PD) 2001 Mark Nelson [delirium] -> del...@th... ! * Please see file COPYING or http://bitzi.com/publicdomain ! * for more info. ! * ! * v0.1.0 - 30 May 2001 - Initial version, supports BMP (Bitmaps) ! * v0.1.1 - 01 Jun 2001 - Added endian-safe portable input functions ! * v0.2.0 - 04 Jun 2001 - Added support for GIF (CompuServe Graphics Interchange Format) ! */ ! ! #include <stdio.h> ! #include <string.h> ! #include <stdlib.h> ! #include <assert.h> ! #include <errno.h> ! ! #include "plugin.h" ! ! ! /*--32-bit Specific Definitions of Portable Data Types---------------------*/ ! ! typedef unsigned char uint8; ! typedef unsigned short uint16; ! typedef unsigned uint32; ! ! /*--Prototypes-------------------------------------------------------------*/ ! ! /* external plugin functions */ ! PluginMethods *init_plugin(void); ! static void image_shutdown_plugin(void); ! static void image_free_attributes(Attribute *attrList); ! static SupportedFormat *image_get_supported_formats(void); ! static const char *image_get_name(void); ! static const char *image_get_version(void); ! static char *image_get_error(void); ! static Attribute *image_file_analyze(const char *fileName); ! ! /* datafile parsing functions */ ! int parse_bmp(FILE *file, uint32 *width, uint32 *height, uint16 *bpp); ! int parse_gif(FILE *file, uint32 *width, uint32 *height, uint16 *bpp); ! ! /* endian-safe input functions */ ! uint8 read_8(FILE *file); ! uint16 read_16_big_endian(FILE *file); ! uint16 read_16_little_endian(FILE *file); ! uint32 read_32_big_endian(FILE *file); ! uint32 read_32_little_endian(FILE *file); ! ! /*--Plugin Parameters------------------------------------------------------*/ ! ! #define PLUGIN_VERSION "0.2.0" ! #define PLUGIN_NAME "Image metadata (BMP, GIF)" ! #define NUM_ATTRS 4 ! ! /*--Cross Platform Foo-----------------------------------------------------*/ ! ! #ifdef _WIN32 ! #define strcasecmp stricmp ! #undef WORDS_BIGENDIAN ! #else ! #include "../config.h" ! #endif ! ! #ifdef WORDS_BIGENDIAN ! # define BIGENDIAN 1 ! #else ! # define BIGENDIAN 0 ! #endif ! ! /*--Plugin Info------------------------------------------------------------*/ ! ! static SupportedFormat formats[] = ! { ! { ".bmp", "BMP (Windows Bitmap) image" }, ! { ".gif", "GIF (CompuServe Graphics Interchange Format) image" }, ! { NULL , NULL } ! }; ! ! static char *errorString = NULL; ! ! static PluginMethods methods = ! { ! image_shutdown_plugin, ! image_get_version, ! image_get_name, ! image_get_supported_formats, ! image_file_analyze, ! NULL, /* no init/update/final */ ! NULL, ! NULL, ! image_free_attributes, ! image_get_error ! }; ! ! /*--Externally-called Plugin Functions-------------------------------------*/ ! ! PluginMethods *init_plugin(void) ! { ! return &methods; ! } ! ! static void image_shutdown_plugin(void) ! { ! if (errorString) ! free(errorString); ! } ! ! static const char *image_get_version(void) ! { ! return PLUGIN_VERSION; ! } ! ! static const char *image_get_name(void) ! { ! return PLUGIN_NAME; ! } ! ! static SupportedFormat *image_get_supported_formats(void) ! { ! return formats; ! } ! ! static Attribute *image_file_analyze(const char *fileName) ! { ! FILE *file; ! Attribute *attrList; ! char temp[100]; ! char *ext; ! int errorcode = 1; ! ! uint32 width; ! uint32 height; ! uint16 bpp; ! ! file = fopen(fileName, "rb"); ! if(file == NULL) ! return NULL; ! ! ext = strrchr(fileName, '.'); ! ! if(strcasecmp(ext,".bmp") == 0) ! errorcode = parse_bmp(file, &width, &height, &bpp); ! else if(strcasecmp(ext, ".gif") == 0) ! errorcode = parse_gif(file, &width, &height, &bpp); ! ! fclose(file); ! ! if(errorcode || width==0 || height==0 || bpp==0) ! return NULL; ! ! /* by this point we should have valid info, so return it */ ! attrList = malloc(sizeof(Attribute) * NUM_ATTRS); ! memset(attrList, 0, sizeof(Attribute) * NUM_ATTRS); ! ! sprintf(temp, "%d", width); ! attrList[0].key = strdup("tag.image.width"); ! attrList[0].value = strdup(temp); ! ! sprintf(temp, "%d", height); ! attrList[1].key = strdup("tag.image.height"); ! attrList[1].value = strdup(temp); ! ! sprintf(temp, "%d", bpp); ! attrList[2].key = strdup("tag.image.bpp"); ! attrList[2].value = strdup(temp); ! ! return attrList; ! } ! ! static void image_free_attributes(Attribute *attrList) ! { ! int i; ! ! for(i = 0; i < NUM_ATTRS; i++) ! { ! if (attrList[i].key) ! free(attrList[i].key); ! if (attrList[i].value) ! free(attrList[i].value); ! } ! ! free(attrList); ! } ! ! static char *image_get_error(void) ! { ! return errorString; ! } ! ! /*--Functions to Parse Files for Width/Height/BPP info---------------------*/ ! ! /* All functions return 0 on success and 1 if file is not a valid file of that type */ ! ! int parse_bmp(FILE *file, uint32 *width, uint32 *height, uint16 *bpp) ! { ! /* File must start with "BM" */ ! if(read_8(file) != 'B' || read_8(file) != 'M') ! return 1; ! ! fseek(file, 16L, SEEK_CUR); ! ! #if BIGENDIAN ! *width = read_32_big_endian(file); ! *height = read_32_big_endian(file); ! fseek(file, 2L, SEEK_CUR); ! *bpp = read_16_big_endian(file); ! #else ! *width = read_32_little_endian(file); ! *height = read_32_little_endian(file); ! fseek(file, 2L, SEEK_CUR); ! *bpp = read_16_little_endian(file); ! #endif ! ! return 0; ! } ! ! int parse_gif(FILE *file, uint32 *width, uint32 *height, uint16 *bpp) ! { ! unsigned char packed; ! uint16 bpp1, bpp2; ! ! /* File must start with "GIF" */ ! if(read_8(file) != 'G' || read_8(file) != 'I' || read_8(file) != 'F') ! return 1; ! ! fseek(file, 3L, SEEK_CUR); ! #if BIGENDIAN ! *width = (uint32) read_16_big_endian(file); ! *height = (uint32) read_16_big_endian(file); ! #else ! *width = (uint32) read_16_little_endian(file); ! *height = (uint32) read_16_little_endian(file); ! #endif ! ! /* packed byte: ! Bits 8 and 5 are flags we don't need to worry about; ! bits 6-8 and 1-3 are 3-bit descriptions of the number of bits, ! minus 1, of "color resolution" and "bits per pixel" respectively. ! Usually these values are the same, but if they're not, take the ! larger of the two to be "bpp," since this is what standard ! image editing programs seem to do. I don't know why. ! */ ! packed = read_8(file); ! bpp1 = ((packed & 0x70) >> 4) + 1; ! bpp2 = (packed & 0x07) + 1; ! ! if(bpp1 > bpp2) ! *bpp = bpp1; ! else ! *bpp = bpp2; ! ! return 0; ! } ! ! /*--Endian-Safe Input Functions--------------------------------------------*/ ! ! uint8 read_8(FILE *file) ! { ! uint8 a; ! ! if((a=getc(file))==(uint8)EOF) ! return 0; ! ! return a; ! } ! ! uint16 read_16_big_endian(FILE *file) ! { ! uint16 a,b; ! ! if((a=getc(file))==(uint16)EOF || (b=getc(file))==(uint16)EOF) ! return 0; ! ! return ((a<<8) + b); ! } ! ! uint16 read_16_little_endian(FILE *file) ! { ! uint16 a,b; ! ! if((a=getc(file))==(uint16)EOF || (b=getc(file))==(uint16)EOF) ! return 0; ! ! return ((b<<8) + a); ! } ! ! uint32 read_32_big_endian(FILE *file) ! { ! uint32 a,b,c,d; ! ! if((a=getc(file))==(uint32)EOF || (b=getc(file))==(uint32)EOF || ! (c=getc(file))==(uint32)EOF || (d=getc(file))==(uint32)EOF) ! return 0; ! ! return ((a<<24) + (b<<16) + (c<<8) + d); ! } ! ! uint32 read_32_little_endian(FILE *file) ! { ! uint32 a,b,c,d; ! ! if((a=getc(file))==(uint32)EOF || (b=getc(file))==(uint32)EOF || ! (c=getc(file))==(uint32)EOF || (d=getc(file))==(uint32)EOF) ! return 0; ! ! return ((d<<24) + (c<<16) + (b<<8) + a); ! } --- 1,377 ---- ! /* (PD) 2001 Mark Nelson [delirium] -> del...@th... ! * Please see file COPYING or http://bitzi.com/publicdomain ! * for more info. ! * ! * Revision history: ! * v0.1.0 - 30 May 2001 - Initial version, supports BMP (Bitmaps) ! * v0.1.1 - 01 Jun 2001 - Added endian-safe portable input functions ! * v0.2.0 - 04 Jun 2001 - Added support for GIF (CompuServe Graphics Interchange Format) ! * v0.3.0 - 13 Jun 2001 - Added support for JPEG/JFIF ! */ ! ! #include <stdio.h> ! #include <string.h> ! #include <stdlib.h> ! #include <assert.h> ! #include <errno.h> ! ! #include "plugin.h" ! ! ! /*--32-bit Specific Definitions of Portable Data Types---------------------*/ ! ! typedef unsigned char uint8; ! typedef unsigned short uint16; ! typedef unsigned uint32; ! ! /*--Prototypes-------------------------------------------------------------*/ ! ! /* external plugin functions */ ! PluginMethods *init_plugin(void); ! static void image_shutdown_plugin(void); ! static void image_free_attributes(Attribute *attrList); ! static SupportedFormat *image_get_supported_formats(void); ! static const char *image_get_name(void); ! static const char *image_get_version(void); ! static char *image_get_error(void); ! static Attribute *image_file_analyze(const char *fileName); ! ! /* datafile parsing functions */ ! int parse_bmp(FILE *file, uint32 *width, uint32 *height, uint16 *bpp); ! int parse_gif(FILE *file, uint32 *width, uint32 *height, uint16 *bpp); ! int parse_jpg(FILE *file, uint32 *width, uint32 *height, uint16 *bpp); ! ! /* endian-safe input functions */ ! uint8 read_8(FILE *file); ! uint16 read_16_big_endian(FILE *file); ! uint16 read_16_little_endian(FILE *file); ! uint32 read_32_big_endian(FILE *file); ! uint32 read_32_little_endian(FILE *file); ! ! /*--Plugin Parameters------------------------------------------------------*/ ! ! #define PLUGIN_VERSION "0.3.0" ! #define PLUGIN_NAME "Image metadata (BMP, GIF, JPEG)" ! #define NUM_ATTRS 4 ! ! /*--Cross Platform Foo-----------------------------------------------------*/ ! ! #ifdef _WIN32 ! #define strcasecmp stricmp ! #else ! #include "../config.h" ! #endif ! ! /*--Plugin Info------------------------------------------------------------*/ ! ! static SupportedFormat formats[] = ! { ! { ".bmp" , "Windows Bitmap image" }, ! { ".gif" , "CompuServe Graphics Interchange Format (GIF) image" }, ! { ".jpg" , "JPEG/JFIF compressed image" }, ! { ".jpeg", "JPEG/JFIF compressed image" }, ! { NULL , NULL } ! }; ! ! static char *errorString = NULL; ! ! static PluginMethods methods = ! { ! image_shutdown_plugin, ! image_get_version, ! image_get_name, ! image_get_supported_formats, ! image_file_analyze, ! NULL, /* no init/update/final */ ! NULL, ! NULL, ! image_free_attributes, ! image_get_error ! }; ! ! /*--Externally-called Plugin Functions-------------------------------------*/ ! ! PluginMethods *init_plugin(void) ! { ! return &methods; ! } ! ! static void image_shutdown_plugin(void) ! { ! if (errorString) ! free(errorString); ! } ! ! static const char *image_get_version(void) ! { ! return PLUGIN_VERSION; ! } ! ! static const char *image_get_name(void) ! { ! return PLUGIN_NAME; ! } ! ! static SupportedFormat *image_get_supported_formats(void) ! { ! return formats; ! } ! ! static Attribute *image_file_analyze(const char *fileName) ! { ! FILE *file; ! Attribute *attrList; ! char temp[100]; ! char *ext; ! int errorcode = 1; ! ! uint32 width; ! uint32 height; ! uint16 bpp; ! ! file = fopen(fileName, "rb"); ! if(file == NULL) ! return NULL; ! ! ext = strrchr(fileName, '.'); ! ! if(strcasecmp(ext,".bmp") == 0) ! errorcode = parse_bmp(file, &width, &height, &bpp); ! else if(strcasecmp(ext, ".gif") == 0) ! errorcode = parse_gif(file, &width, &height, &bpp); ! else if(strcasecmp(ext, ".jpg") == 0) ! errorcode = parse_jpg(file, &width, &height, &bpp); ! else if(strcasecmp(ext, ".jpeg") == 0) ! errorcode = parse_jpg(file, &width, &height, &bpp); ! ! fclose(file); ! ! if(errorcode || width==0 || height==0 || bpp==0) ! return NULL; ! ! /* by this point we should have valid info, so return it */ ! attrList = malloc(sizeof(Attribute) * NUM_ATTRS); ! memset(attrList, 0, sizeof(Attribute) * NUM_ATTRS); ! ! sprintf(temp, "%d", width); ! attrList[0].key = strdup("tag.image.width"); ! attrList[0].value = strdup(temp); ! ! sprintf(temp, "%d", height); ! attrList[1].key = strdup("tag.image.height"); ! attrList[1].value = strdup(temp); ! ! sprintf(temp, "%d", bpp); ! attrList[2].key = strdup("tag.image.bpp"); ! attrList[2].value = strdup(temp); ! ! return attrList; ! } ! ! static void image_free_attributes(Attribute *attrList) ! { ! int i; ! ! for(i = 0; i < NUM_ATTRS; i++) ! { ! if (attrList[i].key) ! free(attrList[i].key); ! if (attrList[i].value) ! free(attrList[i].value); ! } ! ! free(attrList); ! } ! ! static char *image_get_error(void) ! { ! return errorString; ! } ! ! /*--Functions to Parse Files for Width/Height/BPP info---------------------*/ ! ! /* All functions return 0 on success and 1 if file is not a valid file of that type */ ! ! int parse_bmp(FILE *file, uint32 *width, uint32 *height, uint16 *bpp) ! { ! /* File must start with "BM" */ ! if(read_8(file) != 'B' || read_8(file) != 'M') ! return 1; ! ! fseek(file, 16L, SEEK_CUR); ! ! *width = read_32_little_endian(file); ! *height = read_32_little_endian(file); ! fseek(file, 2L, SEEK_CUR); ! *bpp = read_16_little_endian(file); ! ! return 0; ! } ! ! int parse_gif(FILE *file, uint32 *width, uint32 *height, uint16 *bpp) ! { ! unsigned char packed; ! uint16 bpp1, bpp2; ! ! /* File must start with "GIF" */ ! if(read_8(file) != 'G' || read_8(file) != 'I' || read_8(file) != 'F') ! return 1; ! ! fseek(file, 3L, SEEK_CUR); ! *width = (uint32) read_16_little_endian(file); ! *height = (uint32) read_16_little_endian(file); ! ! /* packed byte: ! Bits 8 and 5 are flags we don't need to worry about; ! bits 6-8 and 1-3 are 3-bit descriptions of the number of bits, ! minus 1, of "color resolution" and "bits per pixel" respectively. ! Usually these values are the same, but if they're not, take the ! larger of the two to be "bpp," since this is what standard ! image editing programs seem to do. I don't know why. ! */ ! packed = read_8(file); ! bpp1 = ((packed & 0x70) >> 4) + 1; ! bpp2 = (packed & 0x07) + 1; ! ! if(bpp1 > bpp2) ! *bpp = bpp1; ! else ! *bpp = bpp2; ! ! return 0; ! } ! ! int parse_jpg(FILE *file, uint32 *width, uint32 *height, uint16 *bpp) ! { ! uint16 bytes_left=0; ! ! /* File must start with 0xFFD8FFE0, <2 byte field length>, "JFIF", 0x00 */ ! if(read_8(file) != 0xFF || read_8(file) != 0xD8 || ! read_8(file) != 0xFF || read_8(file) != 0xE0) ! return 1; ! ! bytes_left = read_16_big_endian(file); ! bytes_left -= 2; /* the 2 bytes of the field length indicator itself count */ ! ! if(read_8(file) != 'J' || read_8(file) != 'F' || read_8(file) != 'I' || ! read_8(file) != 'F' || read_8(file) != 0x00) ! return 1; ! ! bytes_left -= 5; ! ! /* skip past the rest of the JFIF indicator field */ ! fseek(file, bytes_left, SEEK_CUR); ! ! /* now we parse the file for the image information field. JPEG fields ! have the general structure of: 0xFF, <1 byte field type>, <2 byte field ! length>, <x byte field data> */ ! while(!feof(file)) ! { ! uint8 type, samples, bits_per_sample; ! ! /* if there's no 0xFF marker, JPEG file is malformed */ ! if(read_8(file) != 0xFF) ! return 1; ! /* JPEG files are sometimes padded with sequential 0xFF bytes */ ! do ! { ! type = read_8(file); ! } while (type == 0xFF); ! ! switch (type) { ! /* image information fields (for various types of compression) */ ! case 0xC0: ! case 0xC1: ! case 0xC2: ! case 0xC3: ! case 0xC5: ! case 0xC6: ! case 0xC7: ! case 0xC9: ! case 0xCA: ! case 0xCB: ! case 0xCD: ! case 0xCE: ! case 0xCF: ! fseek(file, 2L, SEEK_CUR); /* skip the field length */ ! bits_per_sample = read_8(file); ! *height = (uint32) read_16_big_endian(file); ! *width = (uint32) read_16_big_endian(file); ! samples = read_8(file); ! *bpp = (uint16) samples * bits_per_sample; ! return 0; ! ! case 0xD9: /* if end of image, */ ! case 0xDA: /* or beginning of compressed data, */ ! return 1; /* there was no image info (or we missed it) */ ! ! /* if any other field, we don't care, so skip past it */ ! default: ! bytes_left = read_16_big_endian(file); ! /* since the length takes 2 bytes, length must be >= 2 */ ! if (bytes_left < 2) ! return 1; ! bytes_left -= 2; ! ! /* skip the rest of the field and go on the next one */ ! fseek(file, bytes_left, SEEK_CUR); ! break; ! } ! } ! return 1; ! } ! ! /*--Endian-Safe Input Functions--------------------------------------------*/ ! ! uint8 read_8(FILE *file) ! { ! uint8 a; ! ! a=getc(file); ! ! return a; ! } ! ! uint16 read_16_big_endian(FILE *file) ! { ! uint16 a,b; ! ! a=getc(file); ! b=getc(file); ! ! return ((a<<8) + b); ! } ! ! uint16 read_16_little_endian(FILE *file) ! { ! uint16 a,b; ! ! a=getc(file); ! b=getc(file); ! ! return ((b<<8) + a); ! } ! ! uint32 read_32_big_endian(FILE *file) ! { ! uint32 a,b,c,d; ! ! a=getc(file); ! b=getc(file); ! c=getc(file); ! d=getc(file); ! ! return ((a<<24) + (b<<16) + (c<<8) + d); ! } ! ! uint32 read_32_little_endian(FILE *file) ! { ! uint32 a,b,c,d; ! ! a=getc(file); ! b=getc(file); ! c=getc(file); ! d=getc(file); ! ! return ((d<<24) + (c<<16) + (b<<8) + a); ! } |
From: Robert K. <may...@us...> - 2001-06-14 21:28:12
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv15974 Modified Files: id3.c Log Message: Added some sanity checking for frame sizes. If the frame size claims to be larger than the filesize, skip the frame... Index: id3.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/id3.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** id3.c 2001/05/09 23:08:29 1.4 --- id3.c 2001/06/14 21:28:09 1.5 *************** *** 200,205 **** ID3Info *info = NULL; int ret; ! int size; ! unsigned int frameSize = 0; inFile = fopen(fileName, "rb"); --- 200,204 ---- ID3Info *info = NULL; int ret; ! unsigned int size, frameSize = 0, fileSize = 0; inFile = fopen(fileName, "rb"); *************** *** 207,210 **** --- 206,213 ---- return NULL; + ret = fseek(inFile, 0, SEEK_END); + fileSize = ftell(inFile); + fseek(inFile, 0, SEEK_SET); + ret = fread(&head, 1, sizeof(ID3Header), inFile); if (ret != sizeof(ID3Header)) *************** *** 230,233 **** --- 233,244 ---- ((head.size[1] & 0x7F) << 14) | ((head.size[0] & 0x7F) << 21); + + // Check to make sure that the size we calculate are sane! + if (size > fileSize) + { + fclose(inFile); + return NULL; + } + if (head.flags & (1 << 6)) { *************** *** 276,280 **** frameSize = ntohl(frame_v2_3.size); } ! if (frameSize == 0) break; --- 287,293 ---- frameSize = ntohl(frame_v2_3.size); } ! ! // If the frame size is funky, skip it and move on ! if (frameSize == 0 || frameSize > fileSize) break; |
From: Robert K. <may...@us...> - 2001-06-06 21:49:07
|
Update of /cvsroot/bitcollider/bitcollider/image In directory usw-pr-cvs1:/tmp/cvs-serv21991/image Modified Files: image.c Log Message: Ooops, the last checkin didn't get my endian changes Index: image.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/image/image.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** image.c 2001/06/06 21:22:50 1.2 --- image.c 2001/06/06 21:49:04 1.3 *************** *** 61,64 **** --- 61,70 ---- #endif + #ifdef WORDS_BIGENDIAN + # define BIGENDIAN 1 + #else + # define BIGENDIAN 0 + #endif + /*--Plugin Info------------------------------------------------------------*/ *************** *** 192,201 **** fseek(file, 16L, SEEK_CUR); - *width = read_32_little_endian(file); *height = read_32_little_endian(file); - fseek(file, 2L, SEEK_CUR); *bpp = read_16_little_endian(file); return 0; --- 198,213 ---- fseek(file, 16L, SEEK_CUR); + #if BIGENDIAN + *width = read_32_big_endian(file); + *height = read_32_big_endian(file); + fseek(file, 2L, SEEK_CUR); + *bpp = read_16_big_endian(file); + #else + *width = read_32_little_endian(file); *height = read_32_little_endian(file); fseek(file, 2L, SEEK_CUR); *bpp = read_16_little_endian(file); + #endif return 0; *************** *** 212,218 **** fseek(file, 3L, SEEK_CUR); *width = (uint32) read_16_little_endian(file); - *height = (uint32) read_16_little_endian(file); /* packed byte: --- 224,234 ---- fseek(file, 3L, SEEK_CUR); + #if BIGENDIAN + *width = (uint32) read_16_big_endian(file); + *height = (uint32) read_16_big_endian(file); + #else *width = (uint32) read_16_little_endian(file); *height = (uint32) read_16_little_endian(file); + #endif /* packed byte: |
From: Robert K. <may...@us...> - 2001-06-06 21:22:53
|
Update of /cvsroot/bitcollider/bitcollider/image In directory usw-pr-cvs1:/tmp/cvs-serv16801/image Modified Files: image.c Log Message: Checked in the new image plugin from delirium Index: image.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/image/image.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** image.c 2001/05/31 21:57:38 1.1 --- image.c 2001/06/06 21:22:50 1.2 *************** *** 4,7 **** --- 4,9 ---- * * v0.1.0 - 30 May 2001 - Initial version, supports BMP (Bitmaps) + * v0.1.1 - 01 Jun 2001 - Added endian-safe portable input functions + * v0.2.0 - 04 Jun 2001 - Added support for GIF (CompuServe Graphics Interchange Format) */ *************** *** 14,19 **** #include "plugin.h" - /*-------------------------------------------------------------------------*/ PluginMethods *init_plugin(void); static void image_shutdown_plugin(void); --- 16,29 ---- #include "plugin.h" + /*--32-bit Specific Definitions of Portable Data Types---------------------*/ + + typedef unsigned char uint8; + typedef unsigned short uint16; + typedef unsigned uint32; + + /*--Prototypes-------------------------------------------------------------*/ + + /* external plugin functions */ PluginMethods *init_plugin(void); static void image_shutdown_plugin(void); *************** *** 23,48 **** static const char *image_get_version(void); static char *image_get_error(void); ! static Attribute *image_file_analyze(const char *fileName); ! /*-------------------------------------------------------------------------*/ ! #define PLUGIN_VERSION "0.1.0" ! #define PLUGIN_NAME "Image metadata (supports: BMP)" #define NUM_ATTRS 4 ! /*-------------------------------------------------------------------------*/ ! typedef int int32; ! typedef unsigned uint32; ! typedef short int16; ! typedef unsigned short uint16; ! /*-------------------------------------------------------------------------*/ static SupportedFormat formats[] = { ! { ".bmp", "BMP (Bitmap) format" }, ! { NULL, NULL } }; static char *errorString = NULL; --- 33,73 ---- static const char *image_get_version(void); static char *image_get_error(void); ! static Attribute *image_file_analyze(const char *fileName); ! /* datafile parsing functions */ ! int parse_bmp(FILE *file, uint32 *width, uint32 *height, uint16 *bpp); ! int parse_gif(FILE *file, uint32 *width, uint32 *height, uint16 *bpp); ! ! /* endian-safe input functions */ ! uint8 read_8(FILE *file); ! uint16 read_16_big_endian(FILE *file); ! uint16 read_16_little_endian(FILE *file); ! uint32 read_32_big_endian(FILE *file); ! uint32 read_32_little_endian(FILE *file); ! /*--Plugin Parameters------------------------------------------------------*/ ! ! #define PLUGIN_VERSION "0.2.0" ! #define PLUGIN_NAME "Image metadata (BMP, GIF)" #define NUM_ATTRS 4 ! /*--Cross Platform Foo-----------------------------------------------------*/ ! #ifdef _WIN32 ! #define strcasecmp stricmp ! #undef WORDS_BIGENDIAN ! #else ! #include "../config.h" ! #endif ! /*--Plugin Info------------------------------------------------------------*/ static SupportedFormat formats[] = { ! { ".bmp", "BMP (Windows Bitmap) image" }, ! { ".gif", "GIF (CompuServe Graphics Interchange Format) image" }, ! { NULL , NULL } }; + static char *errorString = NULL; *************** *** 61,65 **** }; ! /*-------------------------------------------------------------------------*/ PluginMethods *init_plugin(void) --- 86,90 ---- }; ! /*--Externally-called Plugin Functions-------------------------------------*/ PluginMethods *init_plugin(void) *************** *** 94,101 **** Attribute *attrList; char temp[100]; ! uint16 type; ! int32 width; ! int32 height; uint16 bpp; --- 119,127 ---- Attribute *attrList; char temp[100]; + char *ext; + int errorcode = 1; ! uint32 width; ! uint32 height; uint16 bpp; *************** *** 104,141 **** return NULL; ! attrList = malloc(sizeof(Attribute) * NUM_ATTRS); ! memset(attrList, 0, sizeof(Attribute) * NUM_ATTRS); ! /* read in the type header and check if it's a valid BMP */ ! if(fread(&type, sizeof(uint16), 1, file) < 1) ! { ! fclose(file); ! return NULL; ! } ! /* type header must be "MB" ("BM" stored big-endian) */ ! if(type != 0x4D42) ! { ! fclose(file); ! return NULL; ! } ! fseek(file, 16L, SEEK_CUR); /* seek to width info */ ! if(fread(&width, sizeof(int32), 1, file) < 1) ! { ! fclose(file); ! return NULL; ! } ! if(fread(&height, sizeof(int32), 1, file) < 1) /* height immediately follows */ ! { ! fclose(file); ! return NULL; ! } ! fseek(file, 2L, SEEK_CUR); /* seek to color depth (bpp) info */ ! if(fread(&bpp, sizeof(uint16), 1, file) < 1) ! { ! fclose(file); return NULL; - } sprintf(temp, "%d", width); attrList[0].key = strdup("tag.image.width"); --- 130,149 ---- return NULL; ! ext = strrchr(fileName, '.'); ! if(strcasecmp(ext,".bmp") == 0) ! errorcode = parse_bmp(file, &width, &height, &bpp); ! else if(strcasecmp(ext, ".gif") == 0) ! errorcode = parse_gif(file, &width, &height, &bpp); ! fclose(file); ! ! if(errorcode || width==0 || height==0 || bpp==0) return NULL; + /* by this point we should have valid info, so return it */ + attrList = malloc(sizeof(Attribute) * NUM_ATTRS); + memset(attrList, 0, sizeof(Attribute) * NUM_ATTRS); + sprintf(temp, "%d", width); attrList[0].key = strdup("tag.image.width"); *************** *** 150,155 **** attrList[2].value = strdup(temp); - fclose(file); - return attrList; } --- 158,161 ---- *************** *** 175,176 **** --- 181,290 ---- } + /*--Functions to Parse Files for Width/Height/BPP info---------------------*/ + + /* All functions return 0 on success and 1 if file is not a valid file of that type */ + + int parse_bmp(FILE *file, uint32 *width, uint32 *height, uint16 *bpp) + { + /* File must start with "BM" */ + if(read_8(file) != 'B' || read_8(file) != 'M') + return 1; + + fseek(file, 16L, SEEK_CUR); + *width = read_32_little_endian(file); + + *height = read_32_little_endian(file); + + fseek(file, 2L, SEEK_CUR); + *bpp = read_16_little_endian(file); + + return 0; + } + + int parse_gif(FILE *file, uint32 *width, uint32 *height, uint16 *bpp) + { + unsigned char packed; + uint16 bpp1, bpp2; + + /* File must start with "GIF" */ + if(read_8(file) != 'G' || read_8(file) != 'I' || read_8(file) != 'F') + return 1; + + fseek(file, 3L, SEEK_CUR); + *width = (uint32) read_16_little_endian(file); + + *height = (uint32) read_16_little_endian(file); + + /* packed byte: + Bits 8 and 5 are flags we don't need to worry about; + bits 6-8 and 1-3 are 3-bit descriptions of the number of bits, + minus 1, of "color resolution" and "bits per pixel" respectively. + Usually these values are the same, but if they're not, take the + larger of the two to be "bpp," since this is what standard + image editing programs seem to do. I don't know why. + */ + packed = read_8(file); + bpp1 = ((packed & 0x70) >> 4) + 1; + bpp2 = (packed & 0x07) + 1; + + if(bpp1 > bpp2) + *bpp = bpp1; + else + *bpp = bpp2; + + return 0; + } + + /*--Endian-Safe Input Functions--------------------------------------------*/ + + uint8 read_8(FILE *file) + { + uint8 a; + + if((a=getc(file))==(uint8)EOF) + return 0; + + return a; + } + + uint16 read_16_big_endian(FILE *file) + { + uint16 a,b; + + if((a=getc(file))==(uint16)EOF || (b=getc(file))==(uint16)EOF) + return 0; + + return ((a<<8) + b); + } + + uint16 read_16_little_endian(FILE *file) + { + uint16 a,b; + + if((a=getc(file))==(uint16)EOF || (b=getc(file))==(uint16)EOF) + return 0; + + return ((b<<8) + a); + } + + uint32 read_32_big_endian(FILE *file) + { + uint32 a,b,c,d; + + if((a=getc(file))==(uint32)EOF || (b=getc(file))==(uint32)EOF || + (c=getc(file))==(uint32)EOF || (d=getc(file))==(uint32)EOF) + return 0; + + return ((a<<24) + (b<<16) + (c<<8) + d); + } + + uint32 read_32_little_endian(FILE *file) + { + uint32 a,b,c,d; + + if((a=getc(file))==(uint32)EOF || (b=getc(file))==(uint32)EOF || + (c=getc(file))==(uint32)EOF || (d=getc(file))==(uint32)EOF) + return 0; + + return ((d<<24) + (c<<16) + (b<<8) + a); + } |
From: Robert K. <may...@us...> - 2001-06-05 21:13:12
|
Update of /cvsroot/bitcollider/bitcollider In directory usw-pr-cvs1:/tmp/cvs-serv6175 Modified Files: README Log Message: This is a commit test. Index: README =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** README 2001/02/28 23:29:33 1.1 --- README 2001/06/05 21:13:10 1.2 *************** *** 2,3 **** --- 2,4 ---- - The temp files are not cleaned up right now. + |