summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/foundation
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-08-06 11:32:00 -0700
committerLajos Molnar <lajos@google.com>2014-08-07 14:23:27 -0700
commit8accee4f0e94f19866d260be6eecd6c219eb4982 (patch)
tree99ef44526b372dc6020f995cd78f3b9e3b1ffe58 /media/libstagefright/foundation
parent3659445a8b71afba9927b9d0d8ac41782278bde5 (diff)
downloadframeworks_av-8accee4f0e94f19866d260be6eecd6c219eb4982.zip
frameworks_av-8accee4f0e94f19866d260be6eecd6c219eb4982.tar.gz
frameworks_av-8accee4f0e94f19866d260be6eecd6c219eb4982.tar.bz2
stagefright: add AString parceling, and equal/compareIgnoreCase
Bug: 11990470 Change-Id: If43ada5d2e768931f4409e499eaa268edade0500
Diffstat (limited to 'media/libstagefright/foundation')
-rw-r--r--media/libstagefright/foundation/AString.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/media/libstagefright/foundation/AString.cpp b/media/libstagefright/foundation/AString.cpp
index 894f65c..1befef4 100644
--- a/media/libstagefright/foundation/AString.cpp
+++ b/media/libstagefright/foundation/AString.cpp
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
+#include <binder/Parcel.h>
#include <utils/String8.h>
#include "ADebug.h"
#include "AString.h"
@@ -306,6 +307,14 @@ int AString::compare(const AString &other) const {
return strcmp(mData, other.mData);
}
+int AString::compareIgnoreCase(const AString &other) const {
+ return strcasecmp(mData, other.mData);
+}
+
+bool AString::equalsIgnoreCase(const AString &other) const {
+ return compareIgnoreCase(other) == 0;
+}
+
void AString::tolower() {
makeMutable();
@@ -342,6 +351,21 @@ bool AString::endsWithIgnoreCase(const char *suffix) const {
return !strcasecmp(mData + mSize - suffixLen, suffix);
}
+// static
+AString AString::FromParcel(const Parcel &parcel) {
+ size_t size = static_cast<size_t>(parcel.readInt32());
+ return AString(static_cast<const char *>(parcel.readInplace(size)), size);
+}
+
+status_t AString::writeToParcel(Parcel *parcel) const {
+ CHECK_LE(mSize, INT32_MAX);
+ status_t err = parcel->writeInt32(mSize);
+ if (err == OK) {
+ err = parcel->write(mData, mSize);
+ }
+ return err;
+}
+
AString StringPrintf(const char *format, ...) {
va_list ap;
va_start(ap, format);