Merge "Remove move dead code." am: acec0918e5 am: 1fc404900c

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1677028

Change-Id: I848c3fb85d3b63159faec3525e2befbee83f64f6
This commit is contained in:
Elliott Hughes 2021-04-16 17:25:03 +00:00 committed by Automerger Merge Worker
commit 906a03fc49
3 changed files with 3 additions and 53 deletions

View File

@ -25,6 +25,8 @@
#include <ctype.h> #include <ctype.h>
#include <string>
#include "SharedBuffer.h" #include "SharedBuffer.h"
/* /*
@ -163,9 +165,7 @@ String8::String8(const char16_t* o, size_t len)
} }
String8::String8(const char32_t* o) String8::String8(const char32_t* o)
: mString(allocFromUTF32(o, strlen32(o))) : mString(allocFromUTF32(o, std::char_traits<char32_t>::length(o))) {}
{
}
String8::String8(const char32_t* o, size_t len) String8::String8(const char32_t* o, size_t len)
: mString(allocFromUTF32(o, len)) : mString(allocFromUTF32(o, len))

View File

@ -22,20 +22,6 @@
#include <log/log.h> #include <log/log.h>
#if defined(_WIN32)
# undef nhtol
# undef htonl
# undef nhtos
# undef htons
# define ntohl(x) ( ((x) << 24) | (((x) >> 24) & 255) | (((x) << 8) & 0xff0000) | (((x) >> 8) & 0xff00) )
# define htonl(x) ntohl(x)
# define ntohs(x) ( (((x) << 8) & 0xff00) | (((x) >> 8) & 255) )
# define htons(x) ntohs(x)
#else
# include <netinet/in.h>
#endif
extern "C" { extern "C" {
static const char32_t kByteMask = 0x000000BF; static const char32_t kByteMask = 0x000000BF;
@ -115,24 +101,6 @@ static inline void utf32_codepoint_to_utf8(uint8_t* dstP, char32_t srcChar, size
} }
} }
size_t strlen32(const char32_t *s)
{
const char32_t *ss = s;
while ( *ss )
ss++;
return ss-s;
}
size_t strnlen32(const char32_t *s, size_t maxlen)
{
const char32_t *ss = s;
while ((maxlen > 0) && *ss) {
ss++;
maxlen--;
}
return ss-s;
}
static inline int32_t utf32_at_internal(const char* cur, size_t *num_read) static inline int32_t utf32_at_internal(const char* cur, size_t *num_read)
{ {
const char first_char = *cur; const char first_char = *cur;
@ -254,19 +222,6 @@ int strncmp16(const char16_t *s1, const char16_t *s2, size_t n)
return d; return d;
} }
char16_t *strcpy16(char16_t *dst, const char16_t *src)
{
char16_t *q = dst;
const char16_t *p = src;
char16_t ch;
do {
*q++ = ch = *p++;
} while ( ch );
return dst;
}
size_t strlen16(const char16_t *s) size_t strlen16(const char16_t *s)
{ {
const char16_t *ss = s; const char16_t *ss = s;

View File

@ -27,7 +27,6 @@ int strcmp16(const char16_t *, const char16_t *);
int strncmp16(const char16_t *s1, const char16_t *s2, size_t n); int strncmp16(const char16_t *s1, const char16_t *s2, size_t n);
size_t strlen16(const char16_t *); size_t strlen16(const char16_t *);
size_t strnlen16(const char16_t *, size_t); size_t strnlen16(const char16_t *, size_t);
char16_t *strcpy16(char16_t *, const char16_t *);
char16_t *strstr16(const char16_t*, const char16_t*); char16_t *strstr16(const char16_t*, const char16_t*);
// Version of comparison that supports embedded NULs. // Version of comparison that supports embedded NULs.
@ -39,10 +38,6 @@ char16_t *strstr16(const char16_t*, const char16_t*);
// equivalent result as strcmp16 (unlike strncmp16). // equivalent result as strcmp16 (unlike strncmp16).
int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2); int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2);
// Standard string functions on char32_t strings.
size_t strlen32(const char32_t *);
size_t strnlen32(const char32_t *, size_t);
/** /**
* Measure the length of a UTF-32 string in UTF-8. If the string is invalid * Measure the length of a UTF-32 string in UTF-8. If the string is invalid
* such as containing a surrogate character, -1 will be returned. * such as containing a surrogate character, -1 will be returned.