summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-11-03 23:38:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-03 23:38:43 +0000
commit668f0a356cba44c22d8ca0c9f4711613885d46a9 (patch)
tree2a761d729c706abe8c4fca98e89d818e961a5168 /include
parent3c7efdc00506e6561ca08933f0b2acf5e3f16b02 (diff)
parent4bf58108d442b37ab4adf5ce3a4ecd63472ce254 (diff)
downloadframeworks_base-668f0a356cba44c22d8ca0c9f4711613885d46a9.zip
frameworks_base-668f0a356cba44c22d8ca0c9f4711613885d46a9.tar.gz
frameworks_base-668f0a356cba44c22d8ca0c9f4711613885d46a9.tar.bz2
Merge "Fix issues that will be present in C++11" into lmp-mr1-dev
Diffstat (limited to 'include')
-rw-r--r--include/androidfw/ResourceTypes.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h
index 85e442d..6b84494 100644
--- a/include/androidfw/ResourceTypes.h
+++ b/include/androidfw/ResourceTypes.h
@@ -36,6 +36,17 @@
namespace android {
+/**
+ * In C++11, char16_t is defined as *at least* 16 bits. We do a lot of
+ * casting on raw data and expect char16_t to be exactly 16 bits.
+ */
+#if __cplusplus >= 201103L
+struct __assertChar16Size {
+ static_assert(sizeof(char16_t) == sizeof(uint16_t), "char16_t is not 16 bits");
+ static_assert(alignof(char16_t) == alignof(uint16_t), "char16_t is not 16-bit aligned");
+};
+#endif
+
/** ********************************************************************
* PNG Extensions
*
@@ -702,25 +713,25 @@ public:
// These are available for all nodes:
int32_t getCommentID() const;
- const uint16_t* getComment(size_t* outLen) const;
+ const char16_t* getComment(size_t* outLen) const;
uint32_t getLineNumber() const;
// This is available for TEXT:
int32_t getTextID() const;
- const uint16_t* getText(size_t* outLen) const;
+ const char16_t* getText(size_t* outLen) const;
ssize_t getTextValue(Res_value* outValue) const;
// These are available for START_NAMESPACE and END_NAMESPACE:
int32_t getNamespacePrefixID() const;
- const uint16_t* getNamespacePrefix(size_t* outLen) const;
+ const char16_t* getNamespacePrefix(size_t* outLen) const;
int32_t getNamespaceUriID() const;
- const uint16_t* getNamespaceUri(size_t* outLen) const;
+ const char16_t* getNamespaceUri(size_t* outLen) const;
// These are available for START_TAG and END_TAG:
int32_t getElementNamespaceID() const;
- const uint16_t* getElementNamespace(size_t* outLen) const;
+ const char16_t* getElementNamespace(size_t* outLen) const;
int32_t getElementNameID() const;
- const uint16_t* getElementName(size_t* outLen) const;
+ const char16_t* getElementName(size_t* outLen) const;
// Remaining methods are for retrieving information about attributes
// associated with a START_TAG:
@@ -729,10 +740,10 @@ public:
// Returns -1 if no namespace, -2 if idx out of range.
int32_t getAttributeNamespaceID(size_t idx) const;
- const uint16_t* getAttributeNamespace(size_t idx, size_t* outLen) const;
+ const char16_t* getAttributeNamespace(size_t idx, size_t* outLen) const;
int32_t getAttributeNameID(size_t idx) const;
- const uint16_t* getAttributeName(size_t idx, size_t* outLen) const;
+ const char16_t* getAttributeName(size_t idx, size_t* outLen) const;
uint32_t getAttributeNameResID(size_t idx) const;
// These will work only if the underlying string pool is UTF-8.
@@ -740,7 +751,7 @@ public:
const char* getAttributeName8(size_t idx, size_t* outLen) const;
int32_t getAttributeValueStringID(size_t idx) const;
- const uint16_t* getAttributeStringValue(size_t idx, size_t* outLen) const;
+ const char16_t* getAttributeStringValue(size_t idx, size_t* outLen) const;
int32_t getAttributeDataType(size_t idx) const;
int32_t getAttributeData(size_t idx) const;
@@ -845,7 +856,7 @@ struct ResTable_package
uint32_t id;
// Actual name of this package, \0-terminated.
- char16_t name[128];
+ uint16_t name[128];
// Offset to a ResStringPool_header defining the resource
// type symbol table. If zero, this package is inheriting from
@@ -1450,7 +1461,7 @@ struct ResTable_lib_entry
uint32_t packageId;
// The package name of the shared library. \0 terminated.
- char16_t packageName[128];
+ uint16_t packageName[128];
};
/**
@@ -1681,7 +1692,7 @@ public:
size_t defPackageLen = 0,
uint32_t* outTypeSpecFlags = NULL) const;
- static bool expandResourceRef(const uint16_t* refStr, size_t refLen,
+ static bool expandResourceRef(const char16_t* refStr, size_t refLen,
String16* outPackage,
String16* outType,
String16* outName,