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-10-12 21:37:55
|
Update of /cvsroot/bitcollider/bitcollider/include In directory usw-pr-cvs1:/tmp/cvs-serv13344/include Modified Files: bitcollider.h cache.h Log Message: Moved some include files around. Index: bitcollider.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/bitcollider.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** bitcollider.h 2001/10/12 19:59:51 1.11 --- bitcollider.h 2001/10/12 21:37:52 1.12 *************** *** 8,14 **** #define BITCOLLIDER_H ! #include "config.h" ! #include "plugin.h" #include "cache.h" #include "defs.h" --- 8,16 ---- #define BITCOLLIDER_H ! #ifndef WIN32 ! #include "config.h" ! #endif #include "cache.h" + #include "plugin.h" #include "defs.h" Index: cache.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/cache.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cache.h 2001/10/12 19:59:51 1.2 --- cache.h 2001/10/12 21:37:52 1.3 *************** *** 8,11 **** --- 8,17 ---- #define CACHE_H + #ifndef WIN32 + #include "config.h" + #endif + + #ifdef USE_BDB + #include <db.h> #include "defs.h" *************** *** 55,58 **** --- 61,66 ---- b_bool set_max_count(cache_info *info, int count); int get_max_count(cache_info *info); + + #endif #endif |
From: Robert K. <may...@us...> - 2001-10-12 19:59:55
|
Update of /cvsroot/bitcollider/bitcollider/include In directory usw-pr-cvs1:/tmp/cvs-serv28703/include Modified Files: bitcollider.h cache.h defs.h Log Message: Next set of improvements to the cache support. The cache now has a size limit (by default 8192 entries). If the cache grows past 8192, then remove 10% of the least recently used entries. Also I've added support for making sure the database gets cleaned up properly at exit. Index: bitcollider.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/bitcollider.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** bitcollider.h 2001/10/10 23:25:48 1.10 --- bitcollider.h 2001/10/12 19:59:51 1.11 *************** *** 43,46 **** --- 43,47 ---- #if USE_BDB cache_info *cache; + int maxCacheSize; #endif } Bitcollider; *************** *** 82,85 **** --- 83,87 ---- void set_exit (Bitcollider *bc, b_bool enable); + void clear_bitprint_cache(Bitcollider *bc); Index: cache.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/cache.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** cache.h 2001/10/10 23:25:48 1.1 --- cache.h 2001/10/12 19:59:51 1.2 *************** *** 12,19 **** #include "bitprint.h" typedef struct _cache_info { DB *dbp; ! char *errorString; } cache_info; --- 12,23 ---- #include "bitprint.h" + #define ERR_STRING_LEN 1024 + typedef struct _cache_info { DB *dbp; ! char errorString[ERR_STRING_LEN]; ! int maxCount; ! char fileName[MAX_PATH]; } cache_info; *************** *** 23,37 **** time_t lastModDate; char bitprint[BITPRINT_BASE32_LEN]; } cache_entry; cache_info *init_cache(void); b_bool open_cache(cache_info *info, const char *fileName); void close_cache(cache_info *info); /* Fill out the fileName in the cache entry and get will fill out the other fields. */ ! b_bool get_cache_entry(cache_info *info, cache_entry *entry); ! b_bool add_cache_entry(cache_info *info, cache_entry *entry); ! b_bool remove_cache_entry(cache_info *info, cache_entry *entry); #endif --- 27,58 ---- time_t lastModDate; char bitprint[BITPRINT_BASE32_LEN]; + time_t lastUsedDate; } cache_entry; cache_info *init_cache(void); b_bool open_cache(cache_info *info, const char *fileName); + b_bool create_cache(cache_info *info, const char *fileName, int maxCount); void close_cache(cache_info *info); /* Fill out the fileName in the cache entry and get will fill out the other fields. */ ! b_bool get_cache_entry(cache_info *info, cache_entry *entry); ! ! /* Add an entry to the cache. Set update to true and the add function ! updates an existing record. */ ! b_bool add_cache_entry(cache_info *info, cache_entry *entry, b_bool update); ! ! /* Remove a record from the cache. The key in the entry must be set */ ! b_bool remove_cache_entry(cache_info *info, cache_entry *entry); ! ! /* Remove the numEntries least recently used entries */ ! b_bool remove_excessive_entries(cache_info *info, int curCount); ! ! /* Internal functions: */ ! b_bool set_count(cache_info *info, int count); ! int get_count(cache_info *info); ! ! b_bool set_max_count(cache_info *info, int count); ! int get_max_count(cache_info *info); #endif Index: defs.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/defs.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** defs.h 2001/10/10 23:25:48 1.1 --- defs.h 2001/10/12 19:59:51 1.2 *************** *** 29,32 **** --- 29,34 ---- #endif + #define DEFAULT_MAX_CACHE_SIZE 8192 + #ifdef __cplusplus } |
From: Robert K. <may...@us...> - 2001-10-12 19:59:54
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv28703/lib Modified Files: cache.c main.c Log Message: Next set of improvements to the cache support. The cache now has a size limit (by default 8192 entries). If the cache grows past 8192, then remove 10% of the least recently used entries. Also I've added support for making sure the database gets cleaned up properly at exit. Index: cache.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/cache.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** cache.c 2001/10/10 23:25:48 1.1 --- cache.c 2001/10/12 19:59:51 1.2 *************** *** 8,14 **** --- 8,17 ---- #include <stdlib.h> #include <string.h> + #include <time.h> #include "cache.h" #define DB printf("%s:%d\n", __FILE__, __LINE__); + #define COUNT_KEY "??count??" + #define MAX_COUNT_KEY "??maxcount??" #if USE_BDB *************** *** 27,43 **** int ret; ret = db_create(&info->dbp, NULL, 0); if (ret != 0) { ! info->errorString = strdup(db_strerror(ret)); return false; } ret = info->dbp->open(info->dbp, fileName, NULL, DB_BTREE, DB_CREATE, 0664); if (ret != 0) { ! info->errorString = strdup(db_strerror(ret)); return false; } return true; } --- 30,74 ---- int ret; + strcpy(info->fileName, fileName); ret = db_create(&info->dbp, NULL, 0); if (ret != 0) { ! strcpy(info->errorString, db_strerror(ret)); return false; } + ret = info->dbp->open(info->dbp, fileName, NULL, DB_BTREE, 0, 0664); + if (ret != 0) + { + strcpy(info->errorString, db_strerror(ret)); + return false; + } + + info->maxCount = get_max_count(info); + + return true; + } + + b_bool create_cache(cache_info *info, const char *fileName, int maxCount) + { + int ret; + + strcpy(info->fileName, fileName); + ret = db_create(&info->dbp, NULL, 0); + if (ret != 0) + { + strcpy(info->errorString, db_strerror(ret)); + return false; + } ret = info->dbp->open(info->dbp, fileName, NULL, DB_BTREE, DB_CREATE, 0664); if (ret != 0) { ! strcpy(info->errorString, db_strerror(ret)); return false; } + info->maxCount = maxCount; + set_max_count(info, info->maxCount); + set_count(info, 0); + return true; } *************** *** 46,52 **** { info->dbp->close(info->dbp, 0); - if (info->errorString) - free(info->errorString); - free(info); } --- 77,80 ---- *************** *** 67,73 **** if (ret == DB_NOTFOUND) { ! if (info->errorString) ! free(info->errorString); ! info->errorString = NULL; return false; } --- 95,99 ---- if (ret == DB_NOTFOUND) { ! info->errorString[0] = 0; return false; } *************** *** 75,79 **** if (ret != 0) { ! info->errorString = strdup(db_strerror(ret)); return false; } --- 101,105 ---- if (ret != 0) { ! strcpy(info->errorString, db_strerror(ret)); return false; } *************** *** 86,93 **** if (token) { ! entry->lastModDate = atoi(token); token = strtok(NULL, "*"); if (token) ! strcpy(entry->bitprint, token); } else --- 112,124 ---- if (token) { ! entry->lastUsedDate = atoi(token); token = strtok(NULL, "*"); if (token) ! { ! entry->lastModDate = atoi(token); ! token = strtok(NULL, "*"); ! if (token) ! strcpy(entry->bitprint, token); ! } } else *************** *** 102,110 **** } ! b_bool add_cache_entry(cache_info *info, cache_entry *entry) { ! DBT key, data; ! int ret; ! char strData[100]; memset(&key, 0, sizeof(DBT)); --- 133,142 ---- } ! b_bool add_cache_entry(cache_info *info, cache_entry *entry, b_bool update) { ! DBT key, data; ! int ret; ! char strData[100]; ! time_t t; memset(&key, 0, sizeof(DBT)); *************** *** 114,127 **** key.size = strlen(entry->fileName); ! sprintf(strData, "%ld*%s", (long)entry->lastModDate, entry->bitprint); data.data = strData; data.size = strlen(strData); ! ret = info->dbp->put(info->dbp, NULL, &key, &data, DB_NOOVERWRITE); if (ret != 0) { ! info->errorString = strdup(db_strerror(ret)); return false; } return true; } --- 146,177 ---- key.size = strlen(entry->fileName); ! time(&t); ! sprintf(strData, "%ld*%ld*%s", ! t, (long)entry->lastModDate, entry->bitprint); data.data = strData; data.size = strlen(strData); ! ret = info->dbp->put(info->dbp, NULL, &key, &data, ! update ? 0 : DB_NOOVERWRITE); if (ret != 0) { ! strcpy(info->errorString, db_strerror(ret)); ! printf("insert failed: %s\n", info->errorString); return false; } + + if (!update) + { + int count; + + count = get_count(info) + 1; + if (count > info->maxCount) + { + /* remove_excessive will update the record count */ + remove_excessive_entries(info, count); + } + else + set_count(info, count); + } return true; } *************** *** 139,147 **** ret = info->dbp->del(info->dbp, NULL, &key, 0); if (ret != 0) { ! info->errorString = strdup(db_strerror(ret)); return false; } return true; } #endif --- 189,422 ---- ret = info->dbp->del(info->dbp, NULL, &key, 0); if (ret != 0) + { + strcpy(info->errorString, db_strerror(ret)); + return false; + } + return true; + } + + int get_count(cache_info *info) + { + DBT key, data; + int ret; + + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + + key.data = COUNT_KEY; + key.size = sizeof(COUNT_KEY); + + ret = info->dbp->get(info->dbp, NULL, &key, &data, 0); + if (ret == DB_NOTFOUND) + { + info->errorString[0] = 0; + return 0; + } + + if (ret != 0) { ! strcpy(info->errorString, db_strerror(ret)); ! return -1; ! } ! ((char *)data.data)[data.size] = 0; ! ! return atoi(data.data); ! } ! ! b_bool set_count(cache_info *info, int count) ! { ! DBT key, data; ! int ret; ! char strData[10]; ! ! memset(&key, 0, sizeof(DBT)); ! memset(&data, 0, sizeof(DBT)); ! ! key.data = COUNT_KEY; ! key.size = sizeof(COUNT_KEY); ! ! sprintf(strData, "%d", count); ! data.data = strData; ! data.size = strlen(strData); ! ! ret = info->dbp->put(info->dbp, NULL, &key, &data, 0); ! if (ret != 0) ! { ! strcpy(info->errorString, db_strerror(ret)); return false; } return true; + } + + int get_max_count(cache_info *info) + { + DBT key, data; + int ret; + + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + + key.data = MAX_COUNT_KEY; + key.size = sizeof(MAX_COUNT_KEY); + + ret = info->dbp->get(info->dbp, NULL, &key, &data, 0); + if (ret == DB_NOTFOUND) + { + info->errorString[0] = 0; + return 0; + } + + if (ret != 0) + { + strcpy(info->errorString, db_strerror(ret)); + return -1; + } + ((char *)data.data)[data.size] = 0; + + return atoi(data.data); + } + + b_bool set_max_count(cache_info *info, int count) + { + DBT key, data; + int ret; + char strData[10]; + + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + + key.data = MAX_COUNT_KEY; + key.size = sizeof(MAX_COUNT_KEY); + + sprintf(strData, "%d", count); + data.data = strData; + data.size = strlen(strData); + + ret = info->dbp->put(info->dbp, NULL, &key, &data, 0); + if (ret != 0) + { + strcpy(info->errorString, db_strerror(ret)); + return false; + } + return true; + } + + static int compare_int(const void *a, const void *b) + { + if (*(unsigned int *)a < *(unsigned int *)b) + return -1; + if (*(unsigned int *)a > *(unsigned int *)b) + return 1; + return 0; + } + + b_bool remove_excessive_entries(cache_info *info, int curCount) + { + DBT key, data; + DBC *dbcp; + int ret, i, newCount; + time_t cutoff, *timeCache; + int numEntries; + + numEntries = info->maxCount / 10; + if (curCount < 0) + curCount = get_count(info); + + if (numEntries < 1 || numEntries > curCount) + return false; + + ret = info->dbp->cursor(info->dbp, NULL, &dbcp, 0); + if (ret != 0) + { + strcpy(info->errorString, db_strerror(ret)); + return false; + } + + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + timeCache = malloc(sizeof(int) * curCount); + for(i = 0; i < curCount + 1; i++) + { + ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT); + if (ret != 0) + break; + + if (((char *)key.data)[0] == '?') + { + i--; + continue; + } + + timeCache[i] = atoi(data.data); + } + dbcp->c_close(dbcp); + + qsort(timeCache, curCount, sizeof(int), compare_int); + cutoff = timeCache[numEntries]; + free(timeCache); + + ret = info->dbp->cursor(info->dbp, NULL, &dbcp, 0); + if (ret != 0) + { + strcpy(info->errorString, db_strerror(ret)); + return false; + } + + newCount = curCount; + for(i = 0; i < curCount && newCount > 0; i++) + { + ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT); + if (ret != 0) + break; + + if (((char *)key.data)[0] == '?') + { + i--; + continue; + } + + if (atoi(data.data) <= cutoff) + { + ret = info->dbp->del(info->dbp, NULL, &key, 0); + if (ret == 0) + newCount--; + } + } + dbcp->c_close(dbcp); + set_count(info, newCount); + + return true; + } + #endif + + #if 0 + int main(void) + { + int i; + unsigned rand; + cache_info *info; + cache_entry entry; + time_t t; + + time(&t); + srandom(t); + + info = init_cache(); + open_cache(info, "test.db"); + + for(i = 0; i < 34873; i++) + { + sprintf(entry.fileName, "%u%u%u", random(), random(), random()); + entry.lastUsedDate = random() % t; + entry.lastModDate = random() % t; + sprintf(entry.bitprint, "foo"); + + printf("\nInsert entry %d\n", i); + add_cache_entry(info, &entry, 0); + } + close_cache(info); + + return 1; } #endif Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** main.c 2001/10/10 23:25:48 1.34 --- main.c 2001/10/12 19:59:51 1.35 *************** *** 170,173 **** --- 170,174 ---- #if USE_BDB + bc->maxCacheSize = DEFAULT_MAX_CACHE_SIZE; if (cacheFile[0] != 0) { *************** *** 177,185 **** if (!open_cache(bc->cache, cacheFile)) { ! if (printDebugInfo) ! fprintf(stderr, "Failed to open cache file: %s.\n\n", ! cacheFile); ! close_cache(bc->cache); ! bc->cache = NULL; } } --- 178,193 ---- if (!open_cache(bc->cache, cacheFile)) { ! if (printDebugInfo) ! fprintf(stderr, "Failed to open cache file: %s. " ! "Creating a new one.\n\n", cacheFile); ! unlink(cacheFile); ! if (!create_cache(bc->cache, cacheFile, bc->maxCacheSize)) ! { ! if (printDebugInfo) ! fprintf(stderr, "Failed to create cache file: %s.\n\n", ! cacheFile); ! close_cache(bc->cache); ! bc->cache = NULL; ! } } } *************** *** 295,300 **** #if USE_BDB /* Check to see if this bitprint has already been bitprinted */ ! strcpy(centry.fileName, fileName); ! if (get_cache_entry(submission->bc->cache, ¢ry)) { if (stat(submission->fileName, &fileInfo) == 0) --- 303,311 ---- #if USE_BDB /* Check to see if this bitprint has already been bitprinted */ ! if (realpath(fileName, centry.fileName) == NULL) ! strcpy(centry.fileName, fileName); ! ! if (submission->bc->cache && ! get_cache_entry(submission->bc->cache, ¢ry)) { if (stat(submission->fileName, &fileInfo) == 0) *************** *** 309,316 **** } } - else - { - printf("Stat failed.\n"); - } /* Its out of date or something else is wrong. Remove the entry from the cache */ --- 320,323 ---- *************** *** 444,454 **** #if USE_BDB - strcpy(centry.fileName, fileName); - strcpy(centry.bitprint, bitprint); - if (stat(submission->fileName, &fileInfo) == 0) { centry.lastModDate = fileInfo.st_mtime; ! if (!add_cache_entry(submission->bc->cache, ¢ry)) { printf("Failed to insert bitprint into cache.\n"); --- 451,459 ---- #if USE_BDB if (stat(submission->fileName, &fileInfo) == 0) { centry.lastModDate = fileInfo.st_mtime; ! if (submission->bc->cache && ! !add_cache_entry(submission->bc->cache, ¢ry, false)) { printf("Failed to insert bitprint into cache.\n"); *************** *** 492,495 **** --- 497,520 ---- bc->exitNow = exitNow; } + + void clear_bitprint_cache(Bitcollider *bc) + { + #if USE_BDB + if (bc->cache) + { + int maxCount; + char fileName[MAX_PATH]; + + strcpy(fileName, bc->cache->fileName); + maxCount = get_max_count(bc->cache); + close_cache(bc->cache); + unlink(fileName); + + bc->cache = init_cache(); + create_cache(bc->cache, fileName, maxCount); + } + #endif + } + int get_num_bitprints(BitcolliderSubmission *sub) |
From: Robert K. <may...@us...> - 2001-10-12 19:59:54
|
Update of /cvsroot/bitcollider/bitcollider/src In directory usw-pr-cvs1:/tmp/cvs-serv28703/src Modified Files: bitcollider.c Log Message: Next set of improvements to the cache support. The cache now has a size limit (by default 8192 entries). If the cache grows past 8192, then remove 10% of the least recently used entries. Also I've added support for making sure the database gets cleaned up properly at exit. Index: bitcollider.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/src/bitcollider.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** bitcollider.c 2001/07/23 23:13:33 1.16 --- bitcollider.c 2001/10/12 19:59:51 1.17 *************** *** 9,12 **** --- 9,13 ---- #include <string.h> #include <errno.h> + #include <signal.h> #include "bitcollider.h" #include "dirsearch.h" *************** *** 40,43 **** --- 41,45 ---- printf(" (Default is to analyze only known extensions)\n"); printf(" -f <file> - read tags from <file> instead of analyzing\n"); + printf(" -c - clear the bitprint cache\n"); #ifndef _WIN32 printf(" -k - use the Konqueror to submit\n"); *************** *** 88,92 **** { fprintf(stderr, " %s: ", fileName); ! // fflush(stdout); } --- 90,94 ---- { fprintf(stderr, " %s: ", fileName); ! fflush(stdout); } *************** *** 96,103 **** { fprintf(stderr, "%-3d%%\b\b\b\b", percentComplete); ! // fflush(stdout); } } int main(int argc, char *argv[]) { --- 98,124 ---- { fprintf(stderr, "%-3d%%\b\b\b\b", percentComplete); ! fflush(stdout); } } + /* This var is global so that the atexit() handler can grab it and + cleanly shutdown the Berkeley DB cache */ + static Bitcollider *bc = NULL; + + void exit_cleanup(void) + { + if (bc) + { + bitcollider_shutdown(bc); + } + } + + /* Catch a SIGINT (^C) and then exit normally, letting the atexit + handler do the actual cleanup */ + void signal_cleanup(int sig) + { + exit(0); + } + int main(int argc, char *argv[]) { *************** *** 105,109 **** char checkAsExt[MAX_EXT_LEN]; char tagFile[MAX_PATH]; - Bitcollider *bc = NULL; BitcolliderSubmission *submission; int argIndex = 1, count; --- 126,129 ---- *************** *** 116,119 **** --- 136,140 ---- b_bool recurse = false; b_bool quiet = false; + b_bool clearCache = false; b_bool ret; char fileName[MAX_PATH]; *************** *** 196,199 **** --- 217,225 ---- } else + if (strcmp(argv[argIndex], "-c") == 0) + { + clearCache = true; + } + else if (strcmp(argv[argIndex], "-e") == 0) { *************** *** 218,222 **** break; } ! if (! tagFile[0] && argIndex == argc) { fprintf(stderr, "You must specify a file to bitcollide.\n"); --- 244,248 ---- break; } ! if (! tagFile[0] && !clearCache && argIndex == argc) { fprintf(stderr, "You must specify a file to bitcollide.\n"); *************** *** 235,238 **** --- 261,268 ---- } + /* set the cleanup handler */ + atexit(exit_cleanup); + signal(SIGINT, signal_cleanup); + bc = bitcollider_init(debugPlugins); if (!bc) *************** *** 241,244 **** --- 271,283 ---- exit(-1); } + + if (clearCache) + { + clear_bitprint_cache(bc); + bitcollider_shutdown(bc); + bc = NULL; + fprintf(stderr, "Bitprint cache cleared.\n"); + exit(0); + } if( tagFile[0] ) *************** *** 249,264 **** fprintf(stderr, "Cannot create submission.\n"); bitcollider_shutdown(bc); exit(-1); } ! if (submission->numBitprints == 0) ! { ! print_error(submission->bc, NULL); delete_submission(submission); bitcollider_shutdown(bc); exit(-1); ! } if (autoSubmit) ! set_auto_submit(submission, true); } else --- 288,305 ---- fprintf(stderr, "Cannot create submission.\n"); bitcollider_shutdown(bc); + bc = NULL; exit(-1); } ! if (submission->numBitprints == 0) ! { ! print_error(submission->bc, NULL); delete_submission(submission); bitcollider_shutdown(bc); + bc = NULL; exit(-1); ! } if (autoSubmit) ! set_auto_submit(submission, true); } else *************** *** 269,272 **** --- 310,314 ---- fprintf(stderr, "Cannot create submission.\n"); bitcollider_shutdown(bc); + bc = NULL; exit(-1); } *************** *** 306,309 **** --- 348,352 ---- print_error(bc, "Cannot analyze file"); bitcollider_shutdown(bc); + bc = NULL; exit(-1); } *************** *** 328,331 **** --- 371,375 ---- print_error(bc, "Submission failed"); bitcollider_shutdown(bc); + bc = NULL; exit(-1); } *************** *** 340,343 **** --- 384,391 ---- delete_submission(submission); bitcollider_shutdown(bc); + + /* Set the bitcolider object to NULL, so that the cleanup handler doesn't + clean it up again */ + bc = NULL; return 0; |
From: Robert K. <may...@us...> - 2001-10-10 23:25:51
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv17734/lib Modified Files: Makefile.am main.c Added Files: cache.c Log Message: Added support for caching using the Berkeley DB. If the DB is not found, the cache functionality degrades nicely. Linux only so far -- support for windows will be done shortly. --- NEW FILE: cache.c --- /* (PD) 2001 The Bitzi Corporation * Please see file COPYING or http://bitzi.com/publicdomain * for more info. * * $Id: cache.c,v 1.1 2001/10/10 23:25:48 mayhemchaos Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "cache.h" #define DB printf("%s:%d\n", __FILE__, __LINE__); #if USE_BDB cache_info *init_cache(void) { cache_info *info; info = malloc(sizeof(cache_info)); memset(info, 0, sizeof(cache_info)); return info; } b_bool open_cache(cache_info *info, const char *fileName) { int ret; ret = db_create(&info->dbp, NULL, 0); if (ret != 0) { info->errorString = strdup(db_strerror(ret)); return false; } ret = info->dbp->open(info->dbp, fileName, NULL, DB_BTREE, DB_CREATE, 0664); if (ret != 0) { info->errorString = strdup(db_strerror(ret)); return false; } return true; } void close_cache(cache_info *info) { info->dbp->close(info->dbp, 0); if (info->errorString) free(info->errorString); free(info); } b_bool get_cache_entry(cache_info *info, cache_entry *entry) { DBT key, data; int ret; char *str, *token; memset(&key, 0, sizeof(DBT)); memset(&data, 0, sizeof(DBT)); key.data = entry->fileName; key.size = strlen(entry->fileName); ret = info->dbp->get(info->dbp, NULL, &key, &data, 0); if (ret == DB_NOTFOUND) { if (info->errorString) free(info->errorString); info->errorString = NULL; return false; } if (ret != 0) { info->errorString = strdup(db_strerror(ret)); return false; } str = malloc(data.size + 1); strncpy(str, data.data, data.size); str[data.size] = 0; token = strtok(str, "*"); if (token) { entry->lastModDate = atoi(token); token = strtok(NULL, "*"); if (token) strcpy(entry->bitprint, token); } else { entry->lastModDate = 0; entry->bitprint[0] = 0; } free(str); return true; } b_bool add_cache_entry(cache_info *info, cache_entry *entry) { DBT key, data; int ret; char strData[100]; memset(&key, 0, sizeof(DBT)); memset(&data, 0, sizeof(DBT)); key.data = entry->fileName; key.size = strlen(entry->fileName); sprintf(strData, "%ld*%s", (long)entry->lastModDate, entry->bitprint); data.data = strData; data.size = strlen(strData); ret = info->dbp->put(info->dbp, NULL, &key, &data, DB_NOOVERWRITE); if (ret != 0) { info->errorString = strdup(db_strerror(ret)); return false; } return true; } b_bool remove_cache_entry(cache_info *info, cache_entry *entry) { DBT key; int ret; memset(&key, 0, sizeof(DBT)); key.data = entry->fileName; key.size = strlen(entry->fileName); ret = info->dbp->del(info->dbp, NULL, &key, 0); if (ret != 0) { info->errorString = strdup(db_strerror(ret)); return false; } return true; } #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/Makefile.am,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** Makefile.am 2001/08/10 22:29:31 1.12 --- Makefile.am 2001/10/10 23:25:48 1.13 *************** *** 9,15 **** 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 bitprint.c bitprint.h md5.c md5.h libbitcollider_la_LDFLAGS = -version-info 1:0:0 ! libbitcollider_la_LIBADD = $(LIBLTDL) noinst_HEADERS = browser.h mp3.h id3.h --- 9,15 ---- 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 bitprint.c bitprint.h md5.c md5.h cache.c libbitcollider_la_LDFLAGS = -version-info 1:0:0 ! libbitcollider_la_LIBADD = $(LIBLTDL) $(BDB_LIBS) noinst_HEADERS = browser.h mp3.h id3.h Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** main.c 2001/08/23 20:39:42 1.33 --- main.c 2001/10/10 23:25:48 1.34 *************** *** 22,25 **** --- 22,27 ---- #include "browser.h" #include <errno.h> + #include <unistd.h> + #include <sys/stat.h> #else #include <windows.h> *************** *** 91,97 **** DWORD type; #endif ! char path[MAX_PATH], *ptr; int total = 0; bc = init_plugins(); --- 93,100 ---- DWORD type; #endif ! char path[MAX_PATH], cacheFile[MAX_PATH], *ptr; int total = 0; + cacheFile[0] = 0; bc = init_plugins(); *************** *** 106,109 **** --- 109,113 ---- if (ptr) { + sprintf(cacheFile, "%s/.bitcollider/cache.db", ptr); sprintf(path, "%s/.bitcollider/plugins", ptr); if (printDebugInfo) *************** *** 111,114 **** --- 115,123 ---- total += load_plugins(bc, path, printDebugInfo); } + else + { + if (printDebugInfo) + fprintf(stderr, "HOME env var not set. Cannot find home.\n"); + } ptr = PREFIX"/lib/bitcollider/plugins"; *************** *** 129,135 **** DWORD size = MAX_PATH; ret = RegQueryValueEx(hKey, "PluginDir", NULL, &type, path, &size); - RegCloseKey(hKey); if (ret == ERROR_FILE_NOT_FOUND) --- 138,144 ---- DWORD size = MAX_PATH; + // Get the plugin dir, first ret = RegQueryValueEx(hKey, "PluginDir", NULL, &type, path, &size); if (ret == ERROR_FILE_NOT_FOUND) *************** *** 137,141 **** --- 146,159 ---- else if (ret != ERROR_SUCCESS) + { + RegCloseKey(hKey); return bc; + } + + // Now try to get the cache file + size = MAX_PATH; + ret = RegQueryValueEx(hKey, "CacheFile", NULL, &type, + cacheFile, &size); + RegCloseKey(hKey); } ptr = path; *************** *** 150,153 **** --- 168,189 ---- if (printDebugInfo) fprintf(stderr, "Loaded %d plugins total.\n\n", total); + + #if USE_BDB + if (cacheFile[0] != 0) + { + bc->cache = init_cache(); + if (bc->cache) + { + if (!open_cache(bc->cache, cacheFile)) + { + if (printDebugInfo) + fprintf(stderr, "Failed to open cache file: %s.\n\n", + cacheFile); + close_cache(bc->cache); + bc->cache = NULL; + } + } + } + #endif return bc; *************** *** 156,159 **** --- 192,199 ---- void bitcollider_shutdown(Bitcollider *bc) { + #if USE_BDB + if (bc->cache) + close_cache(bc->cache); + #endif unload_plugins(bc); shutdown_plugins(bc); *************** *** 188,191 **** --- 228,235 ---- Attribute *attrList = NULL, *attr; const char *err; + #if USE_BDB + cache_entry centry; + struct stat fileInfo; + #endif if (submission->bc->error) *************** *** 249,252 **** --- 293,322 ---- return true; + #if USE_BDB + /* Check to see if this bitprint has already been bitprinted */ + strcpy(centry.fileName, fileName); + if (get_cache_entry(submission->bc->cache, ¢ry)) + { + if (stat(submission->fileName, &fileInfo) == 0) + { + if (fileInfo.st_mtime == centry.lastModDate) + { + if (submission->bc->progressCallback && + !submission->bc->preview) + submission->bc->progressCallback(0, submission->fileName, + "found in cache, skipped."); + return true; + } + } + else + { + printf("Stat failed.\n"); + } + /* Its out of date or something else is wrong. Remove the entry + from the cache */ + remove_cache_entry(submission->bc->cache, ¢ry); + } + #endif + if (mp3Check) mp3Info = malloc(sizeof(mp3_info)); *************** *** 372,375 **** --- 442,459 ---- submission->numBitprints++; + + #if USE_BDB + strcpy(centry.fileName, fileName); + strcpy(centry.bitprint, bitprint); + + if (stat(submission->fileName, &fileInfo) == 0) + { + centry.lastModDate = fileInfo.st_mtime; + if (!add_cache_entry(submission->bc->cache, ¢ry)) + { + printf("Failed to insert bitprint into cache.\n"); + } + } + #endif return true; |
From: Robert K. <may...@us...> - 2001-10-10 23:25:51
|
Update of /cvsroot/bitcollider/bitcollider In directory usw-pr-cvs1:/tmp/cvs-serv17734 Modified Files: Makefile.am acconfig.h config.h.in configure.in Log Message: Added support for caching using the Berkeley DB. If the DB is not found, the cache functionality degrades nicely. Linux only so far -- support for windows will be done shortly. Index: Makefile.am =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** Makefile.am 2001/09/10 23:52:47 1.10 --- Makefile.am 2001/10/10 23:25:48 1.11 *************** *** 29,31 **** --- 29,33 ---- $(INSTALL) -m 0644 include/tiger.h $(DESTDIR)$(includedir)/bitcollider $(INSTALL) -m 0644 include/tigertree.h $(DESTDIR)$(includedir)/bitcollider + $(INSTALL) -m 0644 include/defs.h $(DESTDIR)$(includedir)/bitcollider + $(INSTALL) -m 0644 include/cache.h $(DESTDIR)$(includedir)/bitcollider Index: acconfig.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/acconfig.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** acconfig.h 2001/03/19 23:38:29 1.3 --- acconfig.h 2001/10/10 23:25:48 1.4 *************** *** 1,2 **** --- 1,3 ---- + #undef USE_BDB #undef USE_VORBIS #undef PREFIX Index: config.h.in =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/config.h.in,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** config.h.in 2001/08/23 20:39:42 1.6 --- config.h.in 2001/10/10 23:25:48 1.7 *************** *** 5,8 **** --- 5,9 ---- #undef WORDS_BIGENDIAN + #undef USE_BDB #undef USE_VORBIS #undef PREFIX Index: configure.in =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/configure.in,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** configure.in 2001/09/10 23:52:47 1.11 --- configure.in 2001/10/10 23:25:48 1.12 *************** *** 5,9 **** dnl $Id$ AC_INIT(src/bitcollider.c) ! VERSION="0.3.3" AM_INIT_AUTOMAKE(bitcollider, "$VERSION") dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION") --- 5,9 ---- dnl $Id$ AC_INIT(src/bitcollider.c) ! VERSION="0.4.0" AM_INIT_AUTOMAKE(bitcollider, "$VERSION") dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION") *************** *** 29,32 **** --- 29,40 ---- dnl Checks for typedefs, structures, and compiler characteristics. + + AC_CHECK_LIB(db, db_create, have_db="yes", have_db="no") + if test "$have_db" = "yes"; then + AC_DEFINE(USE_BDB) + BDB_LIBS="-ldb" + AC_SUBST(BDB_LIBS) + AC_MSG_RESULT([compiling caching support]) + fi AC_CHECK_LIB(ogg, ogg_sync_init, have_ogg="yes", have_ogg="no") |
From: Robert K. <may...@us...> - 2001-10-10 23:25:51
|
Update of /cvsroot/bitcollider/bitcollider/src In directory usw-pr-cvs1:/tmp/cvs-serv17734/src Modified Files: Makefile.am Log Message: Added support for caching using the Berkeley DB. If the DB is not found, the cache functionality degrades nicely. Linux only so far -- support for windows will be done shortly. Index: Makefile.am =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/src/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Makefile.am 2001/07/23 21:22:34 1.8 --- Makefile.am 2001/10/10 23:25:48 1.9 *************** *** 10,12 **** bitcollider_SOURCES = bitcollider.c bitcollider_LDFLAGS = -export-dynamic ! bitcollider_LDADD = $(top_builddir)/lib/.libs/libbitcollider.a @LIBS@ $(LIBLTDL) --- 10,12 ---- bitcollider_SOURCES = bitcollider.c bitcollider_LDFLAGS = -export-dynamic ! bitcollider_LDADD = $(top_builddir)/lib/.libs/libbitcollider.a @BDB_LIBS@ @LIBS@ $(LIBLTDL) |
From: Robert K. <may...@us...> - 2001-10-10 23:25:51
|
Update of /cvsroot/bitcollider/bitcollider/include In directory usw-pr-cvs1:/tmp/cvs-serv17734/include Modified Files: bc_version.h bitcollider.h Added Files: cache.h defs.h Log Message: Added support for caching using the Berkeley DB. If the DB is not found, the cache functionality degrades nicely. Linux only so far -- support for windows will be done shortly. --- NEW FILE: cache.h --- /* (PD) 2001 The Bitzi Corporation * Please see file COPYING or http://bitzi.com/publicdomain * for more info. * * $Id: cache.h,v 1.1 2001/10/10 23:25:48 mayhemchaos Exp $ */ #ifndef CACHE_H #define CACHE_H #include <db.h> #include "defs.h" #include "bitprint.h" typedef struct _cache_info { DB *dbp; char *errorString; } cache_info; typedef struct _cache_entry { char fileName[MAX_PATH]; time_t lastModDate; char bitprint[BITPRINT_BASE32_LEN]; } cache_entry; cache_info *init_cache(void); b_bool open_cache(cache_info *info, const char *fileName); void close_cache(cache_info *info); /* Fill out the fileName in the cache entry and get will fill out the other fields. */ b_bool get_cache_entry(cache_info *info, cache_entry *entry); b_bool add_cache_entry(cache_info *info, cache_entry *entry); b_bool remove_cache_entry(cache_info *info, cache_entry *entry); #endif --- NEW FILE: defs.h --- /* (PD) 2001 The Bitzi Corporation * Please see file COPYING or http://bitzi.com/publicdomain * for more info. * * $Id: defs.h,v 1.1 2001/10/10 23:25:48 mayhemchaos Exp $ */ #ifndef DEF_H #define DEF_H #ifdef WIN32 #include <windows.h> #define strcasecmp stricmp #endif #ifdef __cplusplus extern "C" { #endif typedef int b_bool; #ifndef true #define true 1 #endif #ifndef false #define false 0 #endif #ifndef MAX_PATH #define MAX_PATH 1024 #endif #ifdef __cplusplus } #endif #endif Index: bc_version.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/bc_version.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** bc_version.h 2001/08/23 18:46:26 1.4 --- bc_version.h 2001/10/10 23:25:48 1.5 *************** *** 22,26 **** /* Your agent-version string; should be #[.#[.#[etc]]] format */ ! #define BC_VERSION "0.3.3" #endif --- 22,26 ---- /* Your agent-version string; should be #[.#[.#[etc]]] format */ ! #define BC_VERSION "0.4.0" #endif Index: bitcollider.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/bitcollider.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** bitcollider.h 2001/07/23 23:13:32 1.9 --- bitcollider.h 2001/10/10 23:25:48 1.10 *************** *** 8,17 **** #define BITCOLLIDER_H ! #ifdef WIN32 ! #include <windows.h> ! #define strcasecmp stricmp ! #endif ! #include "plugin.h" #ifdef __cplusplus --- 8,15 ---- #define BITCOLLIDER_H ! #include "config.h" #include "plugin.h" + #include "cache.h" + #include "defs.h" #ifdef __cplusplus *************** *** 19,35 **** #endif - typedef int b_bool; - #ifndef true - #define true 1 - #endif - #ifndef false - #define false 0 - #endif - #define SUBMIT_URL "http://bitzi.com/lookup/" #define MAX_PLUGINS 256 - #ifndef MAX_PATH - #define MAX_PATH 1024 - #endif typedef struct _PluginInfo --- 17,22 ---- *************** *** 54,57 **** --- 41,47 ---- b_bool preview; b_bool exitNow; + #if USE_BDB + cache_info *cache; + #endif } Bitcollider; |
From: Robert K. <may...@us...> - 2001-10-08 22:00:26
|
Update of /cvsroot/bitcollider/jbitprint/src/com/bitzi/bitprint In directory usw-pr-cvs1:/tmp/cvs-serv9785/src/com/bitzi/bitprint Modified Files: Bitprint.java BitprintUtils.java Log Message: Needed to add an extra exception catch in order handle a missing Tigerhash gracefully. Index: Bitprint.java =================================================================== RCS file: /cvsroot/bitcollider/jbitprint/src/com/bitzi/bitprint/Bitprint.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Bitprint.java 2001/09/24 23:07:52 1.1 --- Bitprint.java 2001/10/08 22:00:22 1.2 *************** *** 25,30 **** com.bitzi.bitprint.BitprintProvider()); ! tigerTree = MessageDigest.getInstance("TigerTree", ! "BitprintProvider"); sha = MessageDigest.getInstance("SHA"); --- 25,37 ---- com.bitzi.bitprint.BitprintProvider()); ! try ! { ! tigerTree = MessageDigest.getInstance("TigerTree", ! "BitprintProvider"); ! } ! catch(NoClassDefFoundError e) ! { ! throw new NoSuchProviderException("Cannot find Tiger hash"); ! } sha = MessageDigest.getInstance("SHA"); Index: BitprintUtils.java =================================================================== RCS file: /cvsroot/bitcollider/jbitprint/src/com/bitzi/bitprint/BitprintUtils.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** BitprintUtils.java 2001/09/24 23:07:52 1.1 --- BitprintUtils.java 2001/10/08 22:00:22 1.2 *************** *** 63,67 **** bitprint.update(in,0,read); } - stream.close(); } catch(IOException e) --- 63,66 ---- |
From: Robert K. <may...@us...> - 2001-09-24 23:08:06
|
Update of /cvsroot/bitcollider/jbitprint In directory usw-pr-cvs1:/tmp/cvs-serv24724 Log Message: Initial check-in. Status: Vendor Tag: vendor Release Tags: start N jbitprint/COPYING N jbitprint/build.xml N jbitprint/src/com/bitzi/bitprint/BitprintTest.java N jbitprint/src/com/bitzi/bitprint/BitprintProvider.java N jbitprint/src/com/bitzi/bitprint/TigerTree.java N jbitprint/src/com/bitzi/bitprint/Bitprint.java N jbitprint/src/com/bitzi/bitprint/BitprintUtils.java N jbitprint/src/com/bitzi/bitprint/Base32.java N jbitprint/src/com/bitzi/bitprint/BitprintException.java No conflicts created by this import ***** Bogus filespec: - ***** Bogus filespec: Imported ***** Bogus filespec: sources |
From: Robert K. <may...@us...> - 2001-09-10 23:52:50
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv9352/lib Modified Files: plugin_man.c Log Message: Vorbis no longer gets compiled if the vorbis headers were not found. Index: plugin_man.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/plugin_man.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** plugin_man.c 2001/09/10 22:01:11 1.14 --- plugin_man.c 2001/09/10 23:52:47 1.15 *************** *** 32,36 **** --- 32,38 ---- Bitcollider *bc; + #ifndef NO_PLUGINS lt_dlinit(); + #endif bc = malloc(sizeof(Bitcollider)); *************** *** 43,47 **** --- 45,51 ---- { free(bc); + #ifndef NO_PLUGINS lt_dlexit(); + #endif } |
From: Robert K. <may...@us...> - 2001-09-10 23:52:50
|
Update of /cvsroot/bitcollider/bitcollider In directory usw-pr-cvs1:/tmp/cvs-serv9352 Modified Files: Makefile.am configure.in Log Message: Vorbis no longer gets compiled if the vorbis headers were not found. Index: Makefile.am =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** Makefile.am 2001/07/09 21:19:52 1.9 --- Makefile.am 2001/09/10 23:52:47 1.10 *************** *** 7,11 **** AUTOMAKE_OPTIONS = foreign ! SUBDIRS = libltdl lib src vorbis wav image cvsclean: distclean --- 7,11 ---- AUTOMAKE_OPTIONS = foreign ! SUBDIRS = libltdl lib src @VORBIS_SUB@ wav image cvsclean: distclean Index: configure.in =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/configure.in,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** configure.in 2001/07/09 21:19:52 1.10 --- configure.in 2001/09/10 23:52:47 1.11 *************** *** 5,9 **** dnl $Id$ AC_INIT(src/bitcollider.c) ! VERSION="0.3.1" AM_INIT_AUTOMAKE(bitcollider, "$VERSION") dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION") --- 5,9 ---- dnl $Id$ AC_INIT(src/bitcollider.c) ! VERSION="0.3.3" AM_INIT_AUTOMAKE(bitcollider, "$VERSION") dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION") *************** *** 34,45 **** --- 34,48 ---- -lvorbis -logg) + VORBIS_SUB="" if test "$have_ogg" = "yes"; then if test "$have_vorbis" = "yes"; then AC_DEFINE(USE_VORBIS) VORBIS_LIBS="-lvorbisfile -lvorbis -logg" + VORBIS_SUB="vorbis" AC_SUBST(VORBIS_LIBS) AC_MSG_RESULT([compiling ogg/vorbis support]) fi fi + AC_SUBST(VORBIS_SUB) if test "${prefix}" = "NONE"; then |
From: Robert K. <may...@us...> - 2001-09-10 22:01:13
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv11101 Modified Files: plugin_man.c Log Message: Ifdefed the ltdl include for non-plugin builds Index: plugin_man.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/plugin_man.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** plugin_man.c 2001/07/31 23:04:20 1.13 --- plugin_man.c 2001/09/10 22:01:11 1.14 *************** *** 11,15 **** --- 11,17 ---- #include <sys/types.h> #include <dirent.h> + #ifndef NO_PLUGINS #include "libltdl/ltdl.h" + #endif #include "bitcollider.h" |
From: Robert K. <may...@us...> - 2001-09-10 21:13:21
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv30778/lib Modified Files: tigertree.c Log Message: Removed an erroneous #error directive Index: tigertree.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/tigertree.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** tigertree.c 2001/09/10 21:04:40 1.5 --- tigertree.c 2001/09/10 21:13:18 1.6 *************** *** 50,54 **** tiger((word64*)node,(word64)NODESIZE,(word64*)ctx->top); // combine two nodes #if USE_BIG_ENDIAN - #error foo! tt_endian((byte *)ctx->top); #endif --- 50,53 ---- |
From: Robert K. <may...@us...> - 2001-08-23 20:39:46
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv16426/lib Modified Files: main.c tigertree.c Log Message: Some cleanup for 0.3.3 Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** main.c 2001/08/13 18:38:15 1.32 --- main.c 2001/08/23 20:39:42 1.33 *************** *** 35,39 **** #define DEFAULT_NUM_ATTRS 16 #define GROW_NUM_ATTRS 16 ! #define MD5_SANITY_CHECK_FAILED "The MD5 hash function compiled into the bitcollider is faulty." #define MD5_SANITY_CHECK_EMPTY "4SQ23YNRAC3AJ4NABGNQ38CCR2" #define MD5_SANITY_CHECK_01234 "IEANJXCPXEMZET9EJJR6CXDHRA" --- 35,39 ---- #define DEFAULT_NUM_ATTRS 16 #define GROW_NUM_ATTRS 16 ! #define MD5_SANITY_CHECK_FAILED "The MD5 hash function compiled into the bitcollider is faulty." #define MD5_SANITY_CHECK_EMPTY "4SQ23YNRAC3AJ4NABGNQ38CCR2" #define MD5_SANITY_CHECK_01234 "IEANJXCPXEMZET9EJJR6CXDHRA" *************** *** 206,214 **** } ! if (!check_md5_hash()) ! { ! set_error(submission, MD5_SANITY_CHECK_FAILED); ! return false; ! } if (submission->bc->exitNow) --- 206,214 ---- } ! if (!check_md5_hash()) ! { ! set_error(submission, MD5_SANITY_CHECK_FAILED); ! return false; ! } if (submission->bc->exitNow) *************** *** 653,657 **** percentComplete = (int)(((word64)ftell(source) * (word64)100) / ! (word64)submission->fileSize); if (percentComplete != submission->percentComplete) { --- 653,657 ---- percentComplete = (int)(((word64)ftell(source) * (word64)100) / ! (word64)submission->fileSize); if (percentComplete != submission->percentComplete) { *************** *** 819,844 **** char *c, *t; int line, empty = 1; ! FILE *infile; ! if (strcmp(fileName, "-")) ! infile = stdin; ! else infile = fopen(fileName, "rb"); submission = (BitcolliderSubmission *)malloc(sizeof(BitcolliderSubmission)); if (submission == NULL) ! { ! fclose(infile); return NULL; ! } memset(submission, 0, sizeof(BitcolliderSubmission)); submission->bc = bc; ! if (infile == NULL) ! { sprintf(err, "Can't open tag file: %s", strerror(errno)); set_error(submission, err); ! return submission; ! } last[0] = 0; --- 819,844 ---- char *c, *t; int line, empty = 1; ! FILE *infile; ! if (strcmp(fileName, "-")) ! infile = stdin; ! else infile = fopen(fileName, "rb"); submission = (BitcolliderSubmission *)malloc(sizeof(BitcolliderSubmission)); if (submission == NULL) ! { ! fclose(infile); return NULL; ! } memset(submission, 0, sizeof(BitcolliderSubmission)); submission->bc = bc; ! if (infile == NULL) ! { sprintf(err, "Can't open tag file: %s", strerror(errno)); set_error(submission, err); ! return submission; ! } last[0] = 0; *************** *** 852,856 **** sprintf(err, "Line %d exceeds length limit", line ); set_error(submission, err); ! fclose(infile); submission->numBitprints = 0; return submission; --- 852,856 ---- sprintf(err, "Line %d exceeds length limit", line ); set_error(submission, err); ! fclose(infile); submission->numBitprints = 0; return submission; *************** *** 860,864 **** sprintf(err, "Line %d is truncated", line ); set_error(submission, err); ! fclose(infile); submission->numBitprints = 0; return submission; --- 860,864 ---- sprintf(err, "Line %d is truncated", line ); set_error(submission, err); ! fclose(infile); submission->numBitprints = 0; return submission; *************** *** 890,895 **** sprintf(err, "Line %d does not appear to contain a tag", line); set_error(submission, err); ! fclose(infile); ! submission->numBitprints = 0; return submission; } --- 890,895 ---- sprintf(err, "Line %d does not appear to contain a tag", line); set_error(submission, err); ! fclose(infile); ! submission->numBitprints = 0; return submission; } *************** *** 921,925 **** } ! fclose(infile); return submission; --- 921,925 ---- } ! fclose(infile); return submission; *************** *** 973,977 **** struct MD5Context md5context; unsigned char md5Digest[16]; ! char md5Hash[33]; MD5Init(&md5context); --- 973,977 ---- struct MD5Context md5context; unsigned char md5Digest[16]; ! char md5Hash[33]; MD5Init(&md5context); *************** *** 979,984 **** bitziEncodeBase32(md5Digest, 16, md5Hash); ! if (strcmp(MD5_SANITY_CHECK_EMPTY, md5Hash)) ! return false; MD5Init(&md5context); --- 979,984 ---- bitziEncodeBase32(md5Digest, 16, md5Hash); ! if (strcmp(MD5_SANITY_CHECK_EMPTY, md5Hash)) ! return false; MD5Init(&md5context); *************** *** 986,995 **** MD5Final(md5Digest, &md5context); bitziEncodeBase32(md5Digest, 16, md5Hash); - printf("01234: %s\n", md5Hash); ! if (strcmp(MD5_SANITY_CHECK_01234, md5Hash)) ! return false; ! return true; } --- 986,994 ---- MD5Final(md5Digest, &md5context); bitziEncodeBase32(md5Digest, 16, md5Hash); ! if (strcmp(MD5_SANITY_CHECK_01234, md5Hash)) ! return false; ! return true; } Index: tigertree.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/tigertree.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** tigertree.c 2001/08/21 17:55:33 1.3 --- tigertree.c 2001/08/23 20:39:42 1.4 *************** *** 114,143 **** } memmove(s,ctx->nodes,TIGERSIZE); - - #if (defined BIG_ENDIAN) - { - word32 *i; - byte *b, btemp; - word16 *w, wtemp; - - for(i = (word32 *)s; i < ((word32 *)s) + 6; i++) - { - b = (byte *)i; - btemp = *b; - *b = *(b + 1); - *(b + 1) = btemp; - - b+=2; - btemp = *(b); - *b = *(b + 1); - *(b + 1) = btemp; - - w = (word16 *)i; - wtemp = *w; - *w = *(w + 1); - *(w + 1) = wtemp; - } - } - #endif } --- 114,117 ---- |
From: Robert K. <may...@us...> - 2001-08-23 20:39:46
|
Update of /cvsroot/bitcollider/bitcollider In directory usw-pr-cvs1:/tmp/cvs-serv16426 Modified Files: aclocal.m4 config.h.in ltmain.sh Log Message: Some cleanup for 0.3.3 Index: aclocal.m4 =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/aclocal.m4,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** aclocal.m4 2001/08/10 22:29:30 1.6 --- aclocal.m4 2001/08/23 20:39:42 1.7 *************** *** 103,227 **** AC_SUBST($1)]) ! # serial 40 AC_PROG_LIBTOOL ! AC_DEFUN(AC_PROG_LIBTOOL, [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl ! # Save cache, so that ltconfig can load it ! AC_CACHE_SAVE [...3571 lines suppressed...] ! dnl This is just to silence aclocal about the macro not being used ! ifelse([AC_DISABLE_FAST_INSTALL])dnl # Like AC_CONFIG_HEADER, but automatically create stamp file. --- 3415,3429 ---- ]) ! # old names ! AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) ! AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) ! AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) ! AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) ! AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) ! AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) ! AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) ! # This is just to silence aclocal about the macro not being used ! ifelse([AC_DISABLE_FAST_INSTALL]) # Like AC_CONFIG_HEADER, but automatically create stamp file. Index: config.h.in =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/config.h.in,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** config.h.in 2001/08/10 22:29:31 1.5 --- config.h.in 2001/08/23 20:39:42 1.6 *************** *** 11,14 **** --- 11,17 ---- #undef SIZEOF_LONG + /* Define if you have the <dlfcn.h> header file. */ + #undef HAVE_DLFCN_H + /* Name of package */ #undef PACKAGE Index: ltmain.sh =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/ltmain.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** ltmain.sh 2001/07/31 18:49:20 1.3 --- ltmain.sh 2001/08/23 20:39:42 1.4 *************** *** 57,61 **** PACKAGE=libtool VERSION=1.4 ! TIMESTAMP=" (1.920 2001/04/24 23:26:18)" default_mode= --- 57,61 ---- PACKAGE=libtool VERSION=1.4 ! TIMESTAMP=" (1.922 2001/04/25 00:05:37)" default_mode= *************** *** 460,464 **** ;; esac ! if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default --- 460,464 ---- ;; esac ! if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default *************** *** 2411,2415 **** *) # Add libc to deplibs on all other systems if necessary. ! if test $build_libtool_need_lc = "yes"; then deplibs="$deplibs -lc" fi --- 2411,2415 ---- *) # Add libc to deplibs on all other systems if necessary. ! if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi *************** *** 2684,2688 **** # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then ! if test $hardcode_into_libs = yes; then # Hardcode the library paths hardcode_libdirs= --- 2684,2688 ---- # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then ! if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= |
From: Robert K. <may...@us...> - 2001-08-23 18:46:29
|
Update of /cvsroot/bitcollider/bitcollider/include In directory usw-pr-cvs1:/tmp/cvs-serv20426 Modified Files: bc_version.h Log Message: Updated for 0.3.3 Index: bc_version.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/bc_version.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** bc_version.h 2001/08/01 21:18:25 1.3 --- bc_version.h 2001/08/23 18:46:26 1.4 *************** *** 22,26 **** /* Your agent-version string; should be #[.#[.#[etc]]] format */ ! #define BC_VERSION "0.3.2" #endif --- 22,26 ---- /* Your agent-version string; should be #[.#[.#[etc]]] format */ ! #define BC_VERSION "0.3.3" #endif |
From: Robert K. <may...@us...> - 2001-08-23 18:45:54
|
Update of /cvsroot/bitcollider/bitcollider In directory usw-pr-cvs1:/tmp/cvs-serv20141 Modified Files: ChangeLog Log Message: Updated for 0.3.3 Index: ChangeLog =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/ChangeLog,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** ChangeLog 2001/08/02 22:43:26 1.6 --- ChangeLog 2001/08/23 18:45:51 1.7 *************** *** 1,2 **** --- 1,7 ---- + Changes to version 0.3.3: + ------------------------- + + - Added support for calculating MD5 hashes. + Changes to version 0.3.2: ------------------------- |
From: Robert K. <may...@us...> - 2001-08-21 17:55:36
|
Update of /cvsroot/bitcollider/bitcollider/include In directory usw-pr-cvs1:/tmp/cvs-serv3788/include Modified Files: tiger.h Log Message: Fixed the tiger hash digest generation for big endian machines. Index: tiger.h =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/include/tiger.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** tiger.h 2001/04/03 23:53:49 1.2 --- tiger.h 2001/08/21 17:55:33 1.3 *************** *** 21,26 **** #endif ! typedef unsigned long word32; ! typedef unsigned char byte; void tiger(word64 *str, word64 length, word64 *res); --- 21,27 ---- #endif ! typedef unsigned long word32; ! typedef unsigned short word16; ! typedef unsigned char byte; void tiger(word64 *str, word64 length, word64 *res); |
From: Robert K. <may...@us...> - 2001-08-21 17:55:36
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv3788/lib Modified Files: tigertree.c Log Message: Fixed the tiger hash digest generation for big endian machines. Index: tigertree.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/tigertree.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** tigertree.c 2001/04/03 23:53:49 1.2 --- tigertree.c 2001/08/21 17:55:33 1.3 *************** *** 25,28 **** --- 25,40 ---- #include "tigertree.h" + #ifdef _WIN32 + #undef WORDS_BIGENDIAN + #else + #include "../config.h" + #endif + + #ifdef WORDS_BIGENDIAN + # define BIG_ENDIAN 1 + #else + # define BIG_ENDIAN 0 + #endif + /* Initialize the tigertree context */ void tt_init(TT_CONTEXT *ctx) *************** *** 102,105 **** --- 114,143 ---- } memmove(s,ctx->nodes,TIGERSIZE); + + #if (defined BIG_ENDIAN) + { + word32 *i; + byte *b, btemp; + word16 *w, wtemp; + + for(i = (word32 *)s; i < ((word32 *)s) + 6; i++) + { + b = (byte *)i; + btemp = *b; + *b = *(b + 1); + *(b + 1) = btemp; + + b+=2; + btemp = *(b); + *b = *(b + 1); + *(b + 1) = btemp; + + w = (word16 *)i; + wtemp = *w; + *w = *(w + 1); + *(w + 1) = wtemp; + } + } + #endif } |
From: Robert K. <may...@us...> - 2001-08-13 18:38:21
|
Update of /cvsroot/bitcollider/bitcollider/win32 In directory usw-pr-cvs1:/tmp/cvs-serv18120/win32 Modified Files: bc_dll.dsp Log Message: Changed the md5 tag to be tag.md5.md5 and added a md5 sanity check. Index: bc_dll.dsp =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/win32/bc_dll.dsp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** bc_dll.dsp 2001/08/01 21:21:56 1.12 --- bc_dll.dsp 2001/08/13 18:38:15 1.13 *************** *** 122,125 **** --- 122,129 ---- # Begin Source File + SOURCE=..\lib\md5.c + # End Source File + # Begin Source File + SOURCE=..\lib\mp3.c # End Source File |
From: Robert K. <may...@us...> - 2001-08-13 18:38:20
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv18120/lib Modified Files: main.c md5.c Log Message: Changed the md5 tag to be tag.md5.md5 and added a md5 sanity check. Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** main.c 2001/08/10 22:29:31 1.31 --- main.c 2001/08/13 18:38:15 1.32 *************** *** 29,38 **** /*------------------------------------------------------------------------- */ ! #define BUFFER_LEN 4096 ! #define FIRST_N_HEX 20 ! #define FIRST_N_HEX_SIZE (FIRST_N_HEX * sizeof(char) * 2) ! #define MAX_ATTR_STRING_LEN 1024 ! #define DEFAULT_NUM_ATTRS 16 ! #define GROW_NUM_ATTRS 16 #ifdef _WIN32 --- 29,41 ---- /*------------------------------------------------------------------------- */ ! #define BUFFER_LEN 4096 ! #define FIRST_N_HEX 20 ! #define FIRST_N_HEX_SIZE (FIRST_N_HEX * sizeof(char) * 2) ! #define MAX_ATTR_STRING_LEN 1024 ! #define DEFAULT_NUM_ATTRS 16 ! #define GROW_NUM_ATTRS 16 ! #define MD5_SANITY_CHECK_FAILED "The MD5 hash function compiled into the bitcollider is faulty." ! #define MD5_SANITY_CHECK_EMPTY "4SQ23YNRAC3AJ4NABGNQ38CCR2" ! #define MD5_SANITY_CHECK_01234 "IEANJXCPXEMZET9EJJR6CXDHRA" #ifdef _WIN32 *************** *** 78,81 **** --- 81,85 ---- void set_error(BitcolliderSubmission *sub, const char *newError); void set_warning(BitcolliderSubmission *sub, const char *newError); + b_bool check_md5_hash(void); /*------------------------------------------------------------------------- */ *************** *** 198,205 **** if (submission->fileName) { ! free(submission->fileName); ! submission->fileName = NULL; } if (submission->bc->exitNow) { --- 202,215 ---- if (submission->fileName) { ! free(submission->fileName); ! submission->fileName = NULL; } + if (!check_md5_hash()) + { + set_error(submission, MD5_SANITY_CHECK_FAILED); + return false; + } + if (submission->bc->exitNow) { *************** *** 271,276 **** add_attribute(submission, "tag.file.length", temp); add_attribute(submission, "tag.file.first20", firstNHex); - add_attribute(submission, "tag.file.md5", md5); add_attribute(submission, "tag.filename.filename", baseFileName); /* Check to make sure that we carried out the mp3 check, and --- 281,286 ---- add_attribute(submission, "tag.file.length", temp); add_attribute(submission, "tag.file.first20", firstNHex); add_attribute(submission, "tag.filename.filename", baseFileName); + add_attribute(submission, "tag.md5.md5", md5); /* Check to make sure that we carried out the mp3 check, and *************** *** 958,959 **** --- 968,995 ---- } #endif + + b_bool check_md5_hash(void) + { + struct MD5Context md5context; + unsigned char md5Digest[16]; + char md5Hash[33]; + + MD5Init(&md5context); + MD5Final(md5Digest, &md5context); + bitziEncodeBase32(md5Digest, 16, md5Hash); + + if (strcmp(MD5_SANITY_CHECK_EMPTY, md5Hash)) + return false; + + MD5Init(&md5context); + MD5Update(&md5context, "01234", 5); + MD5Final(md5Digest, &md5context); + bitziEncodeBase32(md5Digest, 16, md5Hash); + printf("01234: %s\n", md5Hash); + + if (strcmp(MD5_SANITY_CHECK_01234, md5Hash)) + return false; + + return true; + } + Index: md5.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/md5.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** md5.c 2001/08/10 22:29:31 1.1 --- md5.c 2001/08/13 18:38:15 1.2 *************** *** 23,29 **** #include <string.h> /* for memcpy() */ #include <sys/types.h> /* for stupid systems */ ! #include <netinet/in.h> /* for ntohl() */ - #include "config.h" #include "md5.h" --- 23,33 ---- #include <string.h> /* for memcpy() */ #include <sys/types.h> /* for stupid systems */ ! #ifdef WIN32 ! #include <winsock.h> ! #else ! #include <netinet/in.h> /* for ntohl() */ ! #include "config.h" ! #endif #include "md5.h" |
From: Robert K. <may...@us...> - 2001-08-10 22:29:34
|
Update of /cvsroot/bitcollider/bitcollider In directory usw-pr-cvs1:/tmp/cvs-serv29084 Modified Files: aclocal.m4 config.h.in Log Message: Added support for md5 Index: aclocal.m4 =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/aclocal.m4,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** aclocal.m4 2001/07/31 18:49:20 1.5 --- aclocal.m4 2001/08/10 22:29:30 1.6 *************** *** 103,2854 **** AC_SUBST($1)]) - # libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- ! # serial 46 AC_PROG_LIBTOOL ! AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl ! # This can be used to rebuild libtool when needed ! LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" [...3571 lines suppressed...] ! # This is just to silence aclocal about the macro not being used ! ifelse([AC_DISABLE_FAST_INSTALL]) # Like AC_CONFIG_HEADER, but automatically create stamp file. --- 505,519 ---- ]) ! dnl old names ! AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl ! AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl ! AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl ! AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl ! AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl ! AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl ! AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl ! dnl This is just to silence aclocal about the macro not being used ! ifelse([AC_DISABLE_FAST_INSTALL])dnl # Like AC_CONFIG_HEADER, but automatically create stamp file. Index: config.h.in =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/config.h.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** config.h.in 2001/07/31 18:49:20 1.4 --- config.h.in 2001/08/10 22:29:31 1.5 *************** *** 11,17 **** #undef SIZEOF_LONG - /* Define if you have the <dlfcn.h> header file. */ - #undef HAVE_DLFCN_H - /* Name of package */ #undef PACKAGE --- 11,14 ---- |
From: Robert K. <may...@us...> - 2001-08-10 22:29:34
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv29084/lib Modified Files: Makefile.am main.c Added Files: md5.c md5.h Log Message: Added support for md5 --- NEW FILE: md5.c --- /* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. * * Changed so as no longer to depend on Colin Plumb's `usual.h' header * definitions; now uses stuff from dpkg's config.h. * - Ian Jackson <ija...@ny...>. * Still in the public domain. */ #include <string.h> /* for memcpy() */ #include <sys/types.h> /* for stupid systems */ #include <netinet/in.h> /* for ntohl() */ #include "config.h" #include "md5.h" #ifdef WORDS_BIGENDIAN void byteSwap(UWORD32 *buf, unsigned words) { md5byte *p = (md5byte *)buf; do { *buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 | ((unsigned)p[1] << 8 | p[0]); p += 4; } while (--words); } #else #define byteSwap(buf,words) #endif /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void MD5Init(struct MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bytes[0] = 0; ctx->bytes[1] = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ void MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len) { UWORD32 t; /* Update byte count */ t = ctx->bytes[0]; if ((ctx->bytes[0] = t + len) < t) ctx->bytes[1]++; /* Carry from low to high */ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ if (t > len) { memcpy((md5byte *)ctx->in + 64 - t, buf, len); return; } /* First chunk is an odd size */ memcpy((md5byte *)ctx->in + 64 - t, buf, t); byteSwap(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); buf += t; len -= t; /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in, buf, 64); byteSwap(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy(ctx->in, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void MD5Final(md5byte digest[16], struct MD5Context *ctx) { int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ md5byte *p = (md5byte *)ctx->in + count; /* Set the first char of padding to 0x80. There is always room. */ *p++ = 0x80; /* Bytes of padding needed to make 56 bytes (-8..55) */ count = 56 - 1 - count; if (count < 0) { /* Padding forces an extra block */ memset(p, 0, count + 8); byteSwap(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); p = (md5byte *)ctx->in; count = 56; } memset(p, 0, count); byteSwap(ctx->in, 14); /* Append length in bits and transform */ ctx->in[14] = ctx->bytes[0] << 3; ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; MD5Transform(ctx->buf, ctx->in); byteSwap(ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ } #ifndef ASM_MD5 /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f,w,x,y,z,in,s) \ (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) { register UWORD32 a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } #endif --- NEW FILE: md5.h --- /* * This is the header file for the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. * * Changed so as no longer to depend on Colin Plumb's `usual.h' * header definitions; now uses stuff from dpkg's config.h * - Ian Jackson <ija...@ny...>. * Still in the public domain. */ #ifndef MD5_H #define MD5_H #define md5byte unsigned char typedef unsigned int UWORD32; struct MD5Context { UWORD32 buf[4]; UWORD32 bytes[2]; UWORD32 in[16]; }; void MD5Init(struct MD5Context *context); void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len); void MD5Final(unsigned char digest[16], struct MD5Context *context); void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]); #endif /* !MD5_H */ Index: Makefile.am =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** Makefile.am 2001/07/23 22:32:10 1.11 --- Makefile.am 2001/08/10 22:29:31 1.12 *************** *** 9,13 **** 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 bitprint.c bitprint.h libbitcollider_la_LDFLAGS = -version-info 1:0:0 libbitcollider_la_LIBADD = $(LIBLTDL) --- 9,13 ---- 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 bitprint.c bitprint.h md5.c md5.h libbitcollider_la_LDFLAGS = -version-info 1:0:0 libbitcollider_la_LIBADD = $(LIBLTDL) Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** main.c 2001/07/31 21:49:42 1.30 --- main.c 2001/08/10 22:29:31 1.31 *************** *** 14,17 **** --- 14,18 ---- #include "bitcollider.h" #include "bitprint.h" + #include "md5.h" #include "mp3.h" #include "id3.h" *************** *** 58,61 **** --- 59,63 ---- FILE *source, char *bitprint, + char *md5sum, mp3_info *mp3Info, PluginMethods *methods, *************** *** 68,71 **** --- 70,74 ---- const char *fileName, char *bitprint, + char *md5sum, unsigned char *firstHex, mp3_info *mp3Info, *************** *** 174,177 **** --- 177,181 ---- char firstNHex[FIRST_N_HEX_SIZE + 1]; char temp[MAX_ATTR_STRING_LEN], *ext; + char md5[64]; const char *baseFileName; mp3_info *mp3Info = NULL; *************** *** 238,242 **** mp3Info = malloc(sizeof(mp3_info)); ! if (!get_bitprint_data(submission, fileName, bitprint, firstNHex, mp3Info, methods, &attrList)) { --- 242,246 ---- mp3Info = malloc(sizeof(mp3_info)); ! if (!get_bitprint_data(submission, fileName, bitprint, md5, firstNHex, mp3Info, methods, &attrList)) { *************** *** 267,270 **** --- 271,275 ---- add_attribute(submission, "tag.file.length", temp); add_attribute(submission, "tag.file.first20", firstNHex); + add_attribute(submission, "tag.file.md5", md5); add_attribute(submission, "tag.filename.filename", baseFileName); *************** *** 546,549 **** --- 551,555 ---- const char *fileName, char *bitprint, + char *md5sum, unsigned char *firstHex, mp3_info *mp3Info, *************** *** 565,569 **** fseek(source, 0, SEEK_SET); ! ret = calculate_hashes(submission, source, bitprint, mp3Info, methods, attrList); if (ret) --- 571,575 ---- fseek(source, 0, SEEK_SET); ! ret = calculate_hashes(submission, source, bitprint, md5sum, mp3Info, methods, attrList); if (ret) *************** *** 577,589 **** FILE *source, char *bitprint, mp3_info *mcontext, PluginMethods *methods, Attribute **attrList) { ! BP_CONTEXT bcontext; ! unsigned char *buffer, bitprintRaw[BITPRINT_RAW_LEN]; ! int bytes; ! b_bool ret = true; ! Context *context = NULL; if (bitziBitprintInit(&bcontext) == -1) --- 583,597 ---- FILE *source, char *bitprint, + char *md5sum, mp3_info *mcontext, PluginMethods *methods, Attribute **attrList) { ! BP_CONTEXT bcontext; ! struct MD5Context md5context; ! unsigned char *buffer, bitprintRaw[BITPRINT_RAW_LEN], md5Digest[16]; ! int bytes; ! b_bool ret = true; ! Context *context = NULL; if (bitziBitprintInit(&bcontext) == -1) *************** *** 597,600 **** --- 605,609 ---- if (methods && methods->mem_analyze_init) context = methods->mem_analyze_init(); + MD5Init(&md5context); buffer = (unsigned char*)malloc(BUFFER_LEN); *************** *** 627,631 **** if (methods && methods->mem_analyze_update) methods->mem_analyze_update(context, buffer, bytes); ! if (submission->bc->progressCallback && !submission->bc->preview) { --- 636,641 ---- if (methods && methods->mem_analyze_update) methods->mem_analyze_update(context, buffer, bytes); ! MD5Update(&md5context, buffer, bytes); ! if (submission->bc->progressCallback && !submission->bc->preview) { *************** *** 652,655 **** --- 662,668 ---- if (methods && methods->mem_analyze_final) *attrList = methods->mem_analyze_final(context); + + MD5Final(md5Digest, &md5context); + bitziEncodeBase32(md5Digest, 16, md5sum); return ret; |
From: Robert K. <may...@us...> - 2001-08-02 22:43:29
|
Update of /cvsroot/bitcollider/bitcollider In directory usw-pr-cvs1:/tmp/cvs-serv21265 Modified Files: ChangeLog Log Message: Added a note about the image plugin Index: ChangeLog =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** ChangeLog 2001/07/31 23:04:20 1.5 --- ChangeLog 2001/08/02 22:43:26 1.6 *************** *** 2,5 **** --- 2,7 ---- ------------------------- + - A new image plugin as been added. This image plugin was written + by Bitizen delirium and supports GIF, BMP and JPG files) - ID3v2 genres were being reported as strings and not as numeric ID3v1 equivalents. Now all ID3v2 genres that map to ID3v1 genres should |