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:
Axel Dörfler
2002-11-29 19:22:52 +00:00
parent edd97f84ad
commit 006928f81b
2 changed files with 30 additions and 22 deletions
@@ -2066,7 +2066,9 @@ compareKeys(type_code type,const void *key1, int keyLength1, const void *key2, i
return (result < 0.0) ? -1 : 1; return (result < 0.0) ? -1 : 1;
} }
} }
return 0;
// if the type is unknown, the entries don't match...
return -1;
} }
+10 -4
View File
@@ -81,6 +81,12 @@ union value {
char String[INODE_FILE_NAME_LENGTH]; 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 { class Term {
public: public:
Term(int8 op) : fOp(op), fParent(NULL) {} Term(int8 op) : fOp(op), fParent(NULL) {}
@@ -651,12 +657,10 @@ Equation::ConvertValue(type_code type)
if (type == fType) if (type == fType)
return B_OK; return B_OK;
fType = type;
char *string = fString; char *string = fString;
switch (type) { switch (type) {
// B_MIME_STRING_TYPE is defined in Mime.h which I didn't want to include just for that case B_MIME_STRING_TYPE:
case 'MIMS':
type = B_STRING_TYPE; type = B_STRING_TYPE;
// supposed to fall through // supposed to fall through
case B_STRING_TYPE: case B_STRING_TYPE:
@@ -694,6 +698,8 @@ Equation::ConvertValue(type_code type)
return B_ERROR; return B_ERROR;
} }
fType = type;
// patterns are only allowed for string types // patterns are only allowed for string types
if (fType != B_STRING_TYPE && fIsPattern) if (fType != B_STRING_TYPE && fIsPattern)
fIsPattern = false; fIsPattern = false;
@@ -1018,7 +1024,7 @@ Equation::GetNextMatching(Volume *volume, TreeIterator *iterator,
continue; 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 // we could filter out all those where we don't have
// read access... (we should check for every parent // read access... (we should check for every parent
// directory if the X_OK is allowed) // directory if the X_OK is allowed)