]> code.citadel.org Git - citadel.git/blobdiff - libcitadel/lib/mime_parser.c
* add gzip + configure detection -> re-bootstrap!
[citadel.git] / libcitadel / lib / mime_parser.c
index 14f292a6def95a637e5fe9275f2804e03a21f88a..48bea24f187dffd4b65d0c70e408660a5c05c64c 100644 (file)
@@ -493,18 +493,15 @@ void the_mime_parser(char *partnum,
                }
                part_end = content_end;
 
-               /******
-                * I thought there was an off-by-one error here, but there isn't.
-                * This probably means that there's an off-by-one error somewhere
-                * else ... or maybe only in certain messages?
-               --part_end;
-               --length;
-               ******/
-               
-               /* Truncate if the header told us to */
-               if ( (content_length > 0) && (length > content_length) ) {
-                       length = content_length;
-               }
+
+               /* The following code will truncate the MIME part to the size
+                * specified by the Content-length: header.   We have commented it
+                * out because these headers have a tendency to be wrong.
+                *
+                *      if ( (content_length > 0) && (length > content_length) ) {
+                *              length = content_length;
+                *      }
+                 */
 
                /* Sometimes the "name" field is tacked on to Content-type,
                 * and sometimes it's tacked on to Content-disposition.  Use
@@ -681,7 +678,7 @@ MimeGuess MyMimes [] = {
 };
 
 
-const char *GuessMimeType(char *data, size_t dlen)
+const char *GuessMimeType(const char *data, size_t dlen)
 {
        int MimeIndex = 0;
 
@@ -757,6 +754,7 @@ static void DeleteIcon(void *IconNamePtr)
        free(Icon->FileName);
 }
 
+/*
 static const char *PrintFlat(void *IconNamePtr)
 {
        IconName *Icon = (IconName*) IconNamePtr;
@@ -767,6 +765,8 @@ static const char *PrintFile(void *IconNamePtr)
        IconName *Icon = (IconName*) IconNamePtr;
        return Icon->FileName;
 }
+*/
+
 #define GENSTR "x-generic"
 #define IGNORE_PREFIX_1 "gnome-mime"
 int LoadIconDir(const char *DirName)
@@ -778,7 +778,7 @@ int LoadIconDir(const char *DirName)
        IconName *Icon;
 
        filedir = opendir (DirName);
-       IconHash = NewHash();
+       IconHash = NewHash(1, NULL);
        if (filedir == NULL) {
                return 0;
        }
@@ -842,19 +842,21 @@ int LoadIconDir(const char *DirName)
 
 const char *GetIconFilename(char *MimeType, size_t len)
 {
+       void *vIcon;
        IconName *Icon;
        
        if(IconHash == NULL)
                return NULL;
 
-       GetHash(IconHash, MimeType, len, (void**)&Icon);
+       GetHash(IconHash, MimeType, len, &vIcon), Icon = (IconName*) vIcon;
        /* didn't find the exact mimetype? try major only. */
        if (Icon == NULL) {
                char * pMinor;
                pMinor = strchr(MimeType, '/');
                if (pMinor != NULL) {
                        *pMinor = '\0';
-                       GetHash(IconHash, MimeType, pMinor - MimeType, (void**)&Icon);
+                       GetHash(IconHash, MimeType, pMinor - MimeType, &vIcon),
+                               Icon = (IconName*) vIcon;
                }
        }
        if (Icon == NULL) {