8259947: (fs) Optimize UnixPath.encode implementation

Reviewed-by: chegar, shade, alanb
This commit is contained in:
Claes Redestad 2021-01-20 15:14:48 +00:00
parent 69f90b5fd4
commit 5891509d13
6 changed files with 64 additions and 67 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,6 @@
package sun.nio.fs;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* Bsd specific system calls.
*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,6 @@
package sun.nio.fs;
import java.nio.file.*;
import java.io.IOException;
import java.util.*;
import java.util.regex.Pattern;
import static sun.nio.fs.MacOSXNativeDispatcher.*;
@ -47,14 +44,18 @@ class MacOSXFileSystem extends BsdFileSystem {
return Pattern.compile(expr, Pattern.CANON_EQ) ;
}
char[] normalizeNativePath(char[] path) {
for (char c : path) {
@Override
String normalizeNativePath(String path) {
for (int i = 0; i < path.length(); i++) {
char c = path.charAt(i);
if (c > 0x80)
return normalizepath(path, kCFStringNormalizationFormD);
return new String(normalizepath(path.toCharArray(),
kCFStringNormalizationFormD));
}
return path;
}
@Override
String normalizeJavaPath(String path) {
for (int i = 0; i < path.length(); i++) {
if (path.charAt(i) > 0x80)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,6 @@
package sun.nio.fs;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* MacOSX specific system calls.
*/