aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@albatross.co.nz>1999-07-26 02:51:44 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>1999-07-26 03:51:44 +0100
commit41296e2a2391863bdaa411bb67d8ac9af3e39fde (patch)
tree41653eeceacd1252434a7f1e6a81fc4ca6638997 /libjava
parent648d2ffce89154a5c166258f6638ab32e737a2c6 (diff)
downloadgcc-41296e2a2391863bdaa411bb67d8ac9af3e39fde.zip
gcc-41296e2a2391863bdaa411bb67d8ac9af3e39fde.tar.gz
gcc-41296e2a2391863bdaa411bb67d8ac9af3e39fde.tar.bz2
natString.cc (substring): optimize where substring is entire String.
1999-07-22 Bryce McKinlay <bryce@albatross.co.nz> * java/lang/natString.cc (substring): optimize where substring is entire String. * java/io/File.java (getName): don't return separator with file name. * java/io/natFile.cc (attr): fix overflow. From-SVN: r28246
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/java/io/File.java4
-rw-r--r--libjava/java/io/natFile.cc2
-rw-r--r--libjava/java/lang/natString.cc2
4 files changed, 11 insertions, 4 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 4b6fd5e..5c4510e 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+1999-07-22 Bryce McKinlay <bryce@albatross.co.nz>
+
+ * java/lang/natString.cc (substring): optimize where substring is
+ entire String.
+ * java/io/File.java (getName): don't return separator with file name.
+ * java/io/natFile.cc (attr): fix overflow.
+
Sun Jul 25 01:43:34 1999 Anthony Green <green@cygnus.com>
* mauve-libgcj: Disable Object Serialization tests.
diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java
index fa098e2..fd96501 100644
--- a/libjava/java/io/File.java
+++ b/libjava/java/io/File.java
@@ -108,9 +108,7 @@ public class File implements Serializable
public String getName ()
{
int last = path.lastIndexOf(separatorChar);
- if (last == -1)
- last = 0;
- return path.substring(last);
+ return path.substring(last + 1);
}
public String getParent ()
diff --git a/libjava/java/io/natFile.cc b/libjava/java/io/natFile.cc
index 40f2277..9b9a4af 100644
--- a/libjava/java/io/natFile.cc
+++ b/libjava/java/io/natFile.cc
@@ -105,7 +105,7 @@ java::io::File::attr (jstring canon, jint query)
JvAssert (query == MODIFIED || query == LENGTH);
// FIXME: time computation is very POSIX-specific -- POSIX and Java
// have the same Epoch.
- return query == MODIFIED ? sb.st_mtime * 1000 : sb.st_size;
+ return query == MODIFIED ? (jlong)sb.st_mtime * 1000 : sb.st_size;
#else
// There's no good choice here.
return 23;
diff --git a/libjava/java/lang/natString.cc b/libjava/java/lang/natString.cc
index 08f1755..bfdc50f 100644
--- a/libjava/java/lang/natString.cc
+++ b/libjava/java/lang/natString.cc
@@ -687,6 +687,8 @@ java::lang::String::substring (jint beginIndex, jint endIndex)
{
if (beginIndex < 0 || endIndex > count || beginIndex > endIndex)
JvThrow (new StringIndexOutOfBoundsException());
+ if (beginIndex == 0 && endIndex == count)
+ return this;
jint newCount = endIndex - beginIndex;
if (newCount <= 8) // Optimization, mainly for GC.
return JvNewString(JvGetStringChars(this) + beginIndex, newCount);