[haiku-development] src_build_libbe_storage_Path.cpp.diff

  • From: kaoutsis <kaoutsis@xxxxxx>
  • To: haiku-development <haiku-development@xxxxxxxxxxxxx>
  • Date: Thu, 29 May 2008 02:02:59 +0300

* fixes the warning:
src/build/libbe/storage/Path.cpp: In member function ‘bool BPath::operator==(const char*) const’: src/build/libbe/storage/Path.cpp:394: warning: suggest parentheses around && within ||
this way:
[...]
bool
BPath::operator==(const char *path) const
{
- return (InitCheck() != B_OK && path == NULL
- || fName && path && strcmp(fName, path) == 0);
+ return ((InitCheck() != B_OK && (path == NULL))
+ || ((fName && path) && strcmp(fName, path)) == 0);
}
[...]

* the rest are style changes,

good bye,
Vasilis

Index: src/build/libbe/storage/Path.cpp
===================================================================
--- src/build/libbe/storage/Path.cpp    (revision 25685)
+++ src/build/libbe/storage/Path.cpp    (working copy)
@@ -1,12 +1,19 @@
-//----------------------------------------------------------------------
-//  This software is part of the OpenBeOS distribution and is covered 
-//  by the OpenBeOS license.
-//---------------------------------------------------------------------
+/*
+ * Copyright 2008, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             <unknown, please fill in who knows>
+ */
+
+
+
 /*!
        \file Path.cpp
        BPath implementation.
 */
 
+
 #include <new>
 
 #include <Path.h>
@@ -25,45 +32,54 @@
 using namespace OpenBeOS;
 #endif
 
+
 //! Creates an uninitialized BPath object. 
 BPath::BPath()
-        : fName(NULL),
-          fCStatus(B_NO_INIT)
+       :
+       fName(NULL),
+       fCStatus(B_NO_INIT)
 {
 }
+
        
-//! Creates a copy of the given BPath object.
-/*!    \param path the object to be copied
+/*! Creates a copy of the given BPath object.
+       \param path the object to be copied
 */
 BPath::BPath(const BPath &path)
-        : fName(NULL),
-          fCStatus(B_NO_INIT)
+       :
+       fName(NULL),
+       fCStatus(B_NO_INIT)
 {
        *this = path;
 }
 
+
 /*!    \brief Creates a BPath object and initializes it to the filesystem entry
        specified by the given entry_ref struct.
        \param ref the entry_ref
 */
 BPath::BPath(const entry_ref *ref)
-        : fName(NULL),
-          fCStatus(B_NO_INIT)
+       :
+       fName(NULL),
+       fCStatus(B_NO_INIT)
 {
        SetTo(ref);
 }
 
+
 /*!    Creates a BPath object and initializes it to the filesystem entry
        specified by the given BEntry object.
        \param entry the BEntry object
 */
 BPath::BPath(const BEntry *entry)
-        : fName(NULL),
-          fCStatus(B_NO_INIT)
+       :
+       fName(NULL),
+       fCStatus(B_NO_INIT)
 {
        SetTo(entry);
 }
 
+
 /*! \brief Creates a BPath object and initializes it to the specified path or
                   path and filename combination.
        \param dir The base component of the pathname. May be absolute or 
relative.
@@ -75,12 +91,14 @@
                   may occur even if false (see \ref MustNormalize).
 */
 BPath::BPath(const char *dir, const char *leaf, bool normalize)
-        : fName(NULL),
-          fCStatus(B_NO_INIT)
+       :
+       fName(NULL),
+       fCStatus(B_NO_INIT)
 {
        SetTo(dir, leaf, normalize);
 }
-       
+
+
 /*! \brief Creates a BPath object and initializes it to the specified directory
         and filename combination.
        \param dir Refers to the directory that provides the base component of 
the
@@ -92,20 +110,23 @@
                   may occur even if false (see \ref MustNormalize).
 */
 BPath::BPath(const BDirectory *dir, const char *leaf, bool normalize)
-        : fName(NULL),
-          fCStatus(B_NO_INIT)
+       :
+       fName(NULL),
+       fCStatus(B_NO_INIT)
 {
        SetTo(dir, leaf, normalize);
 }
 
+
 //! Destroys the BPath object and frees any of its associated resources.
 BPath::~BPath()
 {
        Unset();
 }
 
-//! Returns the status of the most recent construction or SetTo() call.
-/*!    \return \c B_OK, if the BPath object is properly initialized, an error
+
+/*! Returns the status of the most recent construction or SetTo() call.
+       \return \c B_OK, if the BPath object is properly initialized, an error
                        code otherwise.
 */
 status_t
@@ -114,6 +135,7 @@
        return fCStatus;
 }
 
+
 /*! \brief Reinitializes the object to the filesystem entry specified by the
        given entry_ref struct.
        \param ref the entry_ref
@@ -139,6 +161,7 @@
        return fCStatus;
 }
 
+
 /*! \brief Reinitializes the object to the specified filesystem entry.
        \param entry the BEntry
        \return
@@ -160,6 +183,7 @@
        fCStatus = error;
        return error;
 }
+
        
 /*!    \brief Reinitializes the object to the specified path or path and file
        name combination.
@@ -232,7 +256,8 @@
        fCStatus = error;
        return error;
 }
-       
+
+
 /*!    \brief Reinitializes the object to the specified directory and relative
        path combination.
        \param dir Refers to the directory that provides the base component of 
the
@@ -265,6 +290,7 @@
        fCStatus = error;
        return error;
 }
+
        
 /*!    \brief Returns the object to an uninitialized state. The object frees 
any
        resources it allocated and marks itself as uninitialized.
@@ -275,6 +301,7 @@
        set_path(NULL);
        fCStatus = B_NO_INIT;
 }
+
        
 /*!    \brief Appends the given (relative) path to the end of the current path.
        This call fails if the path is absolute or the object to which you're
@@ -299,26 +326,28 @@
        fCStatus = error;
        return error;
 }
+
        
-//! Returns the object's complete path name.
-/*!    \return
+/*! Returns the object's complete path name.
+       \return
        - the object's path name, or
        - \c NULL, if it is not properly initialized.
 */
-const char *
+const char*
 BPath::Path() const
 {
        return fName;
 }
-       
-//! Returns the leaf portion of the object's path name.
-/*!    The leaf portion is defined as the string after the last \c '/'. For
+
+
+/*! Returns the leaf portion of the object's path name.
+       The leaf portion is defined as the string after the last \c '/'. For
        the root path (\c "/") it is the empty string (\c "").
        \return
        - the leaf portion of the object's path name, or
        - \c NULL, if it is not properly initialized.
 */
-const char *
+const char*
 BPath::Leaf() const
 {
        const char *result = NULL;
@@ -334,6 +363,7 @@
        return result;
 }
 
+
 /*! \brief Calls the argument's SetTo() method with the name of the
        object's parent directory.
        No normalization is done.
@@ -369,9 +399,10 @@
        }
        return error;
 }
+
        
-//! Performs a simple (string-wise) comparison of paths.
-/*!    No normalization takes place! Uninitialized BPath objects are considered
+/*! Performs a simple (string-wise) comparison of paths.
+       No normalization takes place! Uninitialized BPath objects are considered
        to be equal.
        \param item the BPath object to be compared with
        \return \c true, if the path names are equal, \c false otherwise.
@@ -382,20 +413,22 @@
        return (*this == item.Path());
 }
 
-//! Performs a simple (string-wise) comparison of paths.
-/*!    No normalization takes place!
+
+/*! Performs a simple (string-wise) comparison of paths.
+       No normalization takes place!
        \param path the path name to be compared with
        \return \c true, if the path names are equal, \c false otherwise.
 */
 bool
 BPath::operator==(const char *path) const
 {
-       return (InitCheck() != B_OK && path == NULL
-                       || fName && path && strcmp(fName, path) == 0);
+       return ((InitCheck() != B_OK && (path == NULL))
+                       || ((fName && path) && strcmp(fName, path)) == 0);
 }
 
-//! Performs a simple (string-wise) comparison of paths.
-/*!    No normalization takes place! Uninitialized BPath objects are considered
+
+/*! Performs a simple (string-wise) comparison of paths.
+       No normalization takes place! Uninitialized BPath objects are considered
        to be equal.
        \param item the BPath object to be compared with
        \return \c true, if the path names are not equal, \c false otherwise.
@@ -406,8 +439,9 @@
        return !(*this == item);
 }
 
-//! Performs a simple (string-wise) comparison of paths.
-/*!    No normalization takes place!
+
+/*! Performs a simple (string-wise) comparison of paths.
+       No normalization takes place!
        \param path the path name to be compared with
        \return \c true, if the path names are not equal, \c false otherwise.
 */
@@ -416,9 +450,10 @@
 {
        return !(*this == path);
 }
-       
-//! Initializes the object to be a copy of the argument.
-/*!    \param item the BPath object to be copied
+
+
+/*! Initializes the object to be a copy of the argument.
+       \param item the BPath object to be copied
        \return \c *this
 */
 BPath&
@@ -429,8 +464,9 @@
        return *this;
 }
 
-//! Initializes the object to be a copy of the argument.
-/*!    Has the same effect as \code SetTo(path) \endcode.
+
+/*! Initializes the object to be a copy of the argument.
+       Has the same effect as \code SetTo(path) \endcode.
        \param path the path name to be assigned to this object
        \return \c *this
 */
@@ -459,8 +495,8 @@
        = sizeof(dev_t) + sizeof(ino_t);
 
 
-//! Returns \c false.
-/*!    Implements BFlattenable.
+/*! Returns \c false.
+       Implements BFlattenable.
        \return \c false
 */
 bool
@@ -468,9 +504,10 @@
 {
        return false;
 }
-       
-//! Returns \c B_REF_TYPE.
-/*!    Implements BFlattenable.
+
+
+/*! Returns \c B_REF_TYPE.
+       Implements BFlattenable.
        \return \c B_REF_TYPE
 */
 type_code
@@ -478,6 +515,7 @@
 {
        return B_REF_TYPE;
 }
+
        
 /*!    \brief Returns the size of the flattened entry_ref structure that
        represents the pathname.
@@ -497,6 +535,7 @@
        }
        return size;
 }
+
        
 /*!    \brief Converts the object's pathname to an entry_ref and writes it into
        buffer.
@@ -535,9 +574,10 @@
        }
        return error;
 }
-       
-//! Returns \c true if code is \c B_REF_TYPE, and false otherwise.
-/*!    Implements BFlattenable.
+
+
+/*! Returns \c true if code is \c B_REF_TYPE, and false otherwise.
+       Implements BFlattenable.
        \param code the type code in question
        \return \c true if code is \c B_REF_TYPE, and false otherwise.
 */
@@ -546,6 +586,7 @@
 {
        return (code == B_REF_TYPE);
 }
+
        
 /*!    \brief Initializes the BPath with the flattened entry_ref data that's
        found in the supplied buffer.
@@ -586,10 +627,12 @@
        return error;
 }
 
+
 void BPath::_WarPath1() {}
 void BPath::_WarPath2() {}
 void BPath::_WarPath3() {}
 
+
 /*!    \brief Sets the supplied path.
        The path is copied. If \c NULL, the object's path is set to NULL as 
well.
        The object's old path is deleted.
@@ -618,7 +661,6 @@
 }
 
 
-
 /*! \brief Checks a path to see if normalization is required.
 
        The following items require normalization:
@@ -719,6 +761,3 @@
        \var status_t BPath::fCStatus
        \brief The object's initialization status.
 */
-
-
-

Other related posts: