Merge "Fix strstr16." into nyc-dev
am: a34a383607
* commit 'a34a383607007d632878929c6c9278221242d457':
Fix strstr16.
Change-Id: I8fa1fab977f974c861cecb8b24b72cd175c27752
diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp
index ade896a..f1f8bc9 100644
--- a/libutils/Unicode.cpp
+++ b/libutils/Unicode.cpp
@@ -292,6 +292,7 @@
char16_t* strstr16(const char16_t* src, const char16_t* target)
{
const char16_t needle = *target++;
+ const size_t target_len = strlen16(target);
if (needle != '\0') {
do {
do {
@@ -299,7 +300,7 @@
return nullptr;
}
} while (*src++ != needle);
- } while (strcmp16(src, target) != 0);
+ } while (strncmp16(src, target, target_len) != 0);
src--;
}