Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: util/mac/xattr.h

Issue 842223003: Add a tri-state enum to return the result of Xattr operations. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | util/mac/xattr.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mac/xattr.h
diff --git a/util/mac/xattr.h b/util/mac/xattr.h
index b816f3909b565d4ca7346f13fe7d511287b3b3b5..3e14f672c9c62381d6bba4f337e3d159057dea3b 100644
--- a/util/mac/xattr.h
+++ b/util/mac/xattr.h
@@ -24,17 +24,28 @@
namespace crashpad {
+//! \brief The result code for a ReadXattr operation.
+enum class XattrStatus {
+ //! \brief No error occured. No message is logged.
+ kOK = 0,
+
+ //! \brief The attribute does not exist. No message is logged.
+ kNoAttribute,
+
+ //! \brief An error occurred and an error message was logged.
+ kOtherError,
+};
+
//! \brief Reads an extended attribute on a file.
//!
//! \param[in] file The path to the file.
//! \param[in] name The name of the extended attribute to read.
//! \param[out] value The value of the attribute.
//!
-//! \return `true` if the read was successful, with \a value filled in. `false`
-//! on error, with a message logged.
-bool ReadXattr(const base::FilePath& file,
- const base::StringPiece& name,
- std::string* value);
+//! \return XattrStatus
+XattrStatus ReadXattr(const base::FilePath& file,
+ const base::StringPiece& name,
+ std::string* value);
//! \brief Writes an extended attribute on a file.
//!
@@ -52,9 +63,9 @@ bool WriteXattr(const base::FilePath& file,
//!
//! Only the values `"0"` and `"1"`, for `false` and `true` respectively, are
//! valid conversions.
-bool ReadXattrBool(const base::FilePath& file,
- const base::StringPiece& name,
- bool* value);
+XattrStatus ReadXattrBool(const base::FilePath& file,
+ const base::StringPiece& name,
+ bool* value);
//! \copydoc WriteXattr
bool WriteXattrBool(const base::FilePath& file,
@@ -62,9 +73,9 @@ bool WriteXattrBool(const base::FilePath& file,
bool value);
//! \copydoc ReadXattr
-bool ReadXattrInt(const base::FilePath& file,
- const base::StringPiece& name,
- int* value);
+XattrStatus ReadXattrInt(const base::FilePath& file,
+ const base::StringPiece& name,
+ int* value);
//! \copydoc WriteXattr
bool WriteXattrInt(const base::FilePath& file,
@@ -72,9 +83,9 @@ bool WriteXattrInt(const base::FilePath& file,
int value);
//! \copydoc ReadXattr
-bool ReadXattrTimeT(const base::FilePath& file,
- const base::StringPiece& name,
- time_t* value);
+XattrStatus ReadXattrTimeT(const base::FilePath& file,
+ const base::StringPiece& name,
+ time_t* value);
//! \copydoc WriteXattr
bool WriteXattrTimeT(const base::FilePath& file,
« no previous file with comments | « no previous file | util/mac/xattr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698