Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/eet
Dir : e17/libs/eet/src/lib
Modified Files:
Eet.h Eet_private.h eet_data.c eet_dictionary.c eet_lib.c
Log Message:
add cedrics dict check patch
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/Eet.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- Eet.h 2 Mar 2008 06:49:48 -0000 1.46
+++ Eet.h 6 Mar 2008 17:52:59 -0000 1.47
@@ -224,6 +224,7 @@
/* FIXME: Add some documentation */
EAPI Eet_Dictionary* eet_dictionary_get(Eet_File *ef);
+ EAPI int eet_dictionary_string_check(Eet_Dictionary *ed, const char
*string);
/**
* Read a specified entry from an eet file and return data
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/Eet_private.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- Eet_private.h 2 Mar 2008 06:49:48 -0000 1.20
+++ Eet_private.h 6 Mar 2008 17:52:59 -0000 1.21
@@ -87,6 +87,9 @@
int count;
int total;
+
+ const char *start;
+ const char *end;
};
Eet_Dictionary *eet_dictionary_add(void);
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_data.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- eet_data.c 2 Mar 2008 06:49:48 -0000 1.64
+++ eet_data.c 6 Mar 2008 17:52:59 -0000 1.65
@@ -1437,6 +1437,7 @@
case EET_T_UINT:
case EET_T_ULONG_LONG:
break;
+ case EET_T_INLINED_STRING:
case EET_T_STRING:
if (node->data.str) free(node->data.str);
break;
@@ -1620,6 +1621,7 @@
free(data);
}
break;
+ case EET_T_INLINED_STRING:
case EET_T_STRING:
data = eet_data_put_type(ed, node->type, &(node->data.str), &size);
if (data)
@@ -2033,6 +2035,18 @@
}
}
}
+ else
+ if (type == EET_T_INLINED_STRING)
+ {
+ char **str;
+
+ str = (char **)(((char *)data) +
ede->offset);
+ if (*str)
+ {
+ *str = edd->func.str_alloc(*str);
+ _eet_freelist_str_add(*str);
+ }
+ }
}
else if (ede->subtype)
{
@@ -2244,6 +2258,7 @@
dumpfunc(dumpdata, "ulong_long: ");
snprintf(tbuf, sizeof(tbuf), "%llu", *((unsigned
long long *)dd));
dumpfunc(dumpdata, tbuf); break;
+ case EET_T_INLINED_STRING:
case EET_T_STRING:
{
char *s;
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_dictionary.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- eet_dictionary.c 1 Mar 2008 17:37:39 -0000 1.1
+++ eet_dictionary.c 6 Mar 2008 17:52:59 -0000 1.2
@@ -170,8 +170,17 @@
return NULL;
if (index < ed->count)
{
+#ifdef _WIN32
+ /* Windows file system could change the mmaped file when replacing a
file. So we need to copy all string in memory to avoid bugs. */
+ if (ed->all[index].str == NULL)
+ {
+ ed->all[index].str = strdup(ed->all[index].mmap);
+ ed->all[index].mmap = NULL;
+ }
+#else
if (ed->all[index].mmap)
return ed->all[index].mmap;
+#endif
return ed->all[index].str;
}
return NULL;
@@ -289,5 +298,25 @@
*result = ed->all[index].convert.d;
return -1;
}
+ return 0;
+}
+
+EAPI int
+eet_dictionary_string_check(Eet_Dictionary *ed, const char *string)
+{
+ int i;
+
+ if (ed == NULL
+ || string == NULL)
+ return 0;
+
+ if (ed->start <= string
+ && string < ed->end)
+ return 1;
+
+ for (i = 0; i < ed->count; ++i)
+ if (ed->all[i].str == string)
+ return 1;
+
return 0;
}
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_lib.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -3 -r1.91 -r1.92
--- eet_lib.c 2 Mar 2008 06:49:48 -0000 1.91
+++ eet_lib.c 6 Mar 2008 17:52:59 -0000 1.92
@@ -814,7 +814,9 @@
if (eet_test_close(!ef->ed->all, ef)) return NULL;
ef->ed->count = num_dictionary_entries;
-
+ ef->ed->start = start + bytes_dictionary_entries +
bytes_directory_entries;
+ ef->ed->end = ef->ed->start;
+
for (j = 0; j < ef->ed->count; ++j)
{
int hash;
@@ -838,6 +840,9 @@
ef->ed->all[j].mmap = start + offset;
ef->ed->all[j].str = NULL;
+
+ if (ef->ed->all[j].mmap + ef->ed->all[j].len > ef->ed->end)
+ ef->ed->end = ef->ed->all[j].mmap + ef->ed->all[j].len;
/* Check '\0' at the end of the string */
if (eet_test_close(ef->ed->all[j].mmap[ef->ed->all[j].len - 1] !=
'\0', ef)) return NULL;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs