From f7a2cb567f8361a45bae7bb2d3c7ee91006b74c6 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Sat, 3 Nov 2001 12:00:32 +0000 Subject: [PATCH] Fixing 18502, I misapplied the patch and checked in duplicate lines of code. Backing out. --- modules/libpr0n/src/imgRequest.cpp | 80 ------------------- .../converters/nsUnknownDecoder.cpp | 80 ------------------- 2 files changed, 160 deletions(-) diff --git a/modules/libpr0n/src/imgRequest.cpp b/modules/libpr0n/src/imgRequest.cpp index dd2de0f11143..1fb1ff2bb865 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 faabfcf41ffd..dedaeb327334 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");