aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/util
diff options
context:
space:
mode:
authorGravatar Michael Lehenbauer <mikelehen@gmail.com>2018-01-10 09:28:44 -0800
committerGravatar GitHub <noreply@github.com>2018-01-10 09:28:44 -0800
commitdc0b29e9cf7febe201a3845782655ec80d9e19f4 (patch)
tree915ff0260b366e0613f44453a56576586c05fab1 /Firestore/core/src/firebase/firestore/util
parentd6bf54e2872801bc915ffd695bf2aa3051ae22ab (diff)
Run style.sh (#636)
Run style.sh (w/ clang-format version 6)
Diffstat (limited to 'Firestore/core/src/firebase/firestore/util')
-rw-r--r--Firestore/core/src/firebase/firestore/util/assert_apple.mm13
-rw-r--r--Firestore/core/src/firebase/firestore/util/assert_stdio.cc7
-rw-r--r--Firestore/core/src/firebase/firestore/util/firebase_assert.h41
-rw-r--r--Firestore/core/src/firebase/firestore/util/string_apple.h10
-rw-r--r--Firestore/core/src/firebase/firestore/util/string_printf.h3
5 files changed, 43 insertions, 31 deletions
diff --git a/Firestore/core/src/firebase/firestore/util/assert_apple.mm b/Firestore/core/src/firebase/firestore/util/assert_apple.mm
index 0447d6c..83b76e1 100644
--- a/Firestore/core/src/firebase/firestore/util/assert_apple.mm
+++ b/Firestore/core/src/firebase/firestore/util/assert_apple.mm
@@ -26,16 +26,23 @@ namespace firebase {
namespace firestore {
namespace util {
-void FailAssert(const char* file, const char* func, const int line, const char* format, ...) {
+void FailAssert(const char* file,
+ const char* func,
+ const int line,
+ const char* format,
+ ...) {
va_list args;
va_start(args, format);
- NSString *description = [[NSString alloc] initWithFormat:WrapNSStringNoCopy(format) arguments:args];
+ NSString* description =
+ [[NSString alloc] initWithFormat:WrapNSStringNoCopy(format)
+ arguments:args];
va_end(args);
[[NSAssertionHandler currentHandler]
handleFailureInFunction:WrapNSStringNoCopy(func)
file:WrapNSStringNoCopy(file)
lineNumber:line
- description:@"FIRESTORE INTERNAL ASSERTION FAILED: %@", description];
+ description:@"FIRESTORE INTERNAL ASSERTION FAILED: %@",
+ description];
abort();
}
diff --git a/Firestore/core/src/firebase/firestore/util/assert_stdio.cc b/Firestore/core/src/firebase/firestore/util/assert_stdio.cc
index b5d0b7c..5476e65 100644
--- a/Firestore/core/src/firebase/firestore/util/assert_stdio.cc
+++ b/Firestore/core/src/firebase/firestore/util/assert_stdio.cc
@@ -29,8 +29,11 @@ namespace firebase {
namespace firestore {
namespace util {
-void FailAssert(const char* file, const char* func, const int line,
- const char* format, ...) {
+void FailAssert(const char* file,
+ const char* func,
+ const int line,
+ const char* format,
+ ...) {
std::string message;
StringAppendF(&message, "ASSERT: %s(%d) %s: ", file, line, func);
diff --git a/Firestore/core/src/firebase/firestore/util/firebase_assert.h b/Firestore/core/src/firebase/firestore/util/firebase_assert.h
index 9f1bce8..da01864 100644
--- a/Firestore/core/src/firebase/firestore/util/firebase_assert.h
+++ b/Firestore/core/src/firebase/firestore/util/firebase_assert.h
@@ -35,14 +35,14 @@
// Assert condition is true, if it's false log an assert with the specified
// expression as a string.
-#define FIREBASE_ASSERT_WITH_EXPRESSION(condition, expression) \
- do { \
- if (!(condition)) { \
- firebase::firestore::util::FailAssert( \
- __FILE__, __PRETTY_FUNCTION__, __LINE__, \
- FIREBASE_EXPAND_STRINGIFY(expression)); \
- } \
- } while(0)
+#define FIREBASE_ASSERT_WITH_EXPRESSION(condition, expression) \
+ do { \
+ if (!(condition)) { \
+ firebase::firestore::util::FailAssert( \
+ __FILE__, __PRETTY_FUNCTION__, __LINE__, \
+ FIREBASE_EXPAND_STRINGIFY(expression)); \
+ } \
+ } while (0)
// Assert condition is true, if it's false log an assert with the specified
// expression as a string. Compiled out of release builds.
@@ -65,15 +65,15 @@
// Assert condition is true otherwise display the specified expression,
// message and abort.
-#define FIREBASE_ASSERT_MESSAGE_WITH_EXPRESSION(condition, expression, ...) \
- do { \
- if (!(condition)) { \
- firebase::firestore::util::LogError( \
- FIREBASE_EXPAND_STRINGIFY(expression)); \
- firebase::firestore::util::FailAssert( \
- __FILE__, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
- } \
- } while(0)
+#define FIREBASE_ASSERT_MESSAGE_WITH_EXPRESSION(condition, expression, ...) \
+ do { \
+ if (!(condition)) { \
+ firebase::firestore::util::LogError( \
+ FIREBASE_EXPAND_STRINGIFY(expression)); \
+ firebase::firestore::util::FailAssert(__FILE__, __PRETTY_FUNCTION__, \
+ __LINE__, __VA_ARGS__); \
+ } \
+ } while (0)
// Assert condition is true otherwise display the specified expression,
// message and abort. Compiled out of release builds.
@@ -92,8 +92,11 @@ namespace firestore {
namespace util {
// A no-return helper function. To raise an assertion, use Macro instead.
-void FailAssert(const char* file, const char* func, const int line,
- const char* format, ...);
+void FailAssert(const char* file,
+ const char* func,
+ const int line,
+ const char* format,
+ ...);
} // namespace util
} // namespace firestore
diff --git a/Firestore/core/src/firebase/firestore/util/string_apple.h b/Firestore/core/src/firebase/firestore/util/string_apple.h
index 42b51dd..e1be8c3 100644
--- a/Firestore/core/src/firebase/firestore/util/string_apple.h
+++ b/Firestore/core/src/firebase/firestore/util/string_apple.h
@@ -25,13 +25,13 @@ namespace util {
// Translates a C string to the equivalent NSString without making a copy.
inline NSString* WrapNSStringNoCopy(const char* c_str) {
- return [[NSString alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(c_str))
- length:strlen(c_str)
- encoding:NSUTF8StringEncoding
- freeWhenDone:NO];
+ return [[NSString alloc]
+ initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(c_str))
+ length:strlen(c_str)
+ encoding:NSUTF8StringEncoding
+ freeWhenDone:NO];
}
-
} // namespace util
} // namespace firestore
} // namespace firebase
diff --git a/Firestore/core/src/firebase/firestore/util/string_printf.h b/Firestore/core/src/firebase/firestore/util/string_printf.h
index 9e2b9c0..d15296e 100644
--- a/Firestore/core/src/firebase/firestore/util/string_printf.h
+++ b/Firestore/core/src/firebase/firestore/util/string_printf.h
@@ -28,8 +28,7 @@ namespace firestore {
namespace util {
/** Return a C++ string. */
-std::string StringPrintf(const char* format, ...)
- ABSL_PRINTF_ATTRIBUTE(1, 2);
+std::string StringPrintf(const char* format, ...) ABSL_PRINTF_ATTRIBUTE(1, 2);
/** Append result to a supplied string. */
void StringAppendF(std::string* dst, const char* format, ...)