forked from qt-creator/qt-creator
MimeDatabase: expose MimeMagicRule::makePattern
It is necessary for validating pattern values and masks before trying to create a MimeMagicRule instance (which asserts on invalid entries). Change-Id: I6aa31dc9b1f700317e9696be8193bbc8aaf5ace2 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -185,7 +185,7 @@ static bool matchNumber(const MimeMagicRulePrivate *d, const QByteArray &data)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline QByteArray makePattern(const QByteArray &value)
|
||||
QByteArray MimeMagicRule::makePattern(const QByteArray &value)
|
||||
{
|
||||
QByteArray pattern(value.size(), Qt::Uninitialized);
|
||||
char *data = pattern.data();
|
||||
|
@@ -89,6 +89,8 @@ public:
|
||||
static QByteArray typeName(Type type);
|
||||
|
||||
static bool matchSubstring(const char *dataPtr, int dataSize, int rangeStart, int rangeLength, int valueLength, const char *valueData, const char *mask);
|
||||
// Qt Creator additions
|
||||
static QByteArray makePattern(const QByteArray &value); // necessary to be able to verify magic because otherwise MimMagicRule constructor asserts...
|
||||
|
||||
private:
|
||||
const QScopedPointer<MimeMagicRulePrivate> d;
|
||||
|
Reference in New Issue
Block a user