ecore_txt is also a thin and picky wrapper around eina_str_convert()
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 27 Feb 2010 01:10:26 +0000 (01:10 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 27 Feb 2010 01:10:26 +0000 (01:10 +0000)
this remove explicit dependency on iconv, so no checks are required
anymore.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@46546 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
src/lib/ecore_txt/Ecore_Txt.h
src/lib/ecore_txt/Makefile.am
src/lib/ecore_txt/ecore_txt.c

index 15bdc3b..1c514f1 100644 (file)
@@ -438,37 +438,6 @@ elif test "x$have_glib" = "xyes"; then
 fi
 
 
-# iconv library (ecore_txt)
-
-iconv_cflags=""
-iconv_libs=""
-have_iconv="no"
-AC_ARG_WITH([iconv-link],
-   AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]),
-   [
-    iconv_libs=$withval
-    have_iconv="yes"
-   ])
-
-AC_MSG_CHECKING(for explicit iconv link options)
-if test "x${iconv_libs}" = "x" ; then
-   AC_MSG_RESULT([no explicit iconv link option])
-else
-   AC_MSG_RESULT([$iconv_libs])
-fi
-
-AM_ICONV
-
-if test "x${have_iconv}" = "xno" && test "x${am_cv_func_iconv}" = "xyes" ; then
-   iconv_cflags=${LIBICONV}
-   iconv_libs=${LTLIBICONV}
-   have_iconv="yes"
-fi
-
-AC_SUBST(iconv_cflags)
-AC_SUBST(iconv_libs)
-
-
 # SDL library (ecore_sdl)
 
 have_sdl="no"
@@ -1000,7 +969,7 @@ fi
 ECORE_CHECK_MODULE([data], [${want_ecore_data}], [Data])
 
 # ecore_txt
-ECORE_CHECK_MODULE([txt], [${want_ecore_txt}], [Txt], [$have_iconv])
+ECORE_CHECK_MODULE([txt], [${want_ecore_txt}], [Txt], [yes])
 
 # ecore_con
 ECORE_CHECK_MODULE([con], [${want_ecore_con}], [Con], [${have_addrinfo}])
index 734fa8a..ece8637 100644 (file)
@@ -5,6 +5,9 @@
 #ifndef _ECORE_TXT_H
 #define _ECORE_TXT_H
 
+#include <Eina.h>
+#warning "this file is deprecated. use Eina.h instead."
+
 #ifdef EAPI
 # undef EAPI
 #endif
@@ -40,7 +43,7 @@
 extern "C" {
 #endif
 
-EAPI char *ecore_txt_convert(const char *enc_from, const char *enc_to, const char *text);
+EAPI char *ecore_txt_convert(const char *enc_from, const char *enc_to, const char *text) EINA_DEPRECATED;
 
 #ifdef __cplusplus
 }
index f86f103..3ec8e35 100644 (file)
@@ -4,7 +4,7 @@ AM_CPPFLAGS = \
 -I$(top_srcdir)/src/lib/ecore \
 -I$(top_builddir)/src/lib/ecore \
 @EFL_ECORE_TXT_BUILD@ \
-@iconv_cflags@
+@EINA_CFLAGS@
 
 if BUILD_ECORE_TXT
 
@@ -16,7 +16,7 @@ Ecore_Txt.h
 libecore_txt_la_SOURCES = \
 ecore_txt.c
 
-libecore_txt_la_LIBADD = @iconv_libs@
+libecore_txt_la_LIBADD =  @EINA_LIBS@
 
 libecore_txt_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @ecore_txt_release_info@
 
index eb9201a..dd4545c 100644 (file)
@@ -6,80 +6,15 @@
 # include <config.h>
 #endif
 
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <iconv.h>
-
 #include "Ecore_Txt.h"
-#include "ecore_txt_private.h"
 
 
 /**
- * To be documented.
- * 
- * FIXME: Finish this.
+ * @deprecated use eina_str_convert() instead.
  */
 EAPI char *
 ecore_txt_convert(const char *enc_from, const char *enc_to, const char *text)
 {
-   iconv_t ic;
-   char *new_txt, *inp, *outp;
-   size_t inb, outb, outlen, tob, outalloc;
-   
-   if (!text) return NULL;
-   ic = iconv_open(enc_to, enc_from);
-   if (ic == (iconv_t)(-1)) return NULL;
-   new_txt  = malloc(64);
-   inb      = strlen(text);
-   outb     = 64;
-   inp      = (char*)text;
-   outp     = new_txt;
-   outalloc = 64;
-   outlen   = 0;
-
-   for (;;)
-     {
-       size_t count;
-
-       tob = outb;
-       count = iconv(ic, &inp, &inb, &outp, &outb);
-       outlen += tob - outb;
-       if (count == (size_t)(-1))
-         {
-            if (errno == E2BIG)
-              {
-                 new_txt = realloc(new_txt, outalloc + 64);
-                 outp = new_txt + outlen;
-                 outalloc += 64;
-                 outb += 64;
-              }
-            else if (errno == EILSEQ)
-              {
-                 if (new_txt) free(new_txt);
-                 new_txt = NULL;
-                 break;
-              }
-            else if (errno == EINVAL)
-              {
-                 if (new_txt) free(new_txt);
-                 new_txt = NULL;
-                 break;
-              }
-            else
-              {
-                 if (new_txt) free(new_txt);
-                 new_txt = NULL;
-                 break;
-              }
-         }
-       if (inb == 0)
-         {
-            if (outalloc == outlen) new_txt = realloc(new_txt, outalloc + 1);
-            new_txt[outlen] = 0;
-            break;
-         }
-     }
-   iconv_close(ic);
-   return new_txt;
+   EINA_LOG_ERR("use eina_str_convert() instead.");
+   return eina_str_convert(enc_from, enc_to, text);
 }