summaryrefslogtreecommitdiff
path: root/libutils/String16.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-10-08 11:10:11 -0700
committerElliott Hughes <enh@google.com>2018-10-08 11:15:52 -0700
commit643268f325e2bda64248df24913f8b68c842c95a (patch)
tree4ddf6fdaa71ad280a6df08821c15ce97955a4c64 /libutils/String16.cpp
parentf3186de123c742166ec5e61b27b61af3ef929dfb (diff)
Move system/core/ off NO_ERROR.
It causes trouble for Windows, and OK already exists. Bug: N/A Test: builds Change-Id: Ida22fd658b0ebb259c710ba39049b07c9e495d9c
Diffstat (limited to 'libutils/String16.cpp')
-rw-r--r--libutils/String16.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/libutils/String16.cpp b/libutils/String16.cpp
index 5c0b406ca..818b17124 100644
--- a/libutils/String16.cpp
+++ b/libutils/String16.cpp
@@ -157,12 +157,12 @@ status_t String16::setTo(const String16& other, size_t len, size_t begin)
if (begin >= N) {
SharedBuffer::bufferFromData(mString)->release();
mString = getEmptyString();
- return NO_ERROR;
+ return OK;
}
if ((begin+len) > N) len = N-begin;
if (begin == 0 && len == N) {
setTo(other);
- return NO_ERROR;
+ return OK;
}
if (&other == this) {
@@ -191,7 +191,7 @@ status_t String16::setTo(const char16_t* other, size_t len)
memmove(str, other, len*sizeof(char16_t));
str[len] = 0;
mString = str;
- return NO_ERROR;
+ return OK;
}
return NO_MEMORY;
}
@@ -202,9 +202,9 @@ status_t String16::append(const String16& other)
const size_t otherLen = other.size();
if (myLen == 0) {
setTo(other);
- return NO_ERROR;
+ return OK;
} else if (otherLen == 0) {
- return NO_ERROR;
+ return OK;
}
if (myLen >= SIZE_MAX / sizeof(char16_t) - otherLen) {
@@ -218,7 +218,7 @@ status_t String16::append(const String16& other)
char16_t* str = (char16_t*)buf->data();
memcpy(str+myLen, other, (otherLen+1)*sizeof(char16_t));
mString = str;
- return NO_ERROR;
+ return OK;
}
return NO_MEMORY;
}
@@ -228,9 +228,9 @@ status_t String16::append(const char16_t* chrs, size_t otherLen)
const size_t myLen = size();
if (myLen == 0) {
setTo(chrs, otherLen);
- return NO_ERROR;
+ return OK;
} else if (otherLen == 0) {
- return NO_ERROR;
+ return OK;
}
if (myLen >= SIZE_MAX / sizeof(char16_t) - otherLen) {
@@ -245,7 +245,7 @@ status_t String16::append(const char16_t* chrs, size_t otherLen)
memcpy(str+myLen, chrs, otherLen*sizeof(char16_t));
str[myLen+otherLen] = 0;
mString = str;
- return NO_ERROR;
+ return OK;
}
return NO_MEMORY;
}
@@ -260,9 +260,9 @@ status_t String16::insert(size_t pos, const char16_t* chrs, size_t len)
const size_t myLen = size();
if (myLen == 0) {
return setTo(chrs, len);
- return NO_ERROR;
+ return OK;
} else if (len == 0) {
- return NO_ERROR;
+ return OK;
}
if (pos > myLen) pos = myLen;
@@ -286,7 +286,7 @@ status_t String16::insert(size_t pos, const char16_t* chrs, size_t len)
#if 0
printf("Result (%d chrs): %s\n", size(), String8(*this).string());
#endif
- return NO_ERROR;
+ return OK;
}
return NO_MEMORY;
}
@@ -357,7 +357,7 @@ status_t String16::makeLower()
edit[i] = tolower((char)v);
}
}
- return NO_ERROR;
+ return OK;
}
status_t String16::replaceAll(char16_t replaceThis, char16_t withThis)
@@ -378,7 +378,7 @@ status_t String16::replaceAll(char16_t replaceThis, char16_t withThis)
edit[i] = withThis;
}
}
- return NO_ERROR;
+ return OK;
}
status_t String16::remove(size_t len, size_t begin)
@@ -387,11 +387,11 @@ status_t String16::remove(size_t len, size_t begin)
if (begin >= N) {
SharedBuffer::bufferFromData(mString)->release();
mString = getEmptyString();
- return NO_ERROR;
+ return OK;
}
if ((begin+len) > N) len = N-begin;
if (begin == 0 && len == N) {
- return NO_ERROR;
+ return OK;
}
if (begin > 0) {
@@ -410,7 +410,7 @@ status_t String16::remove(size_t len, size_t begin)
char16_t* str = (char16_t*)buf->data();
str[len] = 0;
mString = str;
- return NO_ERROR;
+ return OK;
}
return NO_MEMORY;
}