summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
010b333)
Fix various compiler warnings; we almost compile cleanly with --std=c99 and
-D_BSD_SOURCE.
subkeys[count++] = get_packetid(cursubkey->packet);
cursubkey = cursubkey -> next;
}
subkeys[count++] = get_packetid(cursubkey->packet);
cursubkey = cursubkey -> next;
}
-int worddb_cmp(const char *d1, const char *d2)
+int worddb_cmp(const void *d1, const void *d2)
{
return memcmp(d1, d2, 12);
}
{
return memcmp(d1, d2, 12);
}
{
register uint32_t h = FNV_offset_basis;
register uint32_t p = FNV_mixing_prime;
{
register uint32_t h = FNV_offset_basis;
register uint32_t p = FNV_mixing_prime;
- register uint32_t n = strlen(ptr);
+ register uint32_t n = strlen((char *) ptr);
register uint8_t *c = ptr;
while (n--) {
h *= p;
register uint8_t *c = ptr;
while (n--) {
h *= p;
void keypath(char *buffer, uint64_t _keyid)
{
uint64_t keyid = _keyid << 32;
void keypath(char *buffer, uint64_t _keyid)
{
uint64_t keyid = _keyid << 32;
- snprintf(buffer, PATH_MAX, "%s/key/%02X/%02X/%08lX/%016llX",
+ snprintf(buffer, PATH_MAX, "%s/key/%02X/%02X/%08X/%016llX",
config.db_dir, (uint8_t) ((keyid >> 56) & 0xFF),
(uint8_t) ((keyid >> 48) & 0xFF),
(uint32_t) (keyid >> 32), _keyid);
config.db_dir, (uint8_t) ((keyid >> 56) & 0xFF),
(uint8_t) ((keyid >> 48) & 0xFF),
(uint32_t) (keyid >> 32), _keyid);
void keydir(char *buffer, uint64_t _keyid)
{
uint64_t keyid = _keyid << 32;
void keydir(char *buffer, uint64_t _keyid)
{
uint64_t keyid = _keyid << 32;
- snprintf(buffer, PATH_MAX, "%s/key/%02X/%02X/%08lX", config.db_dir,
+ snprintf(buffer, PATH_MAX, "%s/key/%02X/%02X/%08X", config.db_dir,
(uint8_t) ((keyid >> 56) & 0xFF),
(uint8_t) ((keyid >> 48) & 0xFF),
(uint32_t) (keyid >> 32));
(uint8_t) ((keyid >> 56) & 0xFF),
(uint8_t) ((keyid >> 48) & 0xFF),
(uint32_t) (keyid >> 32));
(uint8_t) ((keyid >> 16) & 0xFF));
mkdir(buffer, 0777);
(uint8_t) ((keyid >> 16) & 0xFF));
mkdir(buffer, 0777);
- snprintf(buffer, PATH_MAX, "%s/%s/%02X/%02X/%08lX", config.db_dir, what,
+ snprintf(buffer, PATH_MAX, "%s/%s/%02X/%02X/%08X", config.db_dir, what,
(uint8_t) ((keyid >> 24) & 0xFF),
(uint8_t) ((keyid >> 16) & 0xFF), (uint32_t) (keyid));
mkdir(buffer, 0777);
(uint8_t) ((keyid >> 24) & 0xFF),
(uint8_t) ((keyid >> 16) & 0xFF), (uint32_t) (keyid));
mkdir(buffer, 0777);
void wordpath(char *buffer, char *word, uint32_t hash, uint64_t keyid)
{
void wordpath(char *buffer, char *word, uint32_t hash, uint64_t keyid)
{
- snprintf(buffer, PATH_MAX, "%s/words/%02X/%02X/%08lX/%s/%016llX",
+ snprintf(buffer, PATH_MAX, "%s/words/%02X/%02X/%08X/%s/%016llX",
config.db_dir, (uint8_t) ((hash >> 24) & 0xFF),
(uint8_t) ((hash >> 16) & 0xFF), hash, word, keyid);
}
void worddir(char *buffer, char *word, uint32_t hash)
{
config.db_dir, (uint8_t) ((hash >> 24) & 0xFF),
(uint8_t) ((hash >> 16) & 0xFF), hash, word, keyid);
}
void worddir(char *buffer, char *word, uint32_t hash)
{
- snprintf(buffer, PATH_MAX, "%s/words/%02X/%02X/%08lX/%s", config.db_dir,
+ snprintf(buffer, PATH_MAX, "%s/words/%02X/%02X/%08X/%s", config.db_dir,
(uint8_t) ((hash >> 24) & 0xFF),
(uint8_t) ((hash >> 16) & 0xFF), hash, word);
}
(uint8_t) ((hash >> 24) & 0xFF),
(uint8_t) ((hash >> 16) & 0xFF), hash, word);
}
{
struct ll *wordlist = NULL, *wl = NULL;
struct ll *keylist = NULL;
{
struct ll *wordlist = NULL, *wl = NULL;
struct ll *keylist = NULL;
+ char *searchtext = NULL;
int addedkeys = 0;
logthing(LOGTHING_CRITICAL, "Search was '%s'", search);
int addedkeys = 0;
logthing(LOGTHING_CRITICAL, "Search was '%s'", search);
- wl = wordlist = makewordlist(wordlist, search);
+ searchtext = strdup(search);
+ wl = wordlist = makewordlist(wordlist, searchtext);
keylist = internal_get_key_by_word(wordlist->object, NULL);
if (!keylist) {
llfree(wordlist, NULL);
keylist = internal_get_key_by_word(wordlist->object, NULL);
if (!keylist) {
llfree(wordlist, NULL);
+ free(searchtext);
+ searchtext = NULL;
if (!nkl) {
llfree(wordlist, NULL);
llfree(keylist, free);
if (!nkl) {
llfree(wordlist, NULL);
llfree(keylist, free);
+ free(searchtext);
+ searchtext = NULL;
return 0;
}
llfree(keylist, free);
return 0;
}
llfree(keylist, free);
+ free(searchtext);
+ searchtext = NULL;
*/
static int keydb_fetchchar(void *fd, size_t count, unsigned char *c)
{
*/
static int keydb_fetchchar(void *fd, size_t count, unsigned char *c)
{
- return (!lo_read(dbconn, *(int *) fd, c, count));
+ return (!lo_read(dbconn, *(int *) fd, (char *) c, count));
*/
static int keydb_putchar(void *fd, size_t count, unsigned char *c)
{
*/
static int keydb_putchar(void *fd, size_t count, unsigned char *c)
{
- return !(lo_write(dbconn, *(int *) fd, c, count));
+ return !(lo_write(dbconn, *(int *) fd, (char *) c, count));
* $Id: onak.c,v 1.22 2004/05/31 14:16:49 noodles Exp $
*/
* $Id: onak.c,v 1.22 2004/05/31 14:16:49 noodles Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>