Commit 40b53de7 authored by brucedawson's avatar brucedawson Committed by Commit bot

Move some sniffer arrays to read-only data segment

Due to a quirk in VC++ it is easy to accidentally prevent a const global
array from being placed in the read-only data segment. This change
removes some should-be-harmless 'const' keywords to work around this
quirk and move ~2,500 bytes to the .rdata (read-only) data segment
across chrome.dll and chrome_child.dll. The arrays affected include
kMagicNumbers, kExtraMagicNumbers, kSniffableTags, kOfficeExtensionTypes,
and a few others.

VC++ bug is filed here:
https://connect.microsoft.com/VisualStudio/feedback/details/3117602

Other instances of this quirk are also being worked around.

BUG=677351

Review-Url: https://codereview.chromium.org/2607993002
Cr-Commit-Position: refs/heads/master@{#441007}
parent abc48db4
...@@ -108,11 +108,11 @@ namespace net { ...@@ -108,11 +108,11 @@ namespace net {
static const size_t kBytesRequiredForMagic = 42; static const size_t kBytesRequiredForMagic = 42;
struct MagicNumber { struct MagicNumber {
const char* const mime_type; const char* mime_type;
const char* const magic; const char* magic;
size_t magic_len; size_t magic_len;
bool is_string; bool is_string;
const char* const mask; // if set, must have same length as |magic| const char* mask; // if set, must have same length as |magic|
}; };
#define MAGIC_NUMBER(mime_type, magic) \ #define MAGIC_NUMBER(mime_type, magic) \
...@@ -203,7 +203,7 @@ enum OfficeDocType { ...@@ -203,7 +203,7 @@ enum OfficeDocType {
struct OfficeExtensionType { struct OfficeExtensionType {
OfficeDocType doc_type; OfficeDocType doc_type;
const char* const extension; const char* extension;
size_t extension_len; size_t extension_len;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment