From d3345a5d754d0aa9494ce51a0e6bc333b6096ff1 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 20 Sep 2011 09:40:55 +0000 Subject: [PATCH] emotion: remove use of xattr. SVN revision: 63495 --- legacy/emotion/configure.ac | 24 ---------- legacy/emotion/src/lib/emotion_smart.c | 61 +++++++------------------- 2 files changed, 17 insertions(+), 68 deletions(-) diff --git a/legacy/emotion/configure.ac b/legacy/emotion/configure.ac index fa12e68a38..08e1fa44f0 100644 --- a/legacy/emotion/configure.ac +++ b/legacy/emotion/configure.ac @@ -185,29 +185,6 @@ case "$host_os" in esac AC_SUBST(lt_enable_auto_import) -### Check for extended attribute - -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include -#include - ]], - [[ -size_t tmp = listxattr("/", NULL, 0); -tmp = getxattr("/", "user.ethumb.md5", NULL, 0); -setxattr("/", "user.ethumb.md5", NULL, 0, 0); - ]])], - [ - AC_DEFINE(HAVE_XATTR, 1, [Define to 1 if you have 'listxattr', 'setxattr' and 'getxattr']) - have_xattr="yes" - ], - [have_xattr="no"]) - -AC_MSG_CHECKING([for Xattr]) -AC_MSG_RESULT([${have_xattr}]) - ### Check for video4linux AC_COMPILE_IFELSE( @@ -356,7 +333,6 @@ echo " edje_cc..............: ${edje_cc}" echo echo " Edje EXTERNAL support: ${have_edje_external}" echo -echo " Xattr................: ${have_xattr}" echo " Eio..................: ${have_eio}" echo " V4L2.................: ${have_v4l2}" echo diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index 8205af51b4..161f467c46 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c @@ -4,11 +4,6 @@ #ifdef HAVE_EIO # include # include -#else -# ifdef HAVE_XATTR -# include -# include -# endif #endif #define E_SMART_OBJ_GET(smart, o, type) \ @@ -1272,19 +1267,11 @@ _eio_load_xattr_cleanup(Smart_Data *sd, Eio_File *handler) } static void -_eio_load_xattr_done(void *data, Eio_File *handler, const char *xattr_data, unsigned int xattr_size) +_eio_load_xattr_done(void *data, Eio_File *handler, double xattr_double) { Smart_Data *sd = data; - if (xattr_size < 128 && xattr_data[xattr_size - 1] == '\0') - { - long long int m = 0; - long int e = 0; - - eina_convert_atod(xattr_data, xattr_size, &m, &e); - emotion_object_position_set(evas_object_smart_parent_get(sd->obj), ldexp((double)m, e)); - } - + emotion_object_position_set(evas_object_smart_parent_get(sd->obj), xattr_double); _eio_load_xattr_cleanup(sd, handler); } @@ -1302,6 +1289,9 @@ emotion_object_last_position_load(Evas_Object *obj) { Smart_Data *sd; const char *tmp; +#ifndef HAVE_EIO + double xattr; +#endif E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); if (!sd->file) return ; @@ -1318,27 +1308,16 @@ emotion_object_last_position_load(Evas_Object *obj) EINA_REFCOUNT_REF(sd); - sd->load_xattr = eio_file_xattr_get(tmp, - "user.e.time_seek", - _eio_load_xattr_done, - _eio_load_xattr_error, - sd); + sd->load_xattr = eio_file_xattr_double_get(tmp, + "user.e.time_seek", + _eio_load_xattr_done, + _eio_load_xattr_error, + sd); #else -# ifdef HAVE_XATTR - { - char double_to_string[128]; - ssize_t sz; - long long int m = 0; - long int e = 0; - - sz = getxattr(tmp, "user.e.time_seek", double_to_string, 128); - if (sz <= 0 || sz > 128 || double_to_string[sz] != '\0') - return ; - - eina_convert_atod(double_to_string, 128, &m, &e); - emotion_object_position_set(obj, ldexp((double)m, e)); - } -# endif + if (eina_xattr_double_get(tmp, "user.e.time_seek", &xattr)) + { + emotion_object_position_set(obj, xattr); + } #endif } @@ -1359,7 +1338,6 @@ emotion_object_last_position_save(Evas_Object *obj) { Smart_Data *sd; const char *tmp; - char double_to_string[128]; E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); if (!sd->file) return ; @@ -1371,16 +1349,11 @@ emotion_object_last_position_save(Evas_Object *obj) else return ; - eina_convert_dtoa(emotion_object_position_get(obj), double_to_string); - #ifdef HAVE_EIO - eio_file_xattr_set(tmp, "user.e.time_seek", - double_to_string, strlen(double_to_string) + 1, 0, - _eio_save_xattr_done, _eio_save_xattr_error, sd); + eio_file_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0, + _eio_save_xattr_done, _eio_save_xattr_error, sd); #else -# ifdef HAVE_XATTR - setxattr(tmp, "user.e.time_seek", double_to_string, strlen(double_to_string), 0); -# endif + eina_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0); #endif }