From b7dcdf619a11364355cc011261e671a254ab3416 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 16 Apr 2010 14:44:29 +0000 Subject: [PATCH] * eet: handle fixed point in data stream. SVN revision: 48055 --- legacy/eet/ChangeLog | 3 +++ legacy/eet/src/lib/eet_data.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/legacy/eet/ChangeLog b/legacy/eet/ChangeLog index e48f69cf64..3d7edc9e56 100644 --- a/legacy/eet/ChangeLog +++ b/legacy/eet/ChangeLog @@ -362,3 +362,6 @@ * Only delete the file at the last possible time. * Reduce open file descriptor. +2010-04-16 Cedric BAIL + + * Handle fixed point in data stream. diff --git a/legacy/eet/src/lib/eet_data.c b/legacy/eet/src/lib/eet_data.c index 935ee711e6..7a3263e2c8 100644 --- a/legacy/eet/src/lib/eet_data.c +++ b/legacy/eet/src/lib/eet_data.c @@ -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;