mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-12 22:40:46 -08:00
Update Android port
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): * java/org/gnu/emacs/EmacsApplication.java (findDumpFile): * java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu) (addSubmenu, display): * java/org/gnu/emacs/EmacsDocumentsProvider.java (getNotificationUri, queryChildDocuments, deleteDocument): * java/org/gnu/emacs/EmacsDrawRectangle.java (perform): * java/org/gnu/emacs/EmacsFillRectangle.java (perform): * java/org/gnu/emacs/EmacsOpenActivity.java (readEmacsClientLog) (checkReadableOrCopy): * java/org/gnu/emacs/EmacsSdk7FontDriver.java (EmacsSdk7FontDriver): * java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView): * java/org/gnu/emacs/EmacsView.java (EmacsView): * java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, onKeyUp): * java/org/gnu/emacs/EmacsWindowAttachmentManager.java (EmacsWindowAttachmentManager): Remove various unused arguments and variables, dead stores, and make minor cleanups and performance improvements. * src/androidmenu.c (FIND_METHOD_STATIC, android_menu_show): Adjust accordingly.
This commit is contained in:
parent
7f0342a1bd
commit
377a3ebbb5
13 changed files with 73 additions and 60 deletions
|
|
@ -146,7 +146,7 @@ public final class EmacsOpenActivity extends Activity
|
|||
FileReader reader;
|
||||
char[] buffer;
|
||||
int rc;
|
||||
String what;
|
||||
StringBuilder builder;
|
||||
|
||||
/* Because the ProcessBuilder functions necessary to redirect
|
||||
process output are not implemented on Android 7 and earlier,
|
||||
|
|
@ -160,7 +160,8 @@ public final class EmacsOpenActivity extends Activity
|
|||
|
||||
cache = getCacheDir ();
|
||||
file = new File (cache, "emacsclient.log");
|
||||
what = "";
|
||||
builder = new StringBuilder ();
|
||||
reader = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -168,13 +169,25 @@ public final class EmacsOpenActivity extends Activity
|
|||
buffer = new char[2048];
|
||||
|
||||
while ((rc = reader.read (buffer, 0, 2048)) != -1)
|
||||
what += String.valueOf (buffer, 0, 2048);
|
||||
builder.append (buffer, 0, rc);
|
||||
|
||||
reader.close ();
|
||||
return what;
|
||||
return builder.toString ();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
/* Close the reader if it's already been opened. */
|
||||
|
||||
try
|
||||
{
|
||||
if (reader != null)
|
||||
reader.close ();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
/* Not sure what to do here. */
|
||||
}
|
||||
|
||||
return ("Couldn't read emacsclient.log: "
|
||||
+ exception.toString ());
|
||||
}
|
||||
|
|
@ -248,11 +261,16 @@ public final class EmacsOpenActivity extends Activity
|
|||
/* inFile is now the file being written to. */
|
||||
inFile = new File (getCacheDir (), inFile.getName ());
|
||||
buffer = new byte[4098];
|
||||
outStream = new FileOutputStream (inFile);
|
||||
stream = new FileInputStream (fd.getFileDescriptor ());
|
||||
|
||||
/* Initialize both streams to NULL. */
|
||||
outStream = null;
|
||||
stream = null;
|
||||
|
||||
try
|
||||
{
|
||||
outStream = new FileOutputStream (inFile);
|
||||
stream = new FileInputStream (fd.getFileDescriptor ());
|
||||
|
||||
while ((read = stream.read (buffer)) >= 0)
|
||||
outStream.write (buffer, 0, read);
|
||||
}
|
||||
|
|
@ -263,8 +281,12 @@ public final class EmacsOpenActivity extends Activity
|
|||
Keep in mind that execution is transferred to ``finally''
|
||||
even if an exception happens inside the while loop
|
||||
above. */
|
||||
stream.close ();
|
||||
outStream.close ();
|
||||
|
||||
if (stream != null)
|
||||
stream.close ();
|
||||
|
||||
if (outStream != null)
|
||||
outStream.close ();
|
||||
}
|
||||
|
||||
return inFile.getCanonicalPath ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue