forked from enlightenment/efl
* eet: handle fixed point in data stream.
SVN revision: 48055
This commit is contained in:
parent
2cc28483e6
commit
b7dcdf619a
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue