* eet: handle fixed point in data stream.
authorcedric <cedric>
Fri, 16 Apr 2010 14:44:29 +0000 (14:44 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 16 Apr 2010 14:44:29 +0000 (14:44 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eet@48055 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/eet_data.c

index e48f69c..3d7edc9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * Only delete the file at the last possible time.
        * Reduce open file descriptor.
 
+2010-04-16  Cedric BAIL
+
+       * Handle fixed point in data stream.
index 935ee71..7a3263e 100644 (file)
@@ -721,7 +721,20 @@ eet_data_get_f32p32(const Eet_Dictionary *ed, const void *src, const void *src_e
 
    fp = (Eina_F32p32*) dst;
 
-   if (!ed) return -1;
+   if (!ed)
+     {
+       const char *s, *p;
+       int len;
+
+       s = (const char *) src;
+       p = s;
+       len = 0;
+       while ((p < (const char *)src_end) && (*p != 0)) { len++; p++; }
+
+       if (!(eina_convert_atofp(s, len, fp)))
+         return -1;
+       return 1;
+     }
 
    if (eet_data_get_int(ed, src, src_end, &idx) < 0) return -1;
 
@@ -736,10 +749,22 @@ eet_data_put_f32p32(Eet_Dictionary *ed, const void *src, int *size_ret)
    char  buf[128];
    int   idx;
 
-   if (!ed) return NULL;
-
    eina_convert_fptoa((Eina_F32p32)(*(Eina_F32p32 *)src), buf);
 
+   if (!ed)
+     {
+       char *d;
+       int len;
+
+       len = strlen(buf);
+       d = malloc(len + 1);
+       if (!d) return NULL;
+       memcpy(d, buf, len + 1);
+       *size_ret = len + 1;
+
+       return d;
+     }
+
    idx = eet_dictionary_string_add(ed, buf);
    if (idx == -1) return NULL;