Fixed the bug in the query code: B_MIME_STRING_TYPE was not correctly
translated into B_STRING_TYPE for the key comparison (it was translated but not saved under the new type). compareKeys() will now return -1 if it didn't know the type to compare. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2121 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2066,7 +2066,9 @@ compareKeys(type_code type,const void *key1, int keyLength1, const void *key2, i
|
||||
return (result < 0.0) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
// if the type is unknown, the entries don't match...
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,6 +81,12 @@ union value {
|
||||
char String[INODE_FILE_NAME_LENGTH];
|
||||
};
|
||||
|
||||
// B_MIME_STRING_TYPE is defined in storage/Mime.h, but we
|
||||
// don't need the whole file here; the type can't change anyway
|
||||
#ifndef _MIME_H
|
||||
# define B_MIME_STRING_TYPE 'MIMS'
|
||||
#endif
|
||||
|
||||
class Term {
|
||||
public:
|
||||
Term(int8 op) : fOp(op), fParent(NULL) {}
|
||||
@@ -651,12 +657,10 @@ Equation::ConvertValue(type_code type)
|
||||
if (type == fType)
|
||||
return B_OK;
|
||||
|
||||
fType = type;
|
||||
char *string = fString;
|
||||
|
||||
switch (type) {
|
||||
// B_MIME_STRING_TYPE is defined in Mime.h which I didn't want to include just for that
|
||||
case 'MIMS':
|
||||
case B_MIME_STRING_TYPE:
|
||||
type = B_STRING_TYPE;
|
||||
// supposed to fall through
|
||||
case B_STRING_TYPE:
|
||||
@@ -694,6 +698,8 @@ Equation::ConvertValue(type_code type)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
fType = type;
|
||||
|
||||
// patterns are only allowed for string types
|
||||
if (fType != B_STRING_TYPE && fIsPattern)
|
||||
fIsPattern = false;
|
||||
@@ -1018,7 +1024,7 @@ Equation::GetNextMatching(Volume *volume, TreeIterator *iterator,
|
||||
continue;
|
||||
}
|
||||
|
||||
// check user permissions here - but which one?!
|
||||
// ToDo: check user permissions here - but which one?!
|
||||
// we could filter out all those where we don't have
|
||||
// read access... (we should check for every parent
|
||||
// directory if the X_OK is allowed)
|
||||
|
||||
Reference in New Issue
Block a user