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-18


From: Pawel Kot
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_28-185-ge2cd022
Date: Mon, 05 Apr 2010 22:41:53 +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  e2cd022ac22362a2f85aaa0a6646fed2d60270b9 (commit)
       via  740c3bcd0e951ada997c87b5c6dfb92640a48e31 (commit)
      from  4cfbfdfc143d01c7ea95852297cd988a319ade0a (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=e2cd022ac22362a2f85aaa0a6646fed2d60270b9


commit e2cd022ac22362a2f85aaa0a6646fed2d60270b9
Author: Pawel Kot <address@hidden>
Date:   Tue Apr 6 00:36:00 2010 +0200

    Fixed encoding of unicode SMS
    Fixed splitting of multipart unicode SMS
    Avoid unnecessary warnings of iconv() problems
    Add libgnokii dependency on glib-2.0
    SMS encoding works correctly only with libiconv and glib-2.0 support
    In SMS user data structure add field storing number of characters 
information

diff --git a/ChangeLog b/ChangeLog
index 548676b..4bf9a33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,10 @@
     o fallback to use mbrtowc()/wcrtomb() or mbtowc()/wctomb() if
       iconv_open() fails                            (Daniele Forsi)
     o fix sending multipart 8-bit SMS               (Daniele Forsi)
+    o fix SMS encoding                                  (Paweł Kot)
+    o fix SMS splitting into parts (concatenated messages with
+      UCS-2 encoding)                                   (Paweł Kot)
+    o add dependency on glib                            (Paweł Kot)
  * build system updates
     o remove GNOKII_API from the definition of asprinf
                                                       (Jari Turkia)
diff --git a/INSTALL b/INSTALL
index 6623455..c9b0b9c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -49,6 +49,7 @@ Requirements
 
 Additional libraries and header files needed for the various gnokii parts:
 
+libgnokii:             glib-2.0
 xgnokii:               libX11, libXpm, glib-2.6, gtk+-2.0
 
 Optional libraries and files:
diff --git a/common/Makefile.am b/common/Makefile.am
index 2c96723..edc4c18 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -13,13 +13,13 @@ SUBDIRS = phones \
        devices \
        $(DATA_DIR)
 
-LIBS   += $(LIBPCSCLITE_LIBS)
+LIBS   += $(LIBPCSCLITE_LIBS) $(GLIB_LIBS)
 
 pkgconfig_DATA = gnokii.pc
 pkgconfigdir = $(libdir)/pkgconfig
 
 libgnokii_la_CPPFLAGS = -DLIBDIR="\"$(libdir)\""
-libgnokii_la_CFLAGS = -I$(top_srcdir)/include
+libgnokii_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
 
 libgnokii_la_SOURCES = \
        libfunctions.c \
diff --git a/common/gsm-encoding.c b/common/gsm-encoding.c
index 1e9c2ae..c5c7f66 100644
--- a/common/gsm-encoding.c
+++ b/common/gsm-encoding.c
@@ -317,20 +317,23 @@ static int char_mbtowc(wchar_t *dst, const char *src, int 
maxlen, MBSTATE *mbs)
 
        pin = (char *)src;
        pout = (char *)dst;
-       inlen = 4;
-       outlen = sizeof(wchar_t);
+       /* Let's assume that we have at most 4-bytes wide characters */
+       inlen = maxlen;
+       outlen = maxlen * sizeof(wchar_t);
 
        cd = iconv_open("WCHAR_T", gn_char_get_encoding());
        if (cd == (iconv_t)-1)
                goto fallback;
        nconv = iconv(cd, &pin, &inlen, &pout, &outlen);
-       if (nconv == (size_t)-1)
+       if ((nconv == (size_t)-1) && (pin == src))
                perror("char_mbtowc/iconv");
        iconv_close(cd);
 
        return (char*)dst == pout ? -1 : pin-src;
 fallback:
 #endif
+       if (maxlen >= MB_CUR_MAX)
+               maxlen = MB_CUR_MAX - 1;
 #ifdef HAVE_WCRTOMB
        return mbrtowc(dst, src, maxlen, mbs);
 #else
@@ -803,8 +806,6 @@ size_t char_uni_alphabet_encode(const char *value, size_t 
n, wchar_t *dest, MBST
 {
        int length;
 
-       if (n > MB_CUR_MAX)
-               n = MB_CUR_MAX;
        length = char_mbtowc(dest, value, n, mbs);
        return length;
 }
@@ -949,11 +950,17 @@ unsigned int char_unicode_decode(unsigned char* dest, 
const unsigned char* src,
  */
 unsigned int char_unicode_encode(unsigned char* dest, const unsigned char* 
src, int len)
 {
-       int length, offset = 0, pos = 0;
-       wchar_t  wc;
+       int pos = 0;
        MBSTATE mbs;
+#ifndef HAVE_ICONV
+       int length, offset = 0;
+       wchar_t  wc;
+#endif
 
        MBSTATE_ENC_CLEAR(mbs);
+#ifdef HAVE_ICONV
+       pos = ucs2_encode(dest, len, src, len);
+#else
        while (offset < len) {
                length = char_uni_alphabet_encode(src + offset, len - offset, 
&wc, &mbs);
                switch (length) {
@@ -969,6 +976,7 @@ unsigned int char_unicode_encode(unsigned char* dest, const 
unsigned char* src,
                        break;
                }
        }
+#endif
        return pos;
 }
 
@@ -1295,7 +1303,7 @@ int ucs2_encode(char *outstring, int outlen, const char 
*instring, int inlen)
        pin = (char *)instring;
        pout = outstring;
 
-       cd = iconv_open("UCS-2", gn_char_get_encoding());
+       cd = iconv_open("UCS-2BE", gn_char_get_encoding());
        if (cd == (iconv_t)-1)
                return -1;
 
diff --git a/common/gsm-sms.c b/common/gsm-sms.c
index 6902f2a..642cf23 100644
--- a/common/gsm-sms.c
+++ b/common/gsm-sms.c
@@ -34,6 +34,8 @@
 
 #include "config.h"
 
+#include <glib.h>
+
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
@@ -1443,7 +1445,7 @@ static gn_error sms_data_encode(gn_sms *sms, gn_sms_raw 
*rawsms)
                        case GN_SMS_DCS_UCS2:
                                dprintf("UCS-2\n");
                                rawsms->dcs |= 0x08;
-                               length = char_unicode_encode(rawsms->user_data 
+ offset, sms->user_data[i].u.text, length);
+                               length = ucs2_encode(rawsms->user_data + 
offset, GN_SMS_LONG_MAX_LENGTH, sms->user_data[i].u.text, length);
                                rawsms->user_data_length = rawsms->length = 
length + udh_length;
                                break;
                        default:
@@ -1553,9 +1555,9 @@ static void sms_dump_raw(gn_sms_raw *rawsms)
 
        memset(buf, 0, 10240);
 
-       dprintf("dcs: 0x%x\n", rawsms->dcs);
-       dprintf("Length: 0x%x\n", rawsms->length);
-       dprintf("user_data_length: 0x%x\n", rawsms->user_data_length);
+       dprintf("dcs: 0x%02x\n", rawsms->dcs);
+       dprintf("Length: 0x%02x\n", rawsms->length);
+       dprintf("user_data_length: 0x%02x\n", rawsms->user_data_length);
        dprintf("ValidityIndicator: %d\n", rawsms->validity_indicator);
        bin2hex(buf, rawsms->user_data, rawsms->user_data_length);
        dprintf("user_data: %s\n", buf);
@@ -1578,6 +1580,7 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
 {
        int i;
        gn_error error = GN_ERR_NONE;
+
        /*
         * This is for long sms handling. There we have sequence:
         * 1.           gn_sms_send()
@@ -1601,6 +1604,21 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
        if (!data->sms)
                return GN_ERR_INTERNALERROR;
 
+
+       /*
+        * We need to convert sms text to a known encoding (UTF-8) to count the 
input chars.
+        */
+       i = 0;
+       while (data->sms->user_data[i].type != GN_SMS_DATA_None) {
+               gchar *str;
+               gsize inlen, outlen;
+
+               str = g_locale_to_utf8(data->sms->user_data[i].u.text, -1, 
&inlen, &outlen, NULL);
+               data->sms->user_data[i].chars = g_utf8_strlen(str, outlen);
+               g_free(str);
+               i++;
+       }
+
        data->raw_sms = malloc(sizeof(*data->raw_sms));
        memset(data->raw_sms, 0, sizeof(*data->raw_sms));
 
@@ -1681,7 +1699,7 @@ static gn_error sms_send_long(gn_data *data, struct 
gn_statemachine *state)
                        total += (data->sms->user_data[i].length * 7 + 7) / 8;
                        break;
                case GN_SMS_DCS_UCS2:
-                       total += (data->sms->user_data[i].length * 2);
+                       total += (data->sms->user_data[i].chars * 2);
                        break;
                default:
                        total += data->sms->user_data[i].length;
@@ -1736,7 +1754,7 @@ static gn_error sms_send_long(gn_data *data, struct 
gn_statemachine *state)
                        start += copied;
                        memset(&data->sms->user_data[0], 0, 
sizeof(gn_sms_user_data));
                        data->sms->user_data[0].type = ud[0].type;
-                       /* We assume UTF8 input */
+                       /* FIXME: We assume UTF8 input */
                        size = 1;
 #define C ud[0].u.text[start + j]
                        for (j = 0, k = 0; start + j < ud[0].length && k < 
max_sms_len / 2; j++) {
@@ -1756,15 +1774,15 @@ static gn_error sms_send_long(gn_data *data, struct 
gn_statemachine *state)
                                        else if (C >= 252 && C < 254)
                                                size = 6;
                                        else
+                                               /* FIXME: handle it somehow */
                                                dprintf("CHARACTER ENCODING 
ERROR\n");
-                                       /* Avoid cutting the character */
-                                       if (j + size > max_sms_len / 2) {
-                                               dprintf("DEBUG: break: %d %d 
%d\n", j, size, max_sms_len / 2);
-                                               break;
-                                       }
                                        k++;
                                }
-                               data->sms->user_data[0].u.text[j] = 
ud[0].u.text[start + j];
+                               /* Avoid cutting a character */
+                               if (k < max_sms_len / 2)
+                                       data->sms->user_data[0].u.text[j] = 
ud[0].u.text[start + j];
+                               else
+                                       j--;
                        }
 #undef C
                        data->sms->user_data[0].length = copied = j;
diff --git a/configure.in b/configure.in
index 4b50bef..b71f42e 100644
--- a/configure.in
+++ b/configure.in
@@ -713,16 +713,15 @@ dnl ======================== Check for libsocket
 AC_CHECK_LIB(socket, socket)
 
 dnl ======================== Checks for glib support for smsd
+PKG_CHECK_MODULES(GLIB, glib-2.0 gmodule-2.0, found_glib=yes, found_glib=no)
 
-found_glib=no
-
+dnl ======================== Autodetect for possibilities to compile smsd
 AC_ARG_ENABLE(smsd,
        AC_HELP_STRING([--disable-smsd],
                [disable smsd support (default is autodetected)]),,
        [enable_smsd=yes])
 
 if test "$enable_smsd" = yes; then
-       PKG_CHECK_MODULES(GLIB, glib-2.0 gmodule-2.0, found_glib=yes, 
found_glib=no)
        if test "$found_glib" = no; then
                AC_MSG_WARN(Cannot find glib 2.0.)
                AC_MSG_WARN(Disabling smsd.)
diff --git a/include/gnokii/sms.h b/include/gnokii/sms.h
index 012b9b0..01feffb 100644
--- a/include/gnokii/sms.h
+++ b/include/gnokii/sms.h
@@ -377,7 +377,8 @@ typedef struct {
 
 typedef struct {
        gn_sms_data_type type;
-       unsigned int length;
+       unsigned int length;    /* Number of bytes used */
+       unsigned int chars;     /* Number of chars used */
        union {
                unsigned char text[10 * GN_SMS_MAX_LENGTH + 1];
                gn_sms_multi multi;
diff --git a/include/misc.h b/include/misc.h
index 46a9f92..19a2bcb 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -43,18 +43,6 @@
 
 #define ARRAY_LEN(x) (sizeof((x)) / sizeof((x)[0]))
 
-/* If glib.h is included, G_GNUC_PRINTF is already defined. */
-#ifndef G_GNUC_PRINTF
-/* Stolen from <glib.h>: */
-#  if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-#    define G_GNUC_PRINTF( format_idx, arg_idx )       \
-      __attribute__((format (printf, format_idx, arg_idx)))
-#  else        /* !__GNUC__ */
-#    define G_GNUC_PRINTF( format_idx, arg_idx )
-#  endif       /* !__GNUC__ */
-#endif
-
-
 #define GNOKII_MAX(a, b)  (((a) > (b)) ? (a) : (b))
 #define GNOKII_MIN(a, b)  (((a) < (b)) ? (a) : (b))
 

http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=740c3bcd0e951ada997c87b5c6dfb92640a48e31


commit e2cd022ac22362a2f85aaa0a6646fed2d60270b9
Author: Pawel Kot <address@hidden>
Date:   Tue Apr 6 00:36:00 2010 +0200

    Fixed encoding of unicode SMS
    Fixed splitting of multipart unicode SMS
    Avoid unnecessary warnings of iconv() problems
    Add libgnokii dependency on glib-2.0
    SMS encoding works correctly only with libiconv and glib-2.0 support
    In SMS user data structure add field storing number of characters 
information

diff --git a/ChangeLog b/ChangeLog
index 548676b..4bf9a33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,10 @@
     o fallback to use mbrtowc()/wcrtomb() or mbtowc()/wctomb() if
       iconv_open() fails                            (Daniele Forsi)
     o fix sending multipart 8-bit SMS               (Daniele Forsi)
+    o fix SMS encoding                                  (Paweł Kot)
+    o fix SMS splitting into parts (concatenated messages with
+      UCS-2 encoding)                                   (Paweł Kot)
+    o add dependency on glib                            (Paweł Kot)
  * build system updates
     o remove GNOKII_API from the definition of asprinf
                                                       (Jari Turkia)
diff --git a/INSTALL b/INSTALL
index 6623455..c9b0b9c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -49,6 +49,7 @@ Requirements
 
 Additional libraries and header files needed for the various gnokii parts:
 
+libgnokii:             glib-2.0
 xgnokii:               libX11, libXpm, glib-2.6, gtk+-2.0
 
 Optional libraries and files:
diff --git a/common/Makefile.am b/common/Makefile.am
index 2c96723..edc4c18 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -13,13 +13,13 @@ SUBDIRS = phones \
        devices \
        $(DATA_DIR)
 
-LIBS   += $(LIBPCSCLITE_LIBS)
+LIBS   += $(LIBPCSCLITE_LIBS) $(GLIB_LIBS)
 
 pkgconfig_DATA = gnokii.pc
 pkgconfigdir = $(libdir)/pkgconfig
 
 libgnokii_la_CPPFLAGS = -DLIBDIR="\"$(libdir)\""
-libgnokii_la_CFLAGS = -I$(top_srcdir)/include
+libgnokii_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
 
 libgnokii_la_SOURCES = \
        libfunctions.c \
diff --git a/common/gsm-encoding.c b/common/gsm-encoding.c
index 1e9c2ae..c5c7f66 100644
--- a/common/gsm-encoding.c
+++ b/common/gsm-encoding.c
@@ -317,20 +317,23 @@ static int char_mbtowc(wchar_t *dst, const char *src, int 
maxlen, MBSTATE *mbs)
 
        pin = (char *)src;
        pout = (char *)dst;
-       inlen = 4;
-       outlen = sizeof(wchar_t);
+       /* Let's assume that we have at most 4-bytes wide characters */
+       inlen = maxlen;
+       outlen = maxlen * sizeof(wchar_t);
 
        cd = iconv_open("WCHAR_T", gn_char_get_encoding());
        if (cd == (iconv_t)-1)
                goto fallback;
        nconv = iconv(cd, &pin, &inlen, &pout, &outlen);
-       if (nconv == (size_t)-1)
+       if ((nconv == (size_t)-1) && (pin == src))
                perror("char_mbtowc/iconv");
        iconv_close(cd);
 
        return (char*)dst == pout ? -1 : pin-src;
 fallback:
 #endif
+       if (maxlen >= MB_CUR_MAX)
+               maxlen = MB_CUR_MAX - 1;
 #ifdef HAVE_WCRTOMB
        return mbrtowc(dst, src, maxlen, mbs);
 #else
@@ -803,8 +806,6 @@ size_t char_uni_alphabet_encode(const char *value, size_t 
n, wchar_t *dest, MBST
 {
        int length;
 
-       if (n > MB_CUR_MAX)
-               n = MB_CUR_MAX;
        length = char_mbtowc(dest, value, n, mbs);
        return length;
 }
@@ -949,11 +950,17 @@ unsigned int char_unicode_decode(unsigned char* dest, 
const unsigned char* src,
  */
 unsigned int char_unicode_encode(unsigned char* dest, const unsigned char* 
src, int len)
 {
-       int length, offset = 0, pos = 0;
-       wchar_t  wc;
+       int pos = 0;
        MBSTATE mbs;
+#ifndef HAVE_ICONV
+       int length, offset = 0;
+       wchar_t  wc;
+#endif
 
        MBSTATE_ENC_CLEAR(mbs);
+#ifdef HAVE_ICONV
+       pos = ucs2_encode(dest, len, src, len);
+#else
        while (offset < len) {
                length = char_uni_alphabet_encode(src + offset, len - offset, 
&wc, &mbs);
                switch (length) {
@@ -969,6 +976,7 @@ unsigned int char_unicode_encode(unsigned char* dest, const 
unsigned char* src,
                        break;
                }
        }
+#endif
        return pos;
 }
 
@@ -1295,7 +1303,7 @@ int ucs2_encode(char *outstring, int outlen, const char 
*instring, int inlen)
        pin = (char *)instring;
        pout = outstring;
 
-       cd = iconv_open("UCS-2", gn_char_get_encoding());
+       cd = iconv_open("UCS-2BE", gn_char_get_encoding());
        if (cd == (iconv_t)-1)
                return -1;
 
diff --git a/common/gsm-sms.c b/common/gsm-sms.c
index 6902f2a..642cf23 100644
--- a/common/gsm-sms.c
+++ b/common/gsm-sms.c
@@ -34,6 +34,8 @@
 
 #include "config.h"
 
+#include <glib.h>
+
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
@@ -1443,7 +1445,7 @@ static gn_error sms_data_encode(gn_sms *sms, gn_sms_raw 
*rawsms)
                        case GN_SMS_DCS_UCS2:
                                dprintf("UCS-2\n");
                                rawsms->dcs |= 0x08;
-                               length = char_unicode_encode(rawsms->user_data 
+ offset, sms->user_data[i].u.text, length);
+                               length = ucs2_encode(rawsms->user_data + 
offset, GN_SMS_LONG_MAX_LENGTH, sms->user_data[i].u.text, length);
                                rawsms->user_data_length = rawsms->length = 
length + udh_length;
                                break;
                        default:
@@ -1553,9 +1555,9 @@ static void sms_dump_raw(gn_sms_raw *rawsms)
 
        memset(buf, 0, 10240);
 
-       dprintf("dcs: 0x%x\n", rawsms->dcs);
-       dprintf("Length: 0x%x\n", rawsms->length);
-       dprintf("user_data_length: 0x%x\n", rawsms->user_data_length);
+       dprintf("dcs: 0x%02x\n", rawsms->dcs);
+       dprintf("Length: 0x%02x\n", rawsms->length);
+       dprintf("user_data_length: 0x%02x\n", rawsms->user_data_length);
        dprintf("ValidityIndicator: %d\n", rawsms->validity_indicator);
        bin2hex(buf, rawsms->user_data, rawsms->user_data_length);
        dprintf("user_data: %s\n", buf);
@@ -1578,6 +1580,7 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
 {
        int i;
        gn_error error = GN_ERR_NONE;
+
        /*
         * This is for long sms handling. There we have sequence:
         * 1.           gn_sms_send()
@@ -1601,6 +1604,21 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
        if (!data->sms)
                return GN_ERR_INTERNALERROR;
 
+
+       /*
+        * We need to convert sms text to a known encoding (UTF-8) to count the 
input chars.
+        */
+       i = 0;
+       while (data->sms->user_data[i].type != GN_SMS_DATA_None) {
+               gchar *str;
+               gsize inlen, outlen;
+
+               str = g_locale_to_utf8(data->sms->user_data[i].u.text, -1, 
&inlen, &outlen, NULL);
+               data->sms->user_data[i].chars = g_utf8_strlen(str, outlen);
+               g_free(str);
+               i++;
+       }
+
        data->raw_sms = malloc(sizeof(*data->raw_sms));
        memset(data->raw_sms, 0, sizeof(*data->raw_sms));
 
@@ -1681,7 +1699,7 @@ static gn_error sms_send_long(gn_data *data, struct 
gn_statemachine *state)
                        total += (data->sms->user_data[i].length * 7 + 7) / 8;
                        break;
                case GN_SMS_DCS_UCS2:
-                       total += (data->sms->user_data[i].length * 2);
+                       total += (data->sms->user_data[i].chars * 2);
                        break;
                default:
                        total += data->sms->user_data[i].length;
@@ -1736,7 +1754,7 @@ static gn_error sms_send_long(gn_data *data, struct 
gn_statemachine *state)
                        start += copied;
                        memset(&data->sms->user_data[0], 0, 
sizeof(gn_sms_user_data));
                        data->sms->user_data[0].type = ud[0].type;
-                       /* We assume UTF8 input */
+                       /* FIXME: We assume UTF8 input */
                        size = 1;
 #define C ud[0].u.text[start + j]
                        for (j = 0, k = 0; start + j < ud[0].length && k < 
max_sms_len / 2; j++) {
@@ -1756,15 +1774,15 @@ static gn_error sms_send_long(gn_data *data, struct 
gn_statemachine *state)
                                        else if (C >= 252 && C < 254)
                                                size = 6;
                                        else
+                                               /* FIXME: handle it somehow */
                                                dprintf("CHARACTER ENCODING 
ERROR\n");
-                                       /* Avoid cutting the character */
-                                       if (j + size > max_sms_len / 2) {
-                                               dprintf("DEBUG: break: %d %d 
%d\n", j, size, max_sms_len / 2);
-                                               break;
-                                       }
                                        k++;
                                }
-                               data->sms->user_data[0].u.text[j] = 
ud[0].u.text[start + j];
+                               /* Avoid cutting a character */
+                               if (k < max_sms_len / 2)
+                                       data->sms->user_data[0].u.text[j] = 
ud[0].u.text[start + j];
+                               else
+                                       j--;
                        }
 #undef C
                        data->sms->user_data[0].length = copied = j;
diff --git a/configure.in b/configure.in
index 4b50bef..b71f42e 100644
--- a/configure.in
+++ b/configure.in
@@ -713,16 +713,15 @@ dnl ======================== Check for libsocket
 AC_CHECK_LIB(socket, socket)
 
 dnl ======================== Checks for glib support for smsd
+PKG_CHECK_MODULES(GLIB, glib-2.0 gmodule-2.0, found_glib=yes, found_glib=no)
 
-found_glib=no
-
+dnl ======================== Autodetect for possibilities to compile smsd
 AC_ARG_ENABLE(smsd,
        AC_HELP_STRING([--disable-smsd],
                [disable smsd support (default is autodetected)]),,
        [enable_smsd=yes])
 
 if test "$enable_smsd" = yes; then
-       PKG_CHECK_MODULES(GLIB, glib-2.0 gmodule-2.0, found_glib=yes, 
found_glib=no)
        if test "$found_glib" = no; then
                AC_MSG_WARN(Cannot find glib 2.0.)
                AC_MSG_WARN(Disabling smsd.)
diff --git a/include/gnokii/sms.h b/include/gnokii/sms.h
index 012b9b0..01feffb 100644
--- a/include/gnokii/sms.h
+++ b/include/gnokii/sms.h
@@ -377,7 +377,8 @@ typedef struct {
 
 typedef struct {
        gn_sms_data_type type;
-       unsigned int length;
+       unsigned int length;    /* Number of bytes used */
+       unsigned int chars;     /* Number of chars used */
        union {
                unsigned char text[10 * GN_SMS_MAX_LENGTH + 1];
                gn_sms_multi multi;
diff --git a/include/misc.h b/include/misc.h
index 46a9f92..19a2bcb 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -43,18 +43,6 @@
 
 #define ARRAY_LEN(x) (sizeof((x)) / sizeof((x)[0]))
 
-/* If glib.h is included, G_GNUC_PRINTF is already defined. */
-#ifndef G_GNUC_PRINTF
-/* Stolen from <glib.h>: */
-#  if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-#    define G_GNUC_PRINTF( format_idx, arg_idx )       \
-      __attribute__((format (printf, format_idx, arg_idx)))
-#  else        /* !__GNUC__ */
-#    define G_GNUC_PRINTF( format_idx, arg_idx )
-#  endif       /* !__GNUC__ */
-#endif
-
-
 #define GNOKII_MAX(a, b)  (((a) > (b)) ? (a) : (b))
 #define GNOKII_MIN(a, b)  (((a) < (b)) ? (a) : (b))
 

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

Summary of changes:
 ChangeLog             |    4 ++++
 INSTALL               |    1 +
 common/Makefile.am    |    4 ++--
 common/gsm-encoding.c |   24 ++++++++++++++++--------
 common/gsm-sms.c      |   42 ++++++++++++++++++++++++++++++------------
 common/misc.c         |    1 +
 configure.in          |    5 ++---
 include/gnokii/sms.h  |    3 ++-
 include/misc.h        |   12 ------------
 9 files changed, 58 insertions(+), 38 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs




reply via email to

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