[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kio/kio
From:       Maks Orlovich <maksim () kde ! org>
Date:       2007-06-13 22:56:18
Message-ID: 1181775378.241217.23436.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 675314 by orlovich:

Be a bit more trusting of some tags when trying to autodetect the mimetype...
... which not uncommonly happens due to sucky servers

(Common with ads -- there are some on digg.com, sports.yahoo.com...)
CCBUG:61483


 M  +8 -5      kmimemagic.cpp  


--- branches/KDE/3.5/kdelibs/kio/kio/kmimemagic.cpp #675313:675314
@@ -230,6 +230,9 @@
 #define L_DIFF   0x400          /* Output of diff */
 #define L_OBJC   0x800          /* Objective C */
 
+// Note: this is not a type, it's just used to mark items that should count more
+#define FLAG_STRONG 0x1000
+
 #define P_HTML   0          /* HTML */
 #define P_C      1          /* first and foremost on UNIX */
 #define P_MAKE   2          /* Makefiles */
@@ -271,10 +274,10 @@
 	short type;
 } const names[] = {
 	{
-		"<html", L_HTML
+		"<html", L_HTML | FLAG_STRONG
 	},
 	{
-		"<HTML", L_HTML
+		"<HTML", L_HTML | FLAG_STRONG
 	},
 	{
 		"<head", L_HTML
@@ -340,10 +343,10 @@
 		"<FRAMESET", L_HTML
 	},
         {
-                "<script", L_HTML
+                "<script", L_HTML | FLAG_STRONG
         },
         {
-                "<SCRIPT", L_HTML
+                "<SCRIPT", L_HTML | FLAG_STRONG
         },
 	{
 		"/*", L_C|L_CPP|L_JAVA|L_OBJC
@@ -1881,7 +1884,7 @@
 			}
                     }
                     for (i = 0; i < (int)NTYPES; i++) {
-                        if ((1 << i) & p->type) typecount[i]++;
+                        if ((1 << i) & p->type) typecount[i]+= p->type & FLAG_STRONG ? 2 : 1;
                     }
 		}
             }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic