2003-02-02 17:07:58 -08:00
|
|
|
#ifndef _EET_PRIVATE_H
|
|
|
|
#define _EET_PRIVATE_H
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/types.h>
|
2004-07-14 09:37:29 -07:00
|
|
|
#include <sys/stat.h>
|
2003-02-02 17:07:58 -08:00
|
|
|
#include <fcntl.h>
|
2006-05-19 19:44:24 -07:00
|
|
|
#include <errno.h>
|
2005-11-03 19:22:22 -08:00
|
|
|
#if HAVE_ALLOCA_H
|
|
|
|
#include <alloca.h>
|
|
|
|
#endif
|
2004-07-14 09:37:29 -07:00
|
|
|
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
2003-02-02 17:07:58 -08:00
|
|
|
#include <netinet/in.h>
|
2004-07-14 09:37:29 -07:00
|
|
|
#elif __MINGW32__
|
|
|
|
#include <winsock.h>
|
|
|
|
#endif
|
|
|
|
|
2003-02-02 17:07:58 -08:00
|
|
|
#include <zlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <fnmatch.h>
|
|
|
|
#include <jpeglib.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <locale.h>
|
|
|
|
|
2006-01-09 23:32:56 -08:00
|
|
|
#ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
|
|
|
// BROKEN in gcc 4 on amd64
|
|
|
|
//# pragma GCC visibility push(hidden)
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2006-03-03 18:46:24 -08:00
|
|
|
FILE *_eet_memfile_read_open(const void *data, size_t size);
|
2003-02-02 17:07:58 -08:00
|
|
|
void _eet_memfile_read_close(FILE *f);
|
|
|
|
FILE *_eet_memfile_write_open(void **data, size_t *size);
|
|
|
|
void _eet_memfile_write_close(FILE *f);
|
2004-01-17 06:58:50 -08:00
|
|
|
void _eet_memfile_shutdown();
|
2003-07-10 03:32:27 -07:00
|
|
|
|
|
|
|
#ifndef PATH_MAX
|
2005-05-25 20:57:57 -07:00
|
|
|
#define PATH_MAX 4096
|
2003-07-10 03:32:27 -07:00
|
|
|
#endif
|
|
|
|
|
2006-06-13 03:20:22 -07:00
|
|
|
/* caluclate hash table entry valu with bitmask size of hash_size */
|
|
|
|
static int
|
|
|
|
eet_hash_gen(const char *key, int hash_size)
|
|
|
|
{
|
|
|
|
int hash_num = 0;
|
|
|
|
int value, i;
|
|
|
|
unsigned char *ptr;
|
|
|
|
|
|
|
|
const int masks[9] =
|
|
|
|
{
|
|
|
|
0x00,
|
|
|
|
0x01,
|
|
|
|
0x03,
|
|
|
|
0x07,
|
|
|
|
0x0f,
|
|
|
|
0x1f,
|
|
|
|
0x3f,
|
|
|
|
0x7f,
|
|
|
|
0xff
|
|
|
|
};
|
|
|
|
|
|
|
|
/* no string - index 0 */
|
|
|
|
if (!key) return 0;
|
|
|
|
|
|
|
|
/* calc hash num */
|
|
|
|
for (i = 0, ptr = (unsigned char *)key, value = (int)(*ptr);
|
|
|
|
value;
|
|
|
|
ptr++, i++, value = (int)(*ptr))
|
|
|
|
hash_num ^= (value | (value << 8)) >> (i & 0x7);
|
|
|
|
|
|
|
|
/* mask it */
|
|
|
|
hash_num &= masks[hash_size];
|
|
|
|
/* return it */
|
|
|
|
return hash_num;
|
|
|
|
}
|
|
|
|
|
2003-02-02 17:07:58 -08:00
|
|
|
#endif
|