* Cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31710 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-07-23 09:45:54 +00:00
parent 664683a7d2
commit 8315ac2417
2 changed files with 141 additions and 147 deletions

View File

@ -1,23 +1,19 @@
//---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
// by the OpenBeOS license. * Distributed under the terms of the MIT License.
//--------------------------------------------------------------------- */
/*!
\file Query.h
BQuery interface declaration.
*/
#ifndef _QUERY_H #ifndef _QUERY_H
#define _QUERY_H #define _QUERY_H
#include <EntryList.h> #include <EntryList.h>
#include <Messenger.h> #include <Messenger.h>
#include <OS.h> #include <OS.h>
#include <SupportDefs.h>
class BVolume; class BVolume;
struct entry_ref; struct entry_ref;
namespace BPrivate { namespace BPrivate {
namespace Storage { namespace Storage {
class QueryNode; class QueryNode;
@ -43,6 +39,7 @@ typedef enum {
_B_RESERVED_OP_ = 0x100000 _B_RESERVED_OP_ = 0x100000
} query_op; } query_op;
/*! /*!
\class BQuery \class BQuery
\brief Represents a live or non-live file system query \brief Represents a live or non-live file system query
@ -56,68 +53,70 @@ typedef enum {
*/ */
class BQuery : public BEntryList { class BQuery : public BEntryList {
public: public:
BQuery(); BQuery();
virtual ~BQuery(); virtual ~BQuery();
status_t Clear(); status_t Clear();
status_t PushAttr(const char *attrName); status_t PushAttr(const char* attrName);
status_t PushOp(query_op op); status_t PushOp(query_op op);
status_t PushUInt32(uint32 value); status_t PushUInt32(uint32 value);
status_t PushInt32(int32 value); status_t PushInt32(int32 value);
status_t PushUInt64(uint64 value); status_t PushUInt64(uint64 value);
status_t PushInt64(int64 value); status_t PushInt64(int64 value);
status_t PushFloat(float value); status_t PushFloat(float value);
status_t PushDouble(double value); status_t PushDouble(double value);
status_t PushString(const char *value, bool caseInsensitive = false); status_t PushString(const char* value,
status_t PushDate(const char *date); bool caseInsensitive = false);
status_t PushDate(const char* date);
status_t SetVolume(const BVolume *volume); status_t SetVolume(const BVolume* volume);
status_t SetPredicate(const char *expression); status_t SetPredicate(const char* expression);
status_t SetTarget(BMessenger messenger); status_t SetTarget(BMessenger messenger);
bool IsLive() const; bool IsLive() const;
status_t GetPredicate(char *buffer, size_t length); status_t GetPredicate(char* buffer, size_t length);
status_t GetPredicate(BString *predicate); status_t GetPredicate(BString* predicate);
size_t PredicateLength(); size_t PredicateLength();
dev_t TargetDevice() const; dev_t TargetDevice() const;
status_t Fetch(); status_t Fetch();
// BEntryList interface // BEntryList interface
virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); virtual status_t GetNextEntry(BEntry* entry, bool traverse = false);
virtual status_t GetNextRef(entry_ref *ref); virtual status_t GetNextRef(entry_ref* ref);
virtual int32 GetNextDirents(struct dirent *buf, size_t length, virtual int32 GetNextDirents(struct dirent* buffer, size_t length,
int32 count = INT_MAX); int32 count = INT_MAX);
virtual status_t Rewind(); virtual status_t Rewind();
virtual int32 CountEntries(); virtual int32 CountEntries();
private: private:
bool _HasFetched() const; bool _HasFetched() const;
status_t _PushNode(BPrivate::Storage::QueryNode *node, bool deleteOnError); status_t _PushNode(BPrivate::Storage::QueryNode* node,
status_t _SetPredicate(const char *expression); bool deleteOnError);
status_t _EvaluateStack(); status_t _SetPredicate(const char* expression);
status_t _EvaluateStack();
// FBC // FBC
virtual void _QwertyQuery1(); virtual void _QwertyQuery1();
virtual void _QwertyQuery2(); virtual void _QwertyQuery2();
virtual void _QwertyQuery3(); virtual void _QwertyQuery3();
virtual void _QwertyQuery4(); virtual void _QwertyQuery4();
virtual void _QwertyQuery5(); virtual void _QwertyQuery5();
virtual void _QwertyQuery6(); virtual void _QwertyQuery6();
private: private:
int32 _reservedData[4]; // FBC BPrivate::Storage::QueryStack* fStack;
BPrivate::Storage::QueryStack *fStack; char* fPredicate;
char *fPredicate; dev_t fDevice;
dev_t fDevice; bool fLive;
bool fLive; port_id fPort;
port_id fPort; long fToken;
long fToken; int fQueryFd;
int fQueryFd; int32 _reservedData[4];
}; };
#endif // _QUERY_H #endif // _QUERY_H

View File

@ -1,20 +1,23 @@
//---------------------------------------------------------------------- /*
// This software is part of the Haiku distribution and is covered * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
// by the MIT license. * Distributed under the terms of the MIT License.
//--------------------------------------------------------------------- *
/*! * Authors:
\file Query.cpp * Tyler Dauwalder
BQuery implementation. * Ingo Weinhold
*/ * Axel Dörfler, axeld@pinc-software.de.
*/
#include <Query.h>
#include <fcntl.h> #include <fcntl.h>
#include <new> #include <new>
#include <parsedate.h>
#include <time.h> #include <time.h>
#include <Entry.h> #include <Entry.h>
#include <fs_query.h> #include <fs_query.h>
#include <Query.h> #include <parsedate.h>
#include <Volume.h> #include <Volume.h>
#include <MessengerPrivate.h> #include <MessengerPrivate.h>
@ -26,24 +29,23 @@
using namespace std; using namespace std;
using namespace BPrivate::Storage; using namespace BPrivate::Storage;
// BQuery
// constructor
/*! \brief Creates an uninitialized BQuery. /*! \brief Creates an uninitialized BQuery.
*/ */
BQuery::BQuery() BQuery::BQuery()
: BEntryList(), :
fStack(NULL), BEntryList(),
fPredicate(NULL), fStack(NULL),
fDevice((dev_t)B_ERROR), fPredicate(NULL),
fLive(false), fDevice((dev_t)B_ERROR),
fPort(B_ERROR), fLive(false),
fToken(0), fPort(B_ERROR),
fQueryFd(-1) fToken(0),
fQueryFd(-1)
{ {
} }
// destructor
/*! \brief Frees all resources associated with the object. /*! \brief Frees all resources associated with the object.
*/ */
BQuery::~BQuery() BQuery::~BQuery()
@ -51,7 +53,7 @@ BQuery::~BQuery()
Clear(); Clear();
} }
// Clear
/*! \brief Resets the object to a uninitialized state. /*! \brief Resets the object to a uninitialized state.
\return \c B_OK \return \c B_OK
*/ */
@ -77,7 +79,7 @@ BQuery::Clear()
return error; return error;
} }
// PushAttr
/*! \brief Pushes an attribute name onto the BQuery's predicate stack. /*! \brief Pushes an attribute name onto the BQuery's predicate stack.
\param attrName the attribute name \param attrName the attribute name
\return \return
@ -93,12 +95,12 @@ BQuery::Clear()
to be called and Clear() also deletes the predicate. to be called and Clear() also deletes the predicate.
*/ */
status_t status_t
BQuery::PushAttr(const char *attrName) BQuery::PushAttr(const char* attrName)
{ {
return _PushNode(new(nothrow) AttributeNode(attrName), true); return _PushNode(new(nothrow) AttributeNode(attrName), true);
} }
// PushOp
/*! \brief Pushes an operator onto the BQuery's predicate stack. /*! \brief Pushes an operator onto the BQuery's predicate stack.
\param op the code representing the operator \param op the code representing the operator
\return \return
@ -141,7 +143,7 @@ BQuery::PushOp(query_op op)
return error; return error;
} }
// PushUInt32
/*! \brief Pushes a uint32 value onto the BQuery's predicate stack. /*! \brief Pushes a uint32 value onto the BQuery's predicate stack.
\param value the value \param value the value
\return \return
@ -162,7 +164,7 @@ BQuery::PushUInt32(uint32 value)
return _PushNode(new(nothrow) UInt32ValueNode(value), true); return _PushNode(new(nothrow) UInt32ValueNode(value), true);
} }
// PushInt32
/*! \brief Pushes an int32 value onto the BQuery's predicate stack. /*! \brief Pushes an int32 value onto the BQuery's predicate stack.
\param value the value \param value the value
\return \return
@ -183,7 +185,7 @@ BQuery::PushInt32(int32 value)
return _PushNode(new(nothrow) Int32ValueNode(value), true); return _PushNode(new(nothrow) Int32ValueNode(value), true);
} }
// PushUInt64
/*! \brief Pushes a uint64 value onto the BQuery's predicate stack. /*! \brief Pushes a uint64 value onto the BQuery's predicate stack.
\param value the value \param value the value
\return \return
@ -204,7 +206,7 @@ BQuery::PushUInt64(uint64 value)
return _PushNode(new(nothrow) UInt64ValueNode(value), true); return _PushNode(new(nothrow) UInt64ValueNode(value), true);
} }
// PushInt64
/*! \brief Pushes an int64 value onto the BQuery's predicate stack. /*! \brief Pushes an int64 value onto the BQuery's predicate stack.
\param value the value \param value the value
\return \return
@ -225,7 +227,7 @@ BQuery::PushInt64(int64 value)
return _PushNode(new(nothrow) Int64ValueNode(value), true); return _PushNode(new(nothrow) Int64ValueNode(value), true);
} }
// PushFloat
/*! \brief Pushes a float value onto the BQuery's predicate stack. /*! \brief Pushes a float value onto the BQuery's predicate stack.
\param value the value \param value the value
\return \return
@ -246,7 +248,7 @@ BQuery::PushFloat(float value)
return _PushNode(new(nothrow) FloatValueNode(value), true); return _PushNode(new(nothrow) FloatValueNode(value), true);
} }
// PushDouble
/*! \brief Pushes a double value onto the BQuery's predicate stack. /*! \brief Pushes a double value onto the BQuery's predicate stack.
\param value the value \param value the value
\return \return
@ -267,7 +269,7 @@ BQuery::PushDouble(double value)
return _PushNode(new(nothrow) DoubleValueNode(value), true); return _PushNode(new(nothrow) DoubleValueNode(value), true);
} }
// PushString
/*! \brief Pushes a string value onto the BQuery's predicate stack. /*! \brief Pushes a string value onto the BQuery's predicate stack.
\param value the value \param value the value
\param caseInsensitive \c true, if the case of the string should be \param caseInsensitive \c true, if the case of the string should be
@ -285,12 +287,12 @@ BQuery::PushDouble(double value)
to be called and Clear() also deletes the predicate. to be called and Clear() also deletes the predicate.
*/ */
status_t status_t
BQuery::PushString(const char *value, bool caseInsensitive) BQuery::PushString(const char* value, bool caseInsensitive)
{ {
return _PushNode(new(nothrow) StringNode(value, caseInsensitive), true); return _PushNode(new(nothrow) StringNode(value, caseInsensitive), true);
} }
// PushDate
/*! \brief Pushes a date value onto the BQuery's predicate stack. /*! \brief Pushes a date value onto the BQuery's predicate stack.
The supplied date can be any string understood by the POSIX function The supplied date can be any string understood by the POSIX function
parsedate(). parsedate().
@ -306,22 +308,15 @@ BQuery::PushString(const char *value, bool caseInsensitive)
to be called and Clear() also deletes the predicate. to be called and Clear() also deletes the predicate.
*/ */
status_t status_t
BQuery::PushDate(const char *date) BQuery::PushDate(const char* date)
{ {
status_t error = (date ? B_OK : B_BAD_VALUE); if (date == NULL || !date[0] || parsedate(date, time(NULL)) < 0)
if (error == B_OK) { return B_BAD_VALUE;
time_t t;
time(&t); return _PushNode(new(nothrow) DateNode(date), true);
t = parsedate(date, t);
if (t < 0)
error = B_BAD_VALUE;
}
if (error == B_OK)
error = _PushNode(new(nothrow) DateNode(date), true);
return error;
} }
// SetVolume
/*! \brief Sets the BQuery's volume. /*! \brief Sets the BQuery's volume.
A query is restricted to one volume. This method sets this volume. It A query is restricted to one volume. This method sets this volume. It
fails, if called after Fetch(). To reuse a BQuery object it has to be fails, if called after Fetch(). To reuse a BQuery object it has to be
@ -332,21 +327,22 @@ BQuery::PushDate(const char *date)
- \c B_NOT_ALLOWED: SetVolume() was called after Fetch(). - \c B_NOT_ALLOWED: SetVolume() was called after Fetch().
*/ */
status_t status_t
BQuery::SetVolume(const BVolume *volume) BQuery::SetVolume(const BVolume* volume)
{ {
status_t error = (volume ? B_OK : B_BAD_VALUE); if (volume == NULL)
if (error == B_OK && _HasFetched()) return B_BAD_VALUE;
error = B_NOT_ALLOWED; if (_HasFetched())
if (error == B_OK) { return B_NOT_ALLOWED;
if (volume->InitCheck() == B_OK)
fDevice = volume->Device(); if (volume->InitCheck() == B_OK)
else fDevice = volume->Device();
fDevice = (dev_t)B_ERROR; else
} fDevice = (dev_t)B_ERROR;
return error;
return B_OK;
} }
// SetPredicate
/*! \brief Sets the BQuery's predicate. /*! \brief Sets the BQuery's predicate.
A predicate can be set either using this method or constructing one on A predicate can be set either using this method or constructing one on
the predicate stack. The two methods can not be mixed. The letter one the predicate stack. The two methods can not be mixed. The letter one
@ -360,7 +356,7 @@ BQuery::SetVolume(const BVolume *volume)
- \c B_NO_MEMORY: Insufficient memory to store the predicate. - \c B_NO_MEMORY: Insufficient memory to store the predicate.
*/ */
status_t status_t
BQuery::SetPredicate(const char *expression) BQuery::SetPredicate(const char* expression)
{ {
status_t error = (expression ? B_OK : B_BAD_VALUE); status_t error = (expression ? B_OK : B_BAD_VALUE);
if (error == B_OK && _HasFetched()) if (error == B_OK && _HasFetched())
@ -370,7 +366,7 @@ BQuery::SetPredicate(const char *expression)
return error; return error;
} }
// SetTarget
/*! \brief Sets the BQuery's target and makes the query live. /*! \brief Sets the BQuery's target and makes the query live.
The query update messages are sent to the specified target. They might The query update messages are sent to the specified target. They might
roll in immediately after calling Fetch(). roll in immediately after calling Fetch().
@ -397,7 +393,7 @@ BQuery::SetTarget(BMessenger messenger)
return error; return error;
} }
// IsLive
/*! \brief Returns whether the query associated with this object is live. /*! \brief Returns whether the query associated with this object is live.
\return \c true, if the query is live, \c false otherwise \return \c true, if the query is live, \c false otherwise
*/ */
@ -407,7 +403,7 @@ BQuery::IsLive() const
return fLive; return fLive;
} }
// GetPredicate
/*! \brief Returns the BQuery's predicate. /*! \brief Returns the BQuery's predicate.
Regardless of whether the predicate has been constructed using the Regardless of whether the predicate has been constructed using the
predicate stack or set via SetPredicate(), this method returns a predicate stack or set via SetPredicate(), this method returns a
@ -423,7 +419,7 @@ BQuery::IsLive() const
You can't interleave Push*() and GetPredicate() calls. You can't interleave Push*() and GetPredicate() calls.
*/ */
status_t status_t
BQuery::GetPredicate(char *buffer, size_t length) BQuery::GetPredicate(char* buffer, size_t length)
{ {
status_t error = (buffer ? B_OK : B_BAD_VALUE); status_t error = (buffer ? B_OK : B_BAD_VALUE);
if (error == B_OK) if (error == B_OK)
@ -437,7 +433,7 @@ BQuery::GetPredicate(char *buffer, size_t length)
return error; return error;
} }
// GetPredicate
/*! \brief Returns the BQuery's predicate. /*! \brief Returns the BQuery's predicate.
Regardless of whether the predicate has been constructed using the Regardless of whether the predicate has been constructed using the
predicate stack or set via SetPredicate(), this method returns a predicate stack or set via SetPredicate(), this method returns a
@ -452,7 +448,7 @@ BQuery::GetPredicate(char *buffer, size_t length)
You can't interleave Push*() and GetPredicate() calls. You can't interleave Push*() and GetPredicate() calls.
*/ */
status_t status_t
BQuery::GetPredicate(BString *predicate) BQuery::GetPredicate(BString* predicate)
{ {
status_t error = (predicate ? B_OK : B_BAD_VALUE); status_t error = (predicate ? B_OK : B_BAD_VALUE);
if (error == B_OK) if (error == B_OK)
@ -464,7 +460,7 @@ BQuery::GetPredicate(BString *predicate)
return error; return error;
} }
// PredicateLength
/*! \brief Returns the length of the BQuery's predicate string. /*! \brief Returns the length of the BQuery's predicate string.
Regardless of whether the predicate has been constructed using the Regardless of whether the predicate has been constructed using the
predicate stack or set via SetPredicate(), this method returns the length predicate stack or set via SetPredicate(), this method returns the length
@ -487,11 +483,10 @@ BQuery::PredicateLength()
return size; return size;
} }
// TargetDevice
/*! \brief Returns the device ID identifying the BQuery's volume. /*! \brief Returns the device ID identifying the BQuery's volume.
\return the device ID of the BQuery's volume or \c B_NO_INIT, if the \return the device ID of the BQuery's volume or \c B_NO_INIT, if the
volume isn't set. volume isn't set.
*/ */
dev_t dev_t
BQuery::TargetDevice() const BQuery::TargetDevice() const
@ -499,7 +494,7 @@ BQuery::TargetDevice() const
return fDevice; return fDevice;
} }
// Fetch
/*! \brief Tells the BQuery to start fetching entries satisfying the predicate. /*! \brief Tells the BQuery to start fetching entries satisfying the predicate.
After Fetch() has been called GetNextEntry(), GetNextRef() and After Fetch() has been called GetNextEntry(), GetNextRef() and
GetNextDirents() can be used to retrieve the enties. Live query updates GetNextDirents() can be used to retrieve the enties. Live query updates
@ -535,9 +530,9 @@ BQuery::Fetch()
} }
// BEntryList interface // #pragma mark - BEntryList interface
// GetNextEntry
/*! \brief Returns the BQuery's next entry as a BEntry. /*! \brief Returns the BQuery's next entry as a BEntry.
Places the next entry in the list in \a entry, traversing symlinks if Places the next entry in the list in \a entry, traversing symlinks if
\a traverse is \c true. \a traverse is \c true.
@ -553,7 +548,7 @@ BQuery::Fetch()
- \c B_FILE_ERROR: Fetch() has not been called before. - \c B_FILE_ERROR: Fetch() has not been called before.
*/ */
status_t status_t
BQuery::GetNextEntry(BEntry *entry, bool traverse) BQuery::GetNextEntry(BEntry* entry, bool traverse)
{ {
status_t error = (entry ? B_OK : B_BAD_VALUE); status_t error = (entry ? B_OK : B_BAD_VALUE);
if (error == B_OK) { if (error == B_OK) {
@ -565,7 +560,7 @@ BQuery::GetNextEntry(BEntry *entry, bool traverse)
return error; return error;
} }
// GetNextRef
/*! \brief Returns the BQuery's next entry as an entry_ref. /*! \brief Returns the BQuery's next entry as an entry_ref.
Places an entry_ref to the next entry in the list into \a ref. Places an entry_ref to the next entry in the list into \a ref.
\param ref a pointer to an entry_ref to be filled in with the data of the \param ref a pointer to an entry_ref to be filled in with the data of the
@ -579,7 +574,7 @@ BQuery::GetNextEntry(BEntry *entry, bool traverse)
- \c B_FILE_ERROR: Fetch() has not been called before. - \c B_FILE_ERROR: Fetch() has not been called before.
*/ */
status_t status_t
BQuery::GetNextRef(entry_ref *ref) BQuery::GetNextRef(entry_ref* ref)
{ {
status_t error = (ref ? B_OK : B_BAD_VALUE); status_t error = (ref ? B_OK : B_BAD_VALUE);
if (error == B_OK && !_HasFetched()) if (error == B_OK && !_HasFetched())
@ -604,7 +599,7 @@ BQuery::GetNextRef(entry_ref *ref)
return error; return error;
} }
// GetNextDirents
/*! \brief Returns the BQuery's next entries as dirent structures. /*! \brief Returns the BQuery's next entries as dirent structures.
Reads a number of entries into the array of dirent structures pointed to by Reads a number of entries into the array of dirent structures pointed to by
\a buf. Reads as many but no more than \a count entries, as many entries as \a buf. Reads as many but no more than \a count entries, as many entries as
@ -622,16 +617,16 @@ BQuery::GetNextRef(entry_ref *ref)
- \c B_FILE_ERROR: Fetch() has not been called before. - \c B_FILE_ERROR: Fetch() has not been called before.
*/ */
int32 int32
BQuery::GetNextDirents(struct dirent *buf, size_t length, int32 count) BQuery::GetNextDirents(struct dirent* buffer, size_t length, int32 count)
{ {
if (!buf) if (!buffer)
return B_BAD_VALUE; return B_BAD_VALUE;
if (!_HasFetched()) if (!_HasFetched())
return B_FILE_ERROR; return B_FILE_ERROR;
return _kern_read_dir(fQueryFd, buf, length, count); return _kern_read_dir(fQueryFd, buffer, length, count);
} }
// Rewind
/*! \brief Rewinds the entry list back to the first entry. /*! \brief Rewinds the entry list back to the first entry.
Unlike R5 Haiku implements this method for BQuery. Unlike R5 Haiku implements this method for BQuery.
@ -648,7 +643,7 @@ BQuery::Rewind()
return _kern_rewind_dir(fQueryFd); return _kern_rewind_dir(fQueryFd);
} }
// CountEntries
/*! \brief Unimplemented method of the BEntryList interface. /*! \brief Unimplemented method of the BEntryList interface.
\return 0. \return 0.
*/ */
@ -658,7 +653,7 @@ BQuery::CountEntries()
return B_ERROR; return B_ERROR;
} }
// _HasFetched
/*! Returns whether Fetch() has already been called on this object. /*! Returns whether Fetch() has already been called on this object.
\return \c true, if Fetch() has successfully been invoked, \c false \return \c true, if Fetch() has successfully been invoked, \c false
otherwise. otherwise.
@ -666,10 +661,10 @@ BQuery::CountEntries()
bool bool
BQuery::_HasFetched() const BQuery::_HasFetched() const
{ {
return (fQueryFd >= 0); return fQueryFd >= 0;
} }
// _PushNode
/*! \brief Pushs a node onto the predicate stack. /*! \brief Pushs a node onto the predicate stack.
If the stack has not been allocate until this time, this method does If the stack has not been allocate until this time, this method does
allocate it. allocate it.
@ -687,7 +682,7 @@ BQuery::_HasFetched() const
- \c B_NOT_ALLOWED: _PushNode() was called after Fetch(). - \c B_NOT_ALLOWED: _PushNode() was called after Fetch().
*/ */
status_t status_t
BQuery::_PushNode(QueryNode *node, bool deleteOnError) BQuery::_PushNode(QueryNode* node, bool deleteOnError)
{ {
status_t error = (node ? B_OK : B_NO_MEMORY); status_t error = (node ? B_OK : B_NO_MEMORY);
if (error == B_OK && _HasFetched()) if (error == B_OK && _HasFetched())
@ -705,7 +700,7 @@ BQuery::_PushNode(QueryNode *node, bool deleteOnError)
return error; return error;
} }
// _SetPredicate
/*! \brief Helper method to set the BQuery's predicate. /*! \brief Helper method to set the BQuery's predicate.
It is not checked whether Fetch() has already been invoked. It is not checked whether Fetch() has already been invoked.
\param predicate the predicate string \param predicate the predicate string
@ -714,7 +709,7 @@ BQuery::_PushNode(QueryNode *node, bool deleteOnError)
- \c B_NO_MEMORY: Insufficient memory to store the predicate. - \c B_NO_MEMORY: Insufficient memory to store the predicate.
*/ */
status_t status_t
BQuery::_SetPredicate(const char *expression) BQuery::_SetPredicate(const char* expression)
{ {
status_t error = B_OK; status_t error = B_OK;
// unset the old predicate // unset the old predicate
@ -731,7 +726,7 @@ BQuery::_SetPredicate(const char *expression)
return error; return error;
} }
// _EvaluateStack
/*! Evaluates the query's predicate stack. /*! Evaluates the query's predicate stack.
The method does nothing (and returns \c B_OK), if the stack is \c NULL. The method does nothing (and returns \c B_OK), if the stack is \c NULL.
If the stack is non-null and Fetch() has already been called, the method If the stack is non-null and Fetch() has already been called, the method
@ -751,7 +746,7 @@ BQuery::_EvaluateStack()
if (_HasFetched()) if (_HasFetched())
error = B_NOT_ALLOWED; error = B_NOT_ALLOWED;
// convert the stack to a tree and evaluate it // convert the stack to a tree and evaluate it
QueryNode *node = NULL; QueryNode* node = NULL;
if (error == B_OK) if (error == B_OK)
error = fStack->ConvertToTree(node); error = fStack->ConvertToTree(node);
BString predicate; BString predicate;