diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-10-06 13:11:04 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-10-06 14:40:13 -0700 |
commit | 3bc6bbc92cd2095f42039b5aadd0a14d0e5d9230 (patch) | |
tree | 39b62affe30e0c2895a0f8a52212a7f91bd80dd7 /include | |
parent | 3b2faf68e5a66ac67b28d6f79d4ba213b6c0d09c (diff) | |
download | frameworks_base-3bc6bbc92cd2095f42039b5aadd0a14d0e5d9230.zip frameworks_base-3bc6bbc92cd2095f42039b5aadd0a14d0e5d9230.tar.gz frameworks_base-3bc6bbc92cd2095f42039b5aadd0a14d0e5d9230.tar.bz2 |
Clean up CursorWindow code.
Bug: 5332296
The code is functionally equivalent, but a little more efficient
and much easier to maintain.
Change-Id: I90670a13799df05831843a5137ab234929281b7c
Diffstat (limited to 'include')
-rw-r--r-- | include/android_runtime/AndroidRuntime.h | 4 | ||||
-rw-r--r-- | include/binder/CursorWindow.h | 28 |
2 files changed, 26 insertions, 6 deletions
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h index 32cd4f5..fd33d59 100644 --- a/include/android_runtime/AndroidRuntime.h +++ b/include/android_runtime/AndroidRuntime.h @@ -31,8 +31,6 @@ namespace android { -class CursorWindow; - class AndroidRuntime { public: @@ -133,8 +131,6 @@ private: static int javaThreadShell(void* args); }; -extern CursorWindow * get_window_from_object(JNIEnv * env, jobject javaWindow); - } #endif diff --git a/include/binder/CursorWindow.h b/include/binder/CursorWindow.h index f0b2909..d227244 100644 --- a/include/binder/CursorWindow.h +++ b/include/binder/CursorWindow.h @@ -143,8 +143,6 @@ public: */ uint32_t alloc(size_t size, bool aligned = false); - uint32_t read_field_slot(int row, int column, field_slot_t * slot); - /** * Copy data into the window at the given offset. */ @@ -181,6 +179,32 @@ public: return ((field_slot_t *)offsetToPtr(fieldDirOffset)) + column; } + int64_t getFieldSlotValueLong(field_slot_t* fieldSlot) { +#if WINDOW_STORAGE_INLINE_NUMERICS + return fieldSlot->data.l; +#else + return copyOutLong(fieldSlot->data.buffer.offset); +#endif + } + + double getFieldSlotValueDouble(field_slot_t* fieldSlot) { +#if WINDOW_STORAGE_INLINE_NUMERICS + return fieldSlot->data.d; +#else + return copyOutDouble(fieldSlot->data.buffer.offset); +#endif + } + +#if WINDOW_STORAGE_UTF8 + char* getFieldSlotValueString(field_slot_t* fieldSlot) { + return reinterpret_cast<char*>(offsetToPtr(fieldSlot->data.buffer.offset)); + } +#else + char16_t* getFieldSlotValueString(field_slot_t* fieldSlot) { + return reinterpret_cast<char16_t*>(offsetToPtr(fieldSlot->data.buffer.offset)); + } +#endif + private: uint8_t * mData; size_t mSize; |