diff options
Diffstat (limited to 'libutils')
-rw-r--r-- | libutils/Android.mk | 7 | ||||
-rw-r--r-- | libutils/SharedBuffer.cpp | 2 | ||||
-rw-r--r-- | libutils/SharedBufferTest.cpp | 6 | ||||
-rw-r--r-- | libutils/tests/String8_test.cpp | 5 |
4 files changed, 10 insertions, 10 deletions
diff --git a/libutils/Android.mk b/libutils/Android.mk index 631b5a3b4..8c4fd15b6 100644 --- a/libutils/Android.mk +++ b/libutils/Android.mk @@ -106,19 +106,16 @@ LOCAL_CLANG := true LOCAL_SANITIZE := integer include $(BUILD_SHARED_LIBRARY) -# Include subdirectory makefiles -# ============================================================ - include $(CLEAR_VARS) LOCAL_MODULE := SharedBufferTest -LOCAL_STATIC_LIBRARIES := libutils libcutils +LOCAL_STATIC_LIBRARIES := libutils LOCAL_SHARED_LIBRARIES := liblog LOCAL_SRC_FILES := SharedBufferTest.cpp include $(BUILD_NATIVE_TEST) include $(CLEAR_VARS) LOCAL_MODULE := SharedBufferTest -LOCAL_STATIC_LIBRARIES := libutils libcutils +LOCAL_STATIC_LIBRARIES := libutils LOCAL_SHARED_LIBRARIES := liblog LOCAL_SRC_FILES := SharedBufferTest.cpp include $(BUILD_HOST_NATIVE_TEST) diff --git a/libutils/SharedBuffer.cpp b/libutils/SharedBuffer.cpp index c7dd1ab34..34d75eebc 100644 --- a/libutils/SharedBuffer.cpp +++ b/libutils/SharedBuffer.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#define __STDC_LIMIT_MACROS -#include <stdint.h> #include <stdlib.h> #include <string.h> diff --git a/libutils/SharedBufferTest.cpp b/libutils/SharedBufferTest.cpp index a0484ffb5..33a4e0c90 100644 --- a/libutils/SharedBufferTest.cpp +++ b/libutils/SharedBufferTest.cpp @@ -31,10 +31,10 @@ TEST(SharedBufferTest, TestAlloc) { // Check that null is returned, as we are asking for the whole address space. android::SharedBuffer* buf = android::SharedBuffer::alloc(SIZE_MAX - sizeof(android::SharedBuffer) - 1); - ASSERT_TRUE(NULL == buf); + ASSERT_EQ(nullptr, buf); buf = android::SharedBuffer::alloc(0); - ASSERT_FALSE(NULL == buf); + ASSERT_NE(nullptr, buf); ASSERT_EQ(0U, buf->size()); buf->release(); } @@ -49,7 +49,7 @@ TEST(SharedBufferTest, TestEditResize) { // Make sure we don't die here. // Check that null is returned, as we are asking for the whole address space. buf = buf->editResize(SIZE_MAX - sizeof(android::SharedBuffer) - 1); - ASSERT_TRUE(NULL == buf); + ASSERT_EQ(nullptr, buf); buf = android::SharedBuffer::alloc(10); buf = buf->editResize(0); diff --git a/libutils/tests/String8_test.cpp b/libutils/tests/String8_test.cpp index c42c68dce..01e64f60a 100644 --- a/libutils/tests/String8_test.cpp +++ b/libutils/tests/String8_test.cpp @@ -72,4 +72,9 @@ TEST_F(String8Test, OperatorPlusEquals) { EXPECT_STREQ(src3, " Verify me."); } +TEST_F(String8Test, SetToSizeMaxReturnsNoMemory) { + const char *in = "some string"; + EXPECT_EQ(NO_MEMORY, String8("").setTo(in, SIZE_MAX)); +} + } |