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_29-31


From: Pawel Kot
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-31-g45085fe
Date: Fri, 09 Jul 2010 17:59:00 +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  45085fe9b7a11c71a238b73c773807908576f98a (commit)
      from  35d70d70c66b42a6a9ee65f153a0e093360bc26a (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=45085fe9b7a11c71a238b73c773807908576f98a


commit 45085fe9b7a11c71a238b73c773807908576f98a
Author: Pawel Kot <address@hidden>
Date:   Fri Jul 9 19:55:54 2010 +0200

    Fix char_ucs2_encode() function. It was not encoding all input.

diff --git a/ChangeLog b/ChangeLog
index beeadef..66326b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
                                                     (Daniele Forsi)
     o fix mbox format of --getsms for sent messages; closes
       https://savannah.nongnu.org/bugs/?30050       (Daniele Forsi)
+    o fix char_ucs2_encode() function                   (Paweł Kot)
  * nk6510 driver updates
     o fix parsing SMS date from saved messages, bug #29830
                                                         (Paweł Kot)
diff --git a/common/gsm-encoding.c b/common/gsm-encoding.c
index 72cb142..c5fd065 100644
--- a/common/gsm-encoding.c
+++ b/common/gsm-encoding.c
@@ -885,7 +885,8 @@ void char_ucs2_decode(unsigned char* dest, const unsigned 
char* src, int len)
  *
  * Converts a string from ISO/IEC 8859-1 to UCS-2 encoded as ASCII-encoded 
hexadecimal bytes.
  * This function should convert "ABC" to "004100420043"
- * Used in AT driver for UCS2 encoding commands.
+ * Used only in AT driver for UCS2 encoding commands.
+ * It reads char by char from the input.
  */
 #define UCS2_SIZE      4
 size_t char_ucs2_encode(char *dest, size_t dest_len, const char *src, size_t 
len)
@@ -895,16 +896,15 @@ size_t char_ucs2_encode(char *dest, size_t dest_len, 
const char *src, size_t len
        MBSTATE mbs;
 
        MBSTATE_ENC_CLEAR(mbs);
-       for (i = 0, o_len = 0; i < len && o_len < dest_len / UCS2_SIZE; 
o_len++) {
+       for (i = 0, o_len = 0; i < len && o_len < dest_len / UCS2_SIZE; 
o_len++, i++) {
                /*
                 * We read input by convertible chunks. 'length' is length of
                 * the read chunk.
                 */
-               length = char_uni_alphabet_encode(src + i, len - i, &wc, &mbs);
+               length = char_uni_alphabet_encode(src + i, 1, &wc, &mbs);
                /* We stop reading after first unreadable input */
                if (length < 1)
                        return o_len * UCS2_SIZE;
-               i += length;
                /* We write here 4 chars + NULL termination */
                /* XXX: We should probably check wchar_t size. */
                snprintf(dest + (o_len * UCS2_SIZE), UCS2_SIZE + 1, "%04x", wc);

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

Summary of changes:
 ChangeLog             |    1 +
 common/gsm-encoding.c |    8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

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