]> code.citadel.org Git - citadel.git/blobdiff - libcitadel/lib/stringbuf.c
* add wrapper to base64 decoding
[citadel.git] / libcitadel / lib / stringbuf.c
index 87d6e3a7536bbc767e100f1a9d9680042d39e2ee..5a991df5a91d0b307a73aa2201df315b2c8f7f04 100644 (file)
@@ -673,3 +673,19 @@ int CompressBuffer(StrBuf *Buf)
 #endif /* HAVE_ZLIB */
        return 0;
 }
+
+int StrBufDecodeBase64(StrBuf *Buf)
+{
+       char *xferbuf;
+       size_t siz;
+       if (Buf == NULL) return -1;
+
+       xferbuf = (char*) malloc(Buf->BufSize);
+       siz = CtdlDecodeBase64(xferbuf,
+                              Buf->buf,
+                              Buf->BufUsed);
+       free(Buf->buf);
+       Buf->buf = xferbuf;
+       Buf->BufUsed = siz;
+       return siz;
+}