gnokii-commit
[Top][All Lists]
Advanced

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

gnokii ChangeLog common/phones/nk6510.c include...


From: Pawel Kot
Subject: gnokii ChangeLog common/phones/nk6510.c include...
Date: Sat, 17 Jun 2006 20:33:06 +0000

CVSROOT:        /cvsroot/gnokii
Module name:    gnokii
Changes by:     Pawel Kot <pkot>        06/06/17 20:33:05

Modified files:
        .              : ChangeLog 
        common/phones  : nk6510.c 
        include        : gnokii-internal.h 
        common         : gsm-encoding.c 

Log message:
        The string length of strings with multibyte chars is not calculated 
correctly by strlen() (Daniel Gollub)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnokii/ChangeLog?cvsroot=gnokii&r1=1.1199&r2=1.1200
http://cvs.savannah.gnu.org/viewcvs/gnokii/common/phones/nk6510.c?cvsroot=gnokii&r1=1.213&r2=1.214
http://cvs.savannah.gnu.org/viewcvs/gnokii/include/gnokii-internal.h?cvsroot=gnokii&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnokii/common/gsm-encoding.c?cvsroot=gnokii&r1=1.68&r2=1.69

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnokii/gnokii/ChangeLog,v
retrieving revision 1.1199
retrieving revision 1.1200
diff -u -b -r1.1199 -r1.1200
--- ChangeLog   17 Jun 2006 20:10:46 -0000      1.1199
+++ ChangeLog   17 Jun 2006 20:33:05 -0000      1.1200
@@ -50,6 +50,8 @@
       missed calls or dialled numbers)                  (Pawel Kot)
     o support date fields in phonebook export and format them
       sanely in raw format                              (Pawel Kot)
+    o the string length of strings with multibyte chars is not
+      calculated correctly by strlen()              (Daniel Gollub)
  * nk6510 driver updates
     o handle calendar extended parameters writing       (Pawel Kot)
     o support for Symbian phones (identifier 'symbian'), generic

Index: common/phones/nk6510.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/phones/nk6510.c,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -b -r1.213 -r1.214
--- common/phones/nk6510.c      23 May 2006 20:00:06 -0000      1.213
+++ common/phones/nk6510.c      17 Jun 2006 20:33:05 -0000      1.214
@@ -1,6 +1,6 @@
 /*
 
-  $Id: nk6510.c,v 1.213 2006/05/23 20:00:06 deller Exp $
+  $Id: nk6510.c,v 1.214 2006/06/17 20:33:05 pkot Exp $
 
   G N O K I I
 
@@ -2951,7 +2951,7 @@
        req[9] = calnote->location % 256;
 
        /* text */
-       req[49] = strlen(calnote->text);
+       req[49] = char_mblen(calnote->text);
        len = char_unicode_encode(req + 54, calnote->text, 
strlen(calnote->text));
        count += len;
 
@@ -2964,7 +2964,7 @@
                break;
        case GN_CALNOTE_MEETING:
                req[27] = 0x01;
-               req[50] = strlen(calnote->mlocation);
+               req[50] = char_mblen(calnote->mlocation);
                count += char_unicode_encode(req + 54 + len, 
calnote->mlocation, strlen(calnote->mlocation));
                break;
        case GN_CALNOTE_CALL:

Index: include/gnokii-internal.h
===================================================================
RCS file: /cvsroot/gnokii/gnokii/include/gnokii-internal.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- include/gnokii-internal.h   11 Jun 2006 20:41:39 -0000      1.32
+++ include/gnokii-internal.h   17 Jun 2006 20:33:05 -0000      1.33
@@ -1,6 +1,6 @@
 /*
 
-  $Id: gnokii-internal.h,v 1.32 2006/06/11 20:41:39 deller Exp $
+  $Id: gnokii-internal.h,v 1.33 2006/06/17 20:33:05 pkot Exp $
 
   G N O K I I
 
@@ -74,6 +74,8 @@
 int char_7bit_pack(unsigned int offset, unsigned char *input, unsigned char 
*output,
                   unsigned int *in_len);
 
+int char_mblen(const char *src);
+
 unsigned int char_unicode_decode(unsigned char* dest, const unsigned char* 
src, int len);
 unsigned int char_unicode_encode(unsigned char* dest, const unsigned char* 
src, int len);
 

Index: common/gsm-encoding.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/gsm-encoding.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- common/gsm-encoding.c       17 Jun 2006 20:06:17 -0000      1.68
+++ common/gsm-encoding.c       17 Jun 2006 20:33:05 -0000      1.69
@@ -1,6 +1,6 @@
 /*
 
-  $Id: gsm-encoding.c,v 1.68 2006/06/17 20:06:17 pkot Exp $
+  $Id: gsm-encoding.c,v 1.69 2006/06/17 20:33:05 pkot Exp $
 
   G N O K I I
 
@@ -137,6 +137,14 @@
                return get_langinfo_codeset(); /* return default codeset */
 }
 
+/* detect the correct len of a string (also for multibyte chars like 
"umlaute") */
+int char_mblen(const char *src)
+{
+       int len = mbstowcs(NULL, src, 0);
+       dprintf("char_mblen(%s): %i\n", src, len);
+       return len;
+}
+
 static int char_mbtowc(wchar_t *dst, const char *src, int maxlen, MBSTATE *mbs)
 {
 #ifdef HAVE_ICONV




reply via email to

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