CtdlEncodeBase64() - only add linebreaks if told to by the caller.
[citadel.git] / libcitadel / lib / base64.c
index 1134588b38045b17072565c15887e2e62df17752..a7be64d9a2834a146076de9dbddda2786c8deb2e 100644 (file)
@@ -88,8 +88,10 @@ size_t CtdlEncodeBase64(char *dest, const char *source, size_t sourcelen, int li
                        bytes_output += 4;
                }
                if ( ((bytes_processed % 57) == 0) || (bytes_processed >= sourcelen) ) {
-                       sprintf(&dest[bytes_output], "\r\n");
-                       bytes_output += 2;
+                       if (linebreaks) {
+                               sprintf(&dest[bytes_output], "\r\n");
+                               bytes_output += 2;
+                       }
                }
 
        }