]> code.citadel.org Git - citadel.git/commitdiff
* some umlaut weirdness
authorWilfried Göesgens <willi@citadel.org>
Sat, 12 Jul 2008 20:19:08 +0000 (20:19 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 12 Jul 2008 20:19:08 +0000 (20:19 +0000)
libcitadel/lib/stringbuf.c

index 30c728f4433deacdcb47d49ac57cb725a2ad49f1..8e42b63332050924c3dfd1521c843f03620b7020 100644 (file)
@@ -382,7 +382,6 @@ void StrBufEUid_unescapize(StrBuf *target, StrBuf *source)
 {
        int a, b, len;
        char hex[3];
-       int target_length = 0;
 
        if (target != NULL)
                FlushStrBuf(target);
@@ -394,7 +393,7 @@ void StrBufEUid_unescapize(StrBuf *target, StrBuf *source)
 
        len = source->BufUsed;
        for (a = 0; a < len; ++a) {
-               if (target_length >= target->BufSize)
+               if (target->BufUsed >= target->BufSize)
                        IncreaseBuf(target, 1, -1);
 
                if (source->buf[a] == '=') {
@@ -403,13 +402,13 @@ void StrBufEUid_unescapize(StrBuf *target, StrBuf *source)
                        hex[2] = 0;
                        b = 0;
                        sscanf(hex, "%02x", &b);
-                       target->buf[target_length] = b;
-                       target->buf[++target_length] = 0;
+                       target->buf[target->BufUsed] = b;
+                       target->buf[++target->BufUsed] = 0;
                        a += 2;
                }
                else {
-                       target->buf[target_length] = source->buf[a];
-                       target->buf[++target_length] = 0;
+                       target->buf[target->BufUsed] = source->buf[a];
+                       target->buf[++target->BufUsed] = 0;
                }
        }
 }
@@ -442,7 +441,7 @@ void StrBufEUid_escapize(StrBuf *target, StrBuf *source)
                else {
                        sprintf(&target->buf[target->BufUsed], 
                                "=%02X", 
-                               source->buf[i]);
+                               (0xFF &source->buf[i]));
                        target->BufUsed += 3;
                }
        }