summaryrefslogtreecommitdiff
path: root/libutils/String16.cpp
AgeCommit message (Collapse)Author
2021-06-10Check for overflow in String16::append and String16::insert.Elliott Hughes
Bug: http://b/178802681 Bug: http://b/178821065 Test: new tests Change-Id: I2352ea4c65e3f29e44e2ad6cad20ad610ceace1f
2021-05-12Remove String16::remove.Elliott Hughes
This function, ironically, is being removed. Even more amusing, it was never "remove" anyway --- it literally did the opposite, and removed everything *except* the range you passed to it, and should probably have been called "keep"! I'm looking at reimplementing much of libutils, but first I'm improving test coverage, and literally every test I wrote for this failed. And then when I fixed the "obvious bugs" in the implementation, I found there actually were a couple of existing unit tests --- that mostly served to demonstrate just how counter-intuitive this function was. Bug: http://b/156999009 Test: treehugger Change-Id: I41fd85f7c0988070f4039f607d2e57523d862ed9
2021-04-07Remove String16::makeLower().Elliott Hughes
If you need to do a case transformation for a Unicode string, you need to use icu4c. This only worked for ASCII, which is just silly. Luckily it doesn't seem to be used anywhere. Test: treehugger Change-Id: I4a864823ec35a0b57b50909587cc3efac3f531a7 Merged-In: I4a864823ec35a0b57b50909587cc3efac3f531a7
2020-07-14String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: ↵Steven Moreland
9be245c3f0 am: 64fb5012b8 am: 4e27b6992b am: 26b81f59d2 am: 8367a666b5 Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802 Change-Id: Ic25dca55b553b062edc4ced44ddef68b96428906
2020-07-14String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: ↵Steven Moreland
9be245c3f0 am: 64fb5012b8 am: 4e27b6992b am: 26b81f59d2 Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802 Change-Id: Ib4704bc8a733ace56e7998b7bad5a6c5638900ad
2020-07-14String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: ↵Steven Moreland
9be245c3f0 am: 64fb5012b8 Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802 Change-Id: I03057c052a24f205c78ee600178d45e0cd51a3c1
2020-05-28String16::remove - avoid overflowSteven Moreland
Bug: 156999009 Test: libutils_test (cases added) Change-Id: Iad46d95d9848928ba81000090b2fe9aec1e5eaac Merged-In: Iad46d95d9848928ba81000090b2fe9aec1e5eaac (cherry picked from commit f251c1c581f2d1b9940e60e756315c5e15443990) (cherry picked from commit 9a9c8910e9296c9dc8d79c37f589895f5a2a836c)
2020-02-10String*: remove 'StaticLinkage' constructorSteven Moreland
Unneeded. Bug: N/A Test: N/A Change-Id: I3ff473d1e2fec98e47abd8abb45dd36e0a808170
2019-09-27Fix memory leak in String16Vic Yang
Newly allocated SharedBuffer already has reference count 1, so we should not call acquire(). Bug: 141764153 Test: Run String16Test.* with ASan that was able to detect the leak without this change. Change-Id: Ib8b1b707b028386d717414d8c5ec5ea7b4b59464
2019-09-05Reland "libutils: Introduce StaticString16""Vic Yang
This reverts commit 1270e4fbf17402fb01dbfa7928a654d41d8553ee. Bug: 138856262 Test: Run unit tests. Change-Id: I37be01d7d4f98a83078870cb0917275336fa2bbd Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-08-30Revert "Reland "libutils: Introduce StaticString16"""Kevin Han
This reverts commit c55ac92bd6b6f14778758893730415f5328da530. Reason for revert: Breaks down-stream branches. See b/140315617 Change-Id: I4937fdf4bdcc7a44d5f10700ecf2d5e96aef7d27 Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-08-30Reland "libutils: Introduce StaticString16""Vic Yang
This time with old branches excluded. Bug: 138856262 Test: Run unit tests. Change-Id: Id0bb1d54b71e38244d64f1b684db1fda81de854c Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-08-29Revert "libutils: Introduce StaticString16"Vic Yang
This reverts commit d4cb4894348818b90457d94580ed4d611c5d11b0. Reason for revert: Breaking aosp_bonito-userdebug Change-Id: Iea72f39d40f476002ce0ad6b5ce3b4e1ca570de7
2019-08-09libutils: Introduce StaticString16Vic Yang
This is a backward compatible implementation of compile time constructed String16 support. As much as we'd like a regular constexpr constructor for String16, we want to make sure the regular non-static String16 does not regress. We also need to make sure prebuilts built with previous version of String16 still works with new libutils. This means we cannot change the size of String16 objects and we cannot make anything virtual. To add a flag to indicate whether a String16 is static without increasing the size of non-static String16 objects, we repurpose a reserved field in SharedBuffer as "for client use". With this, we can tag every String16 and perform memory operation differently based on how the underlying buffers are allocated. By using StaticString16, we are able to eliminate the runtime construction of a String16 and move it out of .bss section. Bug: 138856262 Test: Run newly added unit tests. Change-Id: I72bb8dc27a59b9ef34e0d934bc1e00b0f675855a
2018-10-08Move system/core/ off NO_ERROR.Elliott Hughes
It causes trouble for Windows, and OK already exists. Bug: N/A Test: builds Change-Id: Ida22fd658b0ebb259c710ba39049b07c9e495d9c
2018-07-17Merge "[libutils] Modernize codebase by replacing NULL with nullptr"Yi Kong
am: ab3203f383 Change-Id: I5c2aaaea705a3ab82a5ad999f813e4cc22e63401
2018-07-16[libutils] Modernize codebase by replacing NULL with nullptrYi Kong
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
2018-03-08Merge "libutils: Remove Static.cpp and darwin hacks." am: 929112bcd1Steven Moreland
am: 41a294981b Change-Id: Iebe132eaca4f9034a8e011881f1514f864529fc5
2018-03-06libutils: Remove Static.cpp and darwin hacks.Steven Moreland
Bug: N/A Test: in internal master, the only libraries that reference this symbol are: ./prebuilts/sdk/tools/linux/bin/split-select android::gDarwinIsReallyAnnoying ./prebuilts/sdk/tools/linux/bin/aapt android::gDarwinIsReallyAnnoying ./prebuilts/sdk/tools/linux/bin/aapt2 android::gDarwinIsReallyAnnoying ./prebuilts/sdk/tools/linux/lib64/libaapt2_jni.so android::gDarwinIsReallyAnnoying ./prebuilts/sdk/tools/linux/lib64/libaapt2_jni.so android::gDarwinIsReallyAnnoying + VNDK libraries Test: libutils_test Change-Id: Id39e5ef6438e48fa225ba06dbb59902ca5b60f70
2018-03-02String16: remove integer overflowsSteven Moreland
Bug: 73826242 Test: manual Change-Id: I32e13d61b944c1a527cf2d95473552d246e322be
2018-03-01String16: remove integer overflowsSteven Moreland
Bug: 73826242 Test: manual Change-Id: I32e13d61b944c1a527cf2d95473552d246e322be
2017-03-10Add missing includes.Steven Moreland
Includes are transitively imported by <string> in String8.h + String16.h but that include is being removed. Test: pass Change-Id: Ide5c011b40b4a4f031dd26ead08b5c8d5d299693
2017-03-03clean-up libutils includesMathias Agopian
moved Foo.h as first include of Foo.cpp, and removed redundant includes. Made NativeHandle non virtual. Test: run & compile Bug: n/a Change-Id: I37fa746cd42c9ba23aba181f84cb6c619386406a
2016-08-02Unicode: specify destination length in utf8_to_utf16 methodsSergio Giro
String16(const char *utf8) now returns the empty string in case a string ends halfway throw a utf8 character. Bug: 29267949 Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
2016-05-16Merge commit '8b452b876b90dcfff1dab9012b65b5e67c4531a4' into ↵Michael Wright
manual_merge_8b452b8 Change-Id: Iacdc2d521f669661b4979c03b0476512abdb37c7
2016-05-09Add String16#contains and strstr16 methods.Michael Wright
These are needed for aapt to find javadoc comments that contain "@removed" in order to skip them when printing styleable docs. Bug: 28663748 Change-Id: I8866d2167c41e11d6c2586da369560d5815fd13e
2016-02-18libutils: add String8 and String16 std_string utility methodsSamuel Tan
Add utility methods that convert String16 and String8 into std::string. Also, remove a repeated include of <utils/Unicode.h> in String16.h, since it is not used in that header file, and is already included in String16.cpp. BUG: 27200800 Change-Id: I5238aeb70689499763060a99dff9950fbb7adb3e TEST: libutils builds successfully.
2016-02-16libutils: remove whitespaces in String16.cpp and String16.hSamuel Tan
Remove trailing whitespaces in both these files. BUG: None Change-Id: I18eca5162871b5b2bf7757a7ef36a4e80073798c
2015-09-30system/core: remove methods returning SharedBuffer in String8, String16Sergio Giro
Towards deprecation of SharedBuffer Change-Id: I3069837db32837bcc0f5d8f1118ccd502c9070dc
2015-09-23libutils: hide SharedBuffer by moving SharedBuffer.h to the implementation ↵Sergio Giro
directory Some methods in header files of classes using SharedBuffer need to be moved to the implementation files accordingly Change-Id: I891f3ace2b940ab219e4e449040bfed71c0547db
2014-06-02libutils: turn on -WerrorMark Salyzyn
- Deal with some -Wunused issues - Override PRI macros (windows) - Revert use of PRI macros on off64_t (linux) - Deal with a gnu++11 complaince issue Change-Id: Ie66751293bd84477a5a6dfd8a57e700a16e36964
2014-05-29String16.cpp rm unused utils/Debug.hMark Salyzyn
Change-Id: Ie7e3695770f20be33738a0f0a868cc914248d91a
2013-08-02move libs/utils to libutilsAlex Ray
Change-Id: I6cf4268599460791414882f91eeb88a992fbd29d