am f45c5100: partially implement external display clipping

* commit 'f45c510009edab4a3e93f8d66b2e30aa26759fed':
  partially implement external display clipping
diff --git a/include/utils/Compat.h b/include/utils/Compat.h
index 1819266..fb7748e 100644
--- a/include/utils/Compat.h
+++ b/include/utils/Compat.h
@@ -39,4 +39,27 @@
 
 #endif /* !HAVE_OFF64_T */
 
+#if HAVE_PRINTF_ZD
+#  define ZD "%zd"
+#  define ZD_TYPE ssize_t
+#else
+#  define ZD "%ld"
+#  define ZD_TYPE long
+#endif
+
+/*
+ * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
+ * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
+ * not already defined, then define it here.
+ */
+#ifndef TEMP_FAILURE_RETRY
+/* Used to retry syscalls that can return EINTR. */
+#define TEMP_FAILURE_RETRY(exp) ({         \
+    typeof (exp) _rc;                      \
+    do {                                   \
+        _rc = (exp);                       \
+    } while (_rc == -1 && errno == EINTR); \
+    _rc; })
+#endif
+
 #endif /* __LIB_UTILS_COMPAT_H */
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp
index ef49c0f..a1bfedb 100644
--- a/libs/utils/ZipFileRO.cpp
+++ b/libs/utils/ZipFileRO.cpp
@@ -20,6 +20,7 @@
 #define LOG_TAG "zipro"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
+#include <utils/Compat.h>
 #include <utils/ZipFileRO.h>
 #include <utils/misc.h>
 #include <utils/threads.h>
@@ -32,14 +33,6 @@
 #include <assert.h>
 #include <unistd.h>
 
-#if HAVE_PRINTF_ZD
-#  define ZD "%zd"
-#  define ZD_TYPE ssize_t
-#else
-#  define ZD "%ld"
-#  define ZD_TYPE long
-#endif
-
 /*
  * We must open binary files using open(path, ... | O_BINARY) under Windows.
  * Otherwise strange read errors will happen.
@@ -48,21 +41,6 @@
 #  define O_BINARY  0
 #endif
 
-/*
- * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
- * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
- * not already defined, then define it here.
- */
-#ifndef TEMP_FAILURE_RETRY
-/* Used to retry syscalls that can return EINTR. */
-#define TEMP_FAILURE_RETRY(exp) ({         \
-    typeof (exp) _rc;                      \
-    do {                                   \
-        _rc = (exp);                       \
-    } while (_rc == -1 && errno == EINTR); \
-    _rc; })
-#endif
-
 using namespace android;
 
 /*
diff --git a/libs/utils/ZipUtils.cpp b/libs/utils/ZipUtils.cpp
index cf5467b..a43bbb0 100644
--- a/libs/utils/ZipUtils.cpp
+++ b/libs/utils/ZipUtils.cpp
@@ -21,6 +21,7 @@
 #define LOG_TAG "ziputil"
 
 #include <utils/Log.h>
+#include <utils/Compat.h>
 #include <utils/ZipUtils.h>
 #include <utils/ZipFileRO.h>
 
@@ -98,10 +99,11 @@
             ALOGV("+++ reading %ld bytes (%ld left)\n",
                 getSize, compRemaining);
 
-            int cc = read(fd, readBuf, getSize);
-            if (cc != (int) getSize) {
-                ALOGD("inflate read failed (%d vs %ld)\n",
-                    cc, getSize);
+            int cc = TEMP_FAILURE_RETRY(read(fd, readBuf, getSize));
+            if (cc < 0) {
+                ALOGW("inflate read failed: %s", strerror(errno));
+            } else if (cc != (int) getSize) {
+                ALOGW("inflate read failed (%d vs %ld)", cc, getSize);
                 goto z_bail;
             }
 
diff --git a/libs/utils/tests/Android.mk b/libs/utils/tests/Android.mk
index 0a5b379..5b2b5b1 100644
--- a/libs/utils/tests/Android.mk
+++ b/libs/utils/tests/Android.mk
@@ -4,42 +4,30 @@
 
 # Build the unit tests.
 test_src_files := \
-	BasicHashtable_test.cpp \
-	BlobCache_test.cpp \
-	Looper_test.cpp \
-	String8_test.cpp \
-	Unicode_test.cpp \
-	Vector_test.cpp \
-	ZipFileRO_test.cpp
+    BasicHashtable_test.cpp \
+    BlobCache_test.cpp \
+    Looper_test.cpp \
+    String8_test.cpp \
+    Unicode_test.cpp \
+    Vector_test.cpp \
+    ZipFileRO_test.cpp
 
 shared_libraries := \
-	libz \
-	liblog \
-	libcutils \
-	libutils \
-	libstlport
+    libz \
+    liblog \
+    libcutils \
+    libutils \
+    libstlport
 
 static_libraries := \
-	libgtest \
-	libgtest_main
-
-c_includes := \
-    external/zlib \
-    external/icu4c/common \
-    bionic \
-    bionic/libstdc++/include \
-    external/gtest/include \
-    external/stlport/stlport
-
-module_tags := eng tests
+    libgtest \
+    libgtest_main
 
 $(foreach file,$(test_src_files), \
     $(eval include $(CLEAR_VARS)) \
     $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \
     $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \
-    $(eval LOCAL_C_INCLUDES := $(c_includes)) \
     $(eval LOCAL_SRC_FILES := $(file)) \
     $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
-    $(eval LOCAL_MODULE_TAGS := $(module_tags)) \
-    $(eval include $(BUILD_EXECUTABLE)) \
+    $(eval include $(BUILD_NATIVE_TEST)) \
 )
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 23e89da..4e44941 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -1171,11 +1171,12 @@
     const egl_display_ptr dp = validate_display(dpy);
     if (!dp) return EGL_FALSE;
 
+    EGLBoolean result = EGL_FALSE;
     egl_connection_t* const cnx = &gEGLImpl;
     if (cnx->dso && cnx->egl.eglDestroyImageKHR) {
-        cnx->egl.eglDestroyImageKHR(dp->disp.dpy, img);
+        result = cnx->egl.eglDestroyImageKHR(dp->disp.dpy, img);
     }
-    return EGL_TRUE;
+    return result;
 }
 
 // ----------------------------------------------------------------------------