Lines Matching full:magic
100 // The number of content bytes we need to use all our magic numbers. Feel free
101 // to increase this number if you add a longer magic number.
106 const std::string_view magic; member
108 const char* const mask; // if set, must have same length as |magic|
111 #define MAGIC_NUMBER(mime_type, magic) \ argument
112 { (mime_type), std::string_view((magic), sizeof(magic) - 1), false, nullptr }
122 #define verified_sizeof(magic, mask) \ argument
123 VerifySizes<sizeof(magic), sizeof(mask)>::SIZES
125 #define MAGIC_MASK(mime_type, magic, mask) \ argument
127 (mime_type), std::string_view((magic), verified_sizeof(magic, mask) - 1), \
131 // Magic strings are case insensitive and must not include '\0' characters
132 #define MAGIC_STRING(mime_type, magic) \ argument
133 { (mime_type), std::string_view((magic), sizeof(magic) - 1), true, nullptr }
170 // Including these magic number for Flash is a trade off.
184 // The number of content bytes we need to use all our Microsoft Office magic
285 // Compare content header to a magic number where magic_entry can contain '.'
315 DCHECK_LE(magic_entry.magic.length(), kBytesRequiredForMagic); in MatchMagicNumber()
318 if (content.length() >= magic_entry.magic.length()) { in MatchMagicNumber()
321 DCHECK_EQ(std::string_view::npos, magic_entry.magic.find('\0')); in MatchMagicNumber()
324 match = base::StartsWith(content, magic_entry.magic, in MatchMagicNumber()
327 match = MagicCmp(content, magic_entry.magic); in MatchMagicNumber()
329 std::string_view magic_mask(magic_entry.mask, magic_entry.magic.length()); in MatchMagicNumber()
330 match = MagicMaskCmp(content, magic_entry.magic, magic_mask); in MatchMagicNumber()
344 for (const MagicNumber& magic : magic_numbers) { in CheckForMagicNumbers() local
345 if (MatchMagicNumber(content, magic, result)) in CheckForMagicNumbers()
387 // Check our big table of Magic Numbers in SniffForMagicNumbers()
401 // Check our table of magic numbers for Office file types. in SniffForOfficeDocs()
493 // Check our table of magic numbers for Office file types. If it does not in SniffForInvalidOfficeDocs()
642 // Technically, the crx magic number is just Cr24, but the bytes after that in SniffCRX()
777 // Check the file extension and magic numbers to see if this is an Office in SniffMimeType()
778 // document. This needs to be checked before the general magic numbers in SniffMimeType()
779 // because zip files and Office documents (OOXML) have the same magic number. in SniffMimeType()
781 return true; // We've matched a magic number. No more content needed. in SniffMimeType()
784 // We're not interested in sniffing for magic numbers when the type_hint in SniffMimeType()
789 // Now we look in our large table of magic numbers to see if we can find in SniffMimeType()
792 return true; // We've matched a magic number. No more content needed. in SniffMimeType()