summaryrefslogtreecommitdiffstats
path: root/libs/utils
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:44:00 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:44:00 -0800
commita6938bab1f6fa76ae98ebbe44f4e534e05fa0993 (patch)
treebc5a1f806bd06db8abb197e80be9ead3644c0bcc /libs/utils
parente41dd756db5184519f4dacbf4d95b333822605c7 (diff)
downloadframeworks_native-a6938bab1f6fa76ae98ebbe44f4e534e05fa0993.zip
frameworks_native-a6938bab1f6fa76ae98ebbe44f4e534e05fa0993.tar.gz
frameworks_native-a6938bab1f6fa76ae98ebbe44f4e534e05fa0993.tar.bz2
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'libs/utils')
-rw-r--r--libs/utils/Parcel.cpp15
-rw-r--r--libs/utils/ResourceTypes.cpp9
-rw-r--r--libs/utils/String8.cpp4
3 files changed, 19 insertions, 9 deletions
diff --git a/libs/utils/Parcel.cpp b/libs/utils/Parcel.cpp
index 0eba0b0..0f4b647 100644
--- a/libs/utils/Parcel.cpp
+++ b/libs/utils/Parcel.cpp
@@ -658,15 +658,20 @@ status_t Parcel::writeNativeHandle(const native_handle& handle)
status_t err;
err = writeInt32(handle.numFds);
if (err != NO_ERROR) return err;
-
+
err = writeInt32(handle.numInts);
if (err != NO_ERROR) return err;
-
+
for (int i=0 ; err==NO_ERROR && i<handle.numFds ; i++)
err = writeDupFileDescriptor(handle.data[i]);
-
+
+ if (err != NO_ERROR) {
+ LOGD("write native handle, write dup fd failed");
+ return err;
+ }
+
err = write(handle.data + handle.numFds, sizeof(int)*handle.numInts);
-
+
return err;
}
@@ -947,7 +952,7 @@ native_handle* Parcel::readNativeHandle(native_handle* (*alloc)(void*, int, int)
}
for (int i=0 ; err==NO_ERROR && i<numFds ; i++) {
- h->data[i] = readFileDescriptor();
+ h->data[i] = dup(readFileDescriptor());
if (h->data[i] < 0) err = BAD_VALUE;
}
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index 5a09fb4..71e7cd7 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -1736,7 +1736,7 @@ bool ResTable::getResourceName(uint32_t resID, resource_name* outName) const
}
ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag,
- uint32_t* outSpecFlags) const
+ uint32_t* outSpecFlags, ResTable_config* outConfig) const
{
if (mError != NO_ERROR) {
return mError;
@@ -1809,7 +1809,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag
(const Res_value*)(((const uint8_t*)type) + offset);
ResTable_config thisConfig;
thisConfig.copyFromDtoH(type->config);
-
+
if (outSpecFlags != NULL) {
if (typeClass->typeSpecFlags != NULL) {
*outSpecFlags |= dtohl(typeClass->typeSpecFlags[e]);
@@ -1834,6 +1834,9 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag
outValue->res0 = bestValue->res0;
outValue->dataType = bestValue->dataType;
outValue->data = dtohl(bestValue->data);
+ if (outConfig != NULL) {
+ *outConfig = bestItem;
+ }
TABLE_NOISY(size_t len;
printf("Found value: pkg=%d, type=%d, str=%s, int=%d\n",
bestPackage->header->index,
@@ -3484,7 +3487,7 @@ ssize_t ResTable::getEntry(
ResTable_config thisConfig;
thisConfig.copyFromDtoH(thisType->config);
-
+
TABLE_GETENTRY(LOGI("Match entry 0x%x in type 0x%x (sz 0x%x): imsi:%d/%d=%d/%d lang:%c%c=%c%c cnt:%c%c=%c%c "
"orien:%d=%d touch:%d=%d density:%d=%d key:%d=%d inp:%d=%d nav:%d=%d w:%d=%d h:%d=%d\n",
entryIndex, typeIndex+1, dtohl(thisType->config.size),
diff --git a/libs/utils/String8.cpp b/libs/utils/String8.cpp
index ab843f6..c50d343 100644
--- a/libs/utils/String8.cpp
+++ b/libs/utils/String8.cpp
@@ -317,8 +317,10 @@ status_t String8::real_append(const char* other, size_t otherLen)
->editResize(myLen+otherLen+1);
if (buf) {
char* str = (char*)buf->data();
- memcpy(str+myLen, other, otherLen+1);
mString = str;
+ str += myLen;
+ memcpy(str, other, otherLen);
+ str[otherLen] = '\0';
return NO_ERROR;
}
return NO_MEMORY;