parent
7546655695
commit
959a404e1c
@ -96,6 +96,8 @@ namespace hex::magic {
|
||||
}
|
||||
|
||||
std::string getDescription(const std::vector<u8> &data, bool firstEntryOnly) {
|
||||
if (data.empty()) return "";
|
||||
|
||||
auto magicFiles = getMagicFiles();
|
||||
|
||||
if (magicFiles.has_value()) {
|
||||
@ -119,6 +121,8 @@ namespace hex::magic {
|
||||
}
|
||||
|
||||
std::string getMIMEType(const std::vector<u8> &data, bool firstEntryOnly) {
|
||||
if (data.empty()) return "";
|
||||
|
||||
auto magicFiles = getMagicFiles();
|
||||
|
||||
if (magicFiles.has_value()) {
|
||||
@ -134,6 +138,13 @@ namespace hex::magic {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string getMIMEType(prv::Provider *provider, size_t size, bool firstEntryOnly) {
|
||||
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
||||
provider->read(provider->getBaseAddress(), buffer.data(), buffer.size());
|
||||
|
||||
return getMIMEType(buffer, firstEntryOnly);
|
||||
}
|
||||
|
||||
std::string getExtensions(prv::Provider *provider, size_t size, bool firstEntryOnly) {
|
||||
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
||||
provider->read(provider->getBaseAddress(), buffer.data(), buffer.size());
|
||||
@ -142,6 +153,8 @@ namespace hex::magic {
|
||||
}
|
||||
|
||||
std::string getExtensions(const std::vector<u8> &data, bool firstEntryOnly) {
|
||||
if (data.empty()) return "";
|
||||
|
||||
auto magicFiles = getMagicFiles();
|
||||
|
||||
if (magicFiles.has_value()) {
|
||||
@ -165,6 +178,8 @@ namespace hex::magic {
|
||||
}
|
||||
|
||||
std::string getAppleCreatorType(const std::vector<u8> &data, bool firstEntryOnly) {
|
||||
if (data.empty()) return "";
|
||||
|
||||
auto magicFiles = getMagicFiles();
|
||||
|
||||
if (magicFiles.has_value()) {
|
||||
@ -180,13 +195,6 @@ namespace hex::magic {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string getMIMEType(prv::Provider *provider, size_t size, bool firstEntryOnly) {
|
||||
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
||||
provider->read(provider->getBaseAddress(), buffer.data(), buffer.size());
|
||||
|
||||
return getMIMEType(buffer, firstEntryOnly);
|
||||
}
|
||||
|
||||
bool isValidMIMEType(const std::string &mimeType) {
|
||||
// MIME types always contain a slash
|
||||
if (!mimeType.contains("/"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user