]> code.citadel.org Git - citadel.git/blobdiff - libcitadel/lib/tools.c
* Commented out the 'PrintFlat' and 'PrintFile' functions
[citadel.git] / libcitadel / lib / tools.c
index 15e346778aad74a2c3909c3425c5f39a9844667a..fac3cb5ad6644f08cd52efc4dca0659f633b1155 100644 (file)
@@ -73,12 +73,14 @@ const byte dtable[256] = {
        128, 128, 0
 };
 
-/**
- * \brief copy a string into a buffer of a known size. abort if we exceed the limits
- * \param dest the targetbuffer
- * \param src the source string
- * \param n the size od dest
- * \returns the number of characters copied if dest is big enough, -n if not.
+/*
+ * copy a string into a buffer of a known size. abort if we exceed the limits
+ *
+ * dest        the targetbuffer
+ * src the source string
+ * n   the size od dest
+ *
+ * returns the number of characters copied if dest is big enough, -n if not.
  */
 int safestrncpy(char *dest, const char *src, size_t n)
 {
@@ -444,7 +446,7 @@ char *rfc2047encode(char *line, long length)
                return strdup(line);
        }
 
-       result = (char*) malloc(strlen(UTF8_HEADER) + 4 + length * 2);
+       result = (char*) malloc(sizeof(UTF8_HEADER) + 4 + length * 2);
        strncpy (result, UTF8_HEADER, strlen (UTF8_HEADER));
        CtdlEncodeBase64(result + strlen(UTF8_HEADER), line, length, 0);
        end = strlen (result);
@@ -986,7 +988,7 @@ int Ctdl_Utf8StrLen(char *str)
  */
 char *Ctdl_Utf8StrCut(char *str, int maxlen)
 {
-       int n, m = 0;
+       int n = 0, m = 0;
        char *aptr;
 
        if (str == NULL)
@@ -1029,3 +1031,4 @@ void convert_spaces_to_underscores(char *str)
        }
 }
 
+