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
This commit is contained in:
parent
648d2ffce8
commit
41296e2a23
@ -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.
|
||||
|
@ -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 ()
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user