diff options
-rw-r--r-- | core/java/android/provider/ContactsContract.java | 31 | ||||
-rw-r--r-- | opengl/tests/gl_perfapp/jni/gl_code.cpp | 18 |
2 files changed, 23 insertions, 26 deletions
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 7df8487e2304..c3ec7a2aaf03 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -2113,28 +2113,21 @@ public final class ContactsContract { Data.DATA_VERSION); for (String key : DATA_KEYS) { final int columnIndex = cursor.getColumnIndexOrThrow(key); - if (cursor.isNull(columnIndex)) { - // don't put anything - } else { - try { + switch (cursor.getType(columnIndex)) { + case Cursor.FIELD_TYPE_NULL: + // don't put anything + break; + case Cursor.FIELD_TYPE_INTEGER: + case Cursor.FIELD_TYPE_FLOAT: + case Cursor.FIELD_TYPE_STRING: cv.put(key, cursor.getString(columnIndex)); - } catch (SQLiteException e) { + break; + case Cursor.FIELD_TYPE_BLOB: cv.put(key, cursor.getBlob(columnIndex)); - } + break; + default: + throw new IllegalStateException("Invalid or unhandled data type"); } - // TODO: go back to this version of the code when bug - // http://b/issue?id=2306370 is fixed. -// if (cursor.isNull(columnIndex)) { -// // don't put anything -// } else if (cursor.isLong(columnIndex)) { -// values.put(key, cursor.getLong(columnIndex)); -// } else if (cursor.isFloat(columnIndex)) { -// values.put(key, cursor.getFloat(columnIndex)); -// } else if (cursor.isString(columnIndex)) { -// values.put(key, cursor.getString(columnIndex)); -// } else if (cursor.isBlob(columnIndex)) { -// values.put(key, cursor.getBlob(columnIndex)); -// } } contact.addSubValue(ContactsContract.Data.CONTENT_URI, cv); } while (cursor.moveToNext()); diff --git a/opengl/tests/gl_perfapp/jni/gl_code.cpp b/opengl/tests/gl_perfapp/jni/gl_code.cpp index eafb665d091f..020d848fdf0c 100644 --- a/opengl/tests/gl_perfapp/jni/gl_code.cpp +++ b/opengl/tests/gl_perfapp/jni/gl_code.cpp @@ -384,14 +384,18 @@ void doTest(uint32_t w, uint32_t h) { int texCount; int extraMath; int testSubState; - if ( testState < 5 * 2) { - texCount = 0; // Only 10 tests for texCout 0 - extraMath = testState / 2; - testSubState = testState % 2; + const int extraMathCount = 5; + const int texCount0SubTestCount = 2; + const int texCountNSubTestCount = 8; + + if ( testState < extraMathCount * texCount0SubTestCount) { + texCount = 0; // Only 10 tests for texCount 0 + extraMath = (testState / texCount0SubTestCount) % extraMathCount; + testSubState = testState % texCount0SubTestCount; } else { - texCount = 1 + (testState - 10) / (5 * 8); - extraMath = testState / 8; - testSubState = testState % 8; + texCount = 1 + (testState - extraMathCount * texCount0SubTestCount) / (extraMathCount * texCountNSubTestCount); + extraMath = (testState / texCountNSubTestCount) % extraMathCount; + testSubState = testState % texCountNSubTestCount; } if (texCount >= 3) { LOGI("done\n"); |