---
 include/message.h         |    2 +-
 src/libgadu.c             |    4 ++--
 src/message.c             |   25 ++++++++++++-------------
 test/automatic/message2.c |    4 ++--
 4 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/include/message.h b/include/message.h
index 9d02baf..ced7f9a 100644
--- a/include/message.h
+++ b/include/message.h
@@ -51,6 +51,6 @@ int gg_message_init(gg_message_t *gm, int msgclass, int seq, 
uin_t *recipients,
 #endif
 
 size_t gg_message_html_to_text(char *dst, const char *html);
-size_t gg_message_text_to_html(char *dst, const char *src, gg_encoding_t 
encoding, const char *format, size_t format_len);
+size_t gg_message_text_to_html(char *dst, const char *src, gg_encoding_t 
encoding, const unsigned char *format, size_t format_len);
 
 #endif /* LIBGADU_MESSAGE_H */
diff --git a/src/libgadu.c b/src/libgadu.c
index 7084267..c59f499 100644
--- a/src/libgadu.c
+++ b/src/libgadu.c
@@ -1457,7 +1457,7 @@ int gg_send_message_confer_richtext(struct gg_session 
*sess, int msgclass, int r
                        formatlen = 9;
                }
 
-               len = gg_message_text_to_html(NULL, utf_msg, GG_ENCODING_UTF8, 
(const char*) format + 3, formatlen - 3);
+               len = gg_message_text_to_html(NULL, utf_msg, GG_ENCODING_UTF8, 
format + 3, formatlen - 3);
 
                html_msg = malloc(len + 1);
 
@@ -1466,7 +1466,7 @@ int gg_send_message_confer_richtext(struct gg_session 
*sess, int msgclass, int r
                        goto cleanup;
                }
 
-               gg_message_text_to_html(html_msg, utf_msg, GG_ENCODING_UTF8, 
(const char*) format + 3, formatlen - 3);
+               gg_message_text_to_html(html_msg, utf_msg, GG_ENCODING_UTF8, 
format + 3, formatlen - 3);
 
                s80.seq = gg_fix32(seq_no);
                s80.msgclass = gg_fix32(msgclass);
diff --git a/src/message.c b/src/message.c
index 4b798a8..7d403df 100644
--- a/src/message.c
+++ b/src/message.c
@@ -385,7 +385,7 @@ static void gg_append(char *dst, size_t *pos, const void 
*src, int len)
  *
  * \return Długość tekstu wynikowego bez \c \\0 (nawet jeśli \c dst to \c 
NULL).
  */
-size_t gg_message_text_to_html(char *dst, const char *src, gg_encoding_t 
encoding, const char *format, size_t format_len)
+size_t gg_message_text_to_html(char *dst, const char *src, gg_encoding_t 
encoding, const unsigned char *format, size_t format_len)
 {
        const char span_fmt[] = "<span style=\"color:#%02x%02x%02x; 
font-family:'MS Shell Dlg 2'; font-size:9pt; \">";
        const size_t span_len = 75;
@@ -398,7 +398,6 @@ size_t gg_message_text_to_html(char *dst, const char *src, 
gg_encoding_t encodin
        int in_span = 0;
        unsigned int i;
        size_t len = 0;
-       const unsigned char *format_ = (const unsigned char*) format;
 
        /* Pętla przechodzi też przez kończące \0, żeby móc dokleić obrazek
         * na końcu tekstu. */
@@ -428,8 +427,8 @@ size_t gg_message_text_to_html(char *dst, const char *src, 
gg_encoding_t encodin
                        if (format_idx + 3 > format_len)
                                break;
 
-                       attr_pos = format_[format_idx] | (format_[format_idx + 
1] << 8);
-                       attr = format_[format_idx + 2];
+                       attr_pos = format[format_idx] | (format[format_idx + 1] 
<< 8);
+                       attr = format[format_idx + 2];
 
                        /* Nie doklejaj atrybutów na końcu, co najwyżej 
obrazki. */
 
@@ -460,7 +459,7 @@ size_t gg_message_text_to_html(char *dst, const char *src, 
gg_encoding_t encodin
                                const unsigned char *color;
 
                                if (((attr & GG_FONT_COLOR) != 0) && 
(format_idx + 3 <= format_len)) {
-                                       color = &format_[format_idx];
+                                       color = &format[format_idx];
                                        format_idx += 3;
                                } else {
                                        color = default_color;
@@ -495,14 +494,14 @@ size_t gg_message_text_to_html(char *dst, const char 
*src, gg_encoding_t encodin
                        if (((attr & GG_FONT_IMAGE) != 0) && (format_idx + 10 
<= format_len)) {
                                if (dst != NULL) {
                                        sprintf(&dst[len], img_fmt,
-                                               (unsigned int) 
format_[format_idx + 9],
-                                               (unsigned int) 
format_[format_idx + 8], 
-                                               (unsigned int) 
format_[format_idx + 7],
-                                               (unsigned int) 
format_[format_idx + 6], 
-                                               (unsigned int) 
format_[format_idx + 5],
-                                               (unsigned int) 
format_[format_idx + 4],
-                                               (unsigned int) 
format_[format_idx + 3],
-                                               (unsigned int) 
format_[format_idx + 2]);
+                                               (unsigned int) 
format[format_idx + 9],
+                                               (unsigned int) 
format[format_idx + 8],
+                                               (unsigned int) 
format[format_idx + 7],
+                                               (unsigned int) 
format[format_idx + 6],
+                                               (unsigned int) 
format[format_idx + 5],
+                                               (unsigned int) 
format[format_idx + 4],
+                                               (unsigned int) 
format[format_idx + 3],
+                                               (unsigned int) 
format[format_idx + 2]);
                                }
 
                                len += img_len;
diff --git a/test/automatic/message2.c b/test/automatic/message2.c
index 6d92c7f..0e96ba2 100644
--- a/test/automatic/message2.c
+++ b/test/automatic/message2.c
@@ -154,7 +154,7 @@ const struct test_data html_to_text[] =
        { "", "" },
 };
 
-static void test_text_to_html(const char *input, const char *attr, size_t 
attr_len, const char *output, gg_encoding_t encoding)
+static void test_text_to_html(const char *input, const unsigned char *attr, 
size_t attr_len, const char *output, gg_encoding_t encoding)
 {
        char *result;
        size_t len;
@@ -292,7 +292,7 @@ int main(int argc, char **argv)
        int i;
 
        for (i = 0; i < sizeof(text_to_html) / sizeof(text_to_html[0]); i++)
-               test_text_to_html(text_to_html[i].src, text_to_html[i].attr, 
text_to_html[i].attr_len, text_to_html[i].dst, text_to_html[i].encoding);
+               test_text_to_html(text_to_html[i].src, (const unsigned char*) 
text_to_html[i].attr, text_to_html[i].attr_len, text_to_html[i].dst, 
text_to_html[i].encoding);
 
        for (i = 0; i < sizeof(html_to_text) / sizeof(html_to_text[0]); i++)
                test_html_to_text(html_to_text[i].src, html_to_text[i].dst, 
html_to_text[i].attr, html_to_text[i].attr_len);
-- 
1.7.6.1

_______________________________________________
libgadu-devel mailing list
libgadu-devel@lists.ziew.org
http://lists.ziew.org/mailman/listinfo/libgadu-devel

Reply via email to