aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/model
diff options
context:
space:
mode:
authorGravatar rsgowman <rgowman@google.com>2018-01-27 19:16:41 -0500
committerGravatar Gil <mcg@google.com>2018-01-27 16:16:41 -0800
commita74d39f02b93c2e7bf121b33ab2164a9ac34e66b (patch)
tree98c9dbf488e6e548a64a0341c6a2e8cd5df878f8 /Firestore/core/src/firebase/firestore/model
parent856c3a09f1d8022fc5a06b086644118fd62efbb0 (diff)
Fix a number of c++ build errors (#715)
* Move -fvisibility-inlines-hidden from common_flags to cxx_flags This option isn't supported by C (and causes the build to fail under at least rodete). Manifested error was: ``` -- Looking for include file openssl/rand.h -- Looking for include file openssl/rand.h - not found CMake Error at core/src/firebase/firestore/util/CMakeLists.txt:94 (message): No implementation for SecureRandom available. -- Configuring incomplete, errors occurred! ``` which is completely misleading. :( * Fix exception include for std::logic_error Was causing compiler error on (at least) rodete. (http://en.cppreference.com/w/cpp/error/logic_error suggests that stdexcept is the correct header.) * Remove 'const' from vector contents. vectors cannot contain const objects as the contained objects are required to be assignable and copy constructable. (Not *quite* strictly true; since c++11, this requirement now depends on the operations performed on the container. But my compiler objects at any rate.) http://en.cppreference.com/w/cpp/container/vector https://stackoverflow.com/questions/8685257/why-cant-you-put-a-const-object-into-a-stl-container * Add brackets as suggested (required) by my compiler. * Add missing include For LLONG_MIN, etc. * Enable gnu extension to c++11 for firestore/util *test*. We disable them by default (in cmake/CompilerSetup.cmake) but our tests requires hexidecimal floating point, which is not supported in c++11 (though is supported in C++17, gnu++11, and others). http://en.cppreference.com/w/cpp/language/floating_literal https://bugzilla.redhat.com/show_bug.cgi?id=1321986 * Fix printf format for uint64_t http://en.cppreference.com/w/cpp/types/integer https://stackoverflow.com/questions/9225567/how-to-print-a-int64-t-type-in-c * Allow 0 length printf template strings in tests. * Get rid of a multi line comment. The backslash is apparently interpreted by the compiler cause the next line to be ignored too. In this case, the next line is (currently) a comment, and would be ignored anyways. (But that doesn't stop the compiler from yelling.) * Run ./scripts/style.sh
Diffstat (limited to 'Firestore/core/src/firebase/firestore/model')
-rw-r--r--Firestore/core/src/firebase/firestore/model/field_value.cc16
-rw-r--r--Firestore/core/src/firebase/firestore/model/field_value.h8
2 files changed, 12 insertions, 12 deletions
diff --git a/Firestore/core/src/firebase/firestore/model/field_value.cc b/Firestore/core/src/firebase/firestore/model/field_value.cc
index b063543..570226e 100644
--- a/Firestore/core/src/firebase/firestore/model/field_value.cc
+++ b/Firestore/core/src/firebase/firestore/model/field_value.cc
@@ -95,7 +95,7 @@ FieldValue& FieldValue::operator=(const FieldValue& value) {
break;
case Type::Blob: {
// copy-and-swap
- std::vector<const uint8_t> tmp = value.blob_value_;
+ std::vector<uint8_t> tmp = value.blob_value_;
std::swap(blob_value_, tmp);
break;
}
@@ -104,7 +104,7 @@ FieldValue& FieldValue::operator=(const FieldValue& value) {
break;
case Type::Array: {
// copy-and-swap
- std::vector<const FieldValue> tmp = value.array_value_;
+ std::vector<FieldValue> tmp = value.array_value_;
std::swap(array_value_, tmp);
break;
}
@@ -228,7 +228,7 @@ FieldValue FieldValue::StringValue(std::string&& value) {
FieldValue FieldValue::BlobValue(const uint8_t* source, size_t size) {
FieldValue result;
result.SwitchTo(Type::Blob);
- std::vector<const uint8_t> copy(source, source + size);
+ std::vector<uint8_t> copy(source, source + size);
std::swap(result.blob_value_, copy);
return result;
}
@@ -240,12 +240,12 @@ FieldValue FieldValue::GeoPointValue(const GeoPoint& value) {
return result;
}
-FieldValue FieldValue::ArrayValue(const std::vector<const FieldValue>& value) {
- std::vector<const FieldValue> copy(value);
+FieldValue FieldValue::ArrayValue(const std::vector<FieldValue>& value) {
+ std::vector<FieldValue> copy(value);
return ArrayValue(std::move(copy));
}
-FieldValue FieldValue::ArrayValue(std::vector<const FieldValue>&& value) {
+FieldValue FieldValue::ArrayValue(std::vector<FieldValue>&& value) {
FieldValue result;
result.SwitchTo(Type::Array);
std::swap(result.array_value_, value);
@@ -368,13 +368,13 @@ void FieldValue::SwitchTo(const Type type) {
break;
case Type::Blob:
// Do not even bother to allocate a new array of size 0.
- new (&blob_value_) std::vector<const uint8_t>();
+ new (&blob_value_) std::vector<uint8_t>();
break;
case Type::GeoPoint:
new (&geo_point_value_) GeoPoint();
break;
case Type::Array:
- new (&array_value_) std::vector<const FieldValue>();
+ new (&array_value_) std::vector<FieldValue>();
break;
case Type::Object:
new (&object_value_) std::map<const std::string, const FieldValue>();
diff --git a/Firestore/core/src/firebase/firestore/model/field_value.h b/Firestore/core/src/firebase/firestore/model/field_value.h
index bb6594f..4cd0b3d 100644
--- a/Firestore/core/src/firebase/firestore/model/field_value.h
+++ b/Firestore/core/src/firebase/firestore/model/field_value.h
@@ -105,8 +105,8 @@ class FieldValue {
static FieldValue BlobValue(const uint8_t* source, size_t size);
// static FieldValue ReferenceValue();
static FieldValue GeoPointValue(const GeoPoint& value);
- static FieldValue ArrayValue(const std::vector<const FieldValue>& value);
- static FieldValue ArrayValue(std::vector<const FieldValue>&& value);
+ static FieldValue ArrayValue(const std::vector<FieldValue>& value);
+ static FieldValue ArrayValue(std::vector<FieldValue>&& value);
static FieldValue ObjectValue(
const std::map<const std::string, const FieldValue>& value);
static FieldValue ObjectValue(
@@ -132,9 +132,9 @@ class FieldValue {
Timestamp timestamp_value_;
ServerTimestamp server_timestamp_value_;
std::string string_value_;
- std::vector<const uint8_t> blob_value_;
+ std::vector<uint8_t> blob_value_;
GeoPoint geo_point_value_;
- std::vector<const FieldValue> array_value_;
+ std::vector<FieldValue> array_value_;
std::map<const std::string, const FieldValue> object_value_;
};
};