unaligned int access - fix.

SVN revision: 23702
This commit is contained in:
Carsten Haitzler 2006-07-03 20:15:54 +00:00
parent 4cedfd95b9
commit f1316fa8e9
1 changed files with 17 additions and 13 deletions

View File

@ -562,7 +562,7 @@ eet_open(const char *file, Eet_File_Mode mode)
ef->data_size = file_stat.st_size;
ef->data = mmap(NULL, ef->data_size, PROT_READ, MAP_SHARED, fileno(ef->fp), 0);
if (eet_test_close(ef->data == (void*) -1 || ef->data == NULL, ef))
if (eet_test_close((ef->data == (void *)-1) || (ef->data == NULL), ef))
return NULL;
/* build header table if read mode */
@ -572,8 +572,12 @@ eet_open(const char *file, Eet_File_Mode mode)
return NULL;
#define EXTRACT_INT(Value, Pointer, Index) \
Value = ntohl (*((int*)(Pointer + Index))); \
Index += sizeof(int);
{ \
int tmp; \
memcpy(&tmp, Pointer + Index, sizeof(int)); \
Value = ntohl(tmp); \
Index += sizeof(int); \
}
/* get entries count and byte count */
EXTRACT_INT(num_entries, ef->data, index);
@ -621,7 +625,7 @@ eet_open(const char *file, Eet_File_Mode mode)
int hash;
int k;
#define HEADER_SIZE sizeof (uint32_t) * 5
#define HEADER_SIZE (sizeof(int) * 5)
/* out directory block is inconsistent - we have oveerun our */
/* dynamic block buffer before we finished scanning dir entries */