gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_28-13


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_28-130-ga2c0044
Date: Sun, 15 Nov 2009 15:34:39 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  a2c0044a5e9a1d29513629faea0ccd0755fb3b6a (commit)
      from  cb4ba3d7ee4f6cc4ca08b97b958e614a99ad9f6a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=a2c0044a5e9a1d29513629faea0ccd0755fb3b6a


commit a2c0044a5e9a1d29513629faea0ccd0755fb3b6a
Author: Daniele Forsi <address@hidden>
Date:   Sun Nov 15 16:32:33 2009 +0100

    Fallback to use mbrtowc()/wcrtomb() or mbtowc()/wctomb() if iconv_open() 
fails
    
    Tested on NetBSD 4 and 5.

diff --git a/ChangeLog b/ChangeLog
index 26bf062..f8f9d90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,8 @@
         $XDG_CONFIG_HOME/gnokii for others (following
           freedesktop.org)
       backward compatibility is preserved               (Paweł Kot)
+    o fallback to use mbrtowc()/wcrtomb() or mbtowc()/wctomb() if
+      iconv_open() fails                            (Daniele Forsi)
  * build system updates
     o remove GNOKII_API from the definition of asprinf
                                                       (Jari Turkia)
diff --git a/common/gsm-encoding.c b/common/gsm-encoding.c
index b12e786..1e9c2ae 100644
--- a/common/gsm-encoding.c
+++ b/common/gsm-encoding.c
@@ -302,8 +302,8 @@ int char_mblen(const char *src)
  * or -1 in case of error
  *
  * Converts a multibyte string to a wide char string.
- * Uses iconv() if available, else mbrtowc() if
- * available, else mbtowc().
+ * Uses iconv() if it is available and iconv_open() succeeds, else mbrtowc()
+ * if available, else mbtowc().
  */
 static int char_mbtowc(wchar_t *dst, const char *src, int maxlen, MBSTATE *mbs)
 {
@@ -322,19 +322,19 @@ static int char_mbtowc(wchar_t *dst, const char *src, int 
maxlen, MBSTATE *mbs)
 
        cd = iconv_open("WCHAR_T", gn_char_get_encoding());
        if (cd == (iconv_t)-1)
-               return -1;
+               goto fallback;
        nconv = iconv(cd, &pin, &inlen, &pout, &outlen);
        if (nconv == (size_t)-1)
                perror("char_mbtowc/iconv");
        iconv_close(cd);
 
        return (char*)dst == pout ? -1 : pin-src;
-#else
-#  ifdef HAVE_WCRTOMB
+fallback:
+#endif
+#ifdef HAVE_WCRTOMB
        return mbrtowc(dst, src, maxlen, mbs);
-#  else
+#else
        return mbtowc(dst, src, maxlen);
-#  endif
 #endif
 }
 
@@ -349,8 +349,8 @@ static int char_mbtowc(wchar_t *dst, const char *src, int 
maxlen, MBSTATE *mbs)
  * or -1 in case of error
  *
  * Converts a wide char string to a multibyte string.
- * Uses iconv() if available, else wcrtomb() if
- * available, else wctomb().
+ * Uses iconv() if it is available and iconv_open() succeeds, else wcrtomb()
+ * if available, else wctomb().
  */
 static int char_wctomb(char *dst, wchar_t src, MBSTATE *mbs)
 {
@@ -369,19 +369,19 @@ static int char_wctomb(char *dst, wchar_t src, MBSTATE 
*mbs)
 
        cd = iconv_open(gn_char_get_encoding(), "WCHAR_T");
        if (cd == (iconv_t)-1)
-               return -1;
+               goto fallback;
        nconv = iconv(cd, &pin, &inlen, &pout, &outlen);
        if (nconv == (size_t)-1)
                perror("char_wctomb/iconv");
        iconv_close(cd);
 
        return nconv == -1 ? -1 : pout-dst;
-#else
-    #ifdef HAVE_WCRTOMB
+fallback:
+#endif
+#ifdef HAVE_WCRTOMB
        return wcrtomb(dst, src, mbs);
-    #else
+#else
        return wctomb(dst, src);
-    #endif
 #endif
 }
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |    2 ++
 common/gsm-encoding.c |   28 ++++++++++++++--------------
 2 files changed, 16 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]