mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Integrate react_native_asserts into mapbuffer
Summary: Integrate react_native_asserts into mapbuffer changelog: [internal] internal Reviewed By: JoshuaGross Differential Revision: D27753092 fbshipit-source-id: dbeb7f140f3096c8153e2f6bced4e4d9d88b48b8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e57de5f32f
commit
aee07e1203
@@ -21,9 +21,10 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
|
||||
|
||||
LOCAL_STATIC_LIBRARIES :=
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := glog libglog_init
|
||||
LOCAL_SHARED_LIBRARIES := glog libglog_init libreact_debug
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,glog)
|
||||
$(call import-module,fbgloginit)
|
||||
$(call import-module,react/debug)
|
||||
|
||||
@@ -52,6 +52,7 @@ rn_xplat_cxx_library(
|
||||
"//xplat/fbsystrace:fbsystrace",
|
||||
"//xplat/folly:headers_only",
|
||||
"//xplat/folly:memory",
|
||||
react_native_xplat_target("react/debug:debug"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -70,6 +71,7 @@ fb_xplat_cxx_test(
|
||||
deps = [
|
||||
"//xplat/folly:molly",
|
||||
"//xplat/third-party/gmock:gtest",
|
||||
react_native_xplat_target("react/debug:debug"),
|
||||
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -33,12 +33,9 @@ MapBufferBuilder::MapBufferBuilder(uint16_t initialSize) {
|
||||
|
||||
void MapBufferBuilder::ensureKeyValueSpace() {
|
||||
int oldKeyValuesSize = keyValuesSize_;
|
||||
if (keyValuesSize_ >= std::numeric_limits<uint16_t>::max() / 2) {
|
||||
LOG(ERROR)
|
||||
<< "Error: trying to assign a value beyond the capacity of uint16_t"
|
||||
<< static_cast<uint32_t>(keyValuesSize_) * 2;
|
||||
abort();
|
||||
}
|
||||
react_native_assert(
|
||||
(keyValuesSize_ >= std::numeric_limits<uint16_t>::max() / 2) &&
|
||||
"Error trying to assign a value beyond the capacity of uint16_t");
|
||||
keyValuesSize_ *= 2;
|
||||
uint8_t *newKeyValues = new Byte[keyValuesSize_];
|
||||
uint8_t *oldKeyValues = keyValues_;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/primitives.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
Reference in New Issue
Block a user