diff --git a/modules/libpr0n/src/imgRequest.cpp b/modules/libpr0n/src/imgRequest.cpp index dd2de0f1114..1fb1ff2bb86 100644 --- a/modules/libpr0n/src/imgRequest.cpp +++ b/modules/libpr0n/src/imgRequest.cpp @@ -808,86 +808,6 @@ imgRequest::SniffMimeType(const char *buf, PRUint32 len) return; } - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - // ALWAYS KEEP THIS SNIFF AT THE END OF THE FILE! - if (len >= 4 && - ((PRUint16*)buf)[0]==0 && - (LITTLE_TO_NATIVE16(((PRUint16*)buf)[1]))==1) { - mContentType = nsCRT::strndup("image/x-icon", 12); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = nsCRT::strndup("image/bmp", 9); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = nsCRT::strndup("image/x-icon", 12); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = nsCRT::strndup("image/bmp", 9); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = nsCRT::strndup("image/x-icon", 12); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = nsCRT::strndup("image/bmp", 9); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = nsCRT::strndup("image/x-icon", 12); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = nsCRT::strndup("image/bmp", 9); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = nsCRT::strndup("image/x-icon", 12); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = nsCRT::strndup("image/bmp", 9); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = nsCRT::strndup("image/x-icon", 12); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = nsCRT::strndup("image/bmp", 9); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = nsCRT::strndup("image/x-icon", 12); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = nsCRT::strndup("image/bmp", 9); - return; - } - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { mContentType = nsCRT::strndup("image/x-icon", 12); diff --git a/netwerk/streamconv/converters/nsUnknownDecoder.cpp b/netwerk/streamconv/converters/nsUnknownDecoder.cpp index faabfcf41ff..dedaeb32733 100644 --- a/netwerk/streamconv/converters/nsUnknownDecoder.cpp +++ b/netwerk/streamconv/converters/nsUnknownDecoder.cpp @@ -413,86 +413,6 @@ void nsUnknownDecoder::SniffForImageMimeType(const char *buf, PRUint32 len) return; } - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - // ALWAYS KEEP THIS SNIFF AT THE END OF THE FILE! - if (len >= 4 && - ((PRUint16*)buf)[0]==0 && - (LITTLE_TO_NATIVE16(((PRUint16*)buf)[1]))==1) { - mContentType = NS_LITERAL_CSTRING("image/x-icon"); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = NS_LITERAL_CSTRING("image/bmp"); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = NS_LITERAL_CSTRING("image/x-icon"); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = NS_LITERAL_CSTRING("image/bmp"); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = NS_LITERAL_CSTRING("image/x-icon"); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = NS_LITERAL_CSTRING("image/bmp"); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = NS_LITERAL_CSTRING("image/x-icon"); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = NS_LITERAL_CSTRING("image/bmp"); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = NS_LITERAL_CSTRING("image/x-icon"); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = NS_LITERAL_CSTRING("image/bmp"); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = NS_LITERAL_CSTRING("image/x-icon"); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = NS_LITERAL_CSTRING("image/bmp"); - return; - } - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { - mContentType = NS_LITERAL_CSTRING("image/x-icon"); - return; - } - - if (len >= 2 && !nsCRT::strncmp(buf, "BM", 2)) { - mContentType = NS_LITERAL_CSTRING("image/bmp"); - return; - } - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. if (len >= 4 && !nsCRT::memcmp(buf, "\000\000\001\000", 4)) { mContentType = NS_LITERAL_CSTRING("image/x-icon");