emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8b9d25b4087: Update Android port


From: Po Lu
Subject: master 8b9d25b4087: Update Android port
Date: Sat, 9 Sep 2023 03:52:02 -0400 (EDT)

branch: master
commit 8b9d25b4087df936d51aacd137affbce6469d717
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Update Android port
    
    * src/android-asset.h (android_asset_read_internal): Return an
    error indication if an exception arises while reading.
    (AAsset_getBuffer): Free BUFFER using the C library free
    function.
---
 src/android-asset.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/android-asset.h b/src/android-asset.h
index 4fb309f1645..d7cf0f0cfed 100644
--- a/src/android-asset.h
+++ b/src/android-asset.h
@@ -340,7 +340,7 @@ android_asset_read_internal (AAsset *asset, int nbytes, 
char *buffer)
       /* Detect error conditions.  */
 
       if ((*env)->ExceptionCheck (env))
-       goto out;
+       goto out_errno;
 
       /* Detect EOF.  */
 
@@ -363,6 +363,14 @@ android_asset_read_internal (AAsset *asset, int nbytes, 
char *buffer)
   (*env)->ExceptionClear (env);
   (*env)->DeleteLocalRef (env, stash);
   return total;
+
+ out_errno:
+  /* Return an error indication if an exception arises while the file
+     is being read.  */
+  (*env)->ExceptionClear (env);
+  (*env)->DeleteLocalRef (env, stash);
+  errno = EIO;
+  return -1;
 }
 
 static long
@@ -399,7 +407,7 @@ AAsset_getBuffer (AAsset *asset)
   if (android_asset_read_internal (asset, length, buffer)
       != length)
     {
-      xfree (buffer);
+      free (buffer);
       return NULL;
     }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]