diff --git a/.hgtags b/.hgtags index a0cde234d39..84575326d76 100644 --- a/.hgtags +++ b/.hgtags @@ -45,3 +45,6 @@ eb24af1404aec8aa140c4cd4d13d2839b150dd41 jdk7-b67 bca2225b66d78c4bf4d9801f54cac7715a598650 jdk7-b68 1b662b1ed14eb4ae31d5138a36c433b13d941dc5 jdk7-b69 207f694795c448c17753eff1a2f50363106960c2 jdk7-b70 +c5d39b6be65cba0effb5f466ea48fe43764d0e0c jdk7-b71 +df4bcd06e1d0ab306efa5a44f24a409dc0c0c742 jdk7-b72 +ce74bd35ce948d629a356e168797f44b593b1578 jdk7-b73 diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 1e56a495c63..4511932e4a5 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -45,3 +45,6 @@ c4523c6f82048f420bf0d57c4cd47976753b7d2c jdk7-b67 e1b972ff53cd58f825791f8ed9b2deffd16e768c jdk7-b68 82e6c820c51ac27882b77755d42efefdbf1dcda0 jdk7-b69 175cb3fe615998d1004c6d3fd96e6d2e86b6772d jdk7-b70 +4c36e9853dda27bdac5ef4839a610509fbe31d34 jdk7-b71 +0d7e03b426df27c21dcc44ffb9178eacd1b04f10 jdk7-b72 +3ac6dcf7823205546fbbc3d4ea59f37358d0b0d4 jdk7-b73 diff --git a/README-builds.html b/README-builds.html index 46d5bd72778..414403b2ee3 100644 --- a/README-builds.html +++ b/README-builds.html @@ -38,12 +38,17 @@
  • SOCKS
    This is another type of proxy. It allows for lower level type of tunneling since it works at the TCP level. In effect, diff --git a/jdk/src/share/classes/java/nio/file/FileTreeWalker.java b/jdk/src/share/classes/java/nio/file/FileTreeWalker.java index 71cb86eb88a..1452bd66b2a 100644 --- a/jdk/src/share/classes/java/nio/file/FileTreeWalker.java +++ b/jdk/src/share/classes/java/nio/file/FileTreeWalker.java @@ -41,8 +41,12 @@ class FileTreeWalker { private final boolean detectCycles; private final LinkOption[] linkOptions; private final FileVisitor visitor; + private final int maxDepth; - FileTreeWalker(Set options, FileVisitor visitor) { + FileTreeWalker(Set options, + FileVisitor visitor, + int maxDepth) + { boolean fl = false; boolean dc = false; for (FileVisitOption option: options) { @@ -58,18 +62,15 @@ class FileTreeWalker { this.linkOptions = (fl) ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS }; this.visitor = visitor; + this.maxDepth = maxDepth; } /** * Walk file tree starting at the given file */ - void walk(Path start, int maxDepth) { - // don't use attributes of starting file as they may be stale - if (start instanceof BasicFileAttributesHolder) { - ((BasicFileAttributesHolder)start).invalidate(); - } + void walk(Path start) { FileVisitResult result = walk(start, - maxDepth, + 0, new ArrayList()); if (result == null) { throw new NullPointerException("Visitor returned 'null'"); @@ -89,12 +90,15 @@ class FileTreeWalker { List ancestors) { // depth check - if (depth-- < 0) + if (depth > maxDepth) return FileVisitResult.CONTINUE; // if attributes are cached then use them if possible BasicFileAttributes attrs = null; - if (file instanceof BasicFileAttributesHolder) { + if ((depth > 0) && + (file instanceof BasicFileAttributesHolder) && + (System.getSecurityManager() == null)) + { BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get(); if (!followLinks || !cached.isSymbolicLink()) attrs = cached; @@ -120,6 +124,10 @@ class FileTreeWalker { } } } catch (SecurityException x) { + // If access to starting file is denied then SecurityException + // is thrown, otherwise the file is ignored. + if (depth == 0) + throw x; return FileVisitResult.CONTINUE; } } @@ -196,7 +204,7 @@ class FileTreeWalker { try { for (Path entry: stream) { inAction = true; - result = walk(entry, depth, ancestors); + result = walk(entry, depth+1, ancestors); inAction = false; // returning null will cause NPE to be thrown diff --git a/jdk/src/share/classes/java/nio/file/Files.java b/jdk/src/share/classes/java/nio/file/Files.java index 00e1014526c..ca5bc5698e1 100644 --- a/jdk/src/share/classes/java/nio/file/Files.java +++ b/jdk/src/share/classes/java/nio/file/Files.java @@ -133,10 +133,11 @@ public final class Files { *

    This method walks a file tree rooted at a given starting file. The * file tree traversal is depth-first with the given {@link * FileVisitor} invoked for each file encountered. File tree traversal - * completes when all accessible files in the tree have been visited, a - * visitor returns a result of {@link FileVisitResult#TERMINATE TERMINATE}, - * or the visitor terminates due to an uncaught {@code Error} or {@code - * RuntimeException}. + * completes when all accessible files in the tree have been visited, or a + * visit method returns a result of {@link FileVisitResult#TERMINATE + * TERMINATE}. Where a visit method terminates due an uncaught error or + * runtime exception then the traversal is terminated and the error or + * exception is propagated to the caller of this method. * *

    For each file encountered this method attempts to gets its {@link * java.nio.file.attribute.BasicFileAttributes}. If the file is not a @@ -222,7 +223,7 @@ public final class Files { { if (maxDepth < 0) throw new IllegalArgumentException("'maxDepth' is negative"); - new FileTreeWalker(options, visitor).walk(start, maxDepth); + new FileTreeWalker(options, visitor, maxDepth).walk(start); } /** diff --git a/jdk/src/share/classes/java/nio/file/SimpleFileVisitor.java b/jdk/src/share/classes/java/nio/file/SimpleFileVisitor.java index 761773513ed..f252ef03eea 100644 --- a/jdk/src/share/classes/java/nio/file/SimpleFileVisitor.java +++ b/jdk/src/share/classes/java/nio/file/SimpleFileVisitor.java @@ -124,8 +124,8 @@ public class SimpleFileVisitor implements FileVisitor { * cause. * * @throws IOError - * if iteration of the directory completed prematurely due to an - * I/O error + * with the I/O exception thrown when iteration of the directory + * completed prematurely due to an I/O error */ @Override public FileVisitResult postVisitDirectory(T dir, IOException exc) { diff --git a/jdk/src/share/classes/java/util/Currency.java b/jdk/src/share/classes/java/util/Currency.java index 5c9124a90c8..714bd3b2363 100644 --- a/jdk/src/share/classes/java/util/Currency.java +++ b/jdk/src/share/classes/java/util/Currency.java @@ -35,12 +35,12 @@ import java.io.Serializable; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.spi.CurrencyNameProvider; import java.util.spi.LocaleServiceProvider; import sun.util.LocaleServiceProviderPool; +import sun.util.logging.PlatformLogger; import sun.util.resources.LocaleData; import sun.util.resources.OpenListResourceBundle; @@ -244,7 +244,7 @@ public final class Currency implements Serializable { } } } catch (IOException e) { - log(Level.INFO, "currency.properties is ignored because of an IOException", e); + info("currency.properties is ignored because of an IOException", e); } return null; } @@ -686,7 +686,7 @@ public final class Currency implements Serializable { .append("The entry in currency.properties for ") .append(ctry).append(" is ignored because of the invalid country code.") .toString(); - log(Level.INFO, message, null); + info(message, null); return; } @@ -698,7 +698,7 @@ public final class Currency implements Serializable { .append(ctry) .append(" is ignored because the value format is not recognized.") .toString(); - log(Level.INFO, message, null); + info(message, null); return; } @@ -726,13 +726,13 @@ public final class Currency implements Serializable { setMainTableEntry(ctry.charAt(0), ctry.charAt(1), entry); } - private static void log(Level level, String message, Throwable t) { - Logger logger = Logger.getLogger("java.util.Currency"); - if (logger.isLoggable(level)) { + private static void info(String message, Throwable t) { + PlatformLogger logger = PlatformLogger.getLogger("java.util.Currency"); + if (logger.isLoggable(PlatformLogger.INFO)) { if (t != null) { - logger.log(level, message, t); + logger.info(message, t); } else { - logger.log(level, message); + logger.info(message); } } } diff --git a/jdk/src/share/classes/java/util/Properties.java b/jdk/src/share/classes/java/util/Properties.java index 29363b1fec3..d93a18f97f2 100644 --- a/jdk/src/share/classes/java/util/Properties.java +++ b/jdk/src/share/classes/java/util/Properties.java @@ -101,12 +101,12 @@ import java.io.BufferedWriter; * <!ATTLIST entry key CDATA #REQUIRED> * * - * @see native2ascii tool for Solaris - * @see native2ascii tool for Windows - * *

    This class is thread-safe: multiple threads can share a single * Properties object without the need for external synchronization. * + * @see native2ascii tool for Solaris + * @see native2ascii tool for Windows + * * @author Arthur van Hoff * @author Michael McCloskey * @author Xueming Shen diff --git a/jdk/src/share/classes/java/util/SimpleTimeZone.java b/jdk/src/share/classes/java/util/SimpleTimeZone.java index b0fd57de8df..d97d6f59a03 100644 --- a/jdk/src/share/classes/java/util/SimpleTimeZone.java +++ b/jdk/src/share/classes/java/util/SimpleTimeZone.java @@ -1372,7 +1372,7 @@ public class SimpleTimeZone extends TimeZone { throw new IllegalArgumentException( "Illegal start month " + startMonth); } - if (startTime < 0 || startTime >= millisPerDay) { + if (startTime < 0 || startTime > millisPerDay) { throw new IllegalArgumentException( "Illegal start time " + startTime); } @@ -1419,7 +1419,7 @@ public class SimpleTimeZone extends TimeZone { throw new IllegalArgumentException( "Illegal end month " + endMonth); } - if (endTime < 0 || endTime >= millisPerDay) { + if (endTime < 0 || endTime > millisPerDay) { throw new IllegalArgumentException( "Illegal end time " + endTime); } diff --git a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java index 10f2b6540cd..dc946786f83 100644 --- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java +++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java @@ -766,19 +766,21 @@ public class LinkedBlockingQueue extends AbstractQueue } /** - * Unlike other traversal methods, iterators need to handle: + * Returns the next live successor of p, or null if no such. + * + * Unlike other traversal methods, iterators need to handle both: * - dequeued nodes (p.next == p) - * - interior removed nodes (p.item == null) + * - (possibly multiple) interior removed nodes (p.item == null) */ private Node nextNode(Node p) { - Node s = p.next; - if (p == s) - return head.next; - // Skip over removed nodes. - // May be necessary if multiple interior Nodes are removed. - while (s != null && s.item == null) - s = s.next; - return s; + for (;;) { + Node s = p.next; + if (s == p) + return head.next; + if (s == null || s.item != null) + return s; + p = s; + } } public E next() { diff --git a/jdk/src/share/classes/java/util/jar/Attributes.java b/jdk/src/share/classes/java/util/jar/Attributes.java index 27a2aba8ef9..e9a9e6e6f69 100644 --- a/jdk/src/share/classes/java/util/jar/Attributes.java +++ b/jdk/src/share/classes/java/util/jar/Attributes.java @@ -34,7 +34,7 @@ import java.util.Set; import java.util.Collection; import java.util.AbstractSet; import java.util.Iterator; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import java.util.Comparator; import sun.misc.ASCIICaseInsensitiveComparator; @@ -419,7 +419,7 @@ public class Attributes implements Map, Cloneable { } try { if ((putValue(name, value) != null) && (!lineContinued)) { - Logger.getLogger("java.util.jar").warning( + PlatformLogger.getLogger("java.util.jar").warning( "Duplicate name in Manifest: " + name + ".\n" + "Ensure that the manifest does not " diff --git a/jdk/src/share/classes/java/util/logging/ErrorManager.java b/jdk/src/share/classes/java/util/logging/ErrorManager.java index 39c215151fc..8a6d935dea3 100644 --- a/jdk/src/share/classes/java/util/logging/ErrorManager.java +++ b/jdk/src/share/classes/java/util/logging/ErrorManager.java @@ -28,7 +28,7 @@ package java.util.logging; /** * ErrorManager objects can be attached to Handlers to process - * any error that occur on a Handler during Logging. + * any error that occurs on a Handler during Logging. *

    * When processing logging output, if a Handler encounters problems * then rather than throwing an Exception back to the issuer of @@ -72,7 +72,7 @@ public class ErrorManager { /** * The error method is called when a Handler failure occurs. *

    - * This method may be overriden in subclasses. The default + * This method may be overridden in subclasses. The default * behavior in this base class is that the first call is * reported to System.err, and subsequent calls are ignored. * diff --git a/jdk/src/share/classes/java/util/logging/FileHandler.java b/jdk/src/share/classes/java/util/logging/FileHandler.java index a4f18bd2130..23031a010c8 100644 --- a/jdk/src/share/classes/java/util/logging/FileHandler.java +++ b/jdk/src/share/classes/java/util/logging/FileHandler.java @@ -39,7 +39,7 @@ import java.security.*; * For a rotating set of files, as each file reaches a given size * limit, it is closed, rotated out, and a new file opened. * Successively older files are named by adding "0", "1", "2", - * etc into the base filename. + * etc. into the base filename. *

    * By default buffering is enabled in the IO libraries but each log * record is flushed out when it is complete. @@ -391,7 +391,7 @@ public class FileHandler extends StreamHandler { // Generate a lock file name from the "unique" int. lockFileName = generate(pattern, 0, unique).toString() + ".lck"; // Now try to lock that filename. - // Because some systems (e.g. Solaris) can only do file locks + // Because some systems (e.g., Solaris) can only do file locks // between processes (and not within a process), we first check // if we ourself already have the file locked. synchronized(locks) { diff --git a/jdk/src/share/classes/java/util/logging/Formatter.java b/jdk/src/share/classes/java/util/logging/Formatter.java index 7e7030ba6b0..7cf5c1764a1 100644 --- a/jdk/src/share/classes/java/util/logging/Formatter.java +++ b/jdk/src/share/classes/java/util/logging/Formatter.java @@ -52,7 +52,7 @@ public abstract class Formatter { * Format the given log record and return the formatted string. *

    * The resulting formatted String will normally include a - * localized and formated version of the LogRecord's message field. + * localized and formatted version of the LogRecord's message field. * It is recommended to use the {@link Formatter#formatMessage} * convenience method to localize and format the message field. * @@ -66,7 +66,7 @@ public abstract class Formatter { * Return the header string for a set of formatted records. *

    * This base class returns an empty string, but this may be - * overriden by subclasses. + * overridden by subclasses. * * @param h The target handler (can be null) * @return header string @@ -79,7 +79,7 @@ public abstract class Formatter { * Return the tail string for a set of formatted records. *

    * This base class returns an empty string, but this may be - * overriden by subclasses. + * overridden by subclasses. * * @param h The target handler (can be null) * @return tail string diff --git a/jdk/src/share/classes/java/util/logging/Handler.java b/jdk/src/share/classes/java/util/logging/Handler.java index 2643c734714..7c1c6268b00 100644 --- a/jdk/src/share/classes/java/util/logging/Handler.java +++ b/jdk/src/share/classes/java/util/logging/Handler.java @@ -274,7 +274,7 @@ public abstract class Handler { * Level and whether it satisfies any Filter. It also * may make other Handler specific checks that might prevent a * handler from logging the LogRecord. It will return false if - * the LogRecord is Null. + * the LogRecord is null. *

    * @param record a LogRecord * @return true if the LogRecord would be logged. diff --git a/jdk/src/share/classes/java/util/logging/Level.java b/jdk/src/share/classes/java/util/logging/Level.java index 910a50d1ebb..173201f80ee 100644 --- a/jdk/src/share/classes/java/util/logging/Level.java +++ b/jdk/src/share/classes/java/util/logging/Level.java @@ -110,7 +110,7 @@ public class Level implements java.io.Serializable { * Typically INFO messages will be written to the console * or its equivalent. So the INFO level should only be * used for reasonably significant messages that will - * make sense to end users and system admins. + * make sense to end users and system administrators. * This level is initialized to 800. */ public static final Level INFO = new Level("INFO", 800, defaultBundle); @@ -245,6 +245,8 @@ public class Level implements java.io.Serializable { } /** + * Returns a string representation of this Level. + * * @return the non-localized name of the Level, for example "INFO". */ public final String toString() { @@ -299,14 +301,14 @@ public class Level implements java.io.Serializable { * @throws IllegalArgumentException if the value is not valid. * Valid values are integers between Integer.MIN_VALUE * and Integer.MAX_VALUE, and all known level names. - * Known names are the levels defined by this class (i.e. FINE, + * Known names are the levels defined by this class (e.g., FINE, * FINER, FINEST), or created by this class with * appropriate package access, or new levels defined or created * by subclasses. * * @return The parsed value. Passing an integer that corresponds to a known name - * (eg 700) will return the associated name (eg CONFIG). - * Passing an integer that does not (eg 1) will return a new level name + * (e.g., 700) will return the associated name (e.g., CONFIG). + * Passing an integer that does not (e.g., 1) will return a new level name * initialized to that value. */ public static synchronized Level parse(String name) throws IllegalArgumentException { diff --git a/jdk/src/share/classes/java/util/logging/LogManager.java b/jdk/src/share/classes/java/util/logging/LogManager.java index e6412565a87..4faea17d79e 100644 --- a/jdk/src/share/classes/java/util/logging/LogManager.java +++ b/jdk/src/share/classes/java/util/logging/LogManager.java @@ -283,6 +283,10 @@ public class LogManager { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { readConfiguration(); + + // Platform loggers begin to delegate to java.util.logging.Logger + sun.util.logging.PlatformLogger.redirectPlatformLoggers(); + return null; } }); diff --git a/jdk/src/share/classes/java/util/logging/LogRecord.java b/jdk/src/share/classes/java/util/logging/LogRecord.java index 2610316a5e3..e6706319ffa 100644 --- a/jdk/src/share/classes/java/util/logging/LogRecord.java +++ b/jdk/src/share/classes/java/util/logging/LogRecord.java @@ -188,7 +188,7 @@ public class LogRecord implements java.io.Serializable { } /** - * Get the source Logger name's + * Get the source Logger's name. * * @return source logger name (may be null) */ @@ -197,7 +197,7 @@ public class LogRecord implements java.io.Serializable { } /** - * Set the source Logger name. + * Set the source Logger's name. * * @param name the source logger name (may be null) */ @@ -530,6 +530,7 @@ public class LogRecord implements java.io.Serializable { int depth = access.getStackTraceDepth(throwable); String logClassName = "java.util.logging.Logger"; + String plogClassName = "sun.util.logging.PlatformLogger"; boolean lookingForLogger = true; for (int ix = 0; ix < depth; ix++) { // Calling getStackTraceElement directly prevents the VM @@ -539,15 +540,18 @@ public class LogRecord implements java.io.Serializable { String cname = frame.getClassName(); if (lookingForLogger) { // Skip all frames until we have found the first logger frame. - if (cname.equals(logClassName)) { + if (cname.equals(logClassName) || cname.startsWith(plogClassName)) { lookingForLogger = false; } } else { - if (!cname.equals(logClassName)) { - // We've found the relevant frame. - setSourceClassName(cname); - setSourceMethodName(frame.getMethodName()); - return; + if (!cname.equals(logClassName) && !cname.startsWith(plogClassName)) { + // skip reflection call + if (!cname.startsWith("java.lang.reflect.") && !cname.startsWith("sun.reflect.")) { + // We've found the relevant frame. + setSourceClassName(cname); + setSourceMethodName(frame.getMethodName()); + return; + } } } } diff --git a/jdk/src/share/classes/java/util/logging/Logger.java b/jdk/src/share/classes/java/util/logging/Logger.java index 5ae2b427133..cd9f4d90568 100644 --- a/jdk/src/share/classes/java/util/logging/Logger.java +++ b/jdk/src/share/classes/java/util/logging/Logger.java @@ -66,7 +66,7 @@ import java.lang.ref.WeakReference; * effective level from its parent. *

    * On each logging call the Logger initially performs a cheap - * check of the request level (e.g. SEVERE or FINE) against the + * check of the request level (e.g., SEVERE or FINE) against the * effective log level of the logger. If the request level is * lower than the log level, the logging call returns immediately. *

    @@ -230,7 +230,7 @@ public class Logger { * Protected method to construct a logger for a named subsystem. *

    * The logger will be initially configured with a null Level - * and with useParentHandlers true. + * and with useParentHandlers set to true. * * @param name A name for the logger. This should * be a dot-separated name and should normally @@ -240,7 +240,7 @@ public class Logger { * @param resourceBundleName name of ResourceBundle to be used for localizing * messages for this logger. May be null if none * of the messages require localization. - * @throws MissingResourceException if the ResourceBundleName is non-null and + * @throws MissingResourceException if the resourceBundleName is non-null and * no corresponding resource can be found. */ protected Logger(String name, String resourceBundleName) { @@ -285,7 +285,7 @@ public class Logger { *

    * If a new logger is created its log level will be configured * based on the LogManager configuration and it will configured - * to also send logging output to its parent's handlers. It will + * to also send logging output to its parent's Handlers. It will * be registered in the LogManager global namespace. * * @param name A name for the logger. This should @@ -308,7 +308,7 @@ public class Logger { *

    * If a new logger is created its log level will be configured * based on the LogManager and it will configured to also send logging - * output to its parent loggers Handlers. It will be registered in + * output to its parent's Handlers. It will be registered in * the LogManager global namespace. *

    * If the named Logger already exists and does not yet have a @@ -326,7 +326,8 @@ public class Logger { * messages for this logger. May be null if none of * the messages require localization. * @return a suitable Logger - * @throws MissingResourceException if the named ResourceBundle cannot be found. + * @throws MissingResourceException if the resourceBundleName is non-null and + * no corresponding resource can be found. * @throws IllegalArgumentException if the Logger already exists and uses * a different resource bundle name. * @throws NullPointerException if the name is null. @@ -395,7 +396,8 @@ public class Logger { * messages for this logger. * May be null if none of the messages require localization. * @return a newly created private Logger - * @throws MissingResourceException if the named ResourceBundle cannot be found. + * @throws MissingResourceException if the resourceBundleName is non-null and + * no corresponding resource can be found. */ public static synchronized Logger getAnonymousLogger(String resourceBundleName) { LogManager manager = LogManager.getLogManager(); @@ -514,7 +516,7 @@ public class Logger { * level then the given message is forwarded to all the * registered output Handler objects. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param msg The string message (or a key in the message catalog) */ public void log(Level level, String msg) { @@ -532,7 +534,7 @@ public class Logger { * level then a corresponding LogRecord is created and forwarded * to all the registered output Handler objects. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param msg The string message (or a key in the message catalog) * @param param1 parameter to the message */ @@ -553,7 +555,7 @@ public class Logger { * level then a corresponding LogRecord is created and forwarded * to all the registered output Handler objects. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param msg The string message (or a key in the message catalog) * @param params array of parameters to the message */ @@ -578,7 +580,7 @@ public class Logger { * processed specially by output Formatters and is not treated * as a formatting parameter to the LogRecord message property. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param msg The string message (or a key in the message catalog) * @param thrown Throwable associated with log message. */ @@ -603,7 +605,7 @@ public class Logger { * level then the given message is forwarded to all the * registered output Handler objects. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that issued the logging request * @param msg The string message (or a key in the message catalog) @@ -626,7 +628,7 @@ public class Logger { * level then a corresponding LogRecord is created and forwarded * to all the registered output Handler objects. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that issued the logging request * @param msg The string message (or a key in the message catalog) @@ -653,7 +655,7 @@ public class Logger { * level then a corresponding LogRecord is created and forwarded * to all the registered output Handler objects. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that issued the logging request * @param msg The string message (or a key in the message catalog) @@ -684,7 +686,7 @@ public class Logger { * processed specially by output Formatters and is not treated * as a formatting parameter to the LogRecord message property. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that issued the logging request * @param msg The string message (or a key in the message catalog) @@ -731,7 +733,7 @@ public class Logger { * resource bundle name is null, or an empty String or invalid * then the msg string is not localized. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that issued the logging request * @param bundleName name of resource bundle to localize msg, @@ -762,7 +764,7 @@ public class Logger { * resource bundle name is null, or an empty String or invalid * then the msg string is not localized. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that issued the logging request * @param bundleName name of resource bundle to localize msg, @@ -795,7 +797,7 @@ public class Logger { * resource bundle name is null, or an empty String or invalid * then the msg string is not localized. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that issued the logging request * @param bundleName name of resource bundle to localize msg, @@ -832,7 +834,7 @@ public class Logger { * processed specially by output Formatters and is not treated * as a formatting parameter to the LogRecord message property. *

    - * @param level One of the message level identifiers, e.g. SEVERE + * @param level One of the message level identifiers, e.g., SEVERE * @param sourceClass name of class that issued the logging request * @param sourceMethod name of method that issued the logging request * @param bundleName name of resource bundle to localize msg, @@ -1214,7 +1216,7 @@ public class Logger { /** * Specify whether or not this logger should send its output - * to it's parent Logger. This means that any LogRecords will + * to its parent Logger. This means that any LogRecords will * also be written to the parent's Handlers, and potentially * to its parent, recursively up the namespace. * diff --git a/jdk/src/share/classes/java/util/logging/LoggingMXBean.java b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java index cb67d7b4fb0..a3abe3c69b1 100644 --- a/jdk/src/share/classes/java/util/logging/LoggingMXBean.java +++ b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java @@ -105,8 +105,8 @@ public interface LoggingMXBean extends PlatformManagedObject { * * @param loggerName The name of the Logger to be set. * Must be non-null. - * @param levelName The name of the level to set the specified logger to, - * or null if to set the level to inherit + * @param levelName The name of the level to set on the specified logger, + * or null if setting the level to inherit * from its nearest ancestor. * * @throws IllegalArgumentException if the specified logger diff --git a/jdk/src/share/classes/java/util/logging/MemoryHandler.java b/jdk/src/share/classes/java/util/logging/MemoryHandler.java index d812e3bf64f..aa632223667 100644 --- a/jdk/src/share/classes/java/util/logging/MemoryHandler.java +++ b/jdk/src/share/classes/java/util/logging/MemoryHandler.java @@ -136,7 +136,7 @@ public class MemoryHandler extends Handler { * @param size the number of log records to buffer (must be greater than zero) * @param pushLevel message level to push on * - * @throws IllegalArgumentException is size is <= 0 + * @throws IllegalArgumentException if size is <= 0 */ public MemoryHandler(Handler target, int size, Level pushLevel) { if (target == null || pushLevel == null) { @@ -258,7 +258,7 @@ public class MemoryHandler extends Handler { * This method checks if the LogRecord has an appropriate level and * whether it satisfies any Filter. However it does not * check whether the LogRecord would result in a "push" of the - * buffer contents. It will return false if the LogRecord is Null. + * buffer contents. It will return false if the LogRecord is null. *

    * @param record a LogRecord * @return true if the LogRecord would be logged. diff --git a/jdk/src/share/classes/java/util/logging/StreamHandler.java b/jdk/src/share/classes/java/util/logging/StreamHandler.java index 766142a1a58..ce47fe90427 100644 --- a/jdk/src/share/classes/java/util/logging/StreamHandler.java +++ b/jdk/src/share/classes/java/util/logging/StreamHandler.java @@ -220,7 +220,7 @@ public class StreamHandler extends Handler { *

    * This method checks if the LogRecord has an appropriate level and * whether it satisfies any Filter. It will also return false if - * no output stream has been assigned yet or the LogRecord is Null. + * no output stream has been assigned yet or the LogRecord is null. *

    * @param record a LogRecord * @return true if the LogRecord would be logged. diff --git a/jdk/src/share/classes/java/util/zip/ZipEntry.java b/jdk/src/share/classes/java/util/zip/ZipEntry.java index cba69b0c1a2..8da5a4f54ad 100644 --- a/jdk/src/share/classes/java/util/zip/ZipEntry.java +++ b/jdk/src/share/classes/java/util/zip/ZipEntry.java @@ -26,6 +26,7 @@ package java.util.zip; import java.util.Date; +import sun.misc.BootClassLoaderHook; /** * This class is used to represent a ZIP file entry. @@ -109,12 +110,16 @@ class ZipEntry implements ZipConstants, Cloneable { * @see #getTime() */ public void setTime(long time) { - // fix for bug 6625963: we bypass time calculations while Kernel is - // downloading bundles, since they aren't necessary and would cause - // the Kernel core to depend upon the (very large) time zone data - if (sun.misc.VM.isBootedKernelVM() && - sun.jkernel.DownloadManager.isCurrentThreadDownloading()) { - this.time = sun.jkernel.DownloadManager.KERNEL_STATIC_MODTIME; + // Same value as defined in sun.jkernel.DownloadManager.KERNEL_STATIC_MODTIME + // to avoid direct reference to DownoadManager class. Need to revisit + // if this is needed any more (see comment in the DownloadManager class) + final int KERNEL_STATIC_MODTIME = 10000000; + BootClassLoaderHook hook = BootClassLoaderHook.getHook(); + if (hook != null && hook.isCurrentThreadPrefetching()) { + // fix for bug 6625963: we bypass time calculations while Kernel is + // downloading bundles, since they aren't necessary and would cause + // the Kernel core to depend upon the (very large) time zone data + this.time = KERNEL_STATIC_MODTIME; } else { this.time = javaToDosTime(time); } @@ -253,14 +258,10 @@ class ZipEntry implements ZipConstants, Cloneable { * the first 0xFFFF bytes are output to the ZIP file entry. * * @param comment the comment string - * @exception IllegalArgumentException if the length of the specified - * comment string is greater than 0xFFFF bytes + * * @see #getComment() */ public void setComment(String comment) { - if (comment != null && comment.length() > 0xffff) { - throw new IllegalArgumentException("invalid entry comment length"); - } this.comment = comment; } diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java index 76c270c1b10..583d7dcfe1a 100644 --- a/jdk/src/share/classes/java/util/zip/ZipFile.java +++ b/jdk/src/share/classes/java/util/zip/ZipFile.java @@ -195,7 +195,10 @@ class ZipFile implements ZipConstants, Closeable { if (charset == null) throw new NullPointerException("charset is null"); this.zc = ZipCoder.get(charset); + long t0 = System.nanoTime(); jzfile = open(name, mode, file.lastModified()); + sun.misc.PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0); + sun.misc.PerfCounter.getZipFileCount().increment(); this.name = name; this.total = getTotal(jzfile); } diff --git a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java index 2d13d835c1b..f3e79555ba1 100644 --- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java +++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java @@ -168,8 +168,8 @@ import javax.sql.rowset.serial.*; * The majority of methods for setting placeholder parameters take two parameters, * with the first parameter * indicating which placeholder parameter is to be set, and the second parameter - * giving the value to be set. Methods such as getInt, - * getString, getBoolean, and getLong fall into + * giving the value to be set. Methods such as setInt, + * setString, setBoolean, and setLong fall into * this category. After these methods have been called, a call to the method * getParams will return an array with the values that have been set. Each * element in the array is an Object instance representing the @@ -3259,9 +3259,9 @@ public static final int ASCII_STREAM_PARAM = 2; * @param x the parameter value * @exception SQLException if a database access error occurs or * this method is called on a closed CallableStatement - * @see #getBoolean * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method + * @see #getParams * @since 1.4 */ public void setBoolean(String parameterName, boolean x) throws SQLException{ @@ -3281,7 +3281,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getByte + * @see #getParams * @since 1.4 */ public void setByte(String parameterName, byte x) throws SQLException{ @@ -3301,7 +3301,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getShort + * @see #getParams * @since 1.4 */ public void setShort(String parameterName, short x) throws SQLException{ @@ -3320,7 +3320,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getInt + * @see #getParams * @since 1.4 */ public void setInt(String parameterName, int x) throws SQLException{ @@ -3339,7 +3339,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getLong + * @see #getParams * @since 1.4 */ public void setLong(String parameterName, long x) throws SQLException{ @@ -3358,7 +3358,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getFloat + * @see #getParams * @since 1.4 */ public void setFloat(String parameterName, float x) throws SQLException{ @@ -3377,7 +3377,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getDouble + * @see #getParams * @since 1.4 */ public void setDouble(String parameterName, double x) throws SQLException{ @@ -3398,7 +3398,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getBigDecimal + * @see #getParams * @since 1.4 */ public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{ @@ -3421,7 +3421,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getString + * @see #getParams * @since 1.4 */ public void setString(String parameterName, String x) throws SQLException{ @@ -3443,7 +3443,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getBytes + * @see #getParams * @since 1.4 */ public void setBytes(String parameterName, byte x[]) throws SQLException{ @@ -3464,7 +3464,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getTimestamp + * @see #getParams * @since 1.4 */ public void setTimestamp(String parameterName, java.sql.Timestamp x) @@ -3712,7 +3712,7 @@ public static final int ASCII_STREAM_PARAM = 2; * or STRUCT data type and the JDBC driver does not support * this data type * @see Types - * @see #getObject + * @see #getParams * @since 1.4 */ public void setObject(String parameterName, Object x, int targetSqlType, int scale) @@ -3740,7 +3740,7 @@ public static final int ASCII_STREAM_PARAM = 2; * REF, ROWID, SQLXML * or STRUCT data type and the JDBC driver does not support * this data type - * @see #getObject + * @see #getParams * @since 1.4 */ public void setObject(String parameterName, Object x, int targetSqlType) @@ -3782,7 +3782,7 @@ public static final int ASCII_STREAM_PARAM = 2; * Object parameter is ambiguous * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getObject + * @see #getParams * @since 1.4 */ public void setObject(String parameterName, Object x) throws SQLException{ @@ -4064,7 +4064,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getDate + * @see #getParams * @since 1.4 */ public void setDate(String parameterName, java.sql.Date x) @@ -4091,7 +4091,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getDate + * @see #getParams * @since 1.4 */ public void setDate(String parameterName, java.sql.Date x, Calendar cal) @@ -4111,7 +4111,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getTime + * @see #getParams * @since 1.4 */ public void setTime(String parameterName, java.sql.Time x) @@ -4138,7 +4138,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getTime + * @see #getParams * @since 1.4 */ public void setTime(String parameterName, java.sql.Time x, Calendar cal) @@ -4165,7 +4165,7 @@ public static final int ASCII_STREAM_PARAM = 2; * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method - * @see #getTimestamp + * @see #getParams * @since 1.4 */ public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal) diff --git a/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java b/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java index eb230a09050..faeae5f527e 100644 --- a/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java +++ b/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java @@ -32,7 +32,6 @@ import java.lang.reflect.*; import java.lang.ref.WeakReference; import java.security.AccessController; import java.util.*; -import java.util.logging.*; import com.sun.java.swing.SwingUtilities3; @@ -41,6 +40,7 @@ import sun.java2d.SunGraphics2D; import sun.security.action.GetPropertyAction; import sun.java2d.pipe.hw.ExtendedBufferCapabilities; import sun.awt.SunToolkit; +import sun.util.logging.PlatformLogger; /** * A PaintManager implementation that uses a BufferStrategy for @@ -78,7 +78,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { private static Method COMPONENT_CREATE_BUFFER_STRATEGY_METHOD; private static Method COMPONENT_GET_BUFFER_STRATEGY_METHOD; - private static final Logger LOGGER = Logger.getLogger( + private static final PlatformLogger LOGGER = PlatformLogger.getLogger( "javax.swing.BufferStrategyPaintManager"); /** @@ -222,9 +222,9 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { } private void dispose(java.util.List bufferInfos) { - if (LOGGER.isLoggable(Level.FINER)) { - LOGGER.log(Level.FINER, "BufferStrategyPaintManager disposed", - new RuntimeException()); + if (LOGGER.isLoggable(PlatformLogger.FINER)) { + LOGGER.finer("BufferStrategyPaintManager disposed", + new RuntimeException()); } if (bufferInfos != null) { for (BufferInfo bufferInfo : bufferInfos) { @@ -305,7 +305,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { } } // Invalid root, do what Swing has always done. - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer("prepare failed"); } return super.paint(paintingComponent, bufferComponent, g, x, y, w, h); @@ -335,7 +335,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { } accumulate(x + xOffset + deltaX, y + yOffset + deltaY, w, h); } else { - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer("copyArea: prepare failed or not in sync"); } // Prepare failed, or not in sync. By calling super.copyArea @@ -363,7 +363,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { } } } - if (LOGGER.isLoggable(Level.FINEST)) { + if (LOGGER.isLoggable(PlatformLogger.FINEST)) { LOGGER.finest("beginPaint"); } // Reset the area that needs to be painted. @@ -371,7 +371,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { } public void endPaint() { - if (LOGGER.isLoggable(Level.FINEST)) { + if (LOGGER.isLoggable(PlatformLogger.FINEST)) { LOGGER.finest("endPaint: region " + accumulatedX + " " + accumulatedY + " " + accumulatedMaxX + " " + accumulatedMaxY); @@ -420,7 +420,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { contentsLost = bufferStrategy.contentsLost(); } if (contentsLost) { - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer("endPaint: contents lost"); } // Shown region was bogus, mark buffer as out of sync. @@ -514,7 +514,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { contentsLost = true; bufferInfo = new BufferInfo(root); bufferInfos.add(bufferInfo); - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer("prepare: new BufferInfo: " + root); } } @@ -525,7 +525,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { bsg = bufferStrategy.getDrawGraphics(); if (bufferStrategy.contentsRestored()) { contentsLost = true; - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer( "prepare: contents restored in prepare"); } @@ -539,7 +539,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { if (bufferInfo.getContentsLostDuringExpose()) { contentsLost = true; bufferInfo.setContentsLostDuringExpose(false); - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer("prepare: contents lost on expose"); } } @@ -642,7 +642,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { if (biRoot == null) { // Window gc'ed bufferInfos.remove(counter); - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer("BufferInfo pruned, root null"); } } @@ -748,7 +748,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { if (bs != null) { weakBS = new WeakReference(bs); } - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer("getBufferStrategy: created bs: " + bs); } } @@ -806,7 +806,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { BufferStrategy bs = null; if (SwingUtilities3.isVsyncRequested(root)) { bs = createBufferStrategy(root, true); - if (LOGGER.isLoggable(Level.FINER)) { + if (LOGGER.isLoggable(PlatformLogger.FINER)) { LOGGER.finer("createBufferStrategy: using vsynced strategy"); } } @@ -848,9 +848,9 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { invoke(root); } catch (InvocationTargetException ite) { // Type is not supported - if (LOGGER.isLoggable(Level.FINER)) { - LOGGER.log(Level.FINER, "createBufferStratety failed", - ite); + if (LOGGER.isLoggable(PlatformLogger.FINER)) { + LOGGER.finer("createBufferStratety failed", + ite); } } catch (IllegalArgumentException iae) { assert false; @@ -864,9 +864,9 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { bs = ((Window)root).getBufferStrategy(); } catch (AWTException e) { // Type not supported - if (LOGGER.isLoggable(Level.FINER)) { - LOGGER.log(Level.FINER, "createBufferStratety failed", - e); + if (LOGGER.isLoggable(PlatformLogger.FINER)) { + LOGGER.finer("createBufferStratety failed", + e); } } } @@ -878,8 +878,8 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { */ public void dispose() { Container root = getRoot(); - if (LOGGER.isLoggable(Level.FINER)) { - LOGGER.log(Level.FINER, "disposed BufferInfo for: " + root); + if (LOGGER.isLoggable(PlatformLogger.FINER)) { + LOGGER.finer("disposed BufferInfo for: " + root); } if (root != null) { root.removeComponentListener(this); diff --git a/jdk/src/share/classes/javax/swing/JEditorPane.java b/jdk/src/share/classes/javax/swing/JEditorPane.java index 21528752fd5..4dfbf92488e 100644 --- a/jdk/src/share/classes/javax/swing/JEditorPane.java +++ b/jdk/src/share/classes/javax/swing/JEditorPane.java @@ -24,6 +24,8 @@ */ package javax.swing; +import sun.swing.SwingUtilities2; + import java.awt.*; import java.awt.event.*; import java.lang.reflect.*; @@ -1123,6 +1125,7 @@ public class JEditorPane extends JTextComponent { * @param content the content to replace the selection with. This * value can be null */ + @Override public void replaceSelection(String content) { if (! isEditable()) { UIManager.getLookAndFeel().provideErrorFeedback(JEditorPane.this); @@ -1133,6 +1136,7 @@ public class JEditorPane extends JTextComponent { try { Document doc = getDocument(); Caret caret = getCaret(); + boolean composedTextSaved = saveComposedText(caret.getDot()); int p0 = Math.min(caret.getDot(), caret.getMark()); int p1 = Math.max(caret.getDot(), caret.getMark()); if (doc instanceof AbstractDocument) { @@ -1148,6 +1152,9 @@ public class JEditorPane extends JTextComponent { getInputAttributes()); } } + if (composedTextSaved) { + restoreComposedText(); + } } catch (BadLocationException e) { UIManager.getLookAndFeel().provideErrorFeedback(JEditorPane.this); } @@ -1323,8 +1330,8 @@ public class JEditorPane extends JTextComponent { */ public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); - if (getParent() instanceof JViewport) { - JViewport port = (JViewport)getParent(); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { TextUI ui = getUI(); int prefWidth = d.width; int prefHeight = d.height; @@ -1445,8 +1452,8 @@ public class JEditorPane extends JTextComponent { * match its own, false otherwise */ public boolean getScrollableTracksViewportWidth() { - if (getParent() instanceof JViewport) { - JViewport port = (JViewport)getParent(); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { TextUI ui = getUI(); int w = port.getWidth(); Dimension min = ui.getMinimumSize(this); @@ -1467,8 +1474,8 @@ public class JEditorPane extends JTextComponent { * false otherwise */ public boolean getScrollableTracksViewportHeight() { - if (getParent() instanceof JViewport) { - JViewport port = (JViewport)getParent(); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { TextUI ui = getUI(); int h = port.getHeight(); Dimension min = ui.getMinimumSize(this); diff --git a/jdk/src/share/classes/javax/swing/JFileChooser.java b/jdk/src/share/classes/javax/swing/JFileChooser.java index 8ba9c7c42af..dae4a1ce599 100644 --- a/jdk/src/share/classes/javax/swing/JFileChooser.java +++ b/jdk/src/share/classes/javax/swing/JFileChooser.java @@ -715,7 +715,7 @@ public class JFileChooser extends JComponent implements Accessible { *

      *
    • JFileChooser.CANCEL_OPTION *
    • JFileChooser.APPROVE_OPTION - *
    • JFileCHooser.ERROR_OPTION if an error occurs or the + *
    • JFileChooser.ERROR_OPTION if an error occurs or the * dialog is dismissed *
    * @exception HeadlessException if GraphicsEnvironment.isHeadless() @@ -724,6 +724,11 @@ public class JFileChooser extends JComponent implements Accessible { */ public int showDialog(Component parent, String approveButtonText) throws HeadlessException { + if (dialog != null) { + // Prevent to show second instance of dialog if the previous one still exists + return JFileChooser.ERROR_OPTION; + } + if(approveButtonText != null) { setApproveButtonText(approveButtonText); setDialogType(CUSTOM_DIALOG); diff --git a/jdk/src/share/classes/javax/swing/JLayer.java b/jdk/src/share/classes/javax/swing/JLayer.java index b8cc69e9bcd..93f4b799722 100644 --- a/jdk/src/share/classes/javax/swing/JLayer.java +++ b/jdk/src/share/classes/javax/swing/JLayer.java @@ -1,6 +1,26 @@ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. */ package javax.swing; @@ -36,28 +56,70 @@ import java.security.PrivilegedAction; * {@code JLayer} is a good solution if you only need to do custom painting * over compound component or catch input events from its subcomponents. *
    + * import javax.swing.*;
    + * import javax.swing.plaf.LayerUI;
    + * import java.awt.*;
    + *
    + * public class JLayerSample {
    + *
    + *     private static JLayer<JComponent> createLayer() {
    + *         // This custom layerUI will fill the layer with translucent green
    + *         // and print out all mouseMotion events generated within its borders
    + *         LayerUI<JComponent> layerUI = new LayerUI<JComponent>() {
    + *
    + *             public void paint(Graphics g, JComponent c) {
    + *                 // paint the layer as is
    + *                 super.paint(g, c);
    + *                 // fill it with the translucent green
    + *                 g.setColor(new Color(0, 128, 0, 128));
    + *                 g.fillRect(0, 0, c.getWidth(), c.getHeight());
    + *             }
    + *
    + *             public void installUI(JComponent c) {
    + *                 super.installUI(c);
    + *                 // enable mouse motion events for the layer's subcomponents
    + *                 ((JLayer) c).setLayerEventMask(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    + *             }
    + *
    + *             public void uninstallUI(JComponent c) {
    + *                 super.uninstallUI(c);
    + *                 // reset the layer event mask
    + *                 ((JLayer) c).setLayerEventMask(0);
    + *             }
    + *
    + *             // overridden method which catches MouseMotion events
    + *             public void eventDispatched(AWTEvent e, JLayer<? extends JComponent> l) {
    + *                 System.out.println("AWTEvent detected: " + e);
    + *             }
    + *         };
      *         // create a component to be decorated with the layer
    - *        JPanel panel = new JPanel();
    - *        panel.add(new JButton("JButton"));
    - *        // This custom layerUI will fill the layer with translucent green
    - *        // and print out all mouseMotion events generated within its borders
    - *        LayerUI<JPanel> layerUI = new LayerUI<JPanel>() {
    - *            public void paint(Graphics g, JCompo  nent c) {
    - *                // paint the layer as is
    - *                super.paint(g, c);
    - *                // fill it with the translucent green
    - *                g.setColor(new Color(0, 128, 0, 128));
    - *                g.fillRect(0, 0, c.getWidth(), c.getHeight());
    - *            }
    - *            // overridden method which catches MouseMotion events
    - *            public void eventDispatched(AWTEvent e, JLayer<JPanel> l) {
    - *                System.out.println("AWTEvent detected: " + e);
    - *            }
    - *        };
    - *        // create the layer for the panel using our custom layerUI
    - *        JLayer<JPanel> layer = new JLayer<JPanel>(panel, layerUI);
    - *        // work with the layer as with any other Swing component
    - *        frame.add(layer);
    + *         JPanel panel = new JPanel();
    + *         panel.add(new JButton("JButton"));
    + *
    + *         // create the layer for the panel using our custom layerUI
    + *         return new JLayer<JComponent>(panel, layerUI);
    + *     }
    + *
    + *     private static void createAndShowGUI() {
    + *         final JFrame frame = new JFrame();
    + *         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    + *
    + *         // work with the layer as with any other Swing component
    + *         frame.add(createLayer());
    + *
    + *         frame.setSize(200, 200);
    + *         frame.setLocationRelativeTo(null);
    + *         frame.setVisible(true);
    + *     }
    + *
    + *     public static void main(String[] args) throws Exception {
    + *         SwingUtilities.invokeAndWait(new Runnable() {
    + *             public void run() {
    + *                 createAndShowGUI();
    + *             }
    + *         });
    + *     }
    + * }
      * 
    * * Note: {@code JLayer} doesn't support the following methods: @@ -158,7 +220,7 @@ public final class JLayer * @return the {@code JLayer}'s view component * or {@code null} if none exists * - * @see #setView(V) + * @see #setView(Component) */ public V getView() { return view; @@ -259,7 +321,7 @@ public final class JLayer * @throws UnsupportedOperationException this method is not supported * * @see #setView(Component) - * @see #setGlassPane(Component) + * @see #setGlassPane(JPanel) */ protected void addImpl(Component comp, Object constraints, int index) { throw new UnsupportedOperationException( @@ -271,7 +333,9 @@ public final class JLayer * {@inheritDoc} */ public void remove(Component comp) { - if (comp == getView()) { + if (comp == null) { + super.remove(comp); + } else if (comp == getView()) { setView(null); } else if (comp == getGlassPane()) { setGlassPane(null); @@ -319,7 +383,7 @@ public final class JLayer * @return false if {@code JLayer}'s {@code glassPane} is visible */ public boolean isOptimizedDrawingEnabled() { - return !glassPane.isVisible(); + return glassPane == null || !glassPane.isVisible(); } /** @@ -388,7 +452,10 @@ public final class JLayer if (layerEventMask != oldEventMask) { disableEvents(oldEventMask); enableEvents(eventMask); - eventController.updateAWTEventListener(this); + if (isDisplayable()) { + eventController.updateAWTEventListener( + oldEventMask, layerEventMask); + } } } @@ -475,9 +542,6 @@ public final class JLayer if (getUI() != null) { return getUI().getScrollableTracksViewportHeight(this); } - if (getParent() instanceof JViewport) { - return ((getParent()).getHeight() > getPreferredSize().height); - } return false; } @@ -498,9 +562,6 @@ public final class JLayer if (getUI() != null) { return getUI().getScrollableTracksViewportWidth(this); } - if (getParent() instanceof JViewport) { - return ((getParent()).getWidth() > getPreferredSize().width); - } return false; } @@ -535,20 +596,36 @@ public final class JLayer private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); - if (getUI() != null) { - setUI(getUI()); + if (layerUI != null) { + setUI(layerUI); } - if (getLayerEventMask() != 0) { - eventController.updateAWTEventListener(this); + if (eventMask != 0) { + eventController.updateAWTEventListener(0, eventMask); } } + /** + * {@inheritDoc} + */ + public void addNotify() { + super.addNotify(); + eventController.updateAWTEventListener(0, eventMask); + } + + /** + * {@inheritDoc} + */ + public void removeNotify() { + super.removeNotify(); + eventController.updateAWTEventListener(eventMask, 0); + } + /** * static AWTEventListener to be shared with all AbstractLayerUIs */ private static class LayerEventController implements AWTEventListener { - private ArrayList> layerList = - new ArrayList>(); + private ArrayList layerMaskList = + new ArrayList(); private long currentEventMask; @@ -572,37 +649,24 @@ public final class JLayer } } - private boolean layerListContains(JLayer l) { - for (WeakReference layerWeakReference : layerList) { - if (layerWeakReference.get() == l) { - return true; - } + private void updateAWTEventListener(long oldEventMask, long newEventMask) { + if (oldEventMask != 0) { + layerMaskList.remove(oldEventMask); } - return false; - } - - private void updateAWTEventListener(JLayer layer) { - if (!layerListContains(layer) && layer.getLayerEventMask() != 0) { - layerList.add(new WeakReference(layer)); + if (newEventMask != 0) { + layerMaskList.add(newEventMask); } long combinedMask = 0; - Iterator> it = layerList.iterator(); - while (it.hasNext()) { - WeakReference weakRef = it.next(); - JLayer currLayer = weakRef.get(); - if (currLayer == null) { - it.remove(); - } else { - combinedMask |= currLayer.getLayerEventMask(); - } + for (Long mask : layerMaskList) { + combinedMask |= mask; } if (combinedMask == 0) { removeAWTEventListener(); - layerList.clear(); } else if (getCurrentEventMask() != combinedMask) { removeAWTEventListener(); addAWTEventListener(combinedMask); } + currentEventMask = combinedMask; } private long getCurrentEventMask() { @@ -617,7 +681,7 @@ public final class JLayer return null; } }); - currentEventMask = eventMask; + } private void removeAWTEventListener() { @@ -628,7 +692,6 @@ public final class JLayer return null; } }); - currentEventMask = 0; } private boolean isEventEnabled(long eventMask, int id) { @@ -785,4 +848,4 @@ public final class JLayer public void removeLayoutComponent(Component comp) { } } -} \ No newline at end of file +} diff --git a/jdk/src/share/classes/javax/swing/JList.java b/jdk/src/share/classes/javax/swing/JList.java index 772c7554056..796ac11ba6c 100644 --- a/jdk/src/share/classes/javax/swing/JList.java +++ b/jdk/src/share/classes/javax/swing/JList.java @@ -2722,8 +2722,9 @@ public class JList extends JComponent implements Scrollable, Accessible getVisibleRowCount() <= 0) { return true; } - if (getParent() instanceof JViewport) { - return (getParent().getWidth() > getPreferredSize().width); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + return port.getWidth() > getPreferredSize().width; } return false; } @@ -2747,8 +2748,9 @@ public class JList extends JComponent implements Scrollable, Accessible getVisibleRowCount() <= 0) { return true; } - if (getParent() instanceof JViewport) { - return (getParent().getHeight() > getPreferredSize().height); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + return port.getHeight() > getPreferredSize().height; } return false; } diff --git a/jdk/src/share/classes/javax/swing/JPopupMenu.java b/jdk/src/share/classes/javax/swing/JPopupMenu.java index 8f90a02a2a9..78715b886be 100644 --- a/jdk/src/share/classes/javax/swing/JPopupMenu.java +++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java @@ -412,7 +412,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission( - SecurityConstants.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); + SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } } catch (SecurityException se) { // There is no permission to show popups over the task bar diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java index dc9adebc4d4..521f17ab8a5 100644 --- a/jdk/src/share/classes/javax/swing/JTable.java +++ b/jdk/src/share/classes/javax/swing/JTable.java @@ -718,9 +718,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #addNotify */ protected void configureEnclosingScrollPane() { - Container p = getParent(); - if (p instanceof JViewport) { - Container gp = p.getParent(); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + Container gp = port.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane)gp; // Make certain we are the viewPort's view and not, for @@ -750,9 +750,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * from configureEnclosingScrollPane() and updateUI() in a safe manor. */ private void configureEnclosingScrollPaneUI() { - Container p = getParent(); - if (p instanceof JViewport) { - Container gp = p.getParent(); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + Container gp = port.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane)gp; // Make certain we are the viewPort's view and not, for @@ -819,9 +819,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @since 1.3 */ protected void unconfigureEnclosingScrollPane() { - Container p = getParent(); - if (p instanceof JViewport) { - Container gp = p.getParent(); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + Container gp = port.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane)gp; // Make certain we are the viewPort's view and not, for @@ -5215,9 +5215,10 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #getFillsViewportHeight */ public boolean getScrollableTracksViewportHeight() { + JViewport port = SwingUtilities2.getViewport(this); return getFillsViewportHeight() - && getParent() instanceof JViewport - && (getParent().getHeight() > getPreferredSize().height); + && port != null + && port.getHeight() > getPreferredSize().height; } /** diff --git a/jdk/src/share/classes/javax/swing/JTextField.java b/jdk/src/share/classes/javax/swing/JTextField.java index c104f36ec98..de408914d22 100644 --- a/jdk/src/share/classes/javax/swing/JTextField.java +++ b/jdk/src/share/classes/javax/swing/JTextField.java @@ -24,6 +24,8 @@ */ package javax.swing; +import sun.swing.SwingUtilities2; + import java.awt.*; import java.awt.event.*; import java.beans.*; @@ -288,11 +290,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * @see JComponent#isValidateRoot */ public boolean isValidateRoot() { - Component parent = getParent(); - if (parent instanceof JViewport) { - return false; - } - return true; + return SwingUtilities2.getViewport(this) == null; } diff --git a/jdk/src/share/classes/javax/swing/JTextPane.java b/jdk/src/share/classes/javax/swing/JTextPane.java index efb339bd59f..7f113ddd59c 100644 --- a/jdk/src/share/classes/javax/swing/JTextPane.java +++ b/jdk/src/share/classes/javax/swing/JTextPane.java @@ -170,6 +170,7 @@ public class JTextPane extends JEditorPane { * * @param content the content to replace the selection with */ + @Override public void replaceSelection(String content) { replaceSelection(content, true); } @@ -183,6 +184,7 @@ public class JTextPane extends JEditorPane { if (doc != null) { try { Caret caret = getCaret(); + boolean composedTextSaved = saveComposedText(caret.getDot()); int p0 = Math.min(caret.getDot(), caret.getMark()); int p1 = Math.max(caret.getDot(), caret.getMark()); AttributeSet attr = getInputAttributes().copyAttributes(); @@ -197,6 +199,9 @@ public class JTextPane extends JEditorPane { doc.insertString(p0, content, attr); } } + if (composedTextSaved) { + restoreComposedText(); + } } catch (BadLocationException e) { UIManager.getLookAndFeel().provideErrorFeedback(JTextPane.this); } diff --git a/jdk/src/share/classes/javax/swing/JTree.java b/jdk/src/share/classes/javax/swing/JTree.java index 639dd45e8f9..1b200f78591 100644 --- a/jdk/src/share/classes/javax/swing/JTree.java +++ b/jdk/src/share/classes/javax/swing/JTree.java @@ -3498,8 +3498,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * @see Scrollable#getScrollableTracksViewportWidth */ public boolean getScrollableTracksViewportWidth() { - if (getParent() instanceof JViewport) { - return getParent().getWidth() > getPreferredSize().width; + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + return port.getWidth() > getPreferredSize().width; } return false; } @@ -3514,8 +3515,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * @see Scrollable#getScrollableTracksViewportHeight */ public boolean getScrollableTracksViewportHeight() { - if (getParent() instanceof JViewport) { - return getParent().getHeight() > getPreferredSize().height; + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + return port.getHeight() > getPreferredSize().height; } return false; } diff --git a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java index 715732fcee0..c856c8898c3 100644 --- a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java +++ b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java @@ -29,7 +29,7 @@ import java.awt.Container; import java.awt.Window; import java.util.*; import java.awt.FocusTraversalPolicy; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; /** * A FocusTraversalPolicy that determines traversal order by sorting the @@ -64,7 +64,7 @@ public class SortingFocusTraversalPolicy private Comparator comparator; private boolean implicitDownCycleTraversal = true; - private Logger log = Logger.getLogger("javax.swing.SortingFocusTraversalPolicy"); + private PlatformLogger log = PlatformLogger.getLogger("javax.swing.SortingFocusTraversalPolicy"); /** * Used by getComponentAfter and getComponentBefore for efficiency. In @@ -115,8 +115,8 @@ public class SortingFocusTraversalPolicy try { index = Collections.binarySearch(cycle, aComponent, comparator); } catch (ClassCastException e) { - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "### During the binary search for " + aComponent + " the exception occured: ", e); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### During the binary search for " + aComponent + " the exception occured: ", e); } return -1; } @@ -193,7 +193,7 @@ public class SortingFocusTraversalPolicy if (getImplicitDownCycleTraversal()) { retComp = cont.getFocusTraversalPolicy().getDefaultComponent(cont); - if (retComp != null && log.isLoggable(Level.FINE)) { + if (retComp != null && log.isLoggable(PlatformLogger.FINE)) { log.fine("### Transfered focus down-cycle to " + retComp + " in the focus cycle root " + cont); } @@ -205,7 +205,7 @@ public class SortingFocusTraversalPolicy cont.getFocusTraversalPolicy().getDefaultComponent(cont) : cont.getFocusTraversalPolicy().getLastComponent(cont)); - if (retComp != null && log.isLoggable(Level.FINE)) { + if (retComp != null && log.isLoggable(PlatformLogger.FINE)) { log.fine("### Transfered focus to " + retComp + " in the FTP provider " + cont); } } @@ -236,7 +236,7 @@ public class SortingFocusTraversalPolicy * aComponent is null */ public Component getComponentAfter(Container aContainer, Component aComponent) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Searching in " + aContainer + " for component after " + aComponent); } @@ -260,7 +260,7 @@ public class SortingFocusTraversalPolicy // See if the component is inside of policy provider. Container provider = getTopmostProvider(aContainer, aComponent); if (provider != null) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Asking FTP " + provider + " for component after " + aComponent); } @@ -271,7 +271,7 @@ public class SortingFocusTraversalPolicy // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (afterComp != null) { - if (log.isLoggable(Level.FINE)) log.fine("### FTP returned " + afterComp); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + afterComp); return afterComp; } aComponent = provider; @@ -279,12 +279,12 @@ public class SortingFocusTraversalPolicy List cycle = getFocusTraversalCycle(aContainer); - if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent); int index = getComponentIndex(cycle, aComponent); if (index < 0) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Didn't find component " + aComponent + " in a cycle " + aContainer); } return getFirstComponent(aContainer); @@ -349,7 +349,7 @@ public class SortingFocusTraversalPolicy // See if the component is inside of policy provider. Container provider = getTopmostProvider(aContainer, aComponent); if (provider != null) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Asking FTP " + provider + " for component after " + aComponent); } @@ -360,7 +360,7 @@ public class SortingFocusTraversalPolicy // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (beforeComp != null) { - if (log.isLoggable(Level.FINE)) log.fine("### FTP returned " + beforeComp); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + beforeComp); return beforeComp; } aComponent = provider; @@ -373,12 +373,12 @@ public class SortingFocusTraversalPolicy List cycle = getFocusTraversalCycle(aContainer); - if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent); int index = getComponentIndex(cycle, aComponent); if (index < 0) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Didn't find component " + aComponent + " in a cycle " + aContainer); } return getLastComponent(aContainer); @@ -424,7 +424,7 @@ public class SortingFocusTraversalPolicy public Component getFirstComponent(Container aContainer) { List cycle; - if (log.isLoggable(Level.FINE)) log.fine("### Getting first component in " + aContainer); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting first component in " + aContainer); if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); } @@ -436,10 +436,10 @@ public class SortingFocusTraversalPolicy } if (cycle.size() == 0) { - if (log.isLoggable(Level.FINE)) log.fine("### Cycle is empty"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty"); return null; } - if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle); for (Component comp : cycle) { if (accept(comp)) { @@ -466,7 +466,7 @@ public class SortingFocusTraversalPolicy */ public Component getLastComponent(Container aContainer) { List cycle; - if (log.isLoggable(Level.FINE)) log.fine("### Getting last component in " + aContainer); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting last component in " + aContainer); if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); @@ -479,10 +479,10 @@ public class SortingFocusTraversalPolicy } if (cycle.size() == 0) { - if (log.isLoggable(Level.FINE)) log.fine("### Cycle is empty"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty"); return null; } - if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle); for (int i= cycle.size() - 1; i >= 0; i--) { Component comp = cycle.get(i); diff --git a/jdk/src/share/classes/javax/swing/SwingUtilities.java b/jdk/src/share/classes/javax/swing/SwingUtilities.java index 21a75ce1d97..d7a26a0dd72 100644 --- a/jdk/src/share/classes/javax/swing/SwingUtilities.java +++ b/jdk/src/share/classes/javax/swing/SwingUtilities.java @@ -999,24 +999,20 @@ public class SwingUtilities implements SwingConstants textR.height = (int) v.getPreferredSpan(View.Y_AXIS); } else { textR.width = SwingUtilities2.stringWidth(c, fm, text); - - // Take into account the left and right side bearings. - // This gives more space than it is actually needed, - // but there are two reasons: - // 1. If we set the width to the actual bounds, - // all callers would have to account for the bearings - // themselves. NOTE: all pref size calculations don't do it. - // 2. You can do a drawString at the returned location - // and the text won't be clipped. lsb = SwingUtilities2.getLeftSideBearing(c, fm, text); if (lsb < 0) { + // If lsb is negative, add it to the width and later + // adjust the x location. This gives more space than is + // actually needed. + // This is done like this for two reasons: + // 1. If we set the width to the actual bounds all + // callers would have to account for negative lsb + // (pref size calculations ONLY look at width of + // textR) + // 2. You can do a drawString at the returned location + // and the text won't be clipped. textR.width -= lsb; } - rsb = SwingUtilities2.getRightSideBearing(c, fm, text); - if (rsb > 0) { - textR.width += rsb; - } - if (textR.width > availTextWidth) { text = SwingUtilities2.clipString(c, fm, text, availTextWidth); diff --git a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java index 44c57ce3cad..cf64687421a 100644 --- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java @@ -1,6 +1,26 @@ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. */ package javax.swing.plaf; @@ -202,6 +222,7 @@ public class LayerUI * Returns an array of all the listeners which have been associated * with the named property. * + * @param propertyName The name of the property being listened to * @return all of the {@code PropertyChangeListener}s associated with * the named property; if no such listeners have been added or * if {@code propertyName} is {@code null}, an empty @@ -242,6 +263,7 @@ public class LayerUI /** * Returns the preferred size of the viewport for a view component. * + * @param l the {@code JLayer} component where this UI delegate is being installed * @return the preferred size of the viewport for a view component * @see Scrollable#getPreferredScrollableViewportSize() */ @@ -257,6 +279,10 @@ public class LayerUI * that display logical rows or columns in order to completely expose * one block of rows or columns, depending on the value of orientation. * + * @param l the {@code JLayer} component where this UI delegate is being installed + * @param visibleRect The view area visible within the viewport + * @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. + * @param direction Less than zero to scroll up/left, greater than zero for down/right. * @return the "block" increment for scrolling in the specified direction * @see Scrollable#getScrollableBlockIncrement(Rectangle, int, int) */ @@ -276,6 +302,7 @@ public class LayerUI * determine the height of the layer, unless the preferred height * of the layer is smaller than the height of the viewport. * + * @param l the {@code JLayer} component where this UI delegate is being installed * @return whether the layer should track the height of the viewport * @see Scrollable#getScrollableTracksViewportHeight() */ @@ -283,9 +310,6 @@ public class LayerUI if (l.getView() instanceof Scrollable) { return ((Scrollable)l.getView()).getScrollableTracksViewportHeight(); } - if (l.getParent() instanceof JViewport) { - return (((JViewport)l.getParent()).getHeight() > l.getPreferredSize().height); - } return false; } @@ -294,6 +318,7 @@ public class LayerUI * determine the width of the layer, unless the preferred width * of the layer is smaller than the width of the viewport. * + * @param l the {@code JLayer} component where this UI delegate is being installed * @return whether the layer should track the width of the viewport * @see Scrollable * @see LayerUI#getScrollableTracksViewportWidth(JLayer) @@ -302,9 +327,6 @@ public class LayerUI if (l.getView() instanceof Scrollable) { return ((Scrollable)l.getView()).getScrollableTracksViewportWidth(); } - if (l.getParent() instanceof JViewport) { - return (((JViewport)l.getParent()).getWidth() > l.getPreferredSize().width); - } return false; } @@ -318,6 +340,10 @@ public class LayerUI * Scrolling containers, like JScrollPane, will use this method * each time the user requests a unit scroll. * + * @param l the {@code JLayer} component where this UI delegate is being installed + * @param visibleRect The view area visible within the viewport + * @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. + * @param direction Less than zero to scroll up/left, greater than zero for down/right. * @return The "unit" increment for scrolling in the specified direction. * This value should always be positive. * @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int) @@ -367,4 +393,4 @@ public class LayerUI } return super.getBaselineResizeBehavior(c); } -} \ No newline at end of file +} diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java index 80b449ce7c5..3b2fa972e64 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java @@ -1766,7 +1766,7 @@ public class BasicComboBoxUI extends ComboBoxUI { } private boolean isTypeAheadKey( KeyEvent e ) { - return !e.isAltDown() && !e.isControlDown() && !e.isMetaDown(); + return !e.isAltDown() && !BasicGraphicsUtils.isMenuShortcutKeyDown(e); } // diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java index a9940321dfc..fca8b933ff4 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java @@ -483,11 +483,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { protected JList createList() { return new JList( comboBox.getModel() ) { public void processMouseEvent(MouseEvent e) { - if (e.isControlDown()) { + if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) { // Fix for 4234053. Filter out the Control Key from the list. // ie., don't allow CTRL key deselection. + Toolkit toolkit = Toolkit.getDefaultToolkit(); e = new MouseEvent((Component)e.getSource(), e.getID(), e.getWhen(), - e.getModifiers() ^ InputEvent.CTRL_MASK, + e.getModifiers() ^ toolkit.getMenuShortcutKeyMask(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java index 44f99d6d3e3..7056676ae04 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java @@ -924,7 +924,8 @@ public class BasicFileChooserUI extends FileChooserUI { boolean isTrav = (selectedFile != null && chooser.isTraversable(selectedFile)); boolean isDirSelEnabled = chooser.isDirectorySelectionEnabled(); boolean isFileSelEnabled = chooser.isFileSelectionEnabled(); - boolean isCtrl = (e != null && (e.getModifiers() & ActionEvent.CTRL_MASK) != 0); + boolean isCtrl = (e != null && (e.getModifiers() & + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0); if (isDir && isTrav && (isCtrl || !isDirSelEnabled)) { changeDirectory(selectedFile); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java index 6d831493746..06830129574 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java @@ -33,7 +33,10 @@ import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Insets; import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.KeyEvent; +import java.awt.event.InputEvent; + import sun.swing.SwingUtilities2; @@ -303,4 +306,9 @@ public class BasicGraphicsUtils static boolean isLeftToRight( Component c ) { return c.getComponentOrientation().isLeftToRight(); } + + static boolean isMenuShortcutKeyDown(InputEvent event) { + return (event.getModifiers() & + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0; + } } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java index 7704d10e102..1d3ee7b3509 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java @@ -2371,8 +2371,9 @@ public class BasicListUI extends ListUI JList src = (JList)e.getSource(); ListModel model = src.getModel(); - if (model.getSize() == 0 || e.isAltDown() || e.isControlDown() || e.isMetaDown() || - isNavigationKey(e)) { + if (model.getSize() == 0 || e.isAltDown() || + BasicGraphicsUtils.isMenuShortcutKeyDown(e) || + isNavigationKey(e)) { // Nothing to select return; } @@ -2665,7 +2666,7 @@ public class BasicListUI extends ListUI if (row != -1 && DragRecognitionSupport.mousePressed(e)) { dragPressDidSelection = false; - if (e.isControlDown()) { + if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) { // do nothing for control - will be handled on release // or when drag starts return; @@ -2717,7 +2718,7 @@ public class BasicListUI extends ListUI anchorSelected = list.isSelectedIndex(anchorIndex); } - if (e.isControlDown()) { + if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) { if (e.isShiftDown()) { if (anchorSelected) { list.addSelectionInterval(anchorIndex, row); @@ -2742,7 +2743,7 @@ public class BasicListUI extends ListUI } public void dragStarting(MouseEvent me) { - if (me.isControlDown()) { + if (BasicGraphicsUtils.isMenuShortcutKeyDown(me)) { int row = SwingUtilities2.loc2IndexFileList(list, me.getPoint()); list.addSelectionInterval(row, row); } @@ -2758,7 +2759,7 @@ public class BasicListUI extends ListUI return; } - if (e.isShiftDown() || e.isControlDown()) { + if (e.isShiftDown() || BasicGraphicsUtils.isMenuShortcutKeyDown(e)) { return; } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java index ba31712eb47..02febb9bf62 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java @@ -196,10 +196,6 @@ public class BasicMenuUI extends BasicMenuItemUI return getHandler(); } - protected MenuKeyListener createMenuKeyListener(JComponent c) { - return (MenuKeyListener)getHandler(); - } - public Dimension getMaximumSize(JComponent c) { if (((JMenu)menuItem).isTopLevelMenu() == true) { Dimension d = c.getPreferredSize(); @@ -401,8 +397,7 @@ public class BasicMenuUI extends BasicMenuItemUI public void stateChanged(ChangeEvent e) { } } - private class Handler extends BasicMenuItemUI.Handler implements - MenuKeyListener { + private class Handler extends BasicMenuItemUI.Handler { // // PropertyChangeListener // @@ -585,45 +580,5 @@ public class BasicMenuUI extends BasicMenuItemUI } public void menuDragMouseExited(MenuDragMouseEvent e) {} public void menuDragMouseReleased(MenuDragMouseEvent e) {} - - - // - // MenuKeyListener - // - /** - * Open the Menu - */ - public void menuKeyTyped(MenuKeyEvent e) { - if (!crossMenuMnemonic && BasicPopupMenuUI.getLastPopup() != null) { - // when crossMenuMnemonic is not set, we don't open a toplevel - // menu if another toplevel menu is already open - return; - } - - char key = Character.toLowerCase((char)menuItem.getMnemonic()); - MenuElement path[] = e.getPath(); - MenuSelectionManager manager = e.getMenuSelectionManager(); - if (key == Character.toLowerCase(e.getKeyChar())) { - JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu(); - ArrayList newList = new ArrayList(Arrays.asList(path)); - newList.add(popupMenu); - MenuElement subs[] = popupMenu.getSubElements(); - MenuElement sub = - BasicPopupMenuUI.findEnabledChild(subs, -1, true); - if(sub != null) { - newList.add(sub); - } - MenuElement newPath[] = new MenuElement[0]; - newPath = newList.toArray(newPath); - manager.setSelectedPath(newPath); - e.consume(); - } else if (((JMenu)menuItem).isTopLevelMenu() - && BasicPopupMenuUI.getLastPopup() == null) { - manager.clearSelectedPath(); - } - } - - public void menuKeyPressed(MenuKeyEvent e) {} - public void menuKeyReleased(MenuKeyEvent e) {} } } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java index dc94bf547f9..90f983052d0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java @@ -339,7 +339,7 @@ public class BasicPopupMenuUI extends PopupMenuUI { indexes[matches++] = j; } } - if (item.isArmed()) { + if (item.isArmed() || item.isSelected()) { currentIndex = matches - 1; } } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java index 97e2f60f52b..02bb547d318 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java @@ -1507,7 +1507,8 @@ public class BasicSliderUI extends SliderUI{ propertyName == "paintTicks" || propertyName == "paintTrack" || propertyName == "font" || - propertyName == "paintLabels") { + propertyName == "paintLabels" || + propertyName == "Slider.paintThumbArrowShape") { checkedLabelBaselines = false; calculateGeometry(); slider.repaint(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java index 16ceab73ee2..7e85bee803f 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java @@ -1027,7 +1027,7 @@ public class BasicTableUI extends TableUI shouldStartTimer = table.isCellSelected(pressedRow, pressedCol) && !e.isShiftDown() && - !e.isControlDown() && + !BasicGraphicsUtils.isMenuShortcutKeyDown(e) && !outsidePrefSize; } @@ -1051,7 +1051,7 @@ public class BasicTableUI extends TableUI dragPressDidSelection = false; - if (e.isControlDown() && isFileList) { + if (BasicGraphicsUtils.isMenuShortcutKeyDown(e) && isFileList) { // do nothing for control - will be handled on release // or when drag starts return; @@ -1115,7 +1115,9 @@ public class BasicTableUI extends TableUI CellEditor editor = table.getCellEditor(); if (dragEnabled || editor == null || editor.shouldSelectCell(e)) { - table.changeSelection(pressedRow, pressedCol, e.isControlDown(), e.isShiftDown()); + table.changeSelection(pressedRow, pressedCol, + BasicGraphicsUtils.isMenuShortcutKeyDown(e), + e.isShiftDown()); } } @@ -1212,7 +1214,7 @@ public class BasicTableUI extends TableUI public void dragStarting(MouseEvent me) { dragStarted = true; - if (me.isControlDown() && isFileList) { + if (BasicGraphicsUtils.isMenuShortcutKeyDown(me) && isFileList) { table.getSelectionModel().addSelectionInterval(pressedRow, pressedRow); table.getColumnModel().getSelectionModel(). @@ -1251,7 +1253,8 @@ public class BasicTableUI extends TableUI return; } - table.changeSelection(row, column, e.isControlDown(), true); + table.changeSelection(row, column, + BasicGraphicsUtils.isMenuShortcutKeyDown(e), true); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java index 8fdc88d946f..22fa61f00dc 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java @@ -2265,7 +2265,7 @@ public class BasicTreeUI extends TreeUI */ protected boolean isToggleSelectionEvent(MouseEvent event) { return (SwingUtilities.isLeftMouseButton(event) && - event.isControlDown()); + BasicGraphicsUtils.isMenuShortcutKeyDown(event)); } /** @@ -3255,7 +3255,7 @@ public class BasicTreeUI extends TreeUI // handle first letter navigation if(tree != null && tree.getRowCount()>0 && tree.hasFocus() && tree.isEnabled()) { - if (e.isAltDown() || e.isControlDown() || e.isMetaDown() || + if (e.isAltDown() || BasicGraphicsUtils.isMenuShortcutKeyDown(e) || isNavigationKey(e)) { return; } @@ -3511,7 +3511,7 @@ public class BasicTreeUI extends TreeUI dragPressDidSelection = false; - if (e.isControlDown()) { + if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) { // do nothing for control - will be handled on release // or when drag starts return; @@ -3565,7 +3565,7 @@ public class BasicTreeUI extends TreeUI public void dragStarting(MouseEvent me) { dragStarted = true; - if (me.isControlDown()) { + if (BasicGraphicsUtils.isMenuShortcutKeyDown(me)) { tree.addSelectionPath(pressedPath); setAnchorSelectionPath(pressedPath); setLeadSelectionPath(pressedPath, true); diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java index 8893782d951..831221d57f9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java @@ -1,5 +1,5 @@ /* - * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-2009 Sun Microsystems, Inc. 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,8 +25,6 @@ package javax.swing.plaf.metal; import java.awt.*; -import java.beans.*; -import javax.swing.*; /** * DesktopProperty that only uses font height in configuring font. This @@ -60,7 +58,7 @@ class MetalFontDesktopProperty extends com.sun.java.swing.plaf.windows.DesktopPr * @param type MetalTheme font type. */ MetalFontDesktopProperty(int type) { - this(propertyMapping[type], Toolkit.getDefaultToolkit(), type); + this(propertyMapping[type], type); } /** @@ -72,8 +70,8 @@ class MetalFontDesktopProperty extends com.sun.java.swing.plaf.windows.DesktopPr * @param type Type of font being used, corresponds to MetalTheme font * type. */ - MetalFontDesktopProperty(String key, Toolkit kit, int type) { - super(key, null, kit); + MetalFontDesktopProperty(String key, int type) { + super(key, null); this.type = type; } diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java index 07432841961..76eb24df040 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. 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 @@ -1541,10 +1541,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel table.putDefaults(defaults); if (isWindows() && useSystemFonts() && theme.isSystemTheme()) { - Toolkit kit = Toolkit.getDefaultToolkit(); Object messageFont = new MetalFontDesktopProperty( - "win.messagebox.font.height", kit, MetalTheme. - CONTROL_TEXT_FONT); + "win.messagebox.font.height", MetalTheme.CONTROL_TEXT_FONT); defaults = new Object[] { "OptionPane.messageFont", messageFont, diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template index 492b53583ed..caff0b212a0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template @@ -26,7 +26,7 @@ package ${PACKAGE}; import javax.swing.Painter; import java.awt.Graphics; -import sun.font.FontManager; +import sun.font.FontUtilities; import sun.swing.plaf.synth.DefaultSynthStyle; import javax.swing.BorderFactory; import javax.swing.JComponent; @@ -101,14 +101,7 @@ final class ${LAF_NAME}Defaults { */ private FontUIResource defaultFont; - /** - * Map of lists of derived colors keyed by the DerivedColorKeys - */ - private Map derivedColorsMap = - new HashMap(); - - /** Tempory key used for fetching from the derivedColorsMap */ - private final DerivedColorKey tmpDCKey = new DerivedColorKey(); + private ColorTree colorTree = new ColorTree(); /** Listener for changes to user defaults table */ private DefaultsListener defaultsListener = new DefaultsListener(); @@ -117,14 +110,14 @@ final class ${LAF_NAME}Defaults { void initialize() { // add listener for derived colors UIManager.addPropertyChangeListener(defaultsListener); - UIManager.getDefaults().addPropertyChangeListener(defaultsListener); + UIManager.getDefaults().addPropertyChangeListener(colorTree); } /** Called by UIManager when this look and feel is uninstalled. */ void uninitialize() { // remove listener for derived colors - UIManager.getDefaults().removePropertyChangeListener(defaultsListener); UIManager.removePropertyChangeListener(defaultsListener); + UIManager.getDefaults().removePropertyChangeListener(colorTree); } /** @@ -138,7 +131,7 @@ final class ${LAF_NAME}Defaults { //regions and their states that this class will use for later lookup. //Additional regions can be registered later by 3rd party components. //These are simply the default registrations. - defaultFont = FontManager.getFontConfigFUIR("sans", Font.PLAIN, 12); + defaultFont = FontUtilities.getFontConfigFUIR("sans", Font.PLAIN, 12); defaultStyle = new DefaultSynthStyle(); defaultStyle.setFont(defaultFont); @@ -663,22 +656,23 @@ ${UI_DEFAULT_INIT} } } - /** - * Get a derived color, derived colors are shared instances and will be - * updated when its parent UIDefault color changes. - * - * @param uiDefaultParentName The parent UIDefault key - * @param hOffset The hue offset - * @param sOffset The saturation offset - * @param bOffset The brightness offset - * @param aOffset The alpha offset - * @return The stored derived color - */ - public DerivedColor getDerivedColor(String uiDefaultParentName, - float hOffset, float sOffset, - float bOffset, int aOffset){ - return getDerivedColor(uiDefaultParentName, hOffset, sOffset, - bOffset, aOffset, true); + private void addColor(UIDefaults d, String uin, int r, int g, int b, int a) { + Color color = new ColorUIResource(new Color(r, g, b, a)); + colorTree.addColor(uin, color); + d.put(uin, color); + } + + private void addColor(UIDefaults d, String uin, String parentUin, + float hOffset, float sOffset, float bOffset, int aOffset) { + addColor(d, uin, parentUin, hOffset, sOffset, bOffset, aOffset, true); + } + + private void addColor(UIDefaults d, String uin, String parentUin, + float hOffset, float sOffset, float bOffset, + int aOffset, boolean uiResource) { + Color color = getDerivedColor(uin, parentUin, + hOffset, sOffset, bOffset, aOffset, uiResource); + d.put(uin, color); } /** @@ -694,89 +688,110 @@ ${UI_DEFAULT_INIT} * false if it should not be a UIResource * @return The stored derived color */ - public DerivedColor getDerivedColor(String uiDefaultParentName, + public DerivedColor getDerivedColor(String parentUin, float hOffset, float sOffset, float bOffset, int aOffset, boolean uiResource){ - tmpDCKey.set(uiDefaultParentName, hOffset, sOffset, bOffset, aOffset, - uiResource); - DerivedColor color = derivedColorsMap.get(tmpDCKey); - if (color == null){ - if (uiResource) { - color = new DerivedColor.UIResource(uiDefaultParentName, - hOffset, sOffset, bOffset, aOffset); - } else { - color = new DerivedColor(uiDefaultParentName, hOffset, sOffset, - bOffset, aOffset); - } - // calculate the initial value - color.rederiveColor(); - // add the listener so that if the color changes we'll propogate it - color.addPropertyChangeListener(defaultsListener); - // add to the derived colors table - derivedColorsMap.put(new DerivedColorKey(uiDefaultParentName, - hOffset, sOffset, bOffset, aOffset, uiResource),color); - } - return color; + return getDerivedColor(null, parentUin, + hOffset, sOffset, bOffset, aOffset, uiResource); } - /** - * Key class for derived colors - */ - private class DerivedColorKey { - private String uiDefaultParentName; - private float hOffset, sOffset, bOffset; - private int aOffset; - private boolean uiResource; - - DerivedColorKey(){} - - DerivedColorKey(String uiDefaultParentName, float hOffset, - float sOffset, float bOffset, int aOffset, - boolean uiResource) { - set(uiDefaultParentName, hOffset, sOffset, bOffset, aOffset, uiResource); + private DerivedColor getDerivedColor(String uin, String parentUin, + float hOffset, float sOffset, + float bOffset, int aOffset, + boolean uiResource) { + DerivedColor color; + if (uiResource) { + color = new DerivedColor.UIResource(parentUin, + hOffset, sOffset, bOffset, aOffset); + } else { + color = new DerivedColor(parentUin, hOffset, sOffset, + bOffset, aOffset); } - void set (String uiDefaultParentName, float hOffset, - float sOffset, float bOffset, int aOffset, - boolean uiResource) { - this.uiDefaultParentName = uiDefaultParentName; - this.hOffset = hOffset; - this.sOffset = sOffset; - this.bOffset = bOffset; - this.aOffset = aOffset; - this.uiResource = uiResource; + if (derivedColors.containsKey(color)) { + return derivedColors.get(color); + } else { + derivedColors.put(color, color); + color.rederiveColor(); /// move to ARP.decodeColor() ? + colorTree.addColor(uin, color); + return color; + } + } + + private Map derivedColors = + new HashMap(); + + private class ColorTree implements PropertyChangeListener { + private Node root = new Node(null, null); + private Map nodes = new HashMap(); + + public Color getColor(String uin) { + return nodes.get(uin).color; + } + + public void addColor(String uin, Color color) { + Node parent = getParentNode(color); + Node node = new Node(color, parent); + parent.children.add(node); + if (uin != null) { + nodes.put(uin, node); + } + } + + private Node getParentNode(Color color) { + Node parent = root; + if (color instanceof DerivedColor) { + String parentUin = ((DerivedColor)color).getUiDefaultParentName(); + Node p = nodes.get(parentUin); + if (p != null) { + parent = p; + } + } + return parent; + } + + public void update() { + root.update(); } @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof DerivedColorKey)) return false; - DerivedColorKey that = (DerivedColorKey) o; - if (aOffset != that.aOffset) return false; - if (Float.compare(that.bOffset, bOffset) != 0) return false; - if (Float.compare(that.hOffset, hOffset) != 0) return false; - if (Float.compare(that.sOffset, sOffset) != 0) return false; - if (uiDefaultParentName != null ? - !uiDefaultParentName.equals(that.uiDefaultParentName) : - that.uiDefaultParentName != null) return false; - if (this.uiResource != that.uiResource) return false; - return true; + public void propertyChange(PropertyChangeEvent ev) { + String name = ev.getPropertyName(); + Node node = nodes.get(name); + if (node != null) { + // this is a registered color + node.parent.children.remove(node); + Color color = (Color) ev.getNewValue(); + Node parent = getParentNode(color); + node.set(color, parent); + parent.children.add(node); + node.update(); + } } - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + uiDefaultParentName.hashCode(); - result = 31 * result + hOffset != +0.0f ? - Float.floatToIntBits(hOffset) : 0; - result = 31 * result + sOffset != +0.0f ? - Float.floatToIntBits(sOffset) : 0; - result = 31 * result + bOffset != +0.0f ? - Float.floatToIntBits(bOffset) : 0; - result = 31 * result + aOffset; - result = 31 * result + (uiResource ? 1 : 0); - return result; + class Node { + Color color; + Node parent; + List children = new LinkedList(); + + Node(Color color, Node parent) { + set(color, parent); + } + + public void set(Color color, Node parent) { + this.color = color; + this.parent = parent; + } + + public void update() { + if (color instanceof DerivedColor) { + ((DerivedColor)color).rederiveColor(); + } + for (Node child: children) { + child.update(); + } + } } } @@ -786,49 +801,12 @@ ${UI_DEFAULT_INIT} private class DefaultsListener implements PropertyChangeListener { @Override public void propertyChange(PropertyChangeEvent evt) { - Object src = evt.getSource(); - String key = evt.getPropertyName(); - if (key.equals("lookAndFeel")){ + if ("lookAndFeel".equals(evt.getPropertyName())) { // LAF has been installed, this is the first point at which we // can access our defaults table via UIManager so before now // all derived colors will be incorrect. // First we need to update - for (DerivedColor color : derivedColorsMap.values()) { - color.rederiveColor(); - } - } else if (src instanceof DerivedColor && key.equals("rgb")) { - // derived color that is in UIManager defaults has changed - // update all its dependent colors. Don't worry about doing - // this recursively since calling rederiveColor will cause - // another PCE to be fired, ending up here and essentially - // recursing - DerivedColor parentColor = (DerivedColor)src; - String parentKey = null; - Set> entries = - UIManager.getDefaults().entrySet(); - - for (Map.Entry entry : entries) { - Object value = entry.getValue(); - if (value == parentColor) { - parentKey = entry.getKey().toString(); - } - } - - if (parentKey == null) { - //couldn't find the DerivedColor in the UIDefaults map, - //so we just bail. - return; - } - - for (Map.Entry entry : entries) { - Object value = entry.getValue(); - if (value instanceof DerivedColor) { - DerivedColor color = (DerivedColor)entry.getValue(); - if (parentKey.equals(color.getUiDefaultParentName())) { - color.rederiveColor(); - } - } - } + colorTree.update(); } } } @@ -875,4 +853,3 @@ ${UI_DEFAULT_INIT} } } } - diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/DerivedColor.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/DerivedColor.java index 20b7b1aacec..56bac5f4fb6 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/DerivedColor.java +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/DerivedColor.java @@ -39,8 +39,6 @@ import java.beans.PropertyChangeListener; * @author Jasper Potts */ class DerivedColor extends Color { - private final PropertyChangeSupport changeSupport = - new PropertyChangeSupport(this); private final String uiDefaultParentName; private final float hOffset, sOffset, bOffset; private final int aOffset; @@ -79,7 +77,6 @@ class DerivedColor extends Color { * Recalculate the derived color from the UIManager parent color and offsets */ public void rederiveColor() { - int old = argbValue; Color src = UIManager.getColor(uiDefaultParentName); if (src != null) { float[] tmp = Color.RGBtoHSB(src.getRed(), src.getGreen(), src.getBlue(), null); @@ -97,7 +94,6 @@ class DerivedColor extends Color { int alpha = clamp(aOffset); argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24); } - changeSupport.firePropertyChange("rgb", old, argbValue); } /** @@ -141,35 +137,6 @@ class DerivedColor extends Color { return result; } - /** - * Add a PropertyChangeListener to the listener list. - * The listener is registered for all properties. - * The same listener object may be added more than once, and will be called - * as many times as it is added. - * If listener is null, no exception is thrown and no action - * is taken. - * - * @param listener The PropertyChangeListener to be added - */ - public void addPropertyChangeListener(PropertyChangeListener listener) { - changeSupport.addPropertyChangeListener(listener); - } - - /** - * Remove a PropertyChangeListener from the listener list. - * This removes a PropertyChangeListener that was registered - * for all properties. - * If listener was added more than once to the same event - * source, it will be notified one less time after being removed. - * If listener is null, or was never added, no exception is - * thrown and no action is taken. - * - * @param listener The PropertyChangeListener to be removed - */ - public void removePropertyChangeListener(PropertyChangeListener listener) { - changeSupport.removePropertyChangeListener(listener); - } - private float clamp(float value) { if (value < 0) { value = 0; @@ -211,5 +178,15 @@ class DerivedColor extends Color { float bOffset, int aOffset) { super(uiDefaultParentName, hOffset, sOffset, bOffset, aOffset); } + + @Override + public boolean equals(Object o) { + return (o instanceof UIResource) && super.equals(o); + } + + @Override + public int hashCode() { + return super.hashCode() + 7; + } } } diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java index 8c5d121b7e1..3f100bc811b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java @@ -40,6 +40,9 @@ import java.awt.Container; import java.awt.Graphics2D; import java.awt.LayoutManager; import java.awt.image.BufferedImage; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.*; import javax.swing.GrayFilter; import javax.swing.Icon; import javax.swing.JToolBar; @@ -87,6 +90,8 @@ public class NimbusLookAndFeel extends SynthLookAndFeel { */ private UIDefaults uiDefaults; + private DefaultsListener defaultsListener = new DefaultsListener(); + /** * Create a new NimbusLookAndFeel. */ @@ -115,8 +120,7 @@ public class NimbusLookAndFeel extends SynthLookAndFeel { defaults.uninitialize(); // clear all cached images to free memory ImageCache.getInstance().flush(); - // remove the listeners and things installed by NimbusStyle - NimbusStyle.uninitialize(); + UIManager.getDefaults().removePropertyChangeListener(defaultsListener); } /** @@ -515,4 +519,62 @@ public class NimbusLookAndFeel extends SynthLookAndFeel { return obj; } } + + private Map> compiledDefaults = null; + private boolean defaultListenerAdded = false; + + static String parsePrefix(String key) { + if (key == null) { + return null; + } + boolean inquotes = false; + for (int i = 0; i < key.length(); i++) { + char c = key.charAt(i); + if (c == '"') { + inquotes = !inquotes; + } else if ((c == '[' || c == '.') && !inquotes) { + return key.substring(0, i); + } + } + return null; + } + + Map getDefaultsForPrefix(String prefix) { + if (compiledDefaults == null) { + compiledDefaults = new HashMap>(); + for (Map.Entry entry: UIManager.getDefaults().entrySet()) { + if (entry.getKey() instanceof String) { + addDefault((String) entry.getKey(), entry.getValue()); + } + } + if (! defaultListenerAdded) { + UIManager.getDefaults().addPropertyChangeListener(defaultsListener); + defaultListenerAdded = true; + } + } + return compiledDefaults.get(prefix); + } + + private void addDefault(String key, Object value) { + String prefix = parsePrefix(key); + if (prefix != null) { + Map keys = compiledDefaults.get(prefix); + if (keys == null) { + keys = new HashMap(); + compiledDefaults.put(prefix, keys); + } + keys.put(key, value); + } + } + + private class DefaultsListener implements PropertyChangeListener { + @Override public void propertyChange(PropertyChangeEvent ev) { + String key = ev.getPropertyName(); + if ("UIDefaults".equals(key)) { + compiledDefaults = null; + } else { + addDefault(key, ev.getNewValue()); + } + } + } } diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java index 04efc91cf01..a8f8b3fc5b6 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java @@ -26,7 +26,6 @@ package javax.swing.plaf.nimbus; import javax.swing.Painter; -import java.beans.PropertyChangeEvent; import javax.swing.JComponent; import javax.swing.UIDefaults; import javax.swing.UIManager; @@ -39,16 +38,13 @@ import javax.swing.plaf.synth.SynthStyle; import java.awt.Color; import java.awt.Font; import java.awt.Insets; -import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.TreeMap; -import sun.awt.AppContext; /** *

    A SynthStyle implementation used by Nimbus. Each Region that has been @@ -232,42 +228,6 @@ public final class NimbusStyle extends SynthStyle { super.installDefaults(ctx); } - static String parsePrefix(String key) { - if (key == null) return null; - boolean inquotes = false; - for (int i=0; i> compiledDefaults = - (Map>) - ctx.get("NimbusStyle.defaults"); - - if (compiledDefaults == null) { - // the entire UIDefaults tables are parsed and compiled into - // this map of maps. The key of the compiledDefaults is the - // prefix for each style, while the value is a map of - // keys->values for that prefix. - compiledDefaults = new HashMap>(); - - // get all the defaults from UIManager.getDefaults() and put them - // into the compiledDefaults - compileDefaults(compiledDefaults, UIManager.getDefaults()); - - // This second statement pulls defaults from the laf defaults - UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults(); - compileDefaults(compiledDefaults, lafDefaults); - - // if it has not already been done, add a listener to both - // UIManager.getDefaults() and UIManager.getLookAndFeelDefaults(). - PropertyChangeListener pcl = (PropertyChangeListener) - ctx.get("NimbusStyle.defaults.pcl"); - - // if pcl is null, then it has not yet been registered with - // the UIManager defaults for this app context - if (pcl == null) { - // create a PCL which will simply clear out the compiled - // defaults from the app context, causing it to be recomputed - // on subsequent passes - pcl = new DefaultsListener(); - // add the PCL to both defaults tables that we pay attention - // to, so that if the UIDefaults are updated, then the - // precompiled defaults will be cleared from the app context - // and recomputed on subsequent passes - UIManager.getDefaults().addPropertyChangeListener(pcl); - UIManager.getLookAndFeelDefaults().addPropertyChangeListener(pcl); - // save the PCL to the app context as a marker indicating - // that the PCL has been registered so we don't end up adding - // more than one listener to the UIDefaults tables. - ctx.put("NimbusStyle.defaults.pcl", pcl); - } - - // store the defaults for reuse - ctx.put("NimbusStyle.defaults", compiledDefaults); - } - - TreeMap defaults = compiledDefaults.get(prefix); + Map defaults = + ((NimbusLookAndFeel) UIManager.getLookAndFeel()). + getDefaultsForPrefix(prefix); // inspect the client properties for the key "Nimbus.Overrides". If the // value is an instance of UIDefaults, then these defaults are used @@ -371,52 +274,6 @@ public final class NimbusStyle extends SynthStyle { } } - // Now that I've accumulated all the defaults pertaining to this - // style, call init which will read these defaults and configure - // the default "values". - init(values, defaults); - } - - /** - * Iterates over all the keys in the specified UIDefaults and compiles - * those keys into the comiledDefaults data structure. It relies on - * parsing the "prefix" out of the key. If the key is not a String or is - * null then it is ignored. In all other cases a prefix is parsed out - * (even if that prefix is the empty String or is a "fake" prefix. That - * is, suppose you had a key Foo~~MySpecial.KeyThing~~. In this case this - * is not a Nimbus formatted key, but we don't care, we treat it as if it - * is. This doesn't pose any harm, it will simply never be used). - * - * @param compiledDefaults - * @param d - */ - private void compileDefaults( - Map> compiledDefaults, - UIDefaults d) { - for (Object obj : new HashSet(d.keySet())) { - if (obj instanceof String) { - String key = (String)obj; - String kp = parsePrefix(key); - if (kp == null) continue; - TreeMap map = compiledDefaults.get(kp); - if (map == null) { - map = new TreeMap(); - compiledDefaults.put(kp, map); - } - map.put(key, d.get(key)); - } - } - } - - /** - * Initializes the given Values object with the defaults - * contained in the given TreeMap. - * - * @param v The Values object to be initialized - * @param myDefaults a map of UIDefaults to use in initializing the Values. - * This map must contain only keys associated with this Style. - */ - private void init(Values v, TreeMap myDefaults) { //a list of the different types of states used by this style. This //list may contain only "standard" states (those defined by Synth), //or it may contain custom states, or it may contain only "standard" @@ -433,7 +290,7 @@ public final class NimbusStyle extends SynthStyle { //"values" stateTypes to be a non-null array. //Otherwise, let the "values" stateTypes be null to indicate that //there are no custom states or custom state ordering - String statesString = (String)myDefaults.get(prefix + ".States"); + String statesString = (String)defaults.get(prefix + ".States"); if (statesString != null) { String s[] = statesString.split(","); for (int i=0; i 0) { - v.stateTypes = states.toArray(new State[states.size()]); + values.stateTypes = states.toArray(new State[states.size()]); } //assign codes for each of the state types @@ -490,7 +347,7 @@ public final class NimbusStyle extends SynthStyle { } //Now iterate over all the keys in the defaults table - for (String key : myDefaults.keySet()) { + for (String key : defaults.keySet()) { //The key is something like JButton.Enabled.backgroundPainter, //or JButton.States, or JButton.background. //Remove the "JButton." portion of the key @@ -528,11 +385,11 @@ public final class NimbusStyle extends SynthStyle { //otherwise, assume it is a property and install it on the //values object if ("contentMargins".equals(property)) { - v.contentMargins = (Insets)myDefaults.get(key); + values.contentMargins = (Insets)defaults.get(key); } else if ("States".equals(property)) { //ignore } else { - v.defaults.put(property, myDefaults.get(key)); + values.defaults.put(property, defaults.get(key)); } } else { //it is possible that the developer has a malformed UIDefaults @@ -582,13 +439,13 @@ public final class NimbusStyle extends SynthStyle { //so put it in the UIDefaults associated with that runtime //state if ("backgroundPainter".equals(property)) { - rs.backgroundPainter = (Painter)myDefaults.get(key); + rs.backgroundPainter = getPainter(defaults, key); } else if ("foregroundPainter".equals(property)) { - rs.foregroundPainter = (Painter) myDefaults.get(key); + rs.foregroundPainter = getPainter(defaults, key); } else if ("borderPainter".equals(property)) { - rs.borderPainter = (Painter) myDefaults.get(key); + rs.borderPainter = getPainter(defaults, key); } else { - rs.defaults.put(property, myDefaults.get(key)); + rs.defaults.put(property, defaults.get(key)); } } } @@ -598,7 +455,15 @@ public final class NimbusStyle extends SynthStyle { Collections.sort(runtimeStates, STATE_COMPARATOR); //finally, set the array of runtime states on the values object - v.states = runtimeStates.toArray(new RuntimeState[runtimeStates.size()]); + values.states = runtimeStates.toArray(new RuntimeState[runtimeStates.size()]); + } + + private Painter getPainter(Map defaults, String key) { + Object p = defaults.get(key); + if (p instanceof UIDefaults.LazyValue) { + p = ((UIDefaults.LazyValue)p).createValue(UIManager.getDefaults()); + } + return (p instanceof Painter ? (Painter)p : null); } /** @@ -1245,15 +1110,4 @@ public final class NimbusStyle extends SynthStyle { return hash; } } - - /** - * This listener is used to listen to the UIDefaults tables and clear out - * the cached-precompiled map of defaults in that case. - */ - private static final class DefaultsListener implements PropertyChangeListener { - @Override - public void propertyChange(PropertyChangeEvent evt) { - AppContext.getAppContext().put("NimbusStyle.defaults", null); - } - } } diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf b/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf index b44da311e2b..15532781cf2 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf @@ -14824,7 +14824,9 @@ false NO_CACHING - + + + diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java index a8ec7728a64..c775a4b18b9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java @@ -475,11 +475,11 @@ public class SynthGraphicsUtils { return result; } - static void applyInsets(Rectangle rect, Insets insets) { + static void applyInsets(Rectangle rect, Insets insets, boolean leftToRight) { if (insets != null) { - rect.x += insets.left; + rect.x += (leftToRight ? insets.left : insets.right); rect.y += insets.top; - rect.width -= (insets.right + rect.x); + rect.width -= (leftToRight ? insets.right : insets.left) + rect.x; rect.height -= (insets.bottom + rect.y); } } @@ -492,12 +492,12 @@ public class SynthGraphicsUtils { g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); - applyInsets(viewRect, mi.getInsets()); + boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); + applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( - context, accContext, mi, checkIcon, - arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, - SynthLookAndFeel.isLeftToRight(mi), + context, accContext, mi, checkIcon, arrowIcon, viewRect, + defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemLayoutHelper.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemLayoutHelper.java index 4ca139a709d..4dd5ddc29e2 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemLayoutHelper.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemLayoutHelper.java @@ -195,7 +195,7 @@ class SynthMenuItemLayoutHelper extends MenuItemLayoutHelper { getHorizontalAlignment(), getVerticalAlignment(), getHorizontalTextPosition(), getVerticalTextPosition(), getViewRect(), iconRect, textRect, getGap()); - textRect.width += getLeftTextExtraWidth() + getRightTextExtraWidth(); + textRect.width += getLeftTextExtraWidth(); Rectangle labelRect = iconRect.union(textRect); getLabelSize().setHeight(labelRect.height); getLabelSize().setWidth(labelRect.width); diff --git a/jdk/src/share/classes/javax/swing/text/DefaultCaret.java b/jdk/src/share/classes/javax/swing/text/DefaultCaret.java index 80d06101b98..6adb54f7d80 100644 --- a/jdk/src/share/classes/javax/swing/text/DefaultCaret.java +++ b/jdk/src/share/classes/javax/swing/text/DefaultCaret.java @@ -510,7 +510,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && getDot() != -1) { moveCaret(e); - } else { + } else if (!e.isPopupTrigger()) { positionCaret(e); } } diff --git a/jdk/src/share/classes/javax/swing/text/JTextComponent.java b/jdk/src/share/classes/javax/swing/text/JTextComponent.java index fc24214a844..371afda48b0 100644 --- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java +++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java @@ -2069,8 +2069,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * width to match its own */ public boolean getScrollableTracksViewportWidth() { - if (getParent() instanceof JViewport) { - return (getParent().getWidth() > getPreferredSize().width); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + return port.getWidth() > getPreferredSize().width; } return false; } @@ -2089,8 +2090,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * to match its own */ public boolean getScrollableTracksViewportHeight() { - if (getParent() instanceof JViewport) { - return (getParent().getHeight() > getPreferredSize().height); + JViewport port = SwingUtilities2.getViewport(this); + if (port != null) { + return (port.getHeight() > getPreferredSize().height); } return false; } @@ -4813,7 +4815,18 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A new AttributedString(text, composedIndex, text.getEndIndex())); } - private boolean saveComposedText(int pos) { + /** + * Saves composed text around the specified position. + * + * The composed text (if any) around the specified position is saved + * in a backing store and removed from the document. + * + * @param pos document position to identify the composed text location + * @return {@code true} if the composed text exists and is saved, + * {@code false} otherwise + * @see #restoreComposedText + */ + protected boolean saveComposedText(int pos) { if (composedTextExists()) { int start = composedTextStart.getOffset(); int len = composedTextEnd.getOffset() - @@ -4828,7 +4841,15 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A return false; } - private void restoreComposedText() { + /** + * Restores composed text previously saved by {@code saveComposedText}. + * + * The saved composed text is inserted back into the document. This method + * should be invoked only if {@code saveComposedText} returns {@code true}. + * + * @see #saveComposedText + */ + protected void restoreComposedText() { Document doc = getDocument(); try { doc.insertString(caret.getDot(), diff --git a/jdk/src/share/classes/javax/swing/text/ParagraphView.java b/jdk/src/share/classes/javax/swing/text/ParagraphView.java index c02ea4d810e..1c9ae08c05f 100644 --- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java +++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java @@ -716,7 +716,7 @@ public class ParagraphView extends FlowView implements TabExpander { * @param axis the minor axis * @param r the input {@code SizeRequirements} object * @return the new or adjusted {@code SizeRequirements} object - * @throw IllegalArgumentException if the {@code axis} parameter is invalid + * @throws IllegalArgumentException if the {@code axis} parameter is invalid */ @Override protected SizeRequirements calculateMinorAxisRequirements(int axis, diff --git a/jdk/src/share/classes/javax/swing/text/StyleContext.java b/jdk/src/share/classes/javax/swing/text/StyleContext.java index 4d194eb9054..2ee0b5726be 100644 --- a/jdk/src/share/classes/javax/swing/text/StyleContext.java +++ b/jdk/src/share/classes/javax/swing/text/StyleContext.java @@ -35,7 +35,7 @@ import javax.swing.event.ChangeEvent; import java.lang.ref.WeakReference; import java.util.WeakHashMap; -import sun.font.FontManager; +import sun.font.FontUtilities; /** * A pool of styles and their associated resources. This class determines @@ -263,8 +263,8 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon if (f == null) { f = new Font(family, style, size); } - if (! FontManager.fontSupportsDefaultEncoding(f)) { - f = FontManager.getCompositeFontUIResource(f); + if (! FontUtilities.fontSupportsDefaultEncoding(f)) { + f = FontUtilities.getCompositeFontUIResource(f); } FontKey key = new FontKey(family, style, size); fontTable.put(key, f); diff --git a/jdk/src/share/classes/javax/swing/text/TextLayoutStrategy.java b/jdk/src/share/classes/javax/swing/text/TextLayoutStrategy.java index 85afd75d973..0e3f9873bf1 100644 --- a/jdk/src/share/classes/javax/swing/text/TextLayoutStrategy.java +++ b/jdk/src/share/classes/javax/swing/text/TextLayoutStrategy.java @@ -30,6 +30,7 @@ import java.text.AttributedCharacterIterator; import java.text.BreakIterator; import java.awt.font.*; import java.awt.geom.AffineTransform; +import javax.swing.JComponent; import javax.swing.event.DocumentEvent; import sun.font.BidiUtils; @@ -301,6 +302,13 @@ class TextLayoutStrategy extends FlowView.FlowStrategy { iter = BreakIterator.getLineInstance(); } + Object shaper = null; + if (c instanceof JComponent) { + shaper = ((JComponent) c).getClientProperty( + TextAttribute.NUMERIC_SHAPING); + } + text.setShaper(shaper); + measurer = new LineBreakMeasurer(text, iter, frc); // If the children of the FlowView's logical view are GlyphViews, they @@ -399,6 +407,10 @@ class TextLayoutStrategy extends FlowView.FlowStrategy { return pos - v.getStartOffset() + getBeginIndex(); } + private void setShaper(Object shaper) { + this.shaper = shaper; + } + // --- AttributedCharacterIterator methods ------------------------- /** @@ -511,6 +523,8 @@ class TextLayoutStrategy extends FlowView.FlowStrategy { } else if( attribute == TextAttribute.RUN_DIRECTION ) { return v.getDocument().getProperty(TextAttribute.RUN_DIRECTION); + } else if (attribute == TextAttribute.NUMERIC_SHAPING) { + return shaper; } return null; } @@ -532,8 +546,10 @@ class TextLayoutStrategy extends FlowView.FlowStrategy { keys = new HashSet(); keys.add(TextAttribute.FONT); keys.add(TextAttribute.RUN_DIRECTION); + keys.add(TextAttribute.NUMERIC_SHAPING); } + private Object shaper = null; } } diff --git a/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java b/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java index 6d6006b0a6f..981690a1103 100644 --- a/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java +++ b/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java @@ -150,7 +150,7 @@ public class ParagraphView extends javax.swing.text.ParagraphView { * @param axis the minor axis * @param r the input {@code SizeRequirements} object * @return the new or adjusted {@code SizeRequirements} object - * @throw IllegalArgumentException if the {@code axis} parameter is invalid + * @throws IllegalArgumentException if the {@code axis} parameter is invalid */ protected SizeRequirements calculateMinorAxisRequirements( int axis, SizeRequirements r) { diff --git a/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java b/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java index 2eb24e84616..0225fac4a03 100644 --- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java +++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java @@ -1067,10 +1067,13 @@ public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeS } /** - * Notifies listeners of a change in path. changePaths should contain - * instances of PathPlaceHolder. - */ - protected void notifyPathChange(Vector changedPaths, + * Notifies listeners of a change in path. changePaths should contain + * instances of PathPlaceHolder. + * + * @deprecated As of JDK version 1.7 + */ + @Deprecated + protected void notifyPathChange(Vector changedPaths, TreePath oldLeadSelection) { int cPathCount = changedPaths.size(); boolean[] newness = new boolean[cPathCount]; @@ -1078,7 +1081,7 @@ public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeS PathPlaceHolder placeholder; for(int counter = 0; counter < cPathCount; counter++) { - placeholder = changedPaths.elementAt(counter); + placeholder = (PathPlaceHolder) changedPaths.elementAt(counter); newness[counter] = placeholder.isNew; paths[counter] = placeholder.path; } diff --git a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java index 871da0ce3f5..e513569f6dd 100644 --- a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java +++ b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java @@ -30,7 +30,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.IdentityHashMap; import java.util.Map; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; /** * This class is to let AWT shutdown automatically when a user is done @@ -154,14 +154,17 @@ public final class AWTAutoShutdown implements Runnable { /** * Add a specified thread to the set of busy event dispatch threads. - * If this set already contains the specified thread, the call leaves - * this set unchanged and returns silently. + * If this set already contains the specified thread or the thread is null, + * the call leaves this set unchanged and returns silently. * * @param thread thread to be added to this set, if not present. * @see AWTAutoShutdown#notifyThreadFree * @see AWTAutoShutdown#isReadyToShutdown */ public void notifyThreadBusy(final Thread thread) { + if (thread == null) { + return; + } synchronized (activationLock) { synchronized (mainLock) { if (blockerThread == null) { @@ -177,14 +180,17 @@ public final class AWTAutoShutdown implements Runnable { /** * Remove a specified thread from the set of busy event dispatch threads. - * If this set doesn't contain the specified thread, the call leaves - * this set unchanged and returns silently. + * If this set doesn't contain the specified thread or the thread is null, + * the call leaves this set unchanged and returns silently. * * @param thread thread to be removed from this set, if present. * @see AWTAutoShutdown#notifyThreadBusy * @see AWTAutoShutdown#isReadyToShutdown */ public void notifyThreadFree(final Thread thread) { + if (thread == null) { + return; + } synchronized (activationLock) { synchronized (mainLock) { busyThreadSet.remove(thread); @@ -363,7 +369,7 @@ public final class AWTAutoShutdown implements Runnable { } } - final void dumpPeers(final Logger aLog) { + final void dumpPeers(final PlatformLogger aLog) { synchronized (activationLock) { synchronized (mainLock) { aLog.fine("Mapped peers:"); diff --git a/jdk/make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasResources.java b/jdk/src/share/classes/sun/awt/AWTPermissionFactory.java similarity index 74% rename from jdk/make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasResources.java rename to jdk/src/share/classes/sun/awt/AWTPermissionFactory.java index 82f9c0dd8a9..73d7e2c5cac 100644 --- a/jdk/make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasResources.java +++ b/jdk/src/share/classes/sun/awt/AWTPermissionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2009 Sun Microsystems, Inc. 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 @@ -22,21 +22,21 @@ * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ -package org.jdesktop.swingx.designer.utils; -import java.io.File; +package sun.awt; + +import java.awt.AWTPermission; +import sun.security.util.PermissionFactory; /** - * HasResources - interface for model nodes that have resources - * - * @author Created by Jasper Potts (Jul 2, 2007) + * A factory object for AWTPermission objects. */ -public interface HasResources { - - public File getResourcesDir(); - - public File getImagesDir(); - - public File getTemplatesDir(); +public class AWTPermissionFactory + implements PermissionFactory +{ + @Override + public AWTPermission newPermission(String name) { + return new AWTPermission(name); + } } diff --git a/jdk/src/share/classes/sun/awt/AppContext.java b/jdk/src/share/classes/sun/awt/AppContext.java index 4bdc337970b..3dcabdc6358 100644 --- a/jdk/src/share/classes/sun/awt/AppContext.java +++ b/jdk/src/share/classes/sun/awt/AppContext.java @@ -40,10 +40,9 @@ import java.util.IdentityHashMap; import java.util.Map; import java.util.Set; import java.util.HashSet; -import java.util.logging.Level; -import java.util.logging.Logger; import java.beans.PropertyChangeSupport; import java.beans.PropertyChangeListener; +import sun.util.logging.PlatformLogger; /** * The AppContext is a table referenced by ThreadGroup which stores @@ -128,7 +127,7 @@ import java.beans.PropertyChangeListener; * @author Fred Ecks */ public final class AppContext { - private static final Logger log = Logger.getLogger("sun.awt.AppContext"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.AppContext"); /* Since the contents of an AppContext are unique to each Java * session, this class should never be serialized. */ @@ -380,9 +379,7 @@ public final class AppContext { try { w.dispose(); } catch (Throwable t) { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "exception occured while disposing app context", t); - } + log.finer("exception occured while disposing app context", t); } } AccessController.doPrivileged(new PrivilegedAction() { diff --git a/jdk/src/share/classes/sun/awt/ComponentAccessor.java b/jdk/src/share/classes/sun/awt/ComponentAccessor.java index 49a383815db..d186363e51b 100644 --- a/jdk/src/share/classes/sun/awt/ComponentAccessor.java +++ b/jdk/src/share/classes/sun/awt/ComponentAccessor.java @@ -39,8 +39,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; -import java.util.logging.Logger; -import java.util.logging.Level; +import sun.util.logging.PlatformLogger; import java.security.AccessController; import java.security.PrivilegedAction; @@ -78,7 +77,7 @@ public class ComponentAccessor private static Method methodGetCursorNoClientCode; private static Method methodLocationNoClientCode; - private static final Logger log = Logger.getLogger("sun.awt.ComponentAccessor"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.ComponentAccessor"); private ComponentAccessor() { } @@ -136,13 +135,13 @@ public class ComponentAccessor methodLocationNoClientCode.setAccessible(true); } catch (NoSuchFieldException e) { - log.log(Level.FINE, "Unable to initialize ComponentAccessor", e); + log.fine("Unable to initialize ComponentAccessor", e); } catch (ClassNotFoundException e) { - log.log(Level.FINE, "Unable to initialize ComponentAccessor", e); + log.fine("Unable to initialize ComponentAccessor", e); } catch (NoSuchMethodException e) { - log.log(Level.FINE, "Unable to initialize ComponentAccessor", e); + log.fine("Unable to initialize ComponentAccessor", e); } // to please javac return null; @@ -157,7 +156,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } } @@ -168,7 +167,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } } @@ -179,7 +178,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } } @@ -190,7 +189,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } } @@ -204,7 +203,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } } @@ -214,7 +213,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return 0; } @@ -225,7 +224,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return 0; } @@ -236,7 +235,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return 0; } @@ -247,7 +246,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return 0; } @@ -258,7 +257,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return false; } @@ -271,10 +270,10 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } catch (InvocationTargetException e) { - log.log(Level.FINE, "Unable to invoke on the Component object", e); + log.fine("Unable to invoke on the Component object", e); } return parent; @@ -288,10 +287,10 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } catch (InvocationTargetException e) { - log.log(Level.FINE, "Unable to invoke on the Component object", e); + log.fine("Unable to invoke on the Component object", e); } return font; @@ -307,10 +306,10 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } catch (InvocationTargetException e) { - log.log(Level.FINE, "Unable to invoke on the Component object", e); + log.fine("Unable to invoke on the Component object", e); } } @@ -322,10 +321,10 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } catch (InvocationTargetException e) { - log.log(Level.FINE, "Unable to invoke on the Component object", e); + log.fine("Unable to invoke on the Component object", e); } } @@ -336,7 +335,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } } @@ -348,7 +347,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return color; } @@ -361,7 +360,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return color; } @@ -372,7 +371,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } } @@ -384,7 +383,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return f; } @@ -396,7 +395,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return peer; } @@ -406,7 +405,7 @@ public class ComponentAccessor fieldPeer.set(c, peer); } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } } @@ -415,7 +414,7 @@ public class ComponentAccessor return fieldIgnoreRepaint.getBoolean(comp); } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return false; @@ -427,7 +426,7 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } return false; } @@ -439,10 +438,10 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } catch (InvocationTargetException e) { - log.log(Level.FINE, "Unable to invoke on the Component object", e); + log.fine("Unable to invoke on the Component object", e); } return enabled; } @@ -455,10 +454,10 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } catch (InvocationTargetException e) { - log.log(Level.FINE, "Unable to invoke on the Component object", e); + log.fine("Unable to invoke on the Component object", e); } return cursor; @@ -472,12 +471,13 @@ public class ComponentAccessor } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Component object", e); + log.fine("Unable to access the Component object", e); } catch (InvocationTargetException e) { - log.log(Level.FINE, "Unable to invoke on the Component object", e); + log.fine("Unable to invoke on the Component object", e); } return loc; } + } diff --git a/jdk/src/share/classes/sun/awt/DebugSettings.java b/jdk/src/share/classes/sun/awt/DebugSettings.java index 0d2aaaf6251..9f0f4742c3e 100644 --- a/jdk/src/share/classes/sun/awt/DebugSettings.java +++ b/jdk/src/share/classes/sun/awt/DebugSettings.java @@ -28,7 +28,7 @@ package sun.awt; import java.io.*; import java.util.*; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; /* * Internal class that manages sun.awt.Debug settings. @@ -72,7 +72,7 @@ import java.util.logging.*; * the fix for 4638447). */ final class DebugSettings { - private static final Logger log = Logger.getLogger("sun.awt.debug.DebugSettings"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.debug.DebugSettings"); /* standard debug property key names */ static final String PREFIX = "awtdebug"; @@ -128,8 +128,8 @@ final class DebugSettings { }); // echo the initial property settings to stdout - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "DebugSettings:\n{0}", this); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("DebugSettings:\n{0}" + this); } } @@ -258,8 +258,8 @@ final class DebugSettings { } private void println(Object object) { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, object.toString()); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer(object.toString()); } } diff --git a/jdk/src/share/classes/sun/awt/FontConfiguration.java b/jdk/src/share/classes/sun/awt/FontConfiguration.java index 4504af24e9d..27cee5e38a6 100644 --- a/jdk/src/share/classes/sun/awt/FontConfiguration.java +++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java @@ -30,7 +30,6 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; @@ -38,7 +37,6 @@ import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.logging.Logger; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; @@ -49,7 +47,10 @@ import java.util.Properties; import java.util.Set; import java.util.Vector; import sun.font.CompositeFontDescriptor; -import sun.java2d.SunGraphicsEnvironment; +import sun.font.SunFontManager; +import sun.font.FontManagerFactory; +import sun.font.FontUtilities; +import sun.util.logging.PlatformLogger; /** * Provides the definitions of the five logical fonts: Serif, SansSerif, @@ -65,10 +66,10 @@ public abstract class FontConfiguration { protected static Locale startupLocale = null; protected static Hashtable localeMap = null; private static FontConfiguration fontConfig; - private static Logger logger; + private static PlatformLogger logger; protected static boolean isProperties = true; - protected SunGraphicsEnvironment environment; + protected SunFontManager fontManager; protected boolean preferLocaleFonts; protected boolean preferPropFonts; @@ -80,11 +81,11 @@ public abstract class FontConfiguration { /* A default FontConfiguration must be created before an alternate * one to ensure proper static initialisation takes place. */ - public FontConfiguration(SunGraphicsEnvironment environment) { - if (SunGraphicsEnvironment.debugFonts && logger == null) { - logger = Logger.getLogger("sun.awt.FontConfiguration"); + public FontConfiguration(SunFontManager fm) { + if (FontUtilities.debugFonts() && logger == null) { + logger = PlatformLogger.getLogger("sun.awt.FontConfiguration"); } - this.environment = environment; + fontManager = fm; setOsNameAndVersion(); /* static initialization */ setEncoding(); /* static initialization */ /* Separating out the file location from the rest of the @@ -106,10 +107,10 @@ public abstract class FontConfiguration { return true; } - public FontConfiguration(SunGraphicsEnvironment environment, + public FontConfiguration(SunFontManager fm, boolean preferLocaleFonts, boolean preferPropFonts) { - this.environment = environment; + fontManager = fm; this.preferLocaleFonts = preferLocaleFonts; this.preferPropFonts = preferPropFonts; /* fontConfig should be initialised by default constructor, and @@ -198,17 +199,17 @@ public abstract class FontConfiguration { loadBinary(in); } in.close(); - if (SunGraphicsEnvironment.debugFonts) { + if (FontUtilities.debugFonts()) { logger.config("Read logical font configuration from " + f); } } catch (IOException e) { - if (SunGraphicsEnvironment.debugFonts) { + if (FontUtilities.debugFonts()) { logger.config("Failed to read logical font configuration from " + f); } } } String version = getVersion(); - if (!"1".equals(version) && SunGraphicsEnvironment.debugFonts) { + if (!"1".equals(version) && FontUtilities.debugFonts()) { logger.config("Unsupported fontconfig version: " + version); } } @@ -219,8 +220,8 @@ public abstract class FontConfiguration { File fallbackDir = new File(fallbackDirName); if (fallbackDir.exists() && fallbackDir.isDirectory()) { - String[] ttfs = fallbackDir.list(SunGraphicsEnvironment.ttFilter); - String[] t1s = fallbackDir.list(SunGraphicsEnvironment.t1Filter); + String[] ttfs = fallbackDir.list(fontManager.getTrueTypeFilter()); + String[] t1s = fallbackDir.list(fontManager.getType1Filter()); int numTTFs = (ttfs == null) ? 0 : ttfs.length; int numT1s = (t1s == null) ? 0 : t1s.length; int len = numTTFs + numT1s; @@ -236,7 +237,7 @@ public abstract class FontConfiguration { installedFallbackFontFiles[i+numTTFs] = fallbackDir + File.separator + t1s[i]; } - environment.registerFontsInDir(fallbackDirName); + fontManager.registerFontsInDir(fallbackDirName); } } @@ -365,7 +366,7 @@ public abstract class FontConfiguration { stringTable = new StringBuilder(4096); if (verbose && logger == null) { - logger = Logger.getLogger("sun.awt.FontConfiguration"); + logger = PlatformLogger.getLogger("sun.awt.FontConfiguration"); } new PropertiesHandler().load(in); @@ -465,7 +466,7 @@ public abstract class FontConfiguration { nameIDs[index] = getComponentFontID(coreScripts[index], fontIndex, styleIndex); if (preferLocaleFonts && localeMap != null && - sun.font.FontManager.usingAlternateFontforJALocales()) { + fontManager.usingAlternateFontforJALocales()) { nameIDs[index] = remapLocaleMap(fontIndex, styleIndex, coreScripts[index], nameIDs[index]); } @@ -480,7 +481,7 @@ public abstract class FontConfiguration { short id = getComponentFontID(fallbackScripts[i], fontIndex, styleIndex); if (preferLocaleFonts && localeMap != null && - sun.font.FontManager.usingAlternateFontforJALocales()) { + fontManager.usingAlternateFontforJALocales()) { id = remapLocaleMap(fontIndex, styleIndex, fallbackScripts[i], id); } if (preferPropFonts) { @@ -973,8 +974,8 @@ public abstract class FontConfiguration { public CompositeFontDescriptor[] get2DCompositeFontInfo() { CompositeFontDescriptor[] result = new CompositeFontDescriptor[NUM_FONTS * NUM_STYLES]; - String defaultFontFile = environment.getDefaultFontFile(); - String defaultFontFaceName = environment.getDefaultFontFaceName(); + String defaultFontFile = fontManager.getDefaultFontFile(); + String defaultFontFaceName = fontManager.getDefaultFontFaceName(); for (int fontIndex = 0; fontIndex < NUM_FONTS; fontIndex++) { String fontName = publicFontNames[fontIndex]; @@ -1121,7 +1122,7 @@ public abstract class FontConfiguration { */ HashMap existsMap; public boolean needToSearchForFile(String fileName) { - if (!environment.isLinux) { + if (!FontUtilities.isLinux) { return false; } else if (existsMap == null) { existsMap = new HashMap(); @@ -1139,7 +1140,7 @@ public abstract class FontConfiguration { } else { exists = Boolean.valueOf((new File(fileName)).exists()); existsMap.put(fileName, exists); - if (SunGraphicsEnvironment.debugFonts && + if (FontUtilities.debugFonts() && exists == Boolean.FALSE) { logger.warning("Couldn't locate font file " + fileName); } @@ -2067,7 +2068,8 @@ public abstract class FontConfiguration { throw new Exception(); } } catch (Exception e) { - if (SunGraphicsEnvironment.debugFonts && logger != null) { + if (FontUtilities.debugFonts() && + logger != null) { logger.config("Failed parsing " + key + " property of font configuration."); diff --git a/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java b/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java index 6a8708a2abe..8a1743e3348 100644 --- a/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java +++ b/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java @@ -39,12 +39,11 @@ import java.awt.peer.ComponentPeer; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer { - private static final Logger focusLog = Logger.getLogger("sun.awt.focus.KeyboardFocusManagerPeerImpl"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.focus.KeyboardFocusManagerPeerImpl"); private static AWTAccessor.KeyboardFocusManagerAccessor kfmAccessor = AWTAccessor.getKeyboardFocusManagerAccessor(); @@ -64,7 +63,8 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag public void clearGlobalFocusOwner(Window activeWindow) { if (activeWindow != null) { Component focusOwner = activeWindow.getFocusOwner(); - if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Clearing global focus owner " + focusOwner); + if (focusLog.isLoggable(PlatformLogger.FINE)) + focusLog.fine("Clearing global focus owner " + focusOwner); if (focusOwner != null) { FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null, CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER); @@ -130,14 +130,16 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag FocusEvent fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST, false, lightweightChild, cause); - if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Posting focus event: " + fl); + if (focusLog.isLoggable(PlatformLogger.FINER)) + focusLog.finer("Posting focus event: " + fl); SunToolkit.postPriorityEvent(fl); } FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner, cause); - if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Posting focus event: " + fg); + if (focusLog.isLoggable(PlatformLogger.FINER)) + focusLog.finer("Posting focus event: " + fg); SunToolkit.postPriorityEvent(fg); return true; } diff --git a/jdk/src/share/classes/sun/awt/ScrollPaneWheelScroller.java b/jdk/src/share/classes/sun/awt/ScrollPaneWheelScroller.java index 8035f3f2752..c68829e23f2 100644 --- a/jdk/src/share/classes/sun/awt/ScrollPaneWheelScroller.java +++ b/jdk/src/share/classes/sun/awt/ScrollPaneWheelScroller.java @@ -30,7 +30,7 @@ import java.awt.Insets; import java.awt.Adjustable; import java.awt.event.MouseWheelEvent; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; /* * ScrollPaneWheelScroller is a helper class for implmenenting mouse wheel @@ -39,7 +39,7 @@ import java.util.logging.*; */ public abstract class ScrollPaneWheelScroller { - private static final Logger log = Logger.getLogger("sun.awt.ScrollPaneWheelScroller"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.ScrollPaneWheelScroller"); private ScrollPaneWheelScroller() {} @@ -47,8 +47,8 @@ public abstract class ScrollPaneWheelScroller { * Called from ScrollPane.processMouseWheelEvent() */ public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource()); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource()); } int increment = 0; @@ -56,8 +56,8 @@ public abstract class ScrollPaneWheelScroller { Adjustable adj = getAdjustableToScroll(sp); if (adj != null) { increment = getIncrementFromAdjustable(adj, e); - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "increment from adjustable(" + adj.getClass() + ") : " + increment); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment); } scrollAdjustable(adj, increment); } @@ -74,8 +74,8 @@ public abstract class ScrollPaneWheelScroller { // if policy is display always or never, use vert if (policy == ScrollPane.SCROLLBARS_ALWAYS || policy == ScrollPane.SCROLLBARS_NEVER) { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "using vertical scrolling due to scrollbar policy"); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("using vertical scrolling due to scrollbar policy"); } return sp.getVAdjustable(); @@ -85,31 +85,31 @@ public abstract class ScrollPaneWheelScroller { Insets ins = sp.getInsets(); int vertScrollWidth = sp.getVScrollbarWidth(); - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "insets: l = " + ins.left + ", r = " + ins.right + + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("insets: l = " + ins.left + ", r = " + ins.right + ", t = " + ins.top + ", b = " + ins.bottom); - log.log(Level.FINER, "vertScrollWidth = " + vertScrollWidth); + log.finer("vertScrollWidth = " + vertScrollWidth); } // Check if scrollbar is showing by examining insets of the // ScrollPane if (ins.right >= vertScrollWidth) { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "using vertical scrolling because scrollbar is present"); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("using vertical scrolling because scrollbar is present"); } return sp.getVAdjustable(); } else { int horizScrollHeight = sp.getHScrollbarHeight(); if (ins.bottom >= horizScrollHeight) { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "using horiz scrolling because scrollbar is present"); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("using horiz scrolling because scrollbar is present"); } return sp.getHAdjustable(); } else { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "using NO scrollbar becsause neither is present"); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("using NO scrollbar becsause neither is present"); } return null; } @@ -124,9 +124,9 @@ public abstract class ScrollPaneWheelScroller { */ public static int getIncrementFromAdjustable(Adjustable adj, MouseWheelEvent e) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (adj == null) { - log.log(Level.FINE, "Assertion (adj != null) failed"); + log.fine("Assertion (adj != null) failed"); } } @@ -146,19 +146,19 @@ public abstract class ScrollPaneWheelScroller { * bounds and sets the new value to the Adjustable. */ public static void scrollAdjustable(Adjustable adj, int amount) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (adj == null) { - log.log(Level.FINE, "Assertion (adj != null) failed"); + log.fine("Assertion (adj != null) failed"); } if (amount == 0) { - log.log(Level.FINE, "Assertion (amount != 0) failed"); + log.fine("Assertion (amount != 0) failed"); } } int current = adj.getValue(); int upperLimit = adj.getMaximum() - adj.getVisibleAmount(); - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "doScrolling by " + amount); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("doScrolling by " + amount); } if (amount > 0 && current < upperLimit) { // still some room to scroll diff --git a/jdk/src/share/classes/sun/awt/SunDisplayChanger.java b/jdk/src/share/classes/sun/awt/SunDisplayChanger.java index b4c7f49bb4d..b586e783e58 100644 --- a/jdk/src/share/classes/sun/awt/SunDisplayChanger.java +++ b/jdk/src/share/classes/sun/awt/SunDisplayChanger.java @@ -33,7 +33,7 @@ import java.util.Set; import java.util.HashMap; import java.util.WeakHashMap; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; /** * This class is used to aid in keeping track of DisplayChangedListeners and @@ -54,7 +54,7 @@ import java.util.logging.*; * screen to another on a system equipped with multiple displays. */ public class SunDisplayChanger { - private static final Logger log = Logger.getLogger("sun.awt.multiscreen.SunDisplayChanger"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.multiscreen.SunDisplayChanger"); // Create a new synchronizedMap with initial capacity of one listener. // It is asserted that the most common case is to have one GraphicsDevice @@ -68,13 +68,13 @@ public class SunDisplayChanger { * notified when the display is changed. */ public void add(DisplayChangedListener theListener) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (theListener == null) { - log.log(Level.FINE, "Assertion (theListener != null) failed"); + log.fine("Assertion (theListener != null) failed"); } } - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "Adding listener: " + theListener); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Adding listener: " + theListener); } listeners.put(theListener, null); } @@ -83,13 +83,13 @@ public class SunDisplayChanger { * Remove the given DisplayChangeListener from this SunDisplayChanger. */ public void remove(DisplayChangedListener theListener) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (theListener == null) { - log.log(Level.FINE, "Assertion (theListener != null) failed"); + log.fine("Assertion (theListener != null) failed"); } } - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "Removing listener: " + theListener); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Removing listener: " + theListener); } listeners.remove(theListener); } @@ -99,8 +99,8 @@ public class SunDisplayChanger { * taken place by calling their displayChanged() methods. */ public void notifyListeners() { - if (log.isLoggable(Level.FINEST)) { - log.log(Level.FINEST, "notifyListeners"); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("notifyListeners"); } // This method is implemented by making a clone of the set of listeners, // and then iterating over the clone. This is because during the course @@ -126,8 +126,8 @@ public class SunDisplayChanger { DisplayChangedListener current = (DisplayChangedListener) itr.next(); try { - if (log.isLoggable(Level.FINEST)) { - log.log(Level.FINEST, "displayChanged for listener: " + current); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("displayChanged for listener: " + current); } current.displayChanged(); } catch (IllegalComponentStateException e) { @@ -146,7 +146,7 @@ public class SunDisplayChanger { * taken place by calling their paletteChanged() methods. */ public void notifyPaletteChanged() { - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("notifyPaletteChanged"); } // This method is implemented by making a clone of the set of listeners, @@ -172,8 +172,8 @@ public class SunDisplayChanger { DisplayChangedListener current = (DisplayChangedListener) itr.next(); try { - if (log.isLoggable(Level.FINEST)) { - log.log(Level.FINEST, "paletteChanged for listener: " + current); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("paletteChanged for listener: " + current); } current.paletteChanged(); } catch (IllegalComponentStateException e) { diff --git a/jdk/src/share/classes/sun/awt/SunGraphicsCallback.java b/jdk/src/share/classes/sun/awt/SunGraphicsCallback.java index a85603462b7..da544187faa 100644 --- a/jdk/src/share/classes/sun/awt/SunGraphicsCallback.java +++ b/jdk/src/share/classes/sun/awt/SunGraphicsCallback.java @@ -27,14 +27,14 @@ package sun.awt; import java.awt.*; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; public abstract class SunGraphicsCallback { public static final int HEAVYWEIGHTS = 0x1; public static final int LIGHTWEIGHTS = 0x2; public static final int TWO_PASSES = 0x4; - private static final Logger log = Logger.getLogger("sun.awt.SunGraphicsCallback"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.SunGraphicsCallback"); public abstract void run(Component comp, Graphics cg); @@ -87,11 +87,11 @@ public abstract class SunGraphicsCallback { int ncomponents = comps.length; Shape clip = g.getClip(); - if (log.isLoggable(Level.FINER) && (clip != null)) { + if (log.isLoggable(PlatformLogger.FINER) && (clip != null)) { Rectangle newrect = clip.getBounds(); - log.log(Level.FINER, "x = " + newrect.x + ", y = " + newrect.y + - ", width = " + newrect.width + - ", height = " + newrect.height); + log.finer("x = " + newrect.x + ", y = " + newrect.y + + ", width = " + newrect.width + + ", height = " + newrect.height); } // A seriously sad hack-- diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java index b4dd06a445c..e9bc0450bbd 100644 --- a/jdk/src/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/share/classes/sun/awt/SunToolkit.java @@ -40,8 +40,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.misc.SoftCache; import sun.font.FontDesignMetrics; import sun.awt.im.InputContext; @@ -61,7 +60,7 @@ public abstract class SunToolkit extends Toolkit implements WindowClosingSupport, WindowClosingListener, ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider { - private static final Logger log = Logger.getLogger("sun.awt.SunToolkit"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.SunToolkit"); /* Load debug settings for native code */ static { @@ -986,9 +985,9 @@ public abstract class SunToolkit extends Toolkit //with scale factors x1, x3/4, x2/3, xN, x1/N. Image im = i.next(); if (im == null) { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "SunToolkit.getScaledIconImage: " + - "Skipping the image passed into Java because it's null."); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("SunToolkit.getScaledIconImage: " + + "Skipping the image passed into Java because it's null."); } continue; } @@ -1002,9 +1001,9 @@ public abstract class SunToolkit extends Toolkit iw = im.getWidth(null); ih = im.getHeight(null); } catch (Exception e){ - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "SunToolkit.getScaledIconImage: " + - "Perhaps the image passed into Java is broken. Skipping this icon."); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("SunToolkit.getScaledIconImage: " + + "Perhaps the image passed into Java is broken. Skipping this icon."); } continue; } @@ -1077,8 +1076,8 @@ public abstract class SunToolkit extends Toolkit try { int x = (width - bestWidth) / 2; int y = (height - bestHeight) / 2; - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "WWindowPeer.getScaledIconData() result : " + + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("WWindowPeer.getScaledIconData() result : " + "w : " + width + " h : " + height + " iW : " + bestImage.getWidth(null) + " iH : " + bestImage.getHeight(null) + " sim : " + bestSimilarity + " sf : " + bestScaleFactor + @@ -1095,9 +1094,9 @@ public abstract class SunToolkit extends Toolkit public static DataBufferInt getScaledIconData(java.util.List imageList, int width, int height) { BufferedImage bimage = getScaledIconImage(imageList, width, height); if (bimage == null) { - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "SunToolkit.getScaledIconData: " + - "Perhaps the image passed into Java is broken. Skipping this icon."); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("SunToolkit.getScaledIconData: " + + "Perhaps the image passed into Java is broken. Skipping this icon."); } return null; } @@ -1913,7 +1912,7 @@ public abstract class SunToolkit extends Toolkit } } - protected static void dumpPeers(final Logger aLog) { + protected static void dumpPeers(final PlatformLogger aLog) { AWTAutoShutdown.getInstance().dumpPeers(aLog); } diff --git a/jdk/src/share/classes/sun/awt/WindowAccessor.java b/jdk/src/share/classes/sun/awt/WindowAccessor.java index 10368ef8483..e1fb7c4fc64 100644 --- a/jdk/src/share/classes/sun/awt/WindowAccessor.java +++ b/jdk/src/share/classes/sun/awt/WindowAccessor.java @@ -29,8 +29,7 @@ import java.awt.Window; import java.lang.reflect.Field; -import java.util.logging.Logger; -import java.util.logging.Level; +import sun.util.logging.PlatformLogger; import java.security.AccessController; import java.security.PrivilegedAction; @@ -41,7 +40,7 @@ public class WindowAccessor { private static Field fieldIsAutoRequestFocus; private static Field fieldIsTrayIconWindow; - private static final Logger log = Logger.getLogger("sun.awt.WindowAccessor"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.WindowAccessor"); private WindowAccessor() { } @@ -57,9 +56,9 @@ public class WindowAccessor { fieldIsTrayIconWindow.setAccessible(true); } catch (NoSuchFieldException e) { - log.log(Level.FINE, "Unable to initialize WindowAccessor: ", e); + log.fine("Unable to initialize WindowAccessor: ", e); } catch (ClassNotFoundException e) { - log.log(Level.FINE, "Unable to initialize WindowAccessor: ", e); + log.fine("Unable to initialize WindowAccessor: ", e); } return null; } @@ -71,7 +70,7 @@ public class WindowAccessor { return fieldIsAutoRequestFocus.getBoolean(w); } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Window object", e); + log.fine("Unable to access the Window object", e); } return true; } @@ -81,7 +80,7 @@ public class WindowAccessor { return fieldIsTrayIconWindow.getBoolean(w); } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Window object", e); + log.fine("Unable to access the Window object", e); } return false; } @@ -91,7 +90,7 @@ public class WindowAccessor { fieldIsTrayIconWindow.set(w, isTrayIconWindow); } catch (IllegalAccessException e) { - log.log(Level.FINE, "Unable to access the Window object", e); + log.fine("Unable to access the Window object", e); } } } diff --git a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java index cfe0190b318..521e691024c 100644 --- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java +++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java @@ -89,7 +89,7 @@ import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import sun.awt.AppContext; import sun.awt.SunToolkit; @@ -222,7 +222,7 @@ public abstract class DataTransferer { */ private static DataTransferer transferer; - private static final Logger dtLog = Logger.getLogger("sun.awt.datatransfer.DataTransfer"); + private static final PlatformLogger dtLog = PlatformLogger.getLogger("sun.awt.datatransfer.DataTransfer"); static { Class tCharArrayClass = null, tByteArrayClass = null; @@ -382,9 +382,9 @@ public abstract class DataTransferer { * "text". */ public static boolean doesSubtypeSupportCharset(DataFlavor flavor) { - if (dtLog.isLoggable(Level.FINE)) { + if (dtLog.isLoggable(PlatformLogger.FINE)) { if (!"text".equals(flavor.getPrimaryType())) { - dtLog.log(Level.FINE, "Assertion (\"text\".equals(flavor.getPrimaryType())) failed"); + dtLog.fine("Assertion (\"text\".equals(flavor.getPrimaryType())) failed"); } } diff --git a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java index 6e9b44d7928..c137800b5ed 100644 --- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java +++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java @@ -48,7 +48,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Arrays; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import java.io.IOException; import java.io.InputStream; @@ -99,7 +99,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, protected static final Object _globalLock = new Object(); - private static final Logger dndLog = Logger.getLogger("sun.awt.dnd.SunDropTargetContextPeer"); + private static final PlatformLogger dndLog = PlatformLogger.getLogger("sun.awt.dnd.SunDropTargetContextPeer"); /* * a primitive mechanism for advertising intra-JVM Transferables @@ -845,8 +845,8 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, void registerEvent(SunDropTargetEvent e) { handler.lock(); - if (!eventSet.add(e) && dndLog.isLoggable(Level.FINE)) { - dndLog.log(Level.FINE, "Event is already registered: " + e); + if (!eventSet.add(e) && dndLog.isLoggable(PlatformLogger.FINE)) { + dndLog.fine("Event is already registered: " + e); } handler.unlock(); } diff --git a/jdk/src/share/classes/sun/awt/im/InputContext.java b/jdk/src/share/classes/sun/awt/im/InputContext.java index d0c84c726ed..4a077cfa6d2 100644 --- a/jdk/src/share/classes/sun/awt/im/InputContext.java +++ b/jdk/src/share/classes/sun/awt/im/InputContext.java @@ -50,9 +50,9 @@ import java.text.MessageFormat; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; -import java.util.logging.*; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; +import sun.util.logging.PlatformLogger; import sun.awt.SunToolkit; /** @@ -67,7 +67,7 @@ import sun.awt.SunToolkit; public class InputContext extends java.awt.im.InputContext implements ComponentListener, WindowListener { - private static final Logger log = Logger.getLogger("sun.awt.im.InputContext"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.im.InputContext"); // The current input method is represented by two objects: // a locator is used to keep information about the selected // input method and locale until we actually need a real input @@ -386,7 +386,7 @@ public class InputContext extends java.awt.im.InputContext } previousInputMethod = null; - if (log.isLoggable(Level.FINE)) log.fine("Current client component " + currentClientComponent); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Current client component " + currentClientComponent); if (inputMethod instanceof InputMethodAdapter) { ((InputMethodAdapter) inputMethod).setClientComponent(currentClientComponent); } @@ -889,7 +889,7 @@ public class InputContext extends java.awt.im.InputContext {inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()), throwable.getLocalizedMessage()}; MessageFormat mf = new MessageFormat(errorTextFormat); - Logger logger = Logger.getLogger("sun.awt.im"); + PlatformLogger logger = PlatformLogger.getLogger("sun.awt.im"); logger.config(mf.format(args)); } diff --git a/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java b/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java index fe00063ffbb..ce42bd3a309 100644 --- a/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java +++ b/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java @@ -57,8 +57,9 @@ class ShellFolderManager { * folders, such as Desktop, Documents, History, Network, Home, etc. * This is used in the shortcut panel of the filechooser on Windows 2000 * and Windows Me. - * "fileChooserIcon nn": - * Returns an Image - icon nn from resource 124 in comctl32.dll (Windows only). + * "fileChooserIcon ": + * Returns an Image - icon can be ListView, DetailsView, UpFolder, NewFolder or + * ViewMenu (Windows only). * * @return An Object matching the key string. */ diff --git a/jdk/src/share/classes/sun/font/CMap.java b/jdk/src/share/classes/sun/font/CMap.java index d14451824d1..1d3d950221f 100644 --- a/jdk/src/share/classes/sun/font/CMap.java +++ b/jdk/src/share/classes/sun/font/CMap.java @@ -232,7 +232,7 @@ abstract class CMap { * fonts are using gb2312 encoding, have to use this * workaround to make Solaris zh_CN locale work. -sherman */ - if (FontManager.isSolaris && font.platName != null && + if (FontUtilities.isSolaris && font.platName != null && (font.platName.startsWith( "/usr/openwin/lib/locale/zh_CN.EUC/X11/fonts/TrueType") || font.platName.startsWith( @@ -407,8 +407,8 @@ abstract class CMap { subtableLength = buffer.getInt(offset+4) & INTMASK; } if (offset+subtableLength > buffer.capacity()) { - if (FontManager.logging) { - FontManager.logger.warning("Cmap subtable overflows buffer."); + if (FontUtilities.isLogging()) { + FontUtilities.getLogger().warning("Cmap subtable overflows buffer."); } } switch (subtableFormat) { diff --git a/jdk/src/share/classes/sun/font/CompositeFont.java b/jdk/src/share/classes/sun/font/CompositeFont.java index 4712dc04d3d..7d51e47bc1a 100644 --- a/jdk/src/share/classes/sun/font/CompositeFont.java +++ b/jdk/src/share/classes/sun/font/CompositeFont.java @@ -60,7 +60,7 @@ public final class CompositeFont extends Font2D { public CompositeFont(String name, String[] compFileNames, String[] compNames, int metricsSlotCnt, int[] exclRanges, int[] maxIndexes, - boolean defer) { + boolean defer, SunFontManager fm) { handle = new Font2DHandle(this); fullName = name; @@ -85,13 +85,13 @@ public final class CompositeFont extends Font2D { * The caller could be responsible for this, but for now it seems * better that it is handled internally to the CompositeFont class. */ - if (FontManager.eudcFont != null) { + if (fm.getEUDCFont() != null) { numSlots++; if (componentNames != null) { componentNames = new String[numSlots]; System.arraycopy(compNames, 0, componentNames, 0, numSlots-1); componentNames[numSlots-1] = - FontManager.eudcFont.getFontName(null); + fm.getEUDCFont().getFontName(null); } if (componentFileNames != null) { componentFileNames = new String[numSlots]; @@ -99,7 +99,7 @@ public final class CompositeFont extends Font2D { componentFileNames, 0, numSlots-1); } components = new PhysicalFont[numSlots]; - components[numSlots-1] = FontManager.eudcFont; + components[numSlots-1] = fm.getEUDCFont(); deferredInitialisation = new boolean[numSlots]; if (defer) { for (int i=0; i= 0x10000) { diff --git a/jdk/src/share/classes/sun/font/FileFont.java b/jdk/src/share/classes/sun/font/FileFont.java index 5aad11b2acd..74a07af6825 100644 --- a/jdk/src/share/classes/sun/font/FileFont.java +++ b/jdk/src/share/classes/sun/font/FileFont.java @@ -158,7 +158,8 @@ public abstract class FileFont extends PhysicalFont { * rare maybe it is not worth doing this last part. */ synchronized void deregisterFontAndClearStrikeCache() { - FontManager.deRegisterBadFont(this); + SunFontManager fm = SunFontManager.getInstance(); + fm.deRegisterBadFont(this); for (Reference strikeRef : strikeCache.values()) { if (strikeRef != null) { @@ -172,14 +173,14 @@ public abstract class FileFont extends PhysicalFont { } } scaler.dispose(); - scaler = FontManager.getNullScaler(); + scaler = FontScaler.getNullScaler(); } StrikeMetrics getFontMetrics(long pScalerContext) { try { return getScaler().getFontMetrics(pScalerContext); } catch (FontScalerException fe) { - scaler = FontManager.getNullScaler(); + scaler = FontScaler.getNullScaler(); return getFontMetrics(pScalerContext); } } @@ -188,7 +189,7 @@ public abstract class FileFont extends PhysicalFont { try { return getScaler().getGlyphAdvance(pScalerContext, glyphCode); } catch (FontScalerException fe) { - scaler = FontManager.getNullScaler(); + scaler = FontScaler.getNullScaler(); return getGlyphAdvance(pScalerContext, glyphCode); } } @@ -197,7 +198,7 @@ public abstract class FileFont extends PhysicalFont { try { getScaler().getGlyphMetrics(pScalerContext, glyphCode, metrics); } catch (FontScalerException fe) { - scaler = FontManager.getNullScaler(); + scaler = FontScaler.getNullScaler(); getGlyphMetrics(pScalerContext, glyphCode, metrics); } } @@ -206,7 +207,7 @@ public abstract class FileFont extends PhysicalFont { try { return getScaler().getGlyphImage(pScalerContext, glyphCode); } catch (FontScalerException fe) { - scaler = FontManager.getNullScaler(); + scaler = FontScaler.getNullScaler(); return getGlyphImage(pScalerContext, glyphCode); } } @@ -215,7 +216,7 @@ public abstract class FileFont extends PhysicalFont { try { return getScaler().getGlyphOutlineBounds(pScalerContext, glyphCode); } catch (FontScalerException fe) { - scaler = FontManager.getNullScaler(); + scaler = FontScaler.getNullScaler(); return getGlyphOutlineBounds(pScalerContext, glyphCode); } } @@ -224,7 +225,7 @@ public abstract class FileFont extends PhysicalFont { try { return getScaler().getGlyphOutline(pScalerContext, glyphCode, x, y); } catch (FontScalerException fe) { - scaler = FontManager.getNullScaler(); + scaler = FontScaler.getNullScaler(); return getGlyphOutline(pScalerContext, glyphCode, x, y); } } @@ -233,7 +234,7 @@ public abstract class FileFont extends PhysicalFont { try { return getScaler().getGlyphVectorOutline(pScalerContext, glyphs, numGlyphs, x, y); } catch (FontScalerException fe) { - scaler = FontManager.getNullScaler(); + scaler = FontScaler.getNullScaler(); return getGlyphVectorOutline(pScalerContext, glyphs, numGlyphs, x, y); } } @@ -275,7 +276,8 @@ public abstract class FileFont extends PhysicalFont { */ fontFile.delete(); /* remove from delete on exit hook list : */ - FontManager.tmpFontFiles.remove(fontFile); + // FIXME: still need to be refactored + SunFontManager.getInstance().tmpFontFiles.remove(fontFile); } catch (Exception e) { } } diff --git a/jdk/src/share/classes/sun/font/FileFontStrike.java b/jdk/src/share/classes/sun/font/FileFontStrike.java index 11dff8a20c1..b6c63521dd7 100644 --- a/jdk/src/share/classes/sun/font/FileFontStrike.java +++ b/jdk/src/share/classes/sun/font/FileFontStrike.java @@ -114,7 +114,7 @@ public class FileFontStrike extends PhysicalStrike { private static native boolean initNative(); private static boolean isXPorLater = false; static { - if (FontManager.isWindows && !FontManager.useT2K && + if (FontUtilities.isWindows && !FontUtilities.useT2K && !GraphicsEnvironment.isHeadless()) { isXPorLater = initNative(); } @@ -201,7 +201,7 @@ public class FileFontStrike extends PhysicalStrike { this.disposer = new FontStrikeDisposer(fileFont, desc); initGlyphCache(); pScalerContext = NullFontScaler.getNullScalerContext(); - FontManager.deRegisterBadFont(fileFont); + SunFontManager.getInstance().deRegisterBadFont(fileFont); return; } /* First, see if native code should be used to create the glyph. @@ -211,8 +211,8 @@ public class FileFontStrike extends PhysicalStrike { * except that the advance returned by GDI is always overwritten by * the JDK rasteriser supplied one (see getGlyphImageFromWindows()). */ - if (FontManager.isWindows && isXPorLater && - !FontManager.useT2K && + if (FontUtilities.isWindows && isXPorLater && + !FontUtilities.useT2K && !GraphicsEnvironment.isHeadless() && !fileFont.useJavaRasterizer && (desc.aaHint == INTVAL_TEXT_ANTIALIAS_LCD_HRGB || @@ -241,8 +241,8 @@ public class FileFontStrike extends PhysicalStrike { } } } - if (FontManager.logging && FontManager.isWindows) { - FontManager.logger.info + if (FontUtilities.isLogging() && FontUtilities.isWindows) { + FontUtilities.getLogger().info ("Strike for " + fileFont + " at size = " + intPtSize + " use natives = " + useNatives + " useJavaRasteriser = " + fileFont.useJavaRasterizer + @@ -298,7 +298,7 @@ public class FileFontStrike extends PhysicalStrike { } long getGlyphImageFromNative(int glyphCode) { - if (FontManager.isWindows) { + if (FontUtilities.isWindows) { return getGlyphImageFromWindows(glyphCode); } else { return getGlyphImageFromX11(glyphCode); @@ -366,8 +366,8 @@ public class FileFontStrike extends PhysicalStrike { } else { if (useNatives) { glyphPtr = getGlyphImageFromNative(glyphCode); - if (glyphPtr == 0L && FontManager.logging) { - FontManager.logger.info + if (glyphPtr == 0L && FontUtilities.isLogging()) { + FontUtilities.getLogger().info ("Strike for " + fileFont + " at size = " + intPtSize + " couldn't get native glyph for code = " + glyphCode); @@ -528,7 +528,7 @@ public class FileFontStrike extends PhysicalStrike { if (segmentedCache) { int numSegments = (numGlyphs + SEGSIZE-1)/SEGSIZE; - if (FontManager.longAddresses) { + if (longAddresses) { glyphCacheFormat = SEGLONGARRAY; segLongGlyphImages = new long[numSegments][]; this.disposer.segLongGlyphImages = segLongGlyphImages; @@ -538,7 +538,7 @@ public class FileFontStrike extends PhysicalStrike { this.disposer.segIntGlyphImages = segIntGlyphImages; } } else { - if (FontManager.longAddresses) { + if (longAddresses) { glyphCacheFormat = LONGARRAY; longGlyphImages = new long[numGlyphs]; this.disposer.longGlyphImages = longGlyphImages; diff --git a/jdk/make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIBorder.java b/jdk/src/share/classes/sun/font/FontAccess.java similarity index 63% rename from jdk/make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIBorder.java rename to jdk/src/share/classes/sun/font/FontAccess.java index 46c35ed1b08..442fb5a8fa3 100644 --- a/jdk/make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIBorder.java +++ b/jdk/src/share/classes/sun/font/FontAccess.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2008 Sun Microsystems, Inc. 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 @@ -22,32 +22,27 @@ * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ -package org.jdesktop.synthdesigner.synthmodel; -import javax.swing.border.Border; +package sun.font; -/** - * UIBorder - * - * @author Richard Bair - * @author Jasper Potts - */ -public class UIBorder extends UIDefault { +import java.awt.Font; - public UIBorder() { +public abstract class FontAccess { + + private static FontAccess access; + public static synchronized void setFontAccess(FontAccess acc) { + if (access != null) { + throw new InternalError("Attempt to set FontAccessor twice"); + } + access = acc; } - public UIBorder(String id, Border b) { - super(id, b); + public static synchronized FontAccess getFontAccess() { + return access; } - public Border getBorder() { - return super.getValue(); - } - - public void setBorder(Border b) { - Border old = getBorder(); - super.setValue(b); - firePropertyChange("border", old, b); - } + public abstract Font2D getFont2D(Font f); + public abstract void setFont2D(Font f, Font2DHandle h); + public abstract void setCreatedFont(Font f); + public abstract boolean isCreatedFont(Font f); } diff --git a/jdk/src/share/classes/sun/font/FontDesignMetrics.java b/jdk/src/share/classes/sun/font/FontDesignMetrics.java index d594f11b259..929c0d21dd8 100644 --- a/jdk/src/share/classes/sun/font/FontDesignMetrics.java +++ b/jdk/src/share/classes/sun/font/FontDesignMetrics.java @@ -261,8 +261,9 @@ public final class FontDesignMetrics extends FontMetrics { * Note that currently Swing native L&F composites are not handled * by this code as they use the metrics of the physical anyway. */ - if (FontManager.maybeUsingAlternateCompositeFonts() && - FontManager.getFont2D(font) instanceof CompositeFont) { + SunFontManager fm = SunFontManager.getInstance(); + if (fm.maybeUsingAlternateCompositeFonts() && + FontUtilities.getFont2D(font) instanceof CompositeFont) { return new FontDesignMetrics(font, frc); } @@ -353,7 +354,7 @@ public final class FontDesignMetrics extends FontMetrics { private void initMatrixAndMetrics() { - Font2D font2D = FontManager.getFont2D(font); + Font2D font2D = FontUtilities.getFont2D(font); fontStrike = font2D.getStrike(font, frc); StrikeMetrics metrics = fontStrike.getFontMetrics(); this.ascent = metrics.getAscent(); @@ -473,7 +474,7 @@ public final class FontDesignMetrics extends FontMetrics { char ch = str.charAt(i); if (ch < 0x100) { width += getLatinCharWidth(ch); - } else if (FontManager.isNonSimpleChar(ch)) { + } else if (FontUtilities.isNonSimpleChar(ch)) { width = new TextLayout(str, font, frc).getAdvance(); break; } else { @@ -504,7 +505,7 @@ public final class FontDesignMetrics extends FontMetrics { char ch = data[i]; if (ch < 0x100) { width += getLatinCharWidth(ch); - } else if (FontManager.isNonSimpleChar(ch)) { + } else if (FontUtilities.isNonSimpleChar(ch)) { String str = new String(data, off, len); width = new TextLayout(str, font, frc).getAdvance(); break; diff --git a/jdk/src/share/classes/sun/font/FontFamily.java b/jdk/src/share/classes/sun/font/FontFamily.java index 3f0d5fd601d..ca2d1bfa6ab 100644 --- a/jdk/src/share/classes/sun/font/FontFamily.java +++ b/jdk/src/share/classes/sun/font/FontFamily.java @@ -107,8 +107,9 @@ public class FontFamily { public void setFont(Font2D font, int style) { if (font.getRank() > familyRank) { - if (FontManager.logging) { - FontManager.logger.warning("Rejecting adding " + font + + if (FontUtilities.isLogging()) { + FontUtilities.getLogger() + .warning("Rejecting adding " + font + " of lower rank " + font.getRank() + " to family " + this + " of rank " + familyRank); diff --git a/jdk/src/share/classes/sun/font/FontManager.java b/jdk/src/share/classes/sun/font/FontManager.java index 6ac89628e2a..f79adfc13cf 100644 --- a/jdk/src/share/classes/sun/font/FontManager.java +++ b/jdk/src/share/classes/sun/font/FontManager.java @@ -22,3831 +22,124 @@ * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ - package sun.font; import java.awt.Font; -import java.awt.GraphicsEnvironment; import java.awt.FontFormatException; import java.io.File; -import java.io.FilenameFilter; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; import java.util.Locale; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.StringTokenizer; import java.util.TreeMap; -import java.util.Vector; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; + import javax.swing.plaf.FontUIResource; -import sun.awt.AppContext; -import sun.awt.FontConfiguration; -import sun.awt.SunHints; -import sun.awt.SunToolkit; -import sun.java2d.HeadlessGraphicsEnvironment; -import sun.java2d.SunGraphicsEnvironment; - -import java.awt.geom.GeneralPath; -import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; - -import java.lang.reflect.Constructor; - -import sun.java2d.Disposer; - -/* +/** * Interface between Java Fonts (java.awt.Font) and the underlying * font files/native font resources and the Java and native font scalers. */ -public final class FontManager { +public interface FontManager { - public static final int FONTFORMAT_NONE = -1; - public static final int FONTFORMAT_TRUETYPE = 0; - public static final int FONTFORMAT_TYPE1 = 1; - public static final int FONTFORMAT_T2K = 2; - public static final int FONTFORMAT_TTC = 3; - public static final int FONTFORMAT_COMPOSITE = 4; - public static final int FONTFORMAT_NATIVE = 5; - - public static final int NO_FALLBACK = 0; - public static final int PHYSICAL_FALLBACK = 1; - public static final int LOGICAL_FALLBACK = 2; - - public static final int QUADPATHTYPE = 1; - public static final int CUBICPATHTYPE = 2; - - /* Pool of 20 font file channels chosen because some UTF-8 locale - * composite fonts can use up to 16 platform fonts (including the - * Lucida fall back). This should prevent channel thrashing when - * dealing with one of these fonts. - * The pool array stores the fonts, rather than directly referencing - * the channels, as the font needs to do the open/close work. - */ - private static final int CHANNELPOOLSIZE = 20; - private static int lastPoolIndex = 0; - private static FileFont fontFileCache[] = new FileFont[CHANNELPOOLSIZE]; - - /* Need to implement a simple linked list scheme for fast - * traversal and lookup. - * Also want to "fast path" dialog so there's minimal overhead. - */ - /* There are at exactly 20 composite fonts: 5 faces (but some are not - * usually different), in 4 styles. The array may be auto-expanded - * later if more are needed, eg for user-defined composites or locale - * variants. - */ - private static int maxCompFont = 0; - private static CompositeFont [] compFonts = new CompositeFont[20]; - private static ConcurrentHashMap - compositeFonts = new ConcurrentHashMap(); - private static ConcurrentHashMap - physicalFonts = new ConcurrentHashMap(); - private static ConcurrentHashMap - registeredFontFiles = new ConcurrentHashMap(); - - /* given a full name find the Font. Remind: there's duplication - * here in that this contains the content of compositeFonts + - * physicalFonts. - */ - private static ConcurrentHashMap - fullNameToFont = new ConcurrentHashMap(); - - /* TrueType fonts have localised names. Support searching all - * of these before giving up on a name. - */ - private static HashMap localeFullNamesToFont; - - private static PhysicalFont defaultPhysicalFont; - - /* deprecated, unsupported hack - actually invokes a bug! */ - private static boolean usePlatformFontMetrics = false; - - public static Logger logger = null; - public static boolean logging; - static boolean longAddresses; - static String osName; - static boolean useT2K; - static boolean isWindows; - static boolean isSolaris; - public static boolean isSolaris8; // needed to check for JA wavedash fix. - public static boolean isSolaris9; // needed to check for songti font usage. - private static boolean loaded1dot0Fonts = false; - static SunGraphicsEnvironment sgEnv; - static boolean loadedAllFonts = false; - static boolean loadedAllFontFiles = false; - static TrueTypeFont eudcFont; - static HashMap jreFontMap; - static HashSet jreLucidaFontFiles; - static String[] jreOtherFontFiles; - static boolean noOtherJREFontFiles = false; // initial assumption. - static boolean fontConfigFailed = false; - - /* Used to indicate required return type from toArray(..); */ - private static String[] STR_ARRAY = new String[0]; - - private static void initJREFontMap() { - - /* Key is familyname+style value as an int. - * Value is filename containing the font. - * If no mapping exists, it means there is no font file for the style - * If the mapping exists but the file doesn't exist in the deferred - * list then it means its not installed. - * This looks like a lot of code and strings but if it saves even - * a single file being opened at JRE start-up there's a big payoff. - * Lucida Sans is probably the only important case as the others - * are rarely used. Consider removing the other mappings if there's - * no evidence they are useful in practice. - */ - jreFontMap = new HashMap(); - jreLucidaFontFiles = new HashSet(); - if (SunGraphicsEnvironment.isOpenJDK()) { - return; - } - /* Lucida Sans Family */ - jreFontMap.put("lucida sans0", "LucidaSansRegular.ttf"); - jreFontMap.put("lucida sans1", "LucidaSansDemiBold.ttf"); - /* Lucida Sans full names (map Bold and DemiBold to same file) */ - jreFontMap.put("lucida sans regular0", "LucidaSansRegular.ttf"); - jreFontMap.put("lucida sans regular1", "LucidaSansDemiBold.ttf"); - jreFontMap.put("lucida sans bold1", "LucidaSansDemiBold.ttf"); - jreFontMap.put("lucida sans demibold1", "LucidaSansDemiBold.ttf"); - - /* Lucida Sans Typewriter Family */ - jreFontMap.put("lucida sans typewriter0", - "LucidaTypewriterRegular.ttf"); - jreFontMap.put("lucida sans typewriter1", "LucidaTypewriterBold.ttf"); - /* Typewriter full names (map Bold and DemiBold to same file) */ - jreFontMap.put("lucida sans typewriter regular0", - "LucidaTypewriter.ttf"); - jreFontMap.put("lucida sans typewriter regular1", - "LucidaTypewriterBold.ttf"); - jreFontMap.put("lucida sans typewriter bold1", - "LucidaTypewriterBold.ttf"); - jreFontMap.put("lucida sans typewriter demibold1", - "LucidaTypewriterBold.ttf"); - - /* Lucida Bright Family */ - jreFontMap.put("lucida bright0", "LucidaBrightRegular.ttf"); - jreFontMap.put("lucida bright1", "LucidaBrightDemiBold.ttf"); - jreFontMap.put("lucida bright2", "LucidaBrightItalic.ttf"); - jreFontMap.put("lucida bright3", "LucidaBrightDemiItalic.ttf"); - /* Lucida Bright full names (map Bold and DemiBold to same file) */ - jreFontMap.put("lucida bright regular0", "LucidaBrightRegular.ttf"); - jreFontMap.put("lucida bright regular1", "LucidaBrightDemiBold.ttf"); - jreFontMap.put("lucida bright regular2", "LucidaBrightItalic.ttf"); - jreFontMap.put("lucida bright regular3", "LucidaBrightDemiItalic.ttf"); - jreFontMap.put("lucida bright bold1", "LucidaBrightDemiBold.ttf"); - jreFontMap.put("lucida bright bold3", "LucidaBrightDemiItalic.ttf"); - jreFontMap.put("lucida bright demibold1", "LucidaBrightDemiBold.ttf"); - jreFontMap.put("lucida bright demibold3","LucidaBrightDemiItalic.ttf"); - jreFontMap.put("lucida bright italic2", "LucidaBrightItalic.ttf"); - jreFontMap.put("lucida bright italic3", "LucidaBrightDemiItalic.ttf"); - jreFontMap.put("lucida bright bold italic3", - "LucidaBrightDemiItalic.ttf"); - jreFontMap.put("lucida bright demibold italic3", - "LucidaBrightDemiItalic.ttf"); - for (String ffile : jreFontMap.values()) { - jreLucidaFontFiles.add(ffile); - } - } - - static { - - if (SunGraphicsEnvironment.debugFonts) { - logger = Logger.getLogger("sun.java2d", null); - logging = logger.getLevel() != Level.OFF; - } - initJREFontMap(); - - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - FontManagerNativeLibrary.load(); - - // JNI throws an exception if a class/method/field is not found, - // so there's no need to do anything explicit here. - initIDs(); - - switch (StrikeCache.nativeAddressSize) { - case 8: longAddresses = true; break; - case 4: longAddresses = false; break; - default: throw new RuntimeException("Unexpected address size"); - } - - osName = System.getProperty("os.name", "unknownOS"); - isSolaris = osName.startsWith("SunOS"); - - String t2kStr = System.getProperty("sun.java2d.font.scaler"); - if (t2kStr != null) { - useT2K = "t2k".equals(t2kStr); - } - if (isSolaris) { - String version = System.getProperty("os.version", "unk"); - isSolaris8 = version.equals("5.8"); - isSolaris9 = version.equals("5.9"); - } else { - isWindows = osName.startsWith("Windows"); - if (isWindows) { - String eudcFile = - SunGraphicsEnvironment.eudcFontFileName; - if (eudcFile != null) { - try { - eudcFont = new TrueTypeFont(eudcFile, null, 0, - true); - } catch (FontFormatException e) { - } - } - String prop = - System.getProperty("java2d.font.usePlatformFont"); - if (("true".equals(prop) || getPlatformFontVar())) { - usePlatformFontMetrics = true; - System.out.println("Enabling platform font metrics for win32. This is an unsupported option."); - System.out.println("This yields incorrect composite font metrics as reported by 1.1.x releases."); - System.out.println("It is appropriate only for use by applications which do not use any Java 2"); - System.out.println("functionality. This property will be removed in a later release."); - } - } - } - return null; - } - }); - } - - /* Initialise ptrs used by JNI methods */ - private static native void initIDs(); - - public static void addToPool(FileFont font) { - - FileFont fontFileToClose = null; - int freeSlot = -1; - - synchronized (fontFileCache) { - /* Avoid duplicate entries in the pool, and don't close() it, - * since this method is called only from within open(). - * Seeing a duplicate is most likely to happen if the thread - * was interrupted during a read, forcing perhaps repeated - * close and open calls and it eventually it ends up pointing - * at the same slot. - */ - for (int i=0;i= 0) { - fontFileCache[freeSlot] = font; - return; - } else { - /* replace with new font. */ - fontFileToClose = fontFileCache[lastPoolIndex]; - fontFileCache[lastPoolIndex] = font; - /* lastPoolIndex is updated so that the least recently opened - * file will be closed next. - */ - lastPoolIndex = (lastPoolIndex+1) % CHANNELPOOLSIZE; - } - } - /* Need to close the font file outside of the synchronized block, - * since its possible some other thread is in an open() call on - * this font file, and could be holding its lock and the pool lock. - * Releasing the pool lock allows that thread to continue, so it can - * then release the lock on this font, allowing the close() call - * below to proceed. - * Also, calling close() is safe because any other thread using - * the font we are closing() synchronizes all reading, so we - * will not close the file while its in use. - */ - if (fontFileToClose != null) { - fontFileToClose.close(); - } - } - - /* - * In the normal course of events, the pool of fonts can remain open - * ready for quick access to their contents. The pool is sized so - * that it is not an excessive consumer of system resources whilst - * facilitating performance by providing ready access to the most - * recently used set of font files. - * The only reason to call removeFromPool(..) is for a Font that - * you want to to have GC'd. Currently this would apply only to fonts - * created with java.awt.Font.createFont(..). - * In this case, the caller is expected to have arranged for the file - * to be closed. - * REMIND: consider how to know when a createFont created font should - * be closed. - */ - public static void removeFromPool(FileFont font) { - synchronized (fontFileCache) { - for (int i=0; i - altNameCache) { - - CompositeFont cf = new CompositeFont(compositeName, - componentFileNames, - componentNames, - numMetricsSlots, - exclusionRanges, - exclusionMaxIndex, defer); - /* if the cache has an existing composite for this case, make - * its handle point to this new font. - * This ensures that when the altNameCache that is passed in - * is the global mapNameCache - ie we are running as an application - - * that any statically created java.awt.Font instances which already - * have a Font2D instance will have that re-directed to the new Font - * on subsequent uses. This is particularly important for "the" - * default font instance, or similar cases where a UI toolkit (eg - * Swing) has cached a java.awt.Font. Note that if Swing is using - * a custom composite APIs which update the standard composites have - * no effect - this is typically the case only when using the Windows - * L&F where these APIs would conflict with that L&F anyway. - */ - Font2D oldFont = (Font2D) - altNameCache.get(compositeName.toLowerCase(Locale.ENGLISH)); - if (oldFont instanceof CompositeFont) { - oldFont.handle.font2D = cf; - } - altNameCache.put(compositeName.toLowerCase(Locale.ENGLISH), cf); - } - - private static void addCompositeToFontList(CompositeFont f, int rank) { - - if (logging) { - logger.info("Add to Family "+ f.familyName + - ", Font " + f.fullName + " rank="+rank); - } - f.setRank(rank); - compositeFonts.put(f.fullName, f); - fullNameToFont.put(f.fullName.toLowerCase(Locale.ENGLISH), f); - - FontFamily family = FontFamily.getFamily(f.familyName); - if (family == null) { - family = new FontFamily(f.familyName, true, rank); - } - family.setFont(f, f.style); - } - - /* - * Systems may have fonts with the same name. - * We want to register only one of such fonts (at least until - * such time as there might be APIs which can accommodate > 1). - * Rank is 1) font configuration fonts, 2) JRE fonts, 3) OT/TT fonts, - * 4) Type1 fonts, 5) native fonts. - * - * If the new font has the same name as the old font, the higher - * ranked font gets added, replacing the lower ranked one. - * If the fonts are of equal rank, then make a special case of - * font configuration rank fonts, which are on closer inspection, - * OT/TT fonts such that the larger font is registered. This is - * a heuristic since a font may be "larger" in the sense of more - * code points, or be a larger "file" because it has more bitmaps. - * So it is possible that using filesize may lead to less glyphs, and - * using glyphs may lead to lower quality display. Probably number - * of glyphs is the ideal, but filesize is information we already - * have and is good enough for the known cases. - * Also don't want to register fonts that match JRE font families - * but are coming from a source other than the JRE. - * This will ensure that we will algorithmically style the JRE - * plain font and get the same set of glyphs for all styles. - * - * Note that this method returns a value - * if it returns the same object as its argument that means this - * font was newly registered. - * If it returns a different object it means this font already exists, - * and you should use that one. - * If it returns null means this font was not registered and none - * in that name is registered. The caller must find a substitute - */ - private static PhysicalFont addToFontList(PhysicalFont f, int rank) { - - String fontName = f.fullName; - String familyName = f.familyName; - if (fontName == null || "".equals(fontName)) { - return null; - } - if (compositeFonts.containsKey(fontName)) { - /* Don't register any font that has the same name as a composite */ - return null; - } - f.setRank(rank); - if (!physicalFonts.containsKey(fontName)) { - if (logging) { - logger.info("Add to Family "+familyName + - ", Font " + fontName + " rank="+rank); - } - physicalFonts.put(fontName, f); - FontFamily family = FontFamily.getFamily(familyName); - if (family == null) { - family = new FontFamily(familyName, false, rank); - family.setFont(f, f.style); - } else if (family.getRank() >= rank) { - family.setFont(f, f.style); - } - fullNameToFont.put(fontName.toLowerCase(Locale.ENGLISH), f); - return f; - } else { - PhysicalFont newFont = f; - PhysicalFont oldFont = physicalFonts.get(fontName); - if (oldFont == null) { - return null; - } - /* If the new font is of an equal or higher rank, it is a - * candidate to replace the current one, subject to further tests. - */ - if (oldFont.getRank() >= rank) { - - /* All fonts initialise their mapper when first - * used. If the mapper is non-null then this font - * has been accessed at least once. In that case - * do not replace it. This may be overly stringent, - * but its probably better not to replace a font that - * someone is already using without a compelling reason. - * Additionally the primary case where it is known - * this behaviour is important is in certain composite - * fonts, and since all the components of a given - * composite are usually initialised together this - * is unlikely. For this to be a problem, there would - * have to be a case where two different composites used - * different versions of the same-named font, and they - * were initialised and used at separate times. - * In that case we continue on and allow the new font to - * be installed, but replaceFont will continue to allow - * the original font to be used in Composite fonts. - */ - if (oldFont.mapper != null && rank > Font2D.FONT_CONFIG_RANK) { - return oldFont; - } - - /* Normally we require a higher rank to replace a font, - * but as a special case, if the two fonts are the same rank, - * and are instances of TrueTypeFont we want the - * more complete (larger) one. - */ - if (oldFont.getRank() == rank) { - if (oldFont instanceof TrueTypeFont && - newFont instanceof TrueTypeFont) { - TrueTypeFont oldTTFont = (TrueTypeFont)oldFont; - TrueTypeFont newTTFont = (TrueTypeFont)newFont; - if (oldTTFont.fileSize >= newTTFont.fileSize) { - return oldFont; - } - } else { - return oldFont; - } - } - /* Don't replace ever JRE fonts. - * This test is in case a font configuration references - * a Lucida font, which has been mapped to a Lucida - * from the host O/S. The assumption here is that any - * such font configuration file is probably incorrect, or - * the host O/S version is for the use of AWT. - * In other words if we reach here, there's a possible - * problem with our choice of font configuration fonts. - */ - if (oldFont.platName.startsWith( - SunGraphicsEnvironment.jreFontDirName)) { - if (logging) { - logger.warning("Unexpected attempt to replace a JRE " + - " font " + fontName + " from " + - oldFont.platName + - " with " + newFont.platName); - } - return oldFont; - } - - if (logging) { - logger.info("Replace in Family " + familyName + - ",Font " + fontName + " new rank="+rank + - " from " + oldFont.platName + - " with " + newFont.platName); - } - replaceFont(oldFont, newFont); - physicalFonts.put(fontName, newFont); - fullNameToFont.put(fontName.toLowerCase(Locale.ENGLISH), - newFont); - - FontFamily family = FontFamily.getFamily(familyName); - if (family == null) { - family = new FontFamily(familyName, false, rank); - family.setFont(newFont, newFont.style); - } else if (family.getRank() >= rank) { - family.setFont(newFont, newFont.style); - } - return newFont; - } else { - return oldFont; - } - } - } - - public static Font2D[] getRegisteredFonts() { - PhysicalFont[] physFonts = getPhysicalFonts(); - int mcf = maxCompFont; /* for MT-safety */ - Font2D[] regFonts = new Font2D[physFonts.length+mcf]; - System.arraycopy(compFonts, 0, regFonts, 0, mcf); - System.arraycopy(physFonts, 0, regFonts, mcf, physFonts.length); - return regFonts; - } - - public static PhysicalFont[] getPhysicalFonts() { - return physicalFonts.values().toArray(new PhysicalFont[0]); - } - - - /* The class FontRegistrationInfo is used when a client says not - * to register a font immediately. This mechanism is used to defer - * initialisation of all the components of composite fonts at JRE - * start-up. The CompositeFont class is "aware" of this and when it - * is first used it asks for the registration of its components. - * Also in the event that any physical font is requested the - * deferred fonts are initialised before triggering a search of the - * system. - * Two maps are used. One to track the deferred fonts. The - * other to track the fonts that have been initialised through this - * mechanism. - */ - - private static final class FontRegistrationInfo { - - String fontFilePath; - String[] nativeNames; - int fontFormat; - boolean javaRasterizer; - int fontRank; - - FontRegistrationInfo(String fontPath, String[] names, int format, - boolean useJavaRasterizer, int rank) { - this.fontFilePath = fontPath; - this.nativeNames = names; - this.fontFormat = format; - this.javaRasterizer = useJavaRasterizer; - this.fontRank = rank; - } - } - - private static final ConcurrentHashMap - deferredFontFiles = - new ConcurrentHashMap(); - private static final ConcurrentHashMap - initialisedFonts = new ConcurrentHashMap(); - - /* Remind: possibly enhance initialiseDeferredFonts() to be - * optionally given a name and a style and it could stop when it - * finds that font - but this would be a problem if two of the - * fonts reference the same font face name (cf the Solaris - * euro fonts). - */ - public static synchronized void initialiseDeferredFonts() { - for (String fileName : deferredFontFiles.keySet()) { - initialiseDeferredFont(fileName); - } - } - - public static synchronized void registerDeferredJREFonts(String jreDir) { - for (FontRegistrationInfo info : deferredFontFiles.values()) { - if (info.fontFilePath != null && - info.fontFilePath.startsWith(jreDir)) { - initialiseDeferredFont(info.fontFilePath); - } - } - } - - /* We keep a map of the files which contain the Lucida fonts so we - * don't need to search for them. - * But since we know what fonts these files contain, we can also avoid - * opening them to look for a font name we don't recognise - see - * findDeferredFont(). - * For typical cases where the font isn't a JRE one the overhead is - * this method call, HashMap.get() and null reference test, then - * a boolean test of noOtherJREFontFiles. - */ - private static PhysicalFont findJREDeferredFont(String name, int style) { - - PhysicalFont physicalFont; - String nameAndStyle = name.toLowerCase(Locale.ENGLISH) + style; - String fileName = jreFontMap.get(nameAndStyle); - if (fileName != null) { - initSGEnv(); /* ensure jreFontDirName is initialised */ - fileName = SunGraphicsEnvironment.jreFontDirName + - File.separator + fileName; - if (deferredFontFiles.get(fileName) != null) { - physicalFont = initialiseDeferredFont(fileName); - if (physicalFont != null && - (physicalFont.getFontName(null).equalsIgnoreCase(name) || - physicalFont.getFamilyName(null).equalsIgnoreCase(name)) - && physicalFont.style == style) { - return physicalFont; - } - } - } - - /* Iterate over the deferred font files looking for any in the - * jre directory that we didn't recognise, open each of these. - * In almost all installations this will quickly fall through - * because only the Lucidas will be present and jreOtherFontFiles - * will be empty. - * noOtherJREFontFiles is used so we can skip this block as soon - * as its determined that its not needed - almost always after the - * very first time through. - */ - if (noOtherJREFontFiles) { - return null; - } - synchronized (jreLucidaFontFiles) { - if (jreOtherFontFiles == null) { - HashSet otherFontFiles = new HashSet(); - for (String deferredFile : deferredFontFiles.keySet()) { - File file = new File(deferredFile); - String dir = file.getParent(); - String fname = file.getName(); - /* skip names which aren't absolute, aren't in the JRE - * directory, or are known Lucida fonts. - */ - if (dir == null || - !dir.equals(SunGraphicsEnvironment.jreFontDirName) || - jreLucidaFontFiles.contains(fname)) { - continue; - } - otherFontFiles.add(deferredFile); - } - jreOtherFontFiles = otherFontFiles.toArray(STR_ARRAY); - if (jreOtherFontFiles.length == 0) { - noOtherJREFontFiles = true; - } - } - - for (int i=0; i fontToFileMap, - HashMap fontToFamilyNameMap, - HashMap> - familyToFontListMap, - Locale locale); - - /* Obtained from Platform APIs (windows only) - * Map from lower-case font full name to basename of font file. - * Eg "arial bold" -> ARIALBD.TTF. - * For TTC files, there is a mapping for each font in the file. - */ - private static HashMap fontToFileMap = null; - - /* Obtained from Platform APIs (windows only) - * Map from lower-case font full name to the name of its font family - * Eg "arial bold" -> "Arial" - */ - private static HashMap fontToFamilyNameMap = null; - - /* Obtained from Platform APIs (windows only) - * Map from a lower-case family name to a list of full names of - * the member fonts, eg: - * "arial" -> ["Arial", "Arial Bold", "Arial Italic","Arial Bold Italic"] - */ - private static HashMap> familyToFontListMap= null; - - /* The directories which contain platform fonts */ - private static String[] pathDirs = null; - - private static boolean haveCheckedUnreferencedFontFiles; - - private static String[] getFontFilesFromPath(boolean noType1) { - final FilenameFilter filter; - if (noType1) { - filter = SunGraphicsEnvironment.ttFilter; - } else { - filter = new SunGraphicsEnvironment.TTorT1Filter(); - } - return (String[])AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - if (pathDirs.length == 1) { - File dir = new File(pathDirs[0]); - String[] files = dir.list(filter); - if (files == null) { - return new String[0]; - } - for (int f=0; f fileList = new ArrayList(); - for (int i = 0; i< pathDirs.length; i++) { - File dir = new File(pathDirs[i]); - String[] files = dir.list(filter); - if (files == null) { - continue; - } - for (int f=0; f

    An instance of this class can be used as the argument of + * AccessController.doPrivileged. + * + *

    The following code retrieves the boolean value of the security + * property named "prop" as a privileged action:

    + * + *

    + * boolean b = java.security.AccessController.doPrivileged
    + *              (new GetBooleanSecurityPropertyAction("prop")).booleanValue();
    + * 
    + * + */ +public class GetBooleanSecurityPropertyAction + implements java.security.PrivilegedAction { + private String theProp; + + /** + * Constructor that takes the name of the security property whose boolean + * value needs to be determined. + * + * @param theProp the name of the security property + */ + public GetBooleanSecurityPropertyAction(String theProp) { + this.theProp = theProp; + } + + /** + * Determines the boolean value of the security property whose name was + * specified in the constructor. + * + * @return the Boolean value of the security property. + */ + public Boolean run() { + boolean b = false; + try { + String value = Security.getProperty(theProp); + b = (value != null) && value.equalsIgnoreCase("true"); + } catch (NullPointerException e) {} + return b; + } +} diff --git a/jdk/src/share/classes/sun/security/ec/ECDHKeyAgreement.java b/jdk/src/share/classes/sun/security/ec/ECDHKeyAgreement.java index 8a61a7b1193..5ed3ffe2b00 100644 --- a/jdk/src/share/classes/sun/security/ec/ECDHKeyAgreement.java +++ b/jdk/src/share/classes/sun/security/ec/ECDHKeyAgreement.java @@ -39,21 +39,6 @@ import javax.crypto.spec.*; */ public final class ECDHKeyAgreement extends KeyAgreementSpi { - // flag indicating whether the native ECC implementation is present - private static boolean implementationPresent = true; - static { - try { - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - System.loadLibrary("sunecc"); - return null; - } - }); - } catch (UnsatisfiedLinkError e) { - implementationPresent = false; - } - } - // private key, if initialized private ECPrivateKey privateKey; @@ -65,16 +50,12 @@ public final class ECDHKeyAgreement extends KeyAgreementSpi { /** * Constructs a new ECDHKeyAgreement. - * - * @exception ProviderException if the native ECC library is unavailable. */ public ECDHKeyAgreement() { - if (!implementationPresent) { - throw new ProviderException("ECDH implementation is not available"); - } } // see JCE spec + @Override protected void engineInit(Key key, SecureRandom random) throws InvalidKeyException { if (!(key instanceof PrivateKey)) { @@ -86,6 +67,7 @@ public final class ECDHKeyAgreement extends KeyAgreementSpi { } // see JCE spec + @Override protected void engineInit(Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { @@ -97,6 +79,7 @@ public final class ECDHKeyAgreement extends KeyAgreementSpi { } // see JCE spec + @Override protected Key engineDoPhase(Key key, boolean lastPhase) throws InvalidKeyException, IllegalStateException { if (privateKey == null) { @@ -130,6 +113,7 @@ public final class ECDHKeyAgreement extends KeyAgreementSpi { } // see JCE spec + @Override protected byte[] engineGenerateSecret() throws IllegalStateException { if ((privateKey == null) || (publicValue == null)) { throw new IllegalStateException("Not initialized correctly"); @@ -150,6 +134,7 @@ public final class ECDHKeyAgreement extends KeyAgreementSpi { } // see JCE spec + @Override protected int engineGenerateSecret(byte[] sharedSecret, int offset) throws IllegalStateException, ShortBufferException { if (offset + secretLen > sharedSecret.length) { @@ -162,6 +147,7 @@ public final class ECDHKeyAgreement extends KeyAgreementSpi { } // see JCE spec + @Override protected SecretKey engineGenerateSecret(String algorithm) throws IllegalStateException, NoSuchAlgorithmException, InvalidKeyException { diff --git a/jdk/src/share/classes/sun/security/ec/ECDSASignature.java b/jdk/src/share/classes/sun/security/ec/ECDSASignature.java index b2bf8936c15..3c9857cd1c3 100644 --- a/jdk/src/share/classes/sun/security/ec/ECDSASignature.java +++ b/jdk/src/share/classes/sun/security/ec/ECDSASignature.java @@ -52,21 +52,6 @@ import sun.security.x509.AlgorithmId; */ abstract class ECDSASignature extends SignatureSpi { - // flag indicating whether the native ECC implementation is present - private static boolean implementationPresent = true; - static { - try { - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - System.loadLibrary("sunecc"); - return null; - } - }); - } catch (UnsatisfiedLinkError e) { - implementationPresent = false; - } - } - // message digest implementation we use private final MessageDigest messageDigest; @@ -88,24 +73,13 @@ abstract class ECDSASignature extends SignatureSpi { * @exception ProviderException if the native ECC library is unavailable. */ ECDSASignature() { - if (!implementationPresent) { - throw new - ProviderException("ECDSA implementation is not available"); - } messageDigest = null; } /** * Constructs a new ECDSASignature. Used by subclasses. - * - * @exception ProviderException if the native ECC library is unavailable. */ ECDSASignature(String digestName) { - if (!implementationPresent) { - throw new - ProviderException("ECDSA implementation is not available"); - } - try { messageDigest = MessageDigest.getInstance(digestName); } catch (NoSuchAlgorithmException e) { @@ -299,8 +273,8 @@ abstract class ECDSASignature extends SignatureSpi { byte[] encodedParams = ECParameters.encodeParameters(params); // DER OID int keySize = params.getCurve().getField().getFieldSize(); - // seed is twice the key size (in bytes) - byte[] seed = new byte[((keySize + 7) >> 3) * 2]; + // seed is twice the key size (in bytes) plus 1 + byte[] seed = new byte[(((keySize + 7) >> 3) + 1) * 2]; if (random == null) { random = JCAUtil.getSecureRandom(); } @@ -356,6 +330,7 @@ abstract class ECDSASignature extends SignatureSpi { // Convert the concatenation of R and S into their DER encoding private byte[] encodeSignature(byte[] signature) throws SignatureException { + try { int n = signature.length >> 1; diff --git a/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java b/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java index af98de60b8b..99b82521293 100644 --- a/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java +++ b/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java @@ -46,20 +46,6 @@ import sun.security.jca.JCAUtil; */ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi { - // flag indicating whether the native ECC implementation is present - private static boolean implementationPresent = true; - static { - try { - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - System.loadLibrary("sunecc"); - return null; - } - }); - } catch (UnsatisfiedLinkError e) { - implementationPresent = false; - } - } private static final int KEY_SIZE_MIN = 112; // min bits (see ecc_impl.h) private static final int KEY_SIZE_MAX = 571; // max bits (see ecc_impl.h) private static final int KEY_SIZE_DEFAULT = 256; @@ -75,13 +61,8 @@ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi { /** * Constructs a new ECKeyPairGenerator. - * - * @exception ProviderException if the native ECC library is unavailable. */ public ECKeyPairGenerator() { - if (!implementationPresent) { - throw new ProviderException("EC implementation is not available"); - } // initialize to default in case the app does not call initialize() initialize(KEY_SIZE_DEFAULT, null); } @@ -133,8 +114,8 @@ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi { byte[] encodedParams = ECParameters.encodeParameters((ECParameterSpec)params); - // seed is twice the key size (in bytes) - byte[] seed = new byte[2 * ((keySize + 7) >> 3)]; + // seed is twice the key size (in bytes) plus 1 + byte[] seed = new byte[(((keySize + 7) >> 3) + 1) * 2]; if (random == null) { random = JCAUtil.getSecureRandom(); } diff --git a/jdk/src/share/classes/sun/security/ec/SunEC.java b/jdk/src/share/classes/sun/security/ec/SunEC.java index 49223ca37b2..69afe5bf352 100644 --- a/jdk/src/share/classes/sun/security/ec/SunEC.java +++ b/jdk/src/share/classes/sun/security/ec/SunEC.java @@ -39,7 +39,10 @@ import sun.security.action.PutAllAction; * via JNI to a C++ wrapper class which in turn calls C functions. * The Java classes are packaged into the signed sunec.jar in the JRE * extensions directory and the C++ and C functions are packaged into - * libsunecc.so or sunecc.dll in the JRE native libraries directory. + * libsunec.so or sunec.dll in the JRE native libraries directory. + * If the native library is not present then this provider is registered + * with support for fewer ECC algorithms (KeyPairGenerator, Signature and + * KeyAgreement are omitted). * * @since 1.7 */ @@ -47,6 +50,22 @@ public final class SunEC extends Provider { private static final long serialVersionUID = -2279741672933606418L; + // flag indicating whether the full EC implementation is present + // (when native library is absent then fewer EC algorithms are available) + private static boolean useFullImplementation = true; + static { + try { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { + System.loadLibrary("sunec"); // check for native library + return null; + } + }); + } catch (UnsatisfiedLinkError e) { + useFullImplementation = false; + } + } + public SunEC() { super("SunEC", 1.7d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)"); @@ -54,10 +73,10 @@ public final class SunEC extends Provider { // the provider. Otherwise, create a temporary map and use a // doPrivileged() call at the end to transfer the contents if (System.getSecurityManager() == null) { - SunECEntries.putEntries(this); + SunECEntries.putEntries(this, useFullImplementation); } else { Map map = new HashMap(); - SunECEntries.putEntries(map); + SunECEntries.putEntries(map, useFullImplementation); AccessController.doPrivileged(new PutAllAction(this, map)); } } diff --git a/jdk/src/share/classes/sun/security/ec/SunECEntries.java b/jdk/src/share/classes/sun/security/ec/SunECEntries.java index 759d3007e85..58e99121a25 100644 --- a/jdk/src/share/classes/sun/security/ec/SunECEntries.java +++ b/jdk/src/share/classes/sun/security/ec/SunECEntries.java @@ -38,7 +38,93 @@ final class SunECEntries { // empty } - static void putEntries(Map map) { + static void putEntries(Map map, + boolean useFullImplementation) { + + /* + * Key Factory engine + */ + map.put("KeyFactory.EC", "sun.security.ec.ECKeyFactory"); + map.put("Alg.Alias.KeyFactory.EllipticCurve", "EC"); + + map.put("KeyFactory.EC ImplementedIn", "Software"); + + /* + * Algorithm Parameter engine + */ + map.put("AlgorithmParameters.EC", "sun.security.ec.ECParameters"); + map.put("Alg.Alias.AlgorithmParameters.EllipticCurve", "EC"); + + map.put("AlgorithmParameters.EC KeySize", "256"); + + map.put("AlgorithmParameters.EC ImplementedIn", "Software"); + + map.put("AlgorithmParameters.EC SupportedCurves", + + // A list comprising lists of curve names and object identifiers. + // '[' ( ',' )+ ']' '|' + + // SEC 2 prime curves + "[secp112r1,1.3.132.0.6]|" + + "[secp112r2,1.3.132.0.7]|" + + "[secp128r1,1.3.132.0.28]|" + + "[secp128r2,1.3.132.0.29]|" + + "[secp160k1,1.3.132.0.9]|" + + "[secp160r1,1.3.132.0.8]|" + + "[secp160r2,1.3.132.0.30]|" + + "[secp192k1,1.3.132.0.31]|" + + "[secp192r1,NIST P-192,X9.62 prime192v1,1.2.840.10045.3.1.1]|" + + "[secp224k1,1.3.132.0.32]|" + + "[secp224r1,NIST P-224,1.3.132.0.33]|" + + "[secp256k1,1.3.132.0.10]|" + + "[secp256r1,NIST P-256,X9.62 prime256v1,1.2.840.10045.3.1.7]|" + + "[secp384r1,NIST P-384,1.3.132.0.34]|" + + "[secp521r1,NIST P-521,1.3.132.0.35]|" + + + // ANSI X9.62 prime curves + "[X9.62 prime192v2,1.2.840.10045.3.1.2]|" + + "[X9.62 prime192v3,1.2.840.10045.3.1.3]|" + + "[X9.62 prime239v1,1.2.840.10045.3.1.4]|" + + "[X9.62 prime239v2,1.2.840.10045.3.1.5]|" + + "[X9.62 prime239v3,1.2.840.10045.3.1.6]|" + + + // SEC 2 binary curves + "[sect113r1,1.3.132.0.4]|" + + "[sect113r2,1.3.132.0.5]|" + + "[sect131r1,1.3.132.0.22]|" + + "[sect131r2,1.3.132.0.23]|" + + "[sect163k1,NIST K-163,1.3.132.0.1]|" + + "[sect163r1,1.3.132.0.2]|" + + "[sect163r2,NIST B-163,1.3.132.0.15]|" + + "[sect193r1,1.3.132.0.24]|" + + "[sect193r2,1.3.132.0.25]|" + + "[sect233k1,NIST K-233,1.3.132.0.26]|" + + "[sect233r1,NIST B-233,1.3.132.0.27]|" + + "[sect239k1,1.3.132.0.3]|" + + "[sect283k1,NIST K-283,1.3.132.0.16]|" + + "[sect283r1,NIST B-283,1.3.132.0.17]|" + + "[sect409k1,NIST K-409,1.3.132.0.36]|" + + "[sect409r1,NIST B-409,1.3.132.0.37]|" + + "[sect571k1,NIST K-571,1.3.132.0.38]|" + + "[sect571r1,NIST B-571,1.3.132.0.39]|" + + + // ANSI X9.62 binary curves + "[X9.62 c2tnb191v1,1.2.840.10045.3.0.5]|" + + "[X9.62 c2tnb191v2,1.2.840.10045.3.0.6]|" + + "[X9.62 c2tnb191v3,1.2.840.10045.3.0.7]|" + + "[X9.62 c2tnb239v1,1.2.840.10045.3.0.11]|" + + "[X9.62 c2tnb239v2,1.2.840.10045.3.0.12]|" + + "[X9.62 c2tnb239v3,1.2.840.10045.3.0.13]|" + + "[X9.62 c2tnb359v1,1.2.840.10045.3.0.18]|" + + "[X9.62 c2tnb431r1,1.2.840.10045.3.0.20]"); + + /* + * Register the algorithms below only when the full ECC implementation + * is available + */ + if (!useFullImplementation) { + return; + } /* * Signature engines @@ -62,48 +148,31 @@ final class SunECEntries { map.put("Signature.SHA384withECDSA SupportedKeyClasses", ecKeyClasses); map.put("Signature.SHA512withECDSA SupportedKeyClasses", ecKeyClasses); + map.put("Signature.SHA1withECDSA KeySize", "256"); + + map.put("Signature.NONEwithECDSA ImplementedIn", "Software"); + map.put("Signature.SHA1withECDSA ImplementedIn", "Software"); + map.put("Signature.SHA256withECDSA ImplementedIn", "Software"); + map.put("Signature.SHA384withECDSA ImplementedIn", "Software"); + map.put("Signature.SHA512withECDSA ImplementedIn", "Software"); + /* * Key Pair Generator engine */ map.put("KeyPairGenerator.EC", "sun.security.ec.ECKeyPairGenerator"); map.put("Alg.Alias.KeyPairGenerator.EllipticCurve", "EC"); - /* - * Key Factory engine - */ - map.put("KeyFactory.EC", "sun.security.ec.ECKeyFactory"); - map.put("Alg.Alias.KeyFactory.EllipticCurve", "EC"); + map.put("KeyPairGenerator.EC KeySize", "256"); - /* - * Algorithm Parameter engine - */ - map.put("AlgorithmParameters.EC", "sun.security.ec.ECParameters"); - map.put("Alg.Alias.AlgorithmParameters.EllipticCurve", "EC"); + map.put("KeyPairGenerator.EC ImplementedIn", "Software"); /* * Key Agreement engine */ map.put("KeyAgreement.ECDH", "sun.security.ec.ECDHKeyAgreement"); + map.put("KeyAgreement.ECDH SupportedKeyClasses", ecKeyClasses); - /* - * Key sizes - */ - map.put("Signature.SHA1withECDSA KeySize", "256"); - map.put("KeyPairGenerator.EC KeySize", "256"); - map.put("AlgorithmParameterGenerator.ECDSA KeySize", "256"); - - /* - * Implementation type: software or hardware - */ - map.put("Signature.NONEwithECDSA ImplementedIn", "Software"); - map.put("Signature.SHA1withECDSA ImplementedIn", "Software"); - map.put("Signature.SHA256withECDSA ImplementedIn", "Software"); - map.put("Signature.SHA384withECDSA ImplementedIn", "Software"); - map.put("Signature.SHA512withECDSA ImplementedIn", "Software"); - map.put("KeyPairGenerator.EC ImplementedIn", "Software"); - map.put("KeyFactory.EC ImplementedIn", "Software"); map.put("KeyAgreement.ECDH ImplementedIn", "Software"); - map.put("AlgorithmParameters.EC ImplementedIn", "Software"); } } diff --git a/jdk/src/share/classes/sun/security/krb5/Credentials.java b/jdk/src/share/classes/sun/security/krb5/Credentials.java index 3fde713fd3c..c003a29fa64 100644 --- a/jdk/src/share/classes/sun/security/krb5/Credentials.java +++ b/jdk/src/share/classes/sun/security/krb5/Credentials.java @@ -33,16 +33,11 @@ package sun.security.krb5; import sun.security.krb5.internal.*; import sun.security.krb5.internal.ccache.CredentialsCache; -import java.util.StringTokenizer; import sun.security.krb5.internal.ktab.*; import sun.security.krb5.internal.crypto.EType; import java.io.File; import java.io.IOException; import java.util.Date; -import java.util.Vector; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; import java.net.InetAddress; /** @@ -378,9 +373,9 @@ public class Credentials { KRBError error = ke.getError(); // update salt in PrincipalName - byte[] newSalt = error.getSalt(); - if (newSalt != null && newSalt.length > 0) { - princ.setSalt(new String(newSalt)); + String newSalt = error.getSalt(); + if (newSalt != null && newSalt.length() > 0) { + princ.setSalt(newSalt); } // refresh keys diff --git a/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java b/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java index c493d405f51..fec6998ce3a 100644 --- a/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java +++ b/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java @@ -1,5 +1,5 @@ /* - * Portions Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. + * Portions Copyright 2000-2009 Sun Microsystems, Inc. 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 @@ -56,7 +56,7 @@ public class KrbAsReq extends KrbKdcReq { private boolean PA_ENC_TIMESTAMP_REQUIRED = false; private boolean pa_exists = false; private int pa_etype = 0; - private byte[] pa_salt = null; + private String pa_salt = null; private byte[] pa_s2kparams = null; // default is address-less tickets @@ -88,7 +88,7 @@ public class KrbAsReq extends KrbKdcReq { * with pre-authentication values */ KrbAsReq(PrincipalName principal, EncryptionKey[] keys, - boolean pa_exists, int etype, byte[] salt, byte[] s2kparams) + boolean pa_exists, int etype, String salt, byte[] s2kparams) throws KrbException, IOException { this(keys, // for pre-authentication pa_exists, etype, salt, s2kparams, // pre-auth values @@ -112,7 +112,7 @@ public class KrbAsReq extends KrbKdcReq { } // update with pre-auth info - public void updatePA(int etype, byte[] salt, byte[] params, PrincipalName name) { + public void updatePA(int etype, String salt, byte[] params, PrincipalName name) { // set the pre-auth values pa_exists = true; pa_etype = etype; @@ -120,9 +120,8 @@ public class KrbAsReq extends KrbKdcReq { pa_s2kparams = params; // update salt in PrincipalName - if (salt != null && salt.length > 0) { - String newSalt = new String(salt); - name.setSalt(newSalt); + if (salt != null && salt.length() > 0) { + name.setSalt(salt); if (DEBUG) { System.out.println("Updated salt from pre-auth = " + name.getSalt()); } @@ -161,7 +160,7 @@ public class KrbAsReq extends KrbKdcReq { char[] password, boolean pa_exists, int etype, - byte[] salt, + String salt, byte[] s2kparams, KDCOptions options, PrincipalName cname, @@ -246,7 +245,7 @@ public class KrbAsReq extends KrbKdcReq { EncryptionKey[] keys, boolean pa_exists, int etype, - byte[] salt, + String salt, byte[] s2kparams, KDCOptions options, PrincipalName cname, diff --git a/jdk/src/share/classes/sun/security/krb5/KrbKdcReq.java b/jdk/src/share/classes/sun/security/krb5/KrbKdcReq.java index 259aedd66fa..b915ff99711 100644 --- a/jdk/src/share/classes/sun/security/krb5/KrbKdcReq.java +++ b/jdk/src/share/classes/sun/security/krb5/KrbKdcReq.java @@ -1,5 +1,5 @@ /* - * Portions Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. + * Portions Copyright 2000-2009 Sun Microsystems, Inc. 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 @@ -149,6 +149,11 @@ public abstract class KrbKdcReq { send(realm,tempKdc,useTCP); break; } catch (Exception e) { + if (DEBUG) { + System.out.println(">>> KrbKdcReq send: error trying " + + tempKdc); + e.printStackTrace(System.out); + } savedException = e; } } @@ -179,10 +184,36 @@ public abstract class KrbKdcReq { /* * Get port number for this KDC. */ - StringTokenizer strTok = new StringTokenizer(tempKdc, ":"); - String kdc = strTok.nextToken(); - if (strTok.hasMoreTokens()) { - String portStr = strTok.nextToken(); + String kdc = null; + String portStr = null; + + if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] + int pos = tempKdc.indexOf(']', 1); + if (pos == -1) { + throw new IOException("Illegal KDC: " + tempKdc); + } + kdc = tempKdc.substring(1, pos); + if (pos != tempKdc.length() - 1) { // with port number + if (tempKdc.charAt(pos+1) != ':') { + throw new IOException("Illegal KDC: " + tempKdc); + } + portStr = tempKdc.substring(pos+2); + } + } else { + int colon = tempKdc.indexOf(':'); + if (colon == -1) { // Hostname or IPv4 host only + kdc = tempKdc; + } else { + int nextColon = tempKdc.indexOf(':', colon+1); + if (nextColon > 0) { // >=2 ":", IPv6 with no port + kdc = tempKdc; + } else { // 1 ":", hostname or IPv4 with port + kdc = tempKdc.substring(0, colon); + portStr = tempKdc.substring(colon+1); + } + } + } + if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; diff --git a/jdk/src/share/classes/sun/security/krb5/PrincipalName.java b/jdk/src/share/classes/sun/security/krb5/PrincipalName.java index 3761ffbb469..6705fd63e9a 100644 --- a/jdk/src/share/classes/sun/security/krb5/PrincipalName.java +++ b/jdk/src/share/classes/sun/security/krb5/PrincipalName.java @@ -38,6 +38,7 @@ import java.util.Vector; import java.io.IOException; import java.math.BigInteger; import sun.security.krb5.internal.ccache.CCacheOutputStream; +import sun.security.krb5.internal.util.KerberosString; /** @@ -246,7 +247,7 @@ public class PrincipalName DerValue subSubDer; while(subDer.getData().available() > 0) { subSubDer = subDer.getData().getDerValue(); - v.addElement(subSubDer.getGeneralString()); + v.addElement(new KerberosString(subSubDer).toString()); } if (v.size() > 0) { nameStrings = new String[v.size()]; @@ -554,7 +555,7 @@ public class PrincipalName temp = new DerOutputStream(); DerValue der[] = new DerValue[nameStrings.length]; for (int i = 0; i < nameStrings.length; i++) { - der[i] = new DerValue(DerValue.tag_GeneralString, nameStrings[i]); + der[i] = new KerberosString(nameStrings[i]).toDerValue(); } temp.putSequence(der); bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), temp); diff --git a/jdk/src/share/classes/sun/security/krb5/Realm.java b/jdk/src/share/classes/sun/security/krb5/Realm.java index bf57e7a54ce..7ba959bdcf4 100644 --- a/jdk/src/share/classes/sun/security/krb5/Realm.java +++ b/jdk/src/share/classes/sun/security/krb5/Realm.java @@ -31,11 +31,6 @@ package sun.security.krb5; -import sun.security.krb5.Config; -import sun.security.krb5.PrincipalName; -import sun.security.krb5.KrbException; -import sun.security.krb5.Asn1Exception; -import sun.security.krb5.RealmException; import sun.security.krb5.internal.Krb5; import sun.security.util.*; import java.io.IOException; @@ -43,6 +38,7 @@ import java.util.StringTokenizer; import java.util.Vector; import java.util.Stack; import java.util.EmptyStackException; +import sun.security.krb5.internal.util.KerberosString; /** * Implements the ASN.1 Realm type. @@ -109,7 +105,7 @@ public class Realm implements Cloneable { if (encoding == null) { throw new IllegalArgumentException("encoding can not be null"); } - realm = encoding.getGeneralString(); + realm = new KerberosString(encoding).toString(); if (realm == null || realm.length() == 0) throw new RealmException(Krb5.REALM_NULL); if (!isValidRealmString(realm)) @@ -206,7 +202,7 @@ public class Realm implements Cloneable { */ public byte[] asn1Encode() throws Asn1Exception, IOException { DerOutputStream out = new DerOutputStream(); - out.putGeneralString(this.realm); + out.putDerValue(new KerberosString(this.realm).toDerValue()); return out.toByteArray(); } diff --git a/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo.java b/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo.java index 9790bb8696f..7625a6eb5d9 100644 --- a/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo.java +++ b/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. 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 @@ -28,6 +28,7 @@ package sun.security.krb5.internal; import sun.security.util.*; import sun.security.krb5.Asn1Exception; import java.io.IOException; +import sun.security.krb5.internal.util.KerberosString; /** * Implements the ASN.1 ETYPE-INFO-ENTRY type. @@ -43,7 +44,7 @@ import java.io.IOException; public class ETypeInfo { private int etype; - private byte[] salt = null; + private String salt = null; private static final byte TAG_TYPE = 0; private static final byte TAG_VALUE = 1; @@ -51,21 +52,13 @@ public class ETypeInfo { private ETypeInfo() { } - public ETypeInfo(int etype, byte[] salt) { + public ETypeInfo(int etype, String salt) { this.etype = etype; - if (salt != null) { - this.salt = salt.clone(); - } + this.salt = salt; } public Object clone() { - ETypeInfo etypeInfo = new ETypeInfo(); - etypeInfo.etype = etype; - if (salt != null) { - etypeInfo.salt = new byte[salt.length]; - System.arraycopy(salt, 0, etypeInfo.salt, 0, salt.length); - } - return etypeInfo; + return new ETypeInfo(etype, salt); } /** @@ -94,7 +87,22 @@ public class ETypeInfo { if (encoding.getData().available() > 0) { der = encoding.getData().getDerValue(); if ((der.getTag() & 0x1F) == 0x01) { - this.salt = der.getData().getOctetString(); + byte[] saltBytes = der.getData().getOctetString(); + + // Although salt is defined as an OCTET STRING, it's the + // encoding from of a string. As RFC 4120 says: + // + // "The salt, ..., is also completely unspecified with respect + // to character set and is probably locale-specific". + // + // It's known that this field is using the same encoding as + // KerberosString in most implementations. + + if (KerberosString.MSNAME) { + this.salt = new String(saltBytes, "UTF8"); + } else { + this.salt = new String(saltBytes); + } } } @@ -120,7 +128,11 @@ public class ETypeInfo { if (salt != null) { temp = new DerOutputStream(); - temp.putOctetString(salt); + if (KerberosString.MSNAME) { + temp.putOctetString(salt.getBytes("UTF8")); + } else { + temp.putOctetString(salt.getBytes()); + } bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_VALUE), temp); } @@ -135,8 +147,8 @@ public class ETypeInfo { return etype; } - public byte[] getSalt() { - return ((salt == null) ? null : salt.clone()); + public String getSalt() { + return salt; } } diff --git a/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo2.java b/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo2.java index f1b657116f6..14807745433 100644 --- a/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo2.java +++ b/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo2.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. 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 @@ -28,6 +28,7 @@ package sun.security.krb5.internal; import sun.security.util.*; import sun.security.krb5.Asn1Exception; import java.io.IOException; +import sun.security.krb5.internal.util.KerberosString; /** * Implements the ASN.1 ETYPE-INFO-ENTRY type. @@ -54,11 +55,9 @@ public class ETypeInfo2 { private ETypeInfo2() { } - public ETypeInfo2(int etype, byte[] salt, byte[] s2kparams) { + public ETypeInfo2(int etype, String salt, byte[] s2kparams) { this.etype = etype; - if (salt != null) { - this.saltStr = new String(salt); - } + this.saltStr = salt; if (s2kparams != null) { this.s2kparams = s2kparams.clone(); } @@ -102,7 +101,8 @@ public class ETypeInfo2 { if (encoding.getData().available() > 0) { if ((encoding.getData().peekByte() & 0x1F) == 0x01) { der = encoding.getData().getDerValue(); - this.saltStr = der.getData().getGeneralString(); + this.saltStr = new KerberosString( + der.getData().getDerValue()).toString(); } } @@ -136,7 +136,7 @@ public class ETypeInfo2 { if (saltStr != null) { temp = new DerOutputStream(); - temp.putGeneralString(saltStr); + temp.putDerValue(new KerberosString(saltStr).toDerValue()); bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_VALUE1), temp); } @@ -157,8 +157,8 @@ public class ETypeInfo2 { return etype; } - public byte[] getSalt() { - return ((saltStr == null) ? null : saltStr.getBytes()); + public String getSalt() { + return saltStr; } public byte[] getParams() { diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java index febc959cb80..e7c73181cf7 100644 --- a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java +++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java @@ -1,5 +1,5 @@ /* - * Portions Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. + * Portions Copyright 2000-2009 Sun Microsystems, Inc. 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 @@ -42,6 +42,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.math.BigInteger; import java.util.Arrays; +import sun.security.krb5.internal.util.KerberosString; /** * Implements the ASN.1 KRBError type. * @@ -97,7 +98,7 @@ public class KRBError implements java.io.Serializable { // pre-auth info private int etype = 0; - private byte[] salt = null; + private String salt = null; private byte[] s2kparams = null; private static boolean DEBUG = Krb5.DEBUG; @@ -334,8 +335,8 @@ public class KRBError implements java.io.Serializable { } // access pre-auth info - public final byte[] getSalt() { - return ((salt == null) ? null : salt.clone()); + public final String getSalt() { + return salt; } // access pre-auth info @@ -415,7 +416,8 @@ public class KRBError implements java.io.Serializable { if (der.getData().available() >0) { if ((der.getData().peekByte() & 0x1F) == 0x0B) { subDer = der.getData().getDerValue(); - eText = subDer.getData().getGeneralString(); + eText = new KerberosString(subDer.getData().getDerValue()) + .toString(); } } if (der.getData().available() >0) { @@ -515,7 +517,7 @@ public class KRBError implements java.io.Serializable { if (eText != null) { temp = new DerOutputStream(); - temp.putGeneralString(eText); + temp.putDerValue(new KerberosString(eText).toDerValue()); bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0B), temp); } if (eData != null) { diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java index 61a03c02a94..feaf8cf42a5 100644 --- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java +++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java @@ -34,17 +34,29 @@ import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import javax.crypto.SecretKeyFactory; import javax.crypto.SecretKey; -import java.security.Security; -import java.security.Provider; import java.security.GeneralSecurityException; import javax.crypto.spec.IvParameterSpec; import sun.security.krb5.KrbCryptoException; -import sun.security.krb5.internal.Krb5; -import java.io.UnsupportedEncodingException; import java.util.Arrays; +import sun.security.action.GetPropertyAction; public final class Des { + // RFC 3961 demands that UTF-8 encoding be used in DES's + // string-to-key function. For historical reasons, some + // implementations use a locale-specific encoding. Even + // so, when the client and server use different locales, + // they must agree on a common value, normally the one + // used when the password is set/reset. + // + // The following system property is provided to perform the + // string-to-key encoding. When set, the specified charset + // name is used. Otherwise, the system default charset. + + private final static String CHARSET = + java.security.AccessController.doPrivileged( + new GetPropertyAction("sun.security.krb5.msinterop.des.s2kcharset")); + private static final long[] bad_keys = { 0x0101010101010101L, 0xfefefefefefefefeL, 0x1f1f1f1f1f1f1f1fL, 0xe0e0e0e0e0e0e0e0L, @@ -226,7 +238,11 @@ public final class Des { // Convert password to byte array try { - cbytes = (new String(passwdChars)).getBytes(); + if (CHARSET == null) { + cbytes = (new String(passwdChars)).getBytes(); + } else { + cbytes = (new String(passwdChars)).getBytes(CHARSET); + } } catch (Exception e) { // clear-up sensitive information if (cbytes != null) { diff --git a/jdk/src/share/classes/sun/security/krb5/internal/util/KerberosString.java b/jdk/src/share/classes/sun/security/krb5/internal/util/KerberosString.java new file mode 100644 index 00000000000..2c50fe601b9 --- /dev/null +++ b/jdk/src/share/classes/sun/security/krb5/internal/util/KerberosString.java @@ -0,0 +1,82 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package sun.security.krb5.internal.util; + +import java.io.IOException; +import java.security.AccessController; +import sun.security.action.GetBooleanAction; +import sun.security.util.DerValue; + +/** + * Implements the ASN.1 KerberosString type. + * + *
    + * KerberosString  ::= GeneralString (IA5String)
    + * 
    + * + * This definition reflects the Network Working Group RFC 4120 + * specification available at + * + * http://www.ietf.org/rfc/rfc4120.txt. + */ +public final class KerberosString { + /** + * RFC 4120 defines KerberosString as GeneralString (IA5String), which + * only includes ASCII characters. However, other implementations have been + * known to use GeneralString to contain UTF-8 encoding. To interop + * with these implementations, the following system property is defined. + * When set as true, KerberosString is encoded as UTF-8. Note that this + * only affects the byte encoding, the tag of the ASN.1 type is still + * GeneralString. + */ + public static final boolean MSNAME = AccessController.doPrivileged( + new GetBooleanAction("sun.security.krb5.msinterop.kstring")); + + private final String s; + + public KerberosString(String s) { + this.s = s; + } + + public KerberosString(DerValue der) throws IOException { + if (der.tag != DerValue.tag_GeneralString) { + throw new IOException( + "KerberosString's tag is incorrect: " + der.tag); + } + s = new String(der.getDataBytes(), MSNAME?"UTF8":"ASCII"); + } + + public String toString() { + return s; + } + + public DerValue toDerValue() throws IOException { + // No need to cache the result since this method is + // only called once. + return new DerValue(DerValue.tag_GeneralString, + s.getBytes(MSNAME?"UTF8":"ASCII")); + } +} diff --git a/jdk/src/share/classes/sun/security/provider/PolicyFile.java b/jdk/src/share/classes/sun/security/provider/PolicyFile.java index 768ddd9ce63..324e745f375 100644 --- a/jdk/src/share/classes/sun/security/provider/PolicyFile.java +++ b/jdk/src/share/classes/sun/security/provider/PolicyFile.java @@ -54,7 +54,6 @@ import java.net.SocketPermission; import java.net.NetPermission; import java.util.PropertyPermission; import java.util.concurrent.atomic.AtomicReference; -import java.awt.AWTPermission; /* import javax.security.auth.AuthPermission; import javax.security.auth.kerberos.ServicePermission; @@ -1023,8 +1022,6 @@ public class PolicyFile extends java.security.Policy { return new NetPermission(name, actions); } else if (claz.equals(AllPermission.class)) { return SecurityConstants.ALL_PERMISSION; - } else if (claz.equals(AWTPermission.class)) { - return new AWTPermission(name, actions); /* } else if (claz.equals(ReflectPermission.class)) { return new ReflectPermission(name, actions); diff --git a/jdk/src/share/classes/sun/security/provider/certpath/Builder.java b/jdk/src/share/classes/sun/security/provider/certpath/Builder.java index 8e13fb8b777..5892b1b328d 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/Builder.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/Builder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2009 Sun Microsystems, Inc. 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 @@ -26,12 +26,14 @@ package sun.security.provider.certpath; import java.io.IOException; +import java.security.AccessController; import java.security.GeneralSecurityException; import java.security.cert.*; import java.util.*; import javax.security.auth.x500.X500Principal; +import sun.security.action.GetBooleanAction; import sun.security.util.Debug; import sun.security.x509.GeneralNames; import sun.security.x509.GeneralNameInterface; @@ -64,9 +66,8 @@ public abstract class Builder { * Authority Information Access extension shall be enabled. Currently * disabled by default for compatibility reasons. */ - final static boolean USE_AIA = - DistributionPointFetcher.getBooleanProperty - ("com.sun.security.enableAIAcaIssuers", false); + final static boolean USE_AIA = AccessController.doPrivileged + (new GetBooleanAction("com.sun.security.enableAIAcaIssuers")); /** * Initialize the builder with the input parameters. diff --git a/jdk/src/share/classes/sun/security/provider/certpath/CertId.java b/jdk/src/share/classes/sun/security/provider/certpath/CertId.java index 1ee63949964..20e9aa2a789 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/CertId.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/CertId.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. 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,11 @@ package sun.security.provider.certpath; -import java.io.*; +import java.io.IOException; import java.math.BigInteger; import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; import java.util.Arrays; import sun.misc.HexDumpEncoder; import sun.security.x509.*; @@ -54,21 +56,28 @@ import sun.security.util.*; public class CertId { private static final boolean debug = false; - private AlgorithmId hashAlgId; - private byte[] issuerNameHash; - private byte[] issuerKeyHash; - private SerialNumber certSerialNumber; + private static final AlgorithmId SHA1_ALGID + = new AlgorithmId(AlgorithmId.SHA_oid); + private final AlgorithmId hashAlgId; + private final byte[] issuerNameHash; + private final byte[] issuerKeyHash; + private final SerialNumber certSerialNumber; private int myhash = -1; // hashcode for this CertId /** * Creates a CertId. The hash algorithm used is SHA-1. */ - public CertId(X509CertImpl issuerCert, SerialNumber serialNumber) - throws Exception { + public CertId(X509Certificate issuerCert, SerialNumber serialNumber) + throws IOException { // compute issuerNameHash - MessageDigest md = MessageDigest.getInstance("SHA1"); - hashAlgId = AlgorithmId.get("SHA1"); + MessageDigest md = null; + try { + md = MessageDigest.getInstance("SHA1"); + } catch (NoSuchAlgorithmException nsae) { + throw new IOException("Unable to create CertId", nsae); + } + hashAlgId = SHA1_ALGID; md.update(issuerCert.getSubjectX500Principal().getEncoded()); issuerNameHash = md.digest(); @@ -90,6 +99,7 @@ public class CertId { encoder.encode(issuerNameHash)); System.out.println("issuerKeyHash is " + encoder.encode(issuerKeyHash)); + System.out.println("SerialNumber is " + serialNumber.getNumber()); } } @@ -97,7 +107,6 @@ public class CertId { * Creates a CertId from its ASN.1 DER encoding. */ public CertId(DerInputStream derIn) throws IOException { - hashAlgId = AlgorithmId.parse(derIn.getDerValue()); issuerNameHash = derIn.getOctetString(); issuerKeyHash = derIn.getOctetString(); @@ -157,7 +166,7 @@ public class CertId { * * @return the hashcode value. */ - public int hashCode() { + @Override public int hashCode() { if (myhash == -1) { myhash = hashAlgId.hashCode(); for (int i = 0; i < issuerNameHash.length; i++) { @@ -180,8 +189,7 @@ public class CertId { * @param other the object to test for equality with this object. * @return true if the objects are considered equal, false otherwise. */ - public boolean equals(Object other) { - + @Override public boolean equals(Object other) { if (this == other) { return true; } @@ -203,7 +211,7 @@ public class CertId { /** * Create a string representation of the CertId. */ - public String toString() { + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("CertId \n"); sb.append("Algorithm: " + hashAlgId.toString() +"\n"); diff --git a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java index b462dd5ba08..18845113edb 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java @@ -80,6 +80,7 @@ class CrlRevocationChecker extends PKIXCertPathChecker { { false, false, false, false, false, false, true }; private static final boolean[] ALL_REASONS = {true, true, true, true, true, true, true, true, true}; + private boolean mOnlyEECert = false; // Maximum clock skew in milliseconds (15 minutes) allowed when checking // validity of CRLs @@ -114,6 +115,12 @@ class CrlRevocationChecker extends PKIXCertPathChecker { CrlRevocationChecker(TrustAnchor anchor, PKIXParameters params, Collection certs) throws CertPathValidatorException { + this(anchor, params, certs, false); + } + + CrlRevocationChecker(TrustAnchor anchor, PKIXParameters params, + Collection certs, boolean onlyEECert) + throws CertPathValidatorException { mAnchor = anchor; mParams = params; mStores = new ArrayList(params.getCertStores()); @@ -133,6 +140,7 @@ class CrlRevocationChecker extends PKIXCertPathChecker { } Date testDate = params.getDate(); mCurrentTime = (testDate != null ? testDate : new Date()); + mOnlyEECert = onlyEECert; init(false); } @@ -264,6 +272,13 @@ class CrlRevocationChecker extends PKIXCertPathChecker { " ---checking " + msg + "..."); } + if (mOnlyEECert && currCert.getBasicConstraints() != -1) { + if (debug != null) { + debug.println("Skipping revocation check, not end entity cert"); + } + return; + } + // reject circular dependencies - RFC 3280 is not explicit on how // to handle this, so we feel it is safest to reject them until // the issue is resolved in the PKIX WG. diff --git a/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java index 39ee1f1dad6..dea521a4a19 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java @@ -32,7 +32,7 @@ import java.security.*; import java.security.cert.*; import javax.security.auth.x500.X500Principal; -import sun.security.action.GetPropertyAction; +import sun.security.action.GetBooleanAction; import sun.security.util.Debug; import sun.security.util.DerOutputStream; import sun.security.x509.*; @@ -62,28 +62,8 @@ class DistributionPointFetcher { * extension shall be enabled. Currently disabled by default for * compatibility and legal reasons. */ - private final static boolean USE_CRLDP = - getBooleanProperty("com.sun.security.enableCRLDP", false); - - /** - * Return the value of the boolean System property propName. - */ - public static boolean getBooleanProperty(String propName, - boolean defaultValue) { - // if set, require value of either true or false - String b = AccessController.doPrivileged( - new GetPropertyAction(propName)); - if (b == null) { - return defaultValue; - } else if (b.equalsIgnoreCase("false")) { - return false; - } else if (b.equalsIgnoreCase("true")) { - return true; - } else { - throw new RuntimeException("Value of " + propName - + " must either be 'true' or 'false'"); - } - } + private final static boolean USE_CRLDP = AccessController.doPrivileged + (new GetBooleanAction("com.sun.security.enableCRLDP")); // singleton instance private static final DistributionPointFetcher INSTANCE = diff --git a/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java b/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java index 393a7663c91..41fe50d66b7 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java @@ -82,6 +82,7 @@ class ForwardBuilder extends Builder { TrustAnchor trustAnchor; private Comparator comparator; private boolean searchAllCertStores = true; + private boolean onlyEECert = false; /** * Initialize the builder with the input parameters. @@ -89,7 +90,8 @@ class ForwardBuilder extends Builder { * @param params the parameter set used to build a certification path */ ForwardBuilder(PKIXBuilderParameters buildParams, - X500Principal targetSubjectDN, boolean searchAllCertStores) + X500Principal targetSubjectDN, boolean searchAllCertStores, + boolean onlyEECert) { super(buildParams, targetSubjectDN); @@ -108,6 +110,7 @@ class ForwardBuilder extends Builder { } comparator = new PKIXCertComparator(trustedSubjectDNs); this.searchAllCertStores = searchAllCertStores; + this.onlyEECert = onlyEECert; } /** @@ -875,8 +878,8 @@ class ForwardBuilder extends Builder { /* Check revocation if it is enabled */ if (buildParams.isRevocationEnabled()) { try { - CrlRevocationChecker crlChecker = - new CrlRevocationChecker(anchor, buildParams); + CrlRevocationChecker crlChecker = new CrlRevocationChecker + (anchor, buildParams, null, onlyEECert); crlChecker.check(cert, anchor.getCAPublicKey(), true); } catch (CertPathValidatorException cpve) { if (debug != null) { diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java new file mode 100644 index 00000000000..2665de6d680 --- /dev/null +++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java @@ -0,0 +1,329 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +package sun.security.provider.certpath; + +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URI; +import java.net.URL; +import java.net.HttpURLConnection; +import java.security.cert.CertificateException; +import java.security.cert.CertPathValidatorException; +import java.security.cert.CRLReason; +import java.security.cert.Extension; +import java.security.cert.X509Certificate; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import static sun.security.provider.certpath.OCSPResponse.*; +import sun.security.util.Debug; +import sun.security.x509.AccessDescription; +import sun.security.x509.AuthorityInfoAccessExtension; +import sun.security.x509.GeneralName; +import sun.security.x509.GeneralNameInterface; +import sun.security.x509.URIName; +import sun.security.x509.X509CertImpl; + +/** + * This is a class that checks the revocation status of a certificate(s) using + * OCSP. It is not a PKIXCertPathChecker and therefore can be used outside of + * the CertPathValidator framework. It is useful when you want to + * just check the revocation status of a certificate, and you don't want to + * incur the overhead of validating all of the certificates in the + * associated certificate chain. + * + * @author Sean Mullan + */ +public final class OCSP { + + private static final Debug debug = Debug.getInstance("certpath"); + + private OCSP() {} + + /** + * Obtains the revocation status of a certificate using OCSP using the most + * common defaults. The OCSP responder URI is retrieved from the + * certificate's AIA extension. The OCSP responder certificate is assumed + * to be the issuer's certificate (or issued by the issuer CA). + * + * @param cert the certificate to be checked + * @param issuerCert the issuer certificate + * @return the RevocationStatus + * @throws IOException if there is an exception connecting to or + * communicating with the OCSP responder + * @throws CertPathValidatorException if an exception occurs while + * encoding the OCSP Request or validating the OCSP Response + */ + public static RevocationStatus check(X509Certificate cert, + X509Certificate issuerCert) + throws IOException, CertPathValidatorException { + CertId certId = null; + URI responderURI = null; + try { + X509CertImpl certImpl = X509CertImpl.toImpl(cert); + responderURI = getResponderURI(certImpl); + if (responderURI == null) { + throw new CertPathValidatorException + ("No OCSP Responder URI in certificate"); + } + certId = new CertId(issuerCert, certImpl.getSerialNumberObject()); + } catch (CertificateException ce) { + throw new CertPathValidatorException + ("Exception while encoding OCSPRequest", ce); + } catch (IOException ioe) { + throw new CertPathValidatorException + ("Exception while encoding OCSPRequest", ioe); + } + OCSPResponse ocspResponse = check(Collections.singletonList(certId), + responderURI, issuerCert, null); + return (RevocationStatus) ocspResponse.getSingleResponse(certId); + } + + /** + * Obtains the revocation status of a certificate using OCSP. + * + * @param cert the certificate to be checked + * @param issuerCert the issuer certificate + * @param responderURI the URI of the OCSP responder + * @param responderCert the OCSP responder's certificate + * @param date the time the validity of the OCSP responder's certificate + * should be checked against. If null, the current time is used. + * @return the RevocationStatus + * @throws IOException if there is an exception connecting to or + * communicating with the OCSP responder + * @throws CertPathValidatorException if an exception occurs while + * encoding the OCSP Request or validating the OCSP Response + */ + public static RevocationStatus check(X509Certificate cert, + X509Certificate issuerCert, URI responderURI, X509Certificate + responderCert, Date date) + throws IOException, CertPathValidatorException { + CertId certId = null; + try { + X509CertImpl certImpl = X509CertImpl.toImpl(cert); + certId = new CertId(issuerCert, certImpl.getSerialNumberObject()); + } catch (CertificateException ce) { + throw new CertPathValidatorException + ("Exception while encoding OCSPRequest", ce); + } catch (IOException ioe) { + throw new CertPathValidatorException + ("Exception while encoding OCSPRequest", ioe); + } + OCSPResponse ocspResponse = check(Collections.singletonList(certId), + responderURI, responderCert, date); + return (RevocationStatus) ocspResponse.getSingleResponse(certId); + } + + /** + * Checks the revocation status of a list of certificates using OCSP. + * + * @param certs the CertIds to be checked + * @param responderURI the URI of the OCSP responder + * @param responderCert the OCSP responder's certificate + * @param date the time the validity of the OCSP responder's certificate + * should be checked against. If null, the current time is used. + * @return the OCSPResponse + * @throws IOException if there is an exception connecting to or + * communicating with the OCSP responder + * @throws CertPathValidatorException if an exception occurs while + * encoding the OCSP Request or validating the OCSP Response + */ + static OCSPResponse check(List certIds, URI responderURI, + X509Certificate responderCert, Date date) + throws IOException, CertPathValidatorException { + + byte[] bytes = null; + try { + OCSPRequest request = new OCSPRequest(certIds); + bytes = request.encodeBytes(); + } catch (IOException ioe) { + throw new CertPathValidatorException + ("Exception while encoding OCSPRequest", ioe); + } + + InputStream in = null; + OutputStream out = null; + byte[] response = null; + try { + URL url = responderURI.toURL(); + if (debug != null) { + debug.println("connecting to OCSP service at: " + url); + } + HttpURLConnection con = (HttpURLConnection)url.openConnection(); + con.setDoOutput(true); + con.setDoInput(true); + con.setRequestMethod("POST"); + con.setRequestProperty + ("Content-type", "application/ocsp-request"); + con.setRequestProperty + ("Content-length", String.valueOf(bytes.length)); + out = con.getOutputStream(); + out.write(bytes); + out.flush(); + // Check the response + if (debug != null && + con.getResponseCode() != HttpURLConnection.HTTP_OK) { + debug.println("Received HTTP error: " + con.getResponseCode() + + " - " + con.getResponseMessage()); + } + in = con.getInputStream(); + int contentLength = con.getContentLength(); + if (contentLength == -1) { + contentLength = Integer.MAX_VALUE; + } + response = new byte[contentLength > 2048 ? 2048 : contentLength]; + int total = 0; + while (total < contentLength) { + int count = in.read(response, total, response.length - total); + if (count < 0) + break; + + total += count; + if (total >= response.length && total < contentLength) { + response = Arrays.copyOf(response, total * 2); + } + } + response = Arrays.copyOf(response, total); + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException ioe) { + throw ioe; + } + } + if (out != null) { + try { + out.close(); + } catch (IOException ioe) { + throw ioe; + } + } + } + + OCSPResponse ocspResponse = null; + try { + ocspResponse = new OCSPResponse(response, date, responderCert); + } catch (IOException ioe) { + // response decoding exception + throw new CertPathValidatorException(ioe); + } + if (ocspResponse.getResponseStatus() != ResponseStatus.SUCCESSFUL) { + throw new CertPathValidatorException + ("OCSP response error: " + ocspResponse.getResponseStatus()); + } + + // Check that the response includes a response for all of the + // certs that were supplied in the request + for (CertId certId : certIds) { + SingleResponse sr = ocspResponse.getSingleResponse(certId); + if (sr == null) { + if (debug != null) { + debug.println("No response found for CertId: " + certId); + } + throw new CertPathValidatorException( + "OCSP response does not include a response for a " + + "certificate supplied in the OCSP request"); + } + if (debug != null) { + debug.println("Status of certificate (with serial number " + + certId.getSerialNumber() + ") is: " + sr.getCertStatus()); + } + } + return ocspResponse; + } + + /** + * Returns the URI of the OCSP Responder as specified in the + * certificate's Authority Information Access extension, or null if + * not specified. + * + * @param cert the certificate + * @return the URI of the OCSP Responder, or null if not specified + */ + public static URI getResponderURI(X509Certificate cert) { + try { + return getResponderURI(X509CertImpl.toImpl(cert)); + } catch (CertificateException ce) { + // treat this case as if the cert had no extension + return null; + } + } + + static URI getResponderURI(X509CertImpl certImpl) { + + // Examine the certificate's AuthorityInfoAccess extension + AuthorityInfoAccessExtension aia = + certImpl.getAuthorityInfoAccessExtension(); + if (aia == null) { + return null; + } + + List descriptions = aia.getAccessDescriptions(); + for (AccessDescription description : descriptions) { + if (description.getAccessMethod().equals( + AccessDescription.Ad_OCSP_Id)) { + + GeneralName generalName = description.getAccessLocation(); + if (generalName.getType() == GeneralNameInterface.NAME_URI) { + URIName uri = (URIName) generalName.getName(); + return uri.getURI(); + } + } + } + return null; + } + + /** + * The Revocation Status of a certificate. + */ + public static interface RevocationStatus { + public enum CertStatus { GOOD, REVOKED, UNKNOWN }; + + /** + * Returns the revocation status. + */ + CertStatus getCertStatus(); + /** + * Returns the time when the certificate was revoked, or null + * if it has not been revoked. + */ + Date getRevocationTime(); + /** + * Returns the reason the certificate was revoked, or null if it + * has not been revoked. + */ + CRLReason getRevocationReason(); + + /** + * Returns a Map of additional extensions. + */ + Map getSingleExtensions(); + } +} diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java index 04e0649d8ff..6f72c7ec185 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java @@ -25,19 +25,20 @@ package sun.security.provider.certpath; -import java.io.*; +import java.io.IOException; import java.math.BigInteger; import java.util.*; import java.security.AccessController; -import java.security.Principal; import java.security.PrivilegedAction; import java.security.Security; import java.security.cert.*; import java.security.cert.CertPathValidatorException.BasicReason; -import java.net.*; +import java.net.URI; +import java.net.URISyntaxException; import javax.security.auth.x500.X500Principal; -import sun.security.util.*; +import static sun.security.provider.certpath.OCSP.*; +import sun.security.util.Debug; import sun.security.x509.*; /** @@ -50,27 +51,18 @@ import sun.security.x509.*; */ class OCSPChecker extends PKIXCertPathChecker { - public static final String OCSP_ENABLE_PROP = "ocsp.enable"; - public static final String OCSP_URL_PROP = "ocsp.responderURL"; - public static final String OCSP_CERT_SUBJECT_PROP = + static final String OCSP_ENABLE_PROP = "ocsp.enable"; + static final String OCSP_URL_PROP = "ocsp.responderURL"; + static final String OCSP_CERT_SUBJECT_PROP = "ocsp.responderCertSubjectName"; - public static final String OCSP_CERT_ISSUER_PROP = - "ocsp.responderCertIssuerName"; - public static final String OCSP_CERT_NUMBER_PROP = + static final String OCSP_CERT_ISSUER_PROP = "ocsp.responderCertIssuerName"; + static final String OCSP_CERT_NUMBER_PROP = "ocsp.responderCertSerialNumber"; private static final String HEX_DIGITS = "0123456789ABCDEFabcdef"; private static final Debug DEBUG = Debug.getInstance("certpath"); private static final boolean dump = false; - // Supported extensions - private static final int OCSP_NONCE_DATA[] = - { 1, 3, 6, 1, 5, 5, 7, 48, 1, 2 }; - private static final ObjectIdentifier OCSP_NONCE_OID; - static { - OCSP_NONCE_OID = ObjectIdentifier.newInternal(OCSP_NONCE_DATA); - } - private int remainingCerts; private X509Certificate[] certs; @@ -79,19 +71,26 @@ class OCSPChecker extends PKIXCertPathChecker { private PKIXParameters pkixParams; + private boolean onlyEECert = false; + /** * Default Constructor * * @param certPath the X509 certification path * @param pkixParams the input PKIX parameter set - * @exception CertPathValidatorException Exception thrown if cert path - * does not validate. + * @throws CertPathValidatorException if OCSPChecker can not be created */ OCSPChecker(CertPath certPath, PKIXParameters pkixParams) throws CertPathValidatorException { + this(certPath, pkixParams, false); + } + + OCSPChecker(CertPath certPath, PKIXParameters pkixParams, boolean onlyEECert) + throws CertPathValidatorException { this.cp = certPath; this.pkixParams = pkixParams; + this.onlyEECert = onlyEECert; List tmp = cp.getCertificates(); certs = tmp.toArray(new X509Certificate[tmp.size()]); init(false); @@ -101,6 +100,7 @@ class OCSPChecker extends PKIXCertPathChecker { * Initializes the internal state of the checker from parameters * specified in the constructor */ + @Override public void init(boolean forward) throws CertPathValidatorException { if (!forward) { remainingCerts = certs.length + 1; @@ -110,11 +110,11 @@ class OCSPChecker extends PKIXCertPathChecker { } } - public boolean isForwardCheckingSupported() { + @Override public boolean isForwardCheckingSupported() { return false; } - public Set getSupportedExtensions() { + @Override public Set getSupportedExtensions() { return Collections.emptySet(); } @@ -127,300 +127,233 @@ class OCSPChecker extends PKIXCertPathChecker { * @exception CertPathValidatorException Exception is thrown if the * certificate has been revoked. */ + @Override public void check(Certificate cert, Collection unresolvedCritExts) throws CertPathValidatorException { - InputStream in = null; - OutputStream out = null; - // Decrement the certificate counter remainingCerts--; + X509CertImpl currCertImpl = null; try { - X509Certificate responderCert = null; - boolean seekResponderCert = false; - X500Principal responderSubjectName = null; - X500Principal responderIssuerName = null; - BigInteger responderSerialNumber = null; + currCertImpl = X509CertImpl.toImpl((X509Certificate)cert); + } catch (CertificateException ce) { + throw new CertPathValidatorException(ce); + } - boolean seekIssuerCert = true; - X509CertImpl issuerCertImpl = null; - X509CertImpl currCertImpl = - X509CertImpl.toImpl((X509Certificate)cert); + if (onlyEECert && currCertImpl.getBasicConstraints() != -1) { + if (DEBUG != null) { + DEBUG.println("Skipping revocation check, not end entity cert"); + } + return; + } - /* - * OCSP security property values, in the following order: - * 1. ocsp.responderURL - * 2. ocsp.responderCertSubjectName - * 3. ocsp.responderCertIssuerName - * 4. ocsp.responderCertSerialNumber - */ - String[] properties = getOCSPProperties(); + /* + * OCSP security property values, in the following order: + * 1. ocsp.responderURL + * 2. ocsp.responderCertSubjectName + * 3. ocsp.responderCertIssuerName + * 4. ocsp.responderCertSerialNumber + */ + // should cache these properties to avoid calling every time? + String[] properties = getOCSPProperties(); - // Check whether OCSP is feasible before seeking cert information - URL url = getOCSPServerURL(currCertImpl, properties); + // Check whether OCSP is feasible before seeking cert information + URI uri = getOCSPServerURI(currCertImpl, properties[0]); - // When responder's subject name is set then the issuer/serial - // properties are ignored - if (properties[1] != null) { - responderSubjectName = new X500Principal(properties[1]); + // When responder's subject name is set then the issuer/serial + // properties are ignored + X500Principal responderSubjectName = null; + X500Principal responderIssuerName = null; + BigInteger responderSerialNumber = null; + if (properties[1] != null) { + responderSubjectName = new X500Principal(properties[1]); + } else if (properties[2] != null && properties[3] != null) { + responderIssuerName = new X500Principal(properties[2]); + // remove colon or space separators + String value = stripOutSeparators(properties[3]); + responderSerialNumber = new BigInteger(value, 16); + } else if (properties[2] != null || properties[3] != null) { + throw new CertPathValidatorException( + "Must specify both ocsp.responderCertIssuerName and " + + "ocsp.responderCertSerialNumber properties"); + } - } else if (properties[2] != null && properties[3] != null) { - responderIssuerName = new X500Principal(properties[2]); - // remove colon or space separators - String value = stripOutSeparators(properties[3]); - responderSerialNumber = new BigInteger(value, 16); + // If the OCSP responder cert properties are set then the + // identified cert must be located in the trust anchors or + // in the cert stores. + boolean seekResponderCert = false; + if (responderSubjectName != null || responderIssuerName != null) { + seekResponderCert = true; + } - } else if (properties[2] != null || properties[3] != null) { + // Set the issuer certificate to the next cert in the chain + // (unless we're processing the final cert). + X509Certificate issuerCert = null; + boolean seekIssuerCert = true; + X509Certificate responderCert = null; + if (remainingCerts < certs.length) { + issuerCert = certs[remainingCerts]; + seekIssuerCert = false; // done + + // By default, the OCSP responder's cert is the same as the + // issuer of the cert being validated. + if (!seekResponderCert) { + responderCert = issuerCert; + if (DEBUG != null) { + DEBUG.println("Responder's certificate is the same " + + "as the issuer of the certificate being validated"); + } + } + } + + // Check anchor certs for: + // - the issuer cert (of the cert being validated) + // - the OCSP responder's cert + if (seekIssuerCert || seekResponderCert) { + + if (DEBUG != null && seekResponderCert) { + DEBUG.println("Searching trust anchors for responder's " + + "certificate"); + } + + // Extract the anchor certs + Iterator anchors + = pkixParams.getTrustAnchors().iterator(); + if (!anchors.hasNext()) { throw new CertPathValidatorException( - "Must specify both ocsp.responderCertIssuerName and " + - "ocsp.responderCertSerialNumber properties"); + "Must specify at least one trust anchor"); } - // If the OCSP responder cert properties are set then the - // identified cert must be located in the trust anchors or - // in the cert stores. - if (responderSubjectName != null || responderIssuerName != null) { - seekResponderCert = true; - } + X500Principal certIssuerName = + currCertImpl.getIssuerX500Principal(); + while (anchors.hasNext() && (seekIssuerCert || seekResponderCert)) { - // Set the issuer certificate to the next cert in the chain - // (unless we're processing the final cert). - if (remainingCerts < certs.length) { - issuerCertImpl = X509CertImpl.toImpl(certs[remainingCerts]); - seekIssuerCert = false; // done + TrustAnchor anchor = anchors.next(); + X509Certificate anchorCert = anchor.getTrustedCert(); + X500Principal anchorSubjectName = + anchorCert.getSubjectX500Principal(); - // By default, the OCSP responder's cert is the same as the - // issuer of the cert being validated. - if (! seekResponderCert) { - responderCert = certs[remainingCerts]; - if (DEBUG != null) { - DEBUG.println("Responder's certificate is the same " + - "as the issuer of the certificate being validated"); + if (dump) { + System.out.println("Issuer DN is " + certIssuerName); + System.out.println("Subject DN is " + anchorSubjectName); + } + + // Check if anchor cert is the issuer cert + if (seekIssuerCert && + certIssuerName.equals(anchorSubjectName)) { + + issuerCert = anchorCert; + seekIssuerCert = false; // done + + // By default, the OCSP responder's cert is the same as + // the issuer of the cert being validated. + if (!seekResponderCert && responderCert == null) { + responderCert = anchorCert; + if (DEBUG != null) { + DEBUG.println("Responder's certificate is the" + + " same as the issuer of the certificate " + + "being validated"); + } + } + } + + // Check if anchor cert is the responder cert + if (seekResponderCert) { + // Satisfy the responder subject name property only, or + // satisfy the responder issuer name and serial number + // properties only + if ((responderSubjectName != null && + responderSubjectName.equals(anchorSubjectName)) || + (responderIssuerName != null && + responderSerialNumber != null && + responderIssuerName.equals( + anchorCert.getIssuerX500Principal()) && + responderSerialNumber.equals( + anchorCert.getSerialNumber()))) { + + responderCert = anchorCert; + seekResponderCert = false; // done } } } + if (issuerCert == null) { + throw new CertPathValidatorException( + "No trusted certificate for " + currCertImpl.getIssuerDN()); + } - // Check anchor certs for: - // - the issuer cert (of the cert being validated) - // - the OCSP responder's cert - if (seekIssuerCert || seekResponderCert) { - - if (DEBUG != null && seekResponderCert) { - DEBUG.println("Searching trust anchors for responder's " + + // Check cert stores if responder cert has not yet been found + if (seekResponderCert) { + if (DEBUG != null) { + DEBUG.println("Searching cert stores for responder's " + "certificate"); } - - // Extract the anchor certs - Iterator anchors = pkixParams.getTrustAnchors().iterator(); - if (! anchors.hasNext()) { - throw new CertPathValidatorException( - "Must specify at least one trust anchor"); + X509CertSelector filter = null; + if (responderSubjectName != null) { + filter = new X509CertSelector(); + filter.setSubject(responderSubjectName); + } else if (responderIssuerName != null && + responderSerialNumber != null) { + filter = new X509CertSelector(); + filter.setIssuer(responderIssuerName); + filter.setSerialNumber(responderSerialNumber); } - - X500Principal certIssuerName = - currCertImpl.getIssuerX500Principal(); - while (anchors.hasNext() && - (seekIssuerCert || seekResponderCert)) { - - TrustAnchor anchor = (TrustAnchor)anchors.next(); - X509Certificate anchorCert = anchor.getTrustedCert(); - X500Principal anchorSubjectName = - anchorCert.getSubjectX500Principal(); - - if (dump) { - System.out.println("Issuer DN is " + certIssuerName); - System.out.println("Subject DN is " + - anchorSubjectName); - } - - // Check if anchor cert is the issuer cert - if (seekIssuerCert && - certIssuerName.equals(anchorSubjectName)) { - - issuerCertImpl = X509CertImpl.toImpl(anchorCert); - seekIssuerCert = false; // done - - // By default, the OCSP responder's cert is the same as - // the issuer of the cert being validated. - if (! seekResponderCert && responderCert == null) { - responderCert = anchorCert; + if (filter != null) { + List certStores = pkixParams.getCertStores(); + for (CertStore certStore : certStores) { + Iterator i = null; + try { + i = certStore.getCertificates(filter).iterator(); + } catch (CertStoreException cse) { + // ignore and try next certStore if (DEBUG != null) { - DEBUG.println("Responder's certificate is the" + - " same as the issuer of the certificate " + - "being validated"); + DEBUG.println("CertStore exception:" + cse); } + continue; } - } - - // Check if anchor cert is the responder cert - if (seekResponderCert) { - // Satisfy the responder subject name property only, or - // satisfy the responder issuer name and serial number - // properties only - if ((responderSubjectName != null && - responderSubjectName.equals(anchorSubjectName)) || - (responderIssuerName != null && - responderSerialNumber != null && - responderIssuerName.equals( - anchorCert.getIssuerX500Principal()) && - responderSerialNumber.equals( - anchorCert.getSerialNumber()))) { - - responderCert = anchorCert; + if (i.hasNext()) { + responderCert = (X509Certificate) i.next(); seekResponderCert = false; // done - } - } - } - if (issuerCertImpl == null) { - throw new CertPathValidatorException( - "No trusted certificate for " + - currCertImpl.getIssuerDN()); - } - - // Check cert stores if responder cert has not yet been found - if (seekResponderCert) { - if (DEBUG != null) { - DEBUG.println("Searching cert stores for responder's " + - "certificate"); - } - X509CertSelector filter = null; - if (responderSubjectName != null) { - filter = new X509CertSelector(); - filter.setSubject(responderSubjectName.getName()); - } else if (responderIssuerName != null && - responderSerialNumber != null) { - filter = new X509CertSelector(); - filter.setIssuer(responderIssuerName.getName()); - filter.setSerialNumber(responderSerialNumber); - } - if (filter != null) { - List certStores = pkixParams.getCertStores(); - for (CertStore certStore : certStores) { - Iterator i = - certStore.getCertificates(filter).iterator(); - if (i.hasNext()) { - responderCert = (X509Certificate) i.next(); - seekResponderCert = false; // done - break; - } + break; } } } } + } - // Could not find the certificate identified in the OCSP properties - if (seekResponderCert) { - throw new CertPathValidatorException( - "Cannot find the responder's certificate " + - "(set using the OCSP security properties)."); - } + // Could not find the certificate identified in the OCSP properties + if (seekResponderCert) { + throw new CertPathValidatorException( + "Cannot find the responder's certificate " + + "(set using the OCSP security properties)."); + } - // Construct an OCSP Request - OCSPRequest ocspRequest = - new OCSPRequest(currCertImpl, issuerCertImpl); + CertId certId = null; + OCSPResponse response = null; + try { + certId = new CertId + (issuerCert, currCertImpl.getSerialNumberObject()); + response = OCSP.check(Collections.singletonList(certId), uri, + responderCert, pkixParams.getDate()); + } catch (IOException ioe) { + // should allow this to pass if network failures are acceptable + throw new CertPathValidatorException + ("Unable to send OCSP request", ioe); + } - // Use the URL to the OCSP service that was created earlier - HttpURLConnection con = (HttpURLConnection)url.openConnection(); - if (DEBUG != null) { - DEBUG.println("connecting to OCSP service at: " + url); - } - - // Indicate that both input and output will be performed, - // that the method is POST, and that the content length is - // the length of the byte array - - con.setDoOutput(true); - con.setDoInput(true); - con.setRequestMethod("POST"); - con.setRequestProperty("Content-type", "application/ocsp-request"); - byte[] bytes = ocspRequest.encodeBytes(); - CertId certId = ocspRequest.getCertId(); - - con.setRequestProperty("Content-length", - String.valueOf(bytes.length)); - out = con.getOutputStream(); - out.write(bytes); - out.flush(); - - // Check the response - if (DEBUG != null && - con.getResponseCode() != HttpURLConnection.HTTP_OK) { - DEBUG.println("Received HTTP error: " + con.getResponseCode() + - " - " + con.getResponseMessage()); - } - in = con.getInputStream(); - - byte[] response = null; - int total = 0; - int contentLength = con.getContentLength(); - if (contentLength != -1) { - response = new byte[contentLength]; - } else { - response = new byte[2048]; - contentLength = Integer.MAX_VALUE; - } - - while (total < contentLength) { - int count = in.read(response, total, response.length - total); - if (count < 0) - break; - - total += count; - if (total >= response.length && total < contentLength) { - response = Arrays.copyOf(response, total * 2); - } - } - response = Arrays.copyOf(response, total); - - OCSPResponse ocspResponse = new OCSPResponse(response, pkixParams, - responderCert); - // Check that response applies to the cert that was supplied - if (! certId.equals(ocspResponse.getCertId())) { - throw new CertPathValidatorException( - "Certificate in the OCSP response does not match the " + - "certificate supplied in the OCSP request."); - } - SerialNumber serialNumber = currCertImpl.getSerialNumberObject(); - int certOCSPStatus = ocspResponse.getCertStatus(serialNumber); - - if (DEBUG != null) { - DEBUG.println("Status of certificate (with serial number " + - serialNumber.getNumber() + ") is: " + - OCSPResponse.certStatusToText(certOCSPStatus)); - } - - if (certOCSPStatus == OCSPResponse.CERT_STATUS_REVOKED) { - Throwable t = new CertificateRevokedException( - ocspResponse.getRevocationTime(), - ocspResponse.getRevocationReason(), - responderCert.getSubjectX500Principal(), - ocspResponse.getSingleExtensions()); - throw new CertPathValidatorException(t.getMessage(), t, - null, -1, BasicReason.REVOKED); - - } else if (certOCSPStatus == OCSPResponse.CERT_STATUS_UNKNOWN) { - throw new CertPathValidatorException( - "Certificate's revocation status is unknown", null, cp, - remainingCerts, BasicReason.UNDETERMINED_REVOCATION_STATUS); - } - } catch (Exception e) { - throw new CertPathValidatorException(e); - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException ioe) { - throw new CertPathValidatorException(ioe); - } - } - if (out != null) { - try { - out.close(); - } catch (IOException ioe) { - throw new CertPathValidatorException(ioe); - } - } + RevocationStatus rs = (RevocationStatus) response.getSingleResponse(certId); + RevocationStatus.CertStatus certStatus = rs.getCertStatus(); + if (certStatus == RevocationStatus.CertStatus.REVOKED) { + Throwable t = new CertificateRevokedException( + rs.getRevocationTime(), rs.getRevocationReason(), + responderCert.getSubjectX500Principal(), + rs.getSingleExtensions()); + throw new CertPathValidatorException(t.getMessage(), t, + null, -1, BasicReason.REVOKED); + } else if (certStatus == RevocationStatus.CertStatus.UNKNOWN) { + throw new CertPathValidatorException( + "Certificate's revocation status is unknown", null, cp, + remainingCerts, BasicReason.UNDETERMINED_REVOCATION_STATUS); } } @@ -431,20 +364,18 @@ class OCSPChecker extends PKIXCertPathChecker { * 3. ocsp.responderCertIssuerName * 4. ocsp.responderCertSerialNumber */ - private static URL getOCSPServerURL(X509CertImpl currCertImpl, - String[] properties) - throws CertificateParsingException, CertPathValidatorException { + private static URI getOCSPServerURI(X509CertImpl currCertImpl, + String responderURL) throws CertPathValidatorException { - if (properties[0] != null) { - try { - return new URL(properties[0]); - } catch (java.net.MalformedURLException e) { + if (responderURL != null) { + try { + return new URI(responderURL); + } catch (URISyntaxException e) { throw new CertPathValidatorException(e); - } + } } // Examine the certificate's AuthorityInfoAccess extension - AuthorityInfoAccessExtension aia = currCertImpl.getAuthorityInfoAccessExtension(); if (aia == null) { @@ -459,13 +390,8 @@ class OCSPChecker extends PKIXCertPathChecker { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { - try { - URIName uri = (URIName) generalName.getName(); - return (new URL(uri.getName())); - - } catch (java.net.MalformedURLException e) { - throw new CertPathValidatorException(e); - } + URIName uri = (URIName) generalName.getName(); + return uri.getURI(); } } } diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSPRequest.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSPRequest.java index b7350b55e9b..393ac6f0e73 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPRequest.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. 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 @@ -26,9 +26,9 @@ package sun.security.provider.certpath; import java.io.IOException; -import java.security.cert.CertPathValidatorException; +import java.util.Collections; +import java.util.List; import sun.misc.HexDumpEncoder; -import sun.security.x509.*; import sun.security.util.*; /** @@ -77,47 +77,33 @@ class OCSPRequest { private static final Debug debug = Debug.getInstance("certpath"); private static final boolean dump = false; - // Serial number of the certificates to be checked for revocation - private SerialNumber serialNumber; - - // Issuer's certificate (for computing certId hash values) - private X509CertImpl issuerCert; - - // CertId of the certificate to be checked - private CertId certId = null; + // List of request CertIds + private final List certIds; /* * Constructs an OCSPRequest. This constructor is used * to construct an unsigned OCSP Request for a single user cert. */ - // used by OCSPChecker - OCSPRequest(X509CertImpl userCert, X509CertImpl issuerCert) - throws CertPathValidatorException { - - if (issuerCert == null) { - throw new CertPathValidatorException("Null IssuerCertificate"); - } - this.issuerCert = issuerCert; - serialNumber = userCert.getSerialNumberObject(); + OCSPRequest(CertId certId) { + this.certIds = Collections.singletonList(certId); + } + + OCSPRequest(List certIds) { + this.certIds = certIds; } - // used by OCSPChecker byte[] encodeBytes() throws IOException { // encode tbsRequest DerOutputStream tmp = new DerOutputStream(); - DerOutputStream derSingleReqList = new DerOutputStream(); - SingleRequest singleRequest = null; - - try { - singleRequest = new SingleRequest(issuerCert, serialNumber); - } catch (Exception e) { - throw new IOException("Error encoding OCSP request"); + DerOutputStream requestsOut = new DerOutputStream(); + for (CertId certId : certIds) { + DerOutputStream certIdOut = new DerOutputStream(); + certId.encode(certIdOut); + requestsOut.write(DerValue.tag_Sequence, certIdOut); } - certId = singleRequest.getCertId(); - singleRequest.encode(derSingleReqList); - tmp.write(DerValue.tag_Sequence, derSingleReqList); + tmp.write(DerValue.tag_Sequence, requestsOut); // No extensions supported DerOutputStream tbsRequest = new DerOutputStream(); tbsRequest.write(DerValue.tag_Sequence, tmp); @@ -130,35 +116,14 @@ class OCSPRequest { if (dump) { HexDumpEncoder hexEnc = new HexDumpEncoder(); - System.out.println ("OCSPRequest bytes are... "); + System.out.println("OCSPRequest bytes are... "); System.out.println(hexEnc.encode(bytes)); } - return(bytes); + return bytes; } - // used by OCSPChecker - CertId getCertId() { - return certId; - } - - private static class SingleRequest { - private CertId certId; - - // No extensions are set - - private SingleRequest(X509CertImpl cert, SerialNumber serialNo) throws Exception { - certId = new CertId(cert, serialNo); - } - - private void encode(DerOutputStream out) throws IOException { - DerOutputStream tmp = new DerOutputStream(); - certId.encode(tmp); - out.write(DerValue.tag_Sequence, tmp); - } - - private CertId getCertId() { - return certId; - } + List getCertIds() { + return certIds; } } diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java index cdadc45f66c..e7b148fbc7c 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java @@ -28,17 +28,16 @@ package sun.security.provider.certpath; import java.io.*; import java.math.BigInteger; import java.security.*; +import java.security.cert.CertificateException; +import java.security.cert.CertificateParsingException; import java.security.cert.CertPathValidatorException; import java.security.cert.CRLReason; import java.security.cert.X509Certificate; -import java.security.cert.PKIXParameters; -import javax.security.auth.x500.X500Principal; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.Iterator; import sun.misc.HexDumpEncoder; import sun.security.x509.*; import sun.security.util.*; @@ -113,32 +112,29 @@ import sun.security.util.*; * @author Ram Marti */ -class OCSPResponse { +public final class OCSPResponse { - // Certificate status CHOICE - public static final int CERT_STATUS_GOOD = 0; - public static final int CERT_STATUS_REVOKED = 1; - public static final int CERT_STATUS_UNKNOWN = 2; + public enum ResponseStatus { + SUCCESSFUL, // Response has valid confirmations + MALFORMED_REQUEST, // Illegal confirmation request + INTERNAL_ERROR, // Internal error in issuer + TRY_LATER, // Try again later + UNUSED, // is not used + SIG_REQUIRED, // Must sign the request + UNAUTHORIZED // Request unauthorized + }; + private static ResponseStatus[] rsvalues = ResponseStatus.values(); private static final Debug DEBUG = Debug.getInstance("certpath"); private static final boolean dump = false; - private static final ObjectIdentifier OCSP_BASIC_RESPONSE_OID; - private static final ObjectIdentifier OCSP_NONCE_EXTENSION_OID; - static { - ObjectIdentifier tmp1 = null; - ObjectIdentifier tmp2 = null; - try { - tmp1 = new ObjectIdentifier("1.3.6.1.5.5.7.48.1.1"); - tmp2 = new ObjectIdentifier("1.3.6.1.5.5.7.48.1.2"); - } catch (Exception e) { - // should not happen; log and exit - } - OCSP_BASIC_RESPONSE_OID = tmp1; - OCSP_NONCE_EXTENSION_OID = tmp2; - } + private static final ObjectIdentifier OCSP_BASIC_RESPONSE_OID = + ObjectIdentifier.newInternal(new int[] { 1, 3, 6, 1, 5, 5, 7, 48, 1, 1}); + private static final ObjectIdentifier OCSP_NONCE_EXTENSION_OID = + ObjectIdentifier.newInternal(new int[] { 1, 3, 6, 1, 5, 5, 7, 48, 1, 2}); - // OCSP response status code - private static final int OCSP_RESPONSE_OK = 0; + private static final int CERT_STATUS_GOOD = 0; + private static final int CERT_STATUS_REVOKED = 1; + private static final int CERT_STATUS_UNKNOWN = 2; // ResponderID CHOICE tags private static final int NAME_TAG = 1; @@ -147,7 +143,8 @@ class OCSPResponse { // Object identifier for the OCSPSigning key purpose private static final String KP_OCSP_SIGNING_OID = "1.3.6.1.5.5.7.3.9"; - private SingleResponse singleResponse; + private final ResponseStatus responseStatus; + private final Map singleResponseMap; // Maximum clock skew in milliseconds (15 minutes) allowed when checking // validity of OCSP responses @@ -159,289 +156,289 @@ class OCSPResponse { /* * Create an OCSP response from its ASN.1 DER encoding. */ - // used by OCSPChecker - OCSPResponse(byte[] bytes, PKIXParameters params, + OCSPResponse(byte[] bytes, Date dateCheckedAgainst, X509Certificate responderCert) throws IOException, CertPathValidatorException { - try { - int responseStatus; - ObjectIdentifier responseType; - int version; - CertificateIssuerName responderName = null; - Date producedAtDate; - AlgorithmId sigAlgId; - byte[] ocspNonce; + // OCSPResponse + if (dump) { + HexDumpEncoder hexEnc = new HexDumpEncoder(); + System.out.println("OCSPResponse bytes are..."); + System.out.println(hexEnc.encode(bytes)); + } + DerValue der = new DerValue(bytes); + if (der.tag != DerValue.tag_Sequence) { + throw new IOException("Bad encoding in OCSP response: " + + "expected ASN.1 SEQUENCE tag."); + } + DerInputStream derIn = der.getData(); - // OCSPResponse - if (dump) { - HexDumpEncoder hexEnc = new HexDumpEncoder(); - System.out.println("OCSPResponse bytes are..."); - System.out.println(hexEnc.encode(bytes)); - } - DerValue der = new DerValue(bytes); - if (der.tag != DerValue.tag_Sequence) { - throw new IOException("Bad encoding in OCSP response: " + - "expected ASN.1 SEQUENCE tag."); - } - DerInputStream derIn = der.getData(); + // responseStatus + int status = derIn.getEnumerated(); + if (status >= 0 && status < rsvalues.length) { + responseStatus = rsvalues[status]; + } else { + // unspecified responseStatus + throw new IOException("Unknown OCSPResponse status: " + status); + } + if (DEBUG != null) { + DEBUG.println("OCSP response status: " + responseStatus); + } + if (responseStatus != ResponseStatus.SUCCESSFUL) { + // no need to continue, responseBytes are not set. + singleResponseMap = Collections.emptyMap(); + return; + } - // responseStatus - responseStatus = derIn.getEnumerated(); + // responseBytes + der = derIn.getDerValue(); + if (!der.isContextSpecific((byte)0)) { + throw new IOException("Bad encoding in responseBytes element " + + "of OCSP response: expected ASN.1 context specific tag 0."); + } + DerValue tmp = der.data.getDerValue(); + if (tmp.tag != DerValue.tag_Sequence) { + throw new IOException("Bad encoding in responseBytes element " + + "of OCSP response: expected ASN.1 SEQUENCE tag."); + } + + // responseType + derIn = tmp.data; + ObjectIdentifier responseType = derIn.getOID(); + if (responseType.equals(OCSP_BASIC_RESPONSE_OID)) { if (DEBUG != null) { - DEBUG.println("OCSP response: " + - responseToText(responseStatus)); + DEBUG.println("OCSP response type: basic"); } - if (responseStatus != OCSP_RESPONSE_OK) { - throw new CertPathValidatorException( - "OCSP Response Failure: " + - responseToText(responseStatus)); + } else { + if (DEBUG != null) { + DEBUG.println("OCSP response type: " + responseType); } + throw new IOException("Unsupported OCSP response type: " + + responseType); + } - // responseBytes - der = derIn.getDerValue(); - if (! der.isContextSpecific((byte)0)) { - throw new IOException("Bad encoding in responseBytes element " + - "of OCSP response: expected ASN.1 context specific tag 0."); - }; - DerValue tmp = der.data.getDerValue(); - if (tmp.tag != DerValue.tag_Sequence) { - throw new IOException("Bad encoding in responseBytes element " + - "of OCSP response: expected ASN.1 SEQUENCE tag."); - } + // BasicOCSPResponse + DerInputStream basicOCSPResponse = + new DerInputStream(derIn.getOctetString()); - // responseType - derIn = tmp.data; - responseType = derIn.getOID(); - if (responseType.equals(OCSP_BASIC_RESPONSE_OID)) { - if (DEBUG != null) { - DEBUG.println("OCSP response type: basic"); + DerValue[] seqTmp = basicOCSPResponse.getSequence(2); + if (seqTmp.length < 3) { + throw new IOException("Unexpected BasicOCSPResponse value"); + } + + DerValue responseData = seqTmp[0]; + + // Need the DER encoded ResponseData to verify the signature later + byte[] responseDataDer = seqTmp[0].toByteArray(); + + // tbsResponseData + if (responseData.tag != DerValue.tag_Sequence) { + throw new IOException("Bad encoding in tbsResponseData " + + "element of OCSP response: expected ASN.1 SEQUENCE tag."); + } + DerInputStream seqDerIn = responseData.data; + DerValue seq = seqDerIn.getDerValue(); + + // version + if (seq.isContextSpecific((byte)0)) { + // seq[0] is version + if (seq.isConstructed() && seq.isContextSpecific()) { + //System.out.println ("version is available"); + seq = seq.data.getDerValue(); + int version = seq.getInteger(); + if (seq.data.available() != 0) { + throw new IOException("Bad encoding in version " + + " element of OCSP response: bad format"); } - } else { - if (DEBUG != null) { - DEBUG.println("OCSP response type: " + responseType); - } - throw new IOException("Unsupported OCSP response type: " + - responseType); - } - - // BasicOCSPResponse - DerInputStream basicOCSPResponse = - new DerInputStream(derIn.getOctetString()); - - DerValue[] seqTmp = basicOCSPResponse.getSequence(2); - DerValue responseData = seqTmp[0]; - - // Need the DER encoded ResponseData to verify the signature later - byte[] responseDataDer = seqTmp[0].toByteArray(); - - // tbsResponseData - if (responseData.tag != DerValue.tag_Sequence) { - throw new IOException("Bad encoding in tbsResponseData " + - " element of OCSP response: expected ASN.1 SEQUENCE tag."); - } - DerInputStream seqDerIn = responseData.data; - DerValue seq = seqDerIn.getDerValue(); - - // version - if (seq.isContextSpecific((byte)0)) { - // seq[0] is version - if (seq.isConstructed() && seq.isContextSpecific()) { - //System.out.println ("version is available"); - seq = seq.data.getDerValue(); - version = seq.getInteger(); - if (seq.data.available() != 0) { - throw new IOException("Bad encoding in version " + - " element of OCSP response: bad format"); - } - seq = seqDerIn.getDerValue(); - } - } - - // responderID - short tag = (byte)(seq.tag & 0x1f); - if (tag == NAME_TAG) { - responderName = new CertificateIssuerName(seq.getData()); - if (DEBUG != null) { - DEBUG.println("OCSP Responder name: " + responderName); - } - } else if (tag == KEY_TAG) { - // Ignore, for now - } else { - throw new IOException("Bad encoding in responderID element " + - "of OCSP response: expected ASN.1 context specific tag 0 " + - "or 1"); - } - - // producedAt - seq = seqDerIn.getDerValue(); - producedAtDate = seq.getGeneralizedTime(); - - // responses - DerValue[] singleResponseDer = seqDerIn.getSequence(1); - // Examine only the first response - singleResponse = new SingleResponse(singleResponseDer[0]); - - // responseExtensions - if (seqDerIn.available() > 0) { seq = seqDerIn.getDerValue(); - if (seq.isContextSpecific((byte)1)) { - DerValue[] responseExtDer = seq.data.getSequence(3); - Extension[] responseExtension = - new Extension[responseExtDer.length]; - for (int i = 0; i < responseExtDer.length; i++) { - responseExtension[i] = new Extension(responseExtDer[i]); - if (DEBUG != null) { - DEBUG.println("OCSP extension: " + - responseExtension[i]); - } - if ((responseExtension[i].getExtensionId()).equals( - OCSP_NONCE_EXTENSION_OID)) { - ocspNonce = - responseExtension[i].getExtensionValue(); + } + } - } else if (responseExtension[i].isCritical()) { - throw new IOException( - "Unsupported OCSP critical extension: " + - responseExtension[i].getExtensionId()); - } + // responderID + short tag = (byte)(seq.tag & 0x1f); + if (tag == NAME_TAG) { + if (DEBUG != null) { + X500Name responderName = new X500Name(seq.getData()); + DEBUG.println("OCSP Responder name: " + responderName); + } + } else if (tag == KEY_TAG) { + // Ignore, for now + } else { + throw new IOException("Bad encoding in responderID element of " + + "OCSP response: expected ASN.1 context specific tag 0 or 1"); + } + + // producedAt + seq = seqDerIn.getDerValue(); + if (DEBUG != null) { + Date producedAtDate = seq.getGeneralizedTime(); + DEBUG.println("OCSP response produced at: " + producedAtDate); + } + + // responses + DerValue[] singleResponseDer = seqDerIn.getSequence(1); + singleResponseMap + = new HashMap(singleResponseDer.length); + if (DEBUG != null) { + DEBUG.println("OCSP number of SingleResponses: " + + singleResponseDer.length); + } + for (int i = 0; i < singleResponseDer.length; i++) { + SingleResponse singleResponse + = new SingleResponse(singleResponseDer[i]); + singleResponseMap.put(singleResponse.getCertId(), singleResponse); + } + + // responseExtensions + if (seqDerIn.available() > 0) { + seq = seqDerIn.getDerValue(); + if (seq.isContextSpecific((byte)1)) { + DerValue[] responseExtDer = seq.data.getSequence(3); + for (int i = 0; i < responseExtDer.length; i++) { + Extension responseExtension + = new Extension(responseExtDer[i]); + if (DEBUG != null) { + DEBUG.println("OCSP extension: " + responseExtension); + } + if (responseExtension.getExtensionId().equals( + OCSP_NONCE_EXTENSION_OID)) { + /* + ocspNonce = + responseExtension[i].getExtensionValue(); + */ + } else if (responseExtension.isCritical()) { + throw new IOException( + "Unsupported OCSP critical extension: " + + responseExtension.getExtensionId()); } } } + } - // signatureAlgorithmId - sigAlgId = AlgorithmId.parse(seqTmp[1]); + // signatureAlgorithmId + AlgorithmId sigAlgId = AlgorithmId.parse(seqTmp[1]); - // signature - byte[] signature = seqTmp[2].getBitString(); - X509CertImpl[] x509Certs = null; + // signature + byte[] signature = seqTmp[2].getBitString(); + X509CertImpl[] x509Certs = null; - // if seq[3] is available , then it is a sequence of certificates - if (seqTmp.length > 3) { - // certs are available - DerValue seqCert = seqTmp[3]; - if (! seqCert.isContextSpecific((byte)0)) { - throw new IOException("Bad encoding in certs element " + - "of OCSP response: expected ASN.1 context specific tag 0."); - } - DerValue[] certs = (seqCert.getData()).getSequence(3); - x509Certs = new X509CertImpl[certs.length]; + // if seq[3] is available , then it is a sequence of certificates + if (seqTmp.length > 3) { + // certs are available + DerValue seqCert = seqTmp[3]; + if (!seqCert.isContextSpecific((byte)0)) { + throw new IOException("Bad encoding in certs element of " + + "OCSP response: expected ASN.1 context specific tag 0."); + } + DerValue[] certs = seqCert.getData().getSequence(3); + x509Certs = new X509CertImpl[certs.length]; + try { for (int i = 0; i < certs.length; i++) { x509Certs[i] = new X509CertImpl(certs[i].toByteArray()); } + } catch (CertificateException ce) { + throw new IOException("Bad encoding in X509 Certificate", ce); } + } - // Check whether the cert returned by the responder is trusted - if (x509Certs != null && x509Certs[0] != null) { - X509CertImpl cert = x509Certs[0]; + // Check whether the cert returned by the responder is trusted + if (x509Certs != null && x509Certs[0] != null) { + X509CertImpl cert = x509Certs[0]; - // First check if the cert matches the responder cert which - // was set locally. - if (cert.equals(responderCert)) { - // cert is trusted, now verify the signed response + // First check if the cert matches the responder cert which + // was set locally. + if (cert.equals(responderCert)) { + // cert is trusted, now verify the signed response - // Next check if the cert was issued by the responder cert - // which was set locally. - } else if (cert.getIssuerX500Principal().equals( - responderCert.getSubjectX500Principal())) { + // Next check if the cert was issued by the responder cert + // which was set locally. + } else if (cert.getIssuerX500Principal().equals( + responderCert.getSubjectX500Principal())) { - // Check for the OCSPSigning key purpose + // Check for the OCSPSigning key purpose + try { List keyPurposes = cert.getExtendedKeyUsage(); if (keyPurposes == null || !keyPurposes.contains(KP_OCSP_SIGNING_OID)) { - if (DEBUG != null) { - DEBUG.println("Responder's certificate is not " + - "valid for signing OCSP responses."); - } throw new CertPathValidatorException( "Responder's certificate not valid for signing " + "OCSP responses"); } + } catch (CertificateParsingException cpe) { + // assume cert is not valid for signing + throw new CertPathValidatorException( + "Responder's certificate not valid for signing " + + "OCSP responses", cpe); + } - // check the validity - try { - Date dateCheckedAgainst = params.getDate(); - if (dateCheckedAgainst == null) { - cert.checkValidity(); - } else { - cert.checkValidity(dateCheckedAgainst); - } - } catch (GeneralSecurityException e) { - if (DEBUG != null) { - DEBUG.println("Responder's certificate is not " + - "within the validity period."); - } - throw new CertPathValidatorException( - "Responder's certificate not within the " + - "validity period"); - } - - // check for revocation - // - // A CA may specify that an OCSP client can trust a - // responder for the lifetime of the responder's - // certificate. The CA does so by including the - // extension id-pkix-ocsp-nocheck. - // - Extension noCheck = - cert.getExtension(PKIXExtensions.OCSPNoCheck_Id); - if (noCheck != null) { - if (DEBUG != null) { - DEBUG.println("Responder's certificate includes " + - "the extension id-pkix-ocsp-nocheck."); - } + // check the validity + try { + if (dateCheckedAgainst == null) { + cert.checkValidity(); } else { - // we should do the revocating checking of the - // authorized responder in a future update. + cert.checkValidity(dateCheckedAgainst); } + } catch (GeneralSecurityException e) { + throw new CertPathValidatorException( + "Responder's certificate not within the " + + "validity period", e); + } - // verify the signature - try { - cert.verify(responderCert.getPublicKey()); - responderCert = cert; - // cert is trusted, now verify the signed response - - } catch (GeneralSecurityException e) { - responderCert = null; + // check for revocation + // + // A CA may specify that an OCSP client can trust a + // responder for the lifetime of the responder's + // certificate. The CA does so by including the + // extension id-pkix-ocsp-nocheck. + // + Extension noCheck = + cert.getExtension(PKIXExtensions.OCSPNoCheck_Id); + if (noCheck != null) { + if (DEBUG != null) { + DEBUG.println("Responder's certificate includes " + + "the extension id-pkix-ocsp-nocheck."); } } else { - if (DEBUG != null) { - DEBUG.println("Responder's certificate is not " + - "authorized to sign OCSP responses."); - } - throw new CertPathValidatorException( - "Responder's certificate not authorized to sign " + - "OCSP responses"); + // we should do the revocation checking of the + // authorized responder in a future update. } - } - // Confirm that the signed response was generated using the public - // key from the trusted responder cert - if (responderCert != null) { + // verify the signature + try { + cert.verify(responderCert.getPublicKey()); + responderCert = cert; + // cert is trusted, now verify the signed response - if (! verifyResponse(responseDataDer, responderCert, - sigAlgId, signature, params)) { - if (DEBUG != null) { - DEBUG.println("Error verifying OCSP Responder's " + - "signature"); - } - throw new CertPathValidatorException( - "Error verifying OCSP Responder's signature"); + } catch (GeneralSecurityException e) { + responderCert = null; } } else { - // Need responder's cert in order to verify the signature - if (DEBUG != null) { - DEBUG.println("Unable to verify OCSP Responder's " + - "signature"); - } throw new CertPathValidatorException( - "Unable to verify OCSP Responder's signature"); + "Responder's certificate is not authorized to sign " + + "OCSP responses"); } - } catch (CertPathValidatorException cpve) { - throw cpve; - } catch (Exception e) { - throw new CertPathValidatorException(e); } + + // Confirm that the signed response was generated using the public + // key from the trusted responder cert + if (responderCert != null) { + if (!verifyResponse(responseDataDer, responderCert, + sigAlgId, signature)) { + throw new CertPathValidatorException( + "Error verifying OCSP Responder's signature"); + } + } else { + // Need responder's cert in order to verify the signature + throw new CertPathValidatorException( + "Unable to verify OCSP Responder's signature"); + } + } + + /** + * Returns the OCSP ResponseStatus. + */ + ResponseStatus getResponseStatus() { + return responseStatus; } /* @@ -449,11 +446,10 @@ class OCSPResponse { * The responder's cert is implicitly trusted. */ private boolean verifyResponse(byte[] responseData, X509Certificate cert, - AlgorithmId sigAlgId, byte[] signBytes, PKIXParameters params) - throws SignatureException { + AlgorithmId sigAlgId, byte[] signBytes) + throws CertPathValidatorException { try { - Signature respSignature = Signature.getInstance(sigAlgId.getName()); respSignature.initVerify(cert); respSignature.update(responseData); @@ -472,92 +468,33 @@ class OCSPResponse { return false; } } catch (InvalidKeyException ike) { - throw new SignatureException(ike); - + throw new CertPathValidatorException(ike); } catch (NoSuchAlgorithmException nsae) { - throw new SignatureException(nsae); + throw new CertPathValidatorException(nsae); + } catch (SignatureException se) { + throw new CertPathValidatorException(se); } } - /* - * Return the revocation status code for a given certificate. + /** + * Returns the SingleResponse of the specified CertId, or null if + * there is no response for that CertId. */ - // used by OCSPChecker - int getCertStatus(SerialNumber sn) { - // ignore serial number for now; if we support multiple - // requests/responses then it will be used - return singleResponse.getStatus(); - } - - // used by OCSPChecker - CertId getCertId() { - return singleResponse.getCertId(); - } - - Date getRevocationTime() { - return singleResponse.getRevocationTime(); - } - - CRLReason getRevocationReason() { - return singleResponse.getRevocationReason(); - } - - Map getSingleExtensions() { - return singleResponse.getSingleExtensions(); - } - - /* - * Map an OCSP response status code to a string. - */ - static private String responseToText(int status) { - switch (status) { - case 0: - return "Successful"; - case 1: - return "Malformed request"; - case 2: - return "Internal error"; - case 3: - return "Try again later"; - case 4: - return "Unused status code"; - case 5: - return "Request must be signed"; - case 6: - return "Request is unauthorized"; - default: - return ("Unknown status code: " + status); - } - } - - /* - * Map a certificate's revocation status code to a string. - */ - // used by OCSPChecker - static String certStatusToText(int certStatus) { - switch (certStatus) { - case 0: - return "Good"; - case 1: - return "Revoked"; - case 2: - return "Unknown"; - default: - return ("Unknown certificate status code: " + certStatus); - } + SingleResponse getSingleResponse(CertId certId) { + return singleResponseMap.get(certId); } /* * A class representing a single OCSP response. */ - private class SingleResponse { - private CertId certId; - private int certStatus; - private Date thisUpdate; - private Date nextUpdate; - private Date revocationTime; - private CRLReason revocationReason = CRLReason.UNSPECIFIED; - private HashMap singleExtensions; + final static class SingleResponse implements OCSP.RevocationStatus { + private final CertId certId; + private final CertStatus certStatus; + private final Date thisUpdate; + private final Date nextUpdate; + private final Date revocationTime; + private final CRLReason revocationReason; + private final Map singleExtensions; private SingleResponse(DerValue der) throws IOException { if (der.tag != DerValue.tag_Sequence) { @@ -568,35 +505,48 @@ class OCSPResponse { certId = new CertId(tmp.getDerValue().data); DerValue derVal = tmp.getDerValue(); short tag = (byte)(derVal.tag & 0x1f); - if (tag == CERT_STATUS_GOOD) { - certStatus = CERT_STATUS_GOOD; - } else if (tag == CERT_STATUS_REVOKED) { - certStatus = CERT_STATUS_REVOKED; + if (tag == CERT_STATUS_REVOKED) { + certStatus = CertStatus.REVOKED; revocationTime = derVal.data.getGeneralizedTime(); if (derVal.data.available() != 0) { - int reason = derVal.getEnumerated(); - // if reason out-of-range just leave as UNSPECIFIED - if (reason >= 0 && reason < values.length) { - revocationReason = values[reason]; + DerValue dv = derVal.data.getDerValue(); + tag = (byte)(dv.tag & 0x1f); + if (tag == 0) { + int reason = dv.data.getEnumerated(); + // if reason out-of-range just leave as UNSPECIFIED + if (reason >= 0 && reason < values.length) { + revocationReason = values[reason]; + } else { + revocationReason = CRLReason.UNSPECIFIED; + } + } else { + revocationReason = CRLReason.UNSPECIFIED; } + } else { + revocationReason = CRLReason.UNSPECIFIED; } // RevokedInfo if (DEBUG != null) { DEBUG.println("Revocation time: " + revocationTime); DEBUG.println("Revocation reason: " + revocationReason); } - - } else if (tag == CERT_STATUS_UNKNOWN) { - certStatus = CERT_STATUS_UNKNOWN; - } else { - throw new IOException("Invalid certificate status"); + revocationTime = null; + revocationReason = CRLReason.UNSPECIFIED; + if (tag == CERT_STATUS_GOOD) { + certStatus = CertStatus.GOOD; + } else if (tag == CERT_STATUS_UNKNOWN) { + certStatus = CertStatus.UNKNOWN; + } else { + throw new IOException("Invalid certificate status"); + } } thisUpdate = tmp.getGeneralizedTime(); if (tmp.available() == 0) { // we are done + nextUpdate = null; } else { derVal = tmp.getDerValue(); tag = (byte)(derVal.tag & 0x1f); @@ -610,6 +560,8 @@ class OCSPResponse { derVal = tmp.getDerValue(); tag = (byte)(derVal.tag & 0x1f); } + } else { + nextUpdate = null; } } // singleExtensions @@ -627,7 +579,11 @@ class OCSPResponse { DEBUG.println("OCSP single extension: " + ext); } } + } else { + singleExtensions = Collections.emptyMap(); } + } else { + singleExtensions = Collections.emptyMap(); } long now = System.currentTimeMillis(); @@ -657,7 +613,7 @@ class OCSPResponse { /* * Return the certificate's revocation status code */ - private int getStatus() { + @Override public CertStatus getCertStatus() { return certStatus; } @@ -665,28 +621,28 @@ class OCSPResponse { return certId; } - private Date getRevocationTime() { - return revocationTime; + @Override public Date getRevocationTime() { + return (Date) revocationTime.clone(); } - private CRLReason getRevocationReason() { + @Override public CRLReason getRevocationReason() { return revocationReason; } - private Map getSingleExtensions() { - return singleExtensions; + @Override + public Map getSingleExtensions() { + return Collections.unmodifiableMap(singleExtensions); } /** * Construct a string representation of a single OCSP response. */ - public String toString() { + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("SingleResponse: \n"); sb.append(certId); - sb.append("\nCertStatus: "+ certStatusToText(getCertStatus(null)) + - "\n"); - if (certStatus == CERT_STATUS_REVOKED) { + sb.append("\nCertStatus: "+ certStatus + "\n"); + if (certStatus == CertStatus.REVOKED) { sb.append("revocationTime is " + revocationTime + "\n"); sb.append("revocationReason is " + revocationReason + "\n"); } diff --git a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java index 63335d2342c..145879239ac 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2009 Sun Microsystems, Inc. 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 @@ -28,8 +28,6 @@ package sun.security.provider.certpath; import java.io.IOException; import java.security.AccessController; import java.security.InvalidAlgorithmParameterException; -import java.security.PrivilegedAction; -import java.security.Security; import java.security.cert.CertPath; import java.security.cert.CertPathParameters; import java.security.cert.CertPathValidatorException; @@ -49,6 +47,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.Set; import javax.security.auth.x500.X500Principal; +import sun.security.action.GetBooleanSecurityPropertyAction; import sun.security.util.Debug; /** @@ -67,7 +66,8 @@ public class PKIXCertPathValidator extends CertPathValidatorSpi { private List userCheckers; private String sigProvider; private BasicChecker basicChecker; - private String ocspProperty; + private boolean ocspEnabled = false; + private boolean onlyEECert = false; /** * Default constructor. @@ -253,13 +253,12 @@ public class PKIXCertPathValidator extends CertPathValidatorSpi { if (pkixParam.isRevocationEnabled()) { // Examine OCSP security property - ocspProperty = AccessController.doPrivileged( - new PrivilegedAction() { - public String run() { - return - Security.getProperty(OCSPChecker.OCSP_ENABLE_PROP); - } - }); + ocspEnabled = AccessController.doPrivileged( + new GetBooleanSecurityPropertyAction + (OCSPChecker.OCSP_ENABLE_PROP)); + onlyEECert = AccessController.doPrivileged( + new GetBooleanSecurityPropertyAction + ("com.sun.security.onlyCheckRevocationOfEECert")); } } @@ -301,15 +300,15 @@ public class PKIXCertPathValidator extends CertPathValidatorSpi { if (pkixParam.isRevocationEnabled()) { // Use OCSP if it has been enabled - if ("true".equalsIgnoreCase(ocspProperty)) { + if (ocspEnabled) { OCSPChecker ocspChecker = - new OCSPChecker(cpOriginal, pkixParam); + new OCSPChecker(cpOriginal, pkixParam, onlyEECert); certPathCheckers.add(ocspChecker); } // Always use CRLs - CrlRevocationChecker revocationChecker = - new CrlRevocationChecker(anchor, pkixParam, certList); + CrlRevocationChecker revocationChecker = new + CrlRevocationChecker(anchor, pkixParam, certList, onlyEECert); certPathCheckers.add(revocationChecker); } diff --git a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java index 0c439349d3c..6723cb8c6b8 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2009 Sun Microsystems, Inc. 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 @@ -26,6 +26,7 @@ package sun.security.provider.certpath; import java.io.IOException; +import java.security.AccessController; import java.security.GeneralSecurityException; import java.security.InvalidAlgorithmParameterException; import java.security.Principal; @@ -44,6 +45,7 @@ import java.util.LinkedList; import java.util.Set; import javax.security.auth.x500.X500Principal; +import sun.security.action.GetBooleanSecurityPropertyAction; import sun.security.x509.X500Name; import sun.security.x509.PKIXExtensions; import sun.security.util.Debug; @@ -85,6 +87,7 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { private PublicKey finalPublicKey; private X509CertSelector targetSel; private List orderedCertStores; + private boolean onlyEECert = false; /** * Create an instance of SunCertPathBuilder. @@ -97,6 +100,9 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { } catch (CertificateException e) { throw new CertPathBuilderException(e); } + onlyEECert = AccessController.doPrivileged( + new GetBooleanSecurityPropertyAction + ("com.sun.security.onlyCheckRevocationOfEECert")); } /** @@ -256,7 +262,6 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { /* * Private build reverse method. - * */ private void buildReverse(List> adjacencyList, LinkedList certPathList) throws Exception @@ -296,7 +301,7 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { currentState.updateState(anchor); // init the crl checker currentState.crlChecker = - new CrlRevocationChecker(null, buildParams); + new CrlRevocationChecker(null, buildParams, null, onlyEECert); try { depthFirstSearchReverse(null, currentState, new ReverseBuilder(buildParams, targetSubjectDN), adjacencyList, @@ -341,10 +346,12 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { adjacencyList.add(new LinkedList()); // init the crl checker - currentState.crlChecker = new CrlRevocationChecker(null, buildParams); + currentState.crlChecker + = new CrlRevocationChecker(null, buildParams, null, onlyEECert); depthFirstSearchForward(targetSubjectDN, currentState, - new ForwardBuilder(buildParams, targetSubjectDN, searchAllCertStores), + new ForwardBuilder + (buildParams, targetSubjectDN, searchAllCertStores, onlyEECert), adjacencyList, certPathList); } @@ -486,8 +493,8 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { userCheckers.add(mustCheck, basicChecker); mustCheck++; if (buildParams.isRevocationEnabled()) { - userCheckers.add(mustCheck, - new CrlRevocationChecker(anchor, buildParams)); + userCheckers.add(mustCheck, new CrlRevocationChecker + (anchor, buildParams, null, onlyEECert)); mustCheck++; } } diff --git a/jdk/src/share/classes/sun/security/ssl/CipherSuite.java b/jdk/src/share/classes/sun/security/ssl/CipherSuite.java index bb1ffa0909d..6ca15478f8e 100644 --- a/jdk/src/share/classes/sun/security/ssl/CipherSuite.java +++ b/jdk/src/share/classes/sun/security/ssl/CipherSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2002-2009 Sun Microsystems, Inc. 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 @@ -74,7 +74,7 @@ final class CipherSuite implements Comparable { // Flag indicating if CipherSuite availability can change dynamically. // This is the case when we rely on a JCE cipher implementation that // may not be available in the installed JCE providers. - // It is true because we do not have a Java ECC implementation. + // It is true because we might not have an ECC or Kerberos implementation. final static boolean DYNAMIC_AVAILABILITY = true; private final static boolean ALLOW_ECC = Debug.getBooleanProperty @@ -278,14 +278,22 @@ final class CipherSuite implements Comparable { KeyExchange(String name, boolean allowed) { this.name = name; this.allowed = allowed; - this.alwaysAvailable = allowed && (name.startsWith("EC") == false); + this.alwaysAvailable = allowed && + (!name.startsWith("EC")) && (!name.startsWith("KRB")); } boolean isAvailable() { if (alwaysAvailable) { return true; } - return allowed && JsseJce.isEcAvailable(); + + if (name.startsWith("EC")) { + return (allowed && JsseJce.isEcAvailable()); + } else if (name.startsWith("KRB")) { + return (allowed && JsseJce.isKerberosAvailable()); + } else { + return allowed; + } } public String toString() { diff --git a/jdk/src/share/classes/sun/security/ssl/JsseJce.java b/jdk/src/share/classes/sun/security/ssl/JsseJce.java index 017efd03ac2..779214308d3 100644 --- a/jdk/src/share/classes/sun/security/ssl/JsseJce.java +++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-2009 Sun Microsystems, Inc. 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 @@ -64,6 +64,29 @@ final class JsseJce { // If yes, then all the EC based crypto we need is available. private static volatile Boolean ecAvailable; + // Flag indicating whether Kerberos crypto is available. + // If true, then all the Kerberos-based crypto we need is available. + private final static boolean kerberosAvailable; + static { + boolean temp; + try { + AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public Void run() throws Exception { + // Test for Kerberos using the bootstrap class loader + Class.forName("sun.security.krb5.PrincipalName", true, + null); + return null; + } + }); + temp = true; + + } catch (Exception e) { + temp = false; + } + kerberosAvailable = temp; + } + static { // force FIPS flag initialization // Because isFIPS() is synchronized and cryptoProvider is not modified @@ -187,6 +210,10 @@ final class JsseJce { ecAvailable = null; } + static boolean isKerberosAvailable() { + return kerberosAvailable; + } + /** * Return an JCE cipher implementation for the specified algorithm. */ diff --git a/jdk/src/share/classes/sun/security/tools/JarSigner.java b/jdk/src/share/classes/sun/security/tools/JarSigner.java index fd0797a854d..3e1d0929104 100644 --- a/jdk/src/share/classes/sun/security/tools/JarSigner.java +++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java @@ -291,13 +291,21 @@ public class JarSigner { for (n=0; n < args.length; n++) { String flags = args[n]; + String modifier = null; + if (flags.charAt(0) == '-') { + int pos = flags.indexOf(':'); + if (pos > 0) { + modifier = flags.substring(pos+1); + flags = flags.substring(0, pos); + } + } if (collator.compare(flags, "-keystore") == 0) { if (++n == args.length) usageNoArg(); keystore = args[n]; } else if (collator.compare(flags, "-storepass") ==0) { if (++n == args.length) usageNoArg(); - storepass = args[n].toCharArray(); + storepass = getPass(modifier, args[n]); } else if (collator.compare(flags, "-storetype") ==0) { if (++n == args.length) usageNoArg(); storetype = args[n]; @@ -329,7 +337,7 @@ public class JarSigner { debug = true; } else if (collator.compare(flags, "-keypass") ==0) { if (++n == args.length) usageNoArg(); - keypass = args[n].toCharArray(); + keypass = getPass(modifier, args[n]); } else if (collator.compare(flags, "-sigfile") ==0) { if (++n == args.length) usageNoArg(); sigfile = args[n]; @@ -355,13 +363,7 @@ public class JarSigner { } else if (collator.compare(flags, "-verify") ==0) { verify = true; } else if (collator.compare(flags, "-verbose") ==0) { - verbose = "all"; - } else if (collator.compare(flags, "-verbose:all") ==0) { - verbose = "all"; - } else if (collator.compare(flags, "-verbose:summary") ==0) { - verbose = "summary"; - } else if (collator.compare(flags, "-verbose:grouped") ==0) { - verbose = "grouped"; + verbose = (modifier != null) ? modifier : "all"; } else if (collator.compare(flags, "-sigalg") ==0) { if (++n == args.length) usageNoArg(); sigalg = args[n]; @@ -465,18 +467,25 @@ public class JarSigner { } } - void usageNoArg() { + static char[] getPass(String modifier, String arg) { + char[] output = KeyTool.getPassWithModifier(modifier, arg); + if (output != null) return output; + usage(); + return null; // Useless, usage() already exit + } + + static void usageNoArg() { System.out.println(rb.getString("Option lacks argument")); usage(); } - void usage() { + static void usage() { System.out.println(); System.out.println(rb.getString("Please type jarsigner -help for usage")); System.exit(1); } - void fullusage() { + static void fullusage() { System.out.println(rb.getString ("Usage: jarsigner [options] jar-file alias")); System.out.println(rb.getString @@ -1978,20 +1987,35 @@ public class JarSigner { String[] base64Digests = getDigests(ze, zf, digests, encoder); for (int i=0; i v3ext = new ArrayList (); - private static final int CERTREQ = 1; - private static final int CHANGEALIAS = 2; - private static final int DELETE = 3; - private static final int EXPORTCERT = 4; - private static final int GENKEYPAIR = 5; - private static final int GENSECKEY = 6; - // there is no HELP - private static final int IDENTITYDB = 7; - private static final int IMPORTCERT = 8; - private static final int IMPORTKEYSTORE = 9; - private static final int KEYCLONE = 10; - private static final int KEYPASSWD = 11; - private static final int LIST = 12; - private static final int PRINTCERT = 13; - private static final int SELFCERT = 14; - private static final int STOREPASSWD = 15; - private static final int GENCERT = 16; - private static final int PRINTCERTREQ = 17; + enum Command { + CERTREQ("Generates a certificate request", + "-alias", "-sigalg", "-file", "-keypass", "-keystore", + "-storepass", "-storetype", "-providername", "-providerclass", + "-providerarg", "-providerpath", "-v", "-protected"), + CHANGEALIAS("Changes an entry's alias", + "-alias", "-destalias", "-keypass", "-keystore", "-storepass", + "-storetype", "-providername", "-providerclass", "-providerarg", + "-providerpath", "-v", "-protected"), + DELETE("Deletes an entry", + "-alias", "-keystore", "-storepass", "-storetype", + "-providername", "-providerclass", "-providerarg", + "-providerpath", "-v", "-protected"), + EXPORTCERT("Exports certificate", + "-rfc", "-alias", "-file", "-keystore", "-storepass", + "-storetype", "-providername", "-providerclass", "-providerarg", + "-providerpath", "-v", "-protected"), + GENKEYPAIR("Generates a key pair", + "-alias", "-keyalg", "-keysize", "-sigalg", "-destalias", + "-startdate", "-ext", "-validity", "-keypass", "-keystore", + "-storepass", "-storetype", "-providername", "-providerclass", + "-providerarg", "-providerpath", "-v", "-protected"), + GENSECKEY("Generates a secret key", + "-alias", "-keypass", "-keyalg", "-keysize", "-keystore", + "-storepass", "-storetype", "-providername", "-providerclass", + "-providerarg", "-providerpath", "-v", "-protected"), + GENCERT("Generates certificate from a certificate request", + "-rfc", "-infile", "-outfile", "-alias", "-sigalg", + "-startdate", "-ext", "-validity", "-keypass", "-keystore", + "-storepass", "-storetype", "-providername", "-providerclass", + "-providerarg", "-providerpath", "-v", "-protected"), + IDENTITYDB("Imports entries from a JDK 1.1.x-style identity database", + "-file", "-storetype", "-keystore", "-storepass", "-providername", + "-providerclass", "-providerarg", "-providerpath", "-v"), + IMPORTCERT("Imports a certificate or a certificate chain", + "-noprompt", "-trustcacerts", "-protected", "-alias", "-file", + "-keypass", "-keystore", "-storepass", "-storetype", + "-providername", "-providerclass", "-providerarg", + "-providerpath", "-v"), + IMPORTKEYSTORE("Imports one or all entries from another keystore", + "-srckeystore", "-destkeystore", "-srcstoretype", + "-deststoretype", "-srcstorepass", "-deststorepass", + "-srcprotected", "-srcprovidername", "-destprovidername", + "-srcalias", "-destalias", "-srckeypass", "-destkeypass", + "-noprompt", "-providerclass", "-providerarg", "-providerpath", + "-v"), + KEYCLONE("Clones a key entry", + "-alias", "-destalias", "-keypass", "-new", "-storetype", + "-keystore", "-storepass", "-providername", "-providerclass", + "-providerarg", "-providerpath", "-v"), + KEYPASSWD("Changes the key password of an entry", + "-alias", "-keypass", "-new", "-keystore", "-storepass", + "-storetype", "-providername", "-providerclass", "-providerarg", + "-providerpath", "-v"), + LIST("Lists entries in a keystore", + "-rfc", "-alias", "-keystore", "-storepass", "-storetype", + "-providername", "-providerclass", "-providerarg", + "-providerpath", "-v", "-protected"), + PRINTCERT("Prints the content of a certificate", + "-rfc", "-file", "-sslserver", "-v"), + PRINTCERTREQ("Prints the content of a certificate request", + "-file", "-v"), + SELFCERT("Generates a self-signed certificate", + "-alias", "-sigalg", "-dname", "-startdate", "-validity", "-keypass", + "-storetype", "-keystore", "-storepass", "-providername", + "-providerclass", "-providerarg", "-providerpath", "-v"), + STOREPASSWD("Changes the store password of a keystore", + "-new", "-keystore", "-storepass", "-storetype", "-providername", + "-providerclass", "-providerarg", "-providerpath", "-v"); + + final String description; + final String[] options; + Command(String d, String... o) { + description = d; + options = o; + } + @Override + public String toString() { + return "-" + name().toLowerCase(Locale.ENGLISH); + } + }; + + private static String[][] options = { + // name, arg, description + {"-alias", "", "alias name of the entry to process"}, + {"-destalias", "", "destination alias"}, + {"-destkeypass", "", "destination key password"}, + {"-destkeystore", "", "destination keystore name"}, + {"-destprotected", null, "destination keystore password protected"}, + {"-destprovidername", "", "destination keystore provider name"}, + {"-deststorepass", "", "destination keystore password"}, + {"-deststoretype", "", "destination keystore type"}, + {"-dname", "", "distinguished name"}, + {"-ext", "", "X.509 extension"}, + {"-file", "", "output file name"}, + {"-file", "", "input file name"}, + {"-infile", "", "input file name"}, + {"-keyalg", "", "key algorithm name"}, + {"-keypass", "", "key password"}, + {"-keysize", "", "key bit size"}, + {"-keystore", "", "keystore name"}, + {"-new", "", "new password"}, + {"-noprompt", null, "do not prompt"}, + {"-outfile", "", "output file name"}, + {"-protected", null, "password through protected mechanism"}, + {"-providerarg", "", "provider argument"}, + {"-providerclass", "", "provider class name"}, + {"-providername", "", "provider name"}, + {"-providerpath", "", "provider classpath"}, + {"-rfc", null, "output in RFC style"}, + {"-sigalg", "", "signature algorithm name"}, + {"-srcalias", "", "source alias"}, + {"-srckeypass", "", "source keystore password"}, + {"-srckeystore", "", "source keystore name"}, + {"-srcprotected", null, "source keystore password protected"}, + {"-srcprovidername", "", "source keystore provider name"}, + {"-srcstorepass", "", "source keystore password"}, + {"-srcstoretype", "", "source keystore type"}, + {"-sslserver", "", "SSL server host and port"}, + {"-startdate", "", "certificate validity start date/time"}, + {"-storepass", "", "keystore password"}, + {"-storetype", "", "keystore type"}, + {"-trustcacerts", null, "trust certificates from cacerts"}, + {"-v", null, "verbose output"}, + {"-validity", "", "validity number of days"}, + }; private static final Class[] PARAM_STRING = { String.class }; @@ -192,7 +301,7 @@ public final class KeyTool { private void run(String[] args, PrintStream out) throws Exception { try { parseArgs(args); - if (command != -1) { + if (command != null) { doCommands(out); } } catch (Exception e) { @@ -224,59 +333,59 @@ public final class KeyTool { */ void parseArgs(String[] args) { - if (args.length == 0) { - usage(); - return; - } - int i=0; + boolean help = args.length == 0; for (i=0; (i < args.length) && args[i].startsWith("-"); i++) { String flags = args[i]; + + // Check if the last option needs an arg + if (i == args.length - 1) { + for (String[] option: options) { + // Only options with an arg need to be checked + if (collator.compare(flags, option[0]) == 0) { + if (option[1] != null) errorNeedArgument(flags); + break; + } + } + } + + /* + * Check modifiers + */ + String modifier = null; + int pos = flags.indexOf(':'); + if (pos > 0) { + modifier = flags.substring(pos+1); + flags = flags.substring(0, pos); + } /* * command modes */ - if (collator.compare(flags, "-certreq") == 0) { - command = CERTREQ; - } else if (collator.compare(flags, "-delete") == 0) { - command = DELETE; - } else if (collator.compare(flags, "-export") == 0 || - collator.compare(flags, "-exportcert") == 0) { + boolean isCommand = false; + for (Command c: Command.values()) { + if (collator.compare(flags, c.toString()) == 0) { + command = c; + isCommand = true; + break; + } + } + + if (isCommand) { + // already recognized as a command + } else if (collator.compare(flags, "-export") == 0) { command = EXPORTCERT; - } else if (collator.compare(flags, "-genkey") == 0 || - collator.compare(flags, "-genkeypair") == 0) { + } else if (collator.compare(flags, "-genkey") == 0) { command = GENKEYPAIR; - } else if (collator.compare(flags, "-help") == 0) { - usage(); - return; - } else if (collator.compare(flags, "-identitydb") == 0) { // obsolete - command = IDENTITYDB; - } else if (collator.compare(flags, "-import") == 0 || - collator.compare(flags, "-importcert") == 0) { + } else if (collator.compare(flags, "-import") == 0) { command = IMPORTCERT; - } else if (collator.compare(flags, "-keyclone") == 0) { // obsolete - command = KEYCLONE; - } else if (collator.compare(flags, "-changealias") == 0) { - command = CHANGEALIAS; - } else if (collator.compare(flags, "-keypasswd") == 0) { - command = KEYPASSWD; - } else if (collator.compare(flags, "-list") == 0) { - command = LIST; - } else if (collator.compare(flags, "-printcert") == 0) { - command = PRINTCERT; - } else if (collator.compare(flags, "-selfcert") == 0) { // obsolete - command = SELFCERT; - } else if (collator.compare(flags, "-storepasswd") == 0) { - command = STOREPASSWD; - } else if (collator.compare(flags, "-importkeystore") == 0) { - command = IMPORTKEYSTORE; - } else if (collator.compare(flags, "-genseckey") == 0) { - command = GENSECKEY; - } else if (collator.compare(flags, "-gencert") == 0) { - command = GENCERT; - } else if (collator.compare(flags, "-printcertreq") == 0) { - command = PRINTCERTREQ; + } + /* + * Help + */ + else if (collator.compare(flags, "-help") == 0) { + help = true; } /* @@ -284,101 +393,74 @@ public final class KeyTool { */ else if (collator.compare(flags, "-keystore") == 0 || collator.compare(flags, "-destkeystore") == 0) { - if (++i == args.length) errorNeedArgument(flags); - ksfname = args[i]; + ksfname = args[++i]; } else if (collator.compare(flags, "-storepass") == 0 || collator.compare(flags, "-deststorepass") == 0) { - if (++i == args.length) errorNeedArgument(flags); - storePass = args[i].toCharArray(); + storePass = getPass(modifier, args[++i]); passwords.add(storePass); } else if (collator.compare(flags, "-storetype") == 0 || collator.compare(flags, "-deststoretype") == 0) { - if (++i == args.length) errorNeedArgument(flags); - storetype = args[i]; + storetype = args[++i]; } else if (collator.compare(flags, "-srcstorepass") == 0) { - if (++i == args.length) errorNeedArgument(flags); - srcstorePass = args[i].toCharArray(); + srcstorePass = getPass(modifier, args[++i]); passwords.add(srcstorePass); } else if (collator.compare(flags, "-srcstoretype") == 0) { - if (++i == args.length) errorNeedArgument(flags); - srcstoretype = args[i]; + srcstoretype = args[++i]; } else if (collator.compare(flags, "-srckeypass") == 0) { - if (++i == args.length) errorNeedArgument(flags); - srckeyPass = args[i].toCharArray(); + srckeyPass = getPass(modifier, args[++i]); passwords.add(srckeyPass); } else if (collator.compare(flags, "-srcprovidername") == 0) { - if (++i == args.length) errorNeedArgument(flags); - srcProviderName = args[i]; + srcProviderName = args[++i]; } else if (collator.compare(flags, "-providername") == 0 || collator.compare(flags, "-destprovidername") == 0) { - if (++i == args.length) errorNeedArgument(flags); - providerName = args[i]; + providerName = args[++i]; } else if (collator.compare(flags, "-providerpath") == 0) { - if (++i == args.length) errorNeedArgument(flags); - pathlist = args[i]; + pathlist = args[++i]; } else if (collator.compare(flags, "-keypass") == 0) { - if (++i == args.length) errorNeedArgument(flags); - keyPass = args[i].toCharArray(); + keyPass = getPass(modifier, args[++i]); passwords.add(keyPass); } else if (collator.compare(flags, "-new") == 0) { - if (++i == args.length) errorNeedArgument(flags); - newPass = args[i].toCharArray(); + newPass = getPass(modifier, args[++i]); passwords.add(newPass); } else if (collator.compare(flags, "-destkeypass") == 0) { - if (++i == args.length) errorNeedArgument(flags); - destKeyPass = args[i].toCharArray(); + destKeyPass = getPass(modifier, args[++i]); passwords.add(destKeyPass); } else if (collator.compare(flags, "-alias") == 0 || collator.compare(flags, "-srcalias") == 0) { - if (++i == args.length) errorNeedArgument(flags); - alias = args[i]; + alias = args[++i]; } else if (collator.compare(flags, "-dest") == 0 || collator.compare(flags, "-destalias") == 0) { - if (++i == args.length) errorNeedArgument(flags); - dest = args[i]; + dest = args[++i]; } else if (collator.compare(flags, "-dname") == 0) { - if (++i == args.length) errorNeedArgument(flags); - dname = args[i]; + dname = args[++i]; } else if (collator.compare(flags, "-keysize") == 0) { - if (++i == args.length) errorNeedArgument(flags); - keysize = Integer.parseInt(args[i]); + keysize = Integer.parseInt(args[++i]); } else if (collator.compare(flags, "-keyalg") == 0) { - if (++i == args.length) errorNeedArgument(flags); - keyAlgName = args[i]; + keyAlgName = args[++i]; } else if (collator.compare(flags, "-sigalg") == 0) { - if (++i == args.length) errorNeedArgument(flags); - sigAlgName = args[i]; + sigAlgName = args[++i]; } else if (collator.compare(flags, "-startdate") == 0) { - if (++i == args.length) errorNeedArgument(flags); - startDate = args[i]; + startDate = args[++i]; } else if (collator.compare(flags, "-validity") == 0) { - if (++i == args.length) errorNeedArgument(flags); - validity = Long.parseLong(args[i]); + validity = Long.parseLong(args[++i]); } else if (collator.compare(flags, "-ext") == 0) { - if (++i == args.length) errorNeedArgument(flags); - v3ext.add(args[i]); + v3ext.add(args[++i]); } else if (collator.compare(flags, "-file") == 0) { - if (++i == args.length) errorNeedArgument(flags); - filename = args[i]; + filename = args[++i]; } else if (collator.compare(flags, "-infile") == 0) { - if (++i == args.length) errorNeedArgument(flags); - infilename = args[i]; + infilename = args[++i]; } else if (collator.compare(flags, "-outfile") == 0) { - if (++i == args.length) errorNeedArgument(flags); - outfilename = args[i]; + outfilename = args[++i]; } else if (collator.compare(flags, "-sslserver") == 0) { - if (++i == args.length) errorNeedArgument(flags); - sslserver = args[i]; + sslserver = args[++i]; } else if (collator.compare(flags, "-srckeystore") == 0) { - if (++i == args.length) errorNeedArgument(flags); - srcksfname = args[i]; + srcksfname = args[++i]; } else if ((collator.compare(flags, "-provider") == 0) || (collator.compare(flags, "-providerclass") == 0)) { - if (++i == args.length) errorNeedArgument(flags); if (providers == null) { providers = new HashSet> (3); } - String providerClass = args[i]; + String providerClass = args[++i]; String providerArg = null; if (args.length > (i+1)) { @@ -418,19 +500,24 @@ public final class KeyTool { } if (i is not a legal command")); - Object[] source = {args[i]}; - throw new RuntimeException(form.format(source)); + System.err.println(rb.getString("Illegal option: ") + args[i]); + tinyHelp(); } - if (command == -1) { - System.err.println(rb.getString("Usage error: no command provided")); - tinyHelp(); + if (command == null) { + if (help) { + usage(); + } else { + System.err.println(rb.getString("Usage error: no command provided")); + tinyHelp(); + } + } else if (help) { + usage(); + command = null; } } - boolean isKeyStoreRelated(int cmd) { + boolean isKeyStoreRelated(Command cmd) { return cmd != PRINTCERT && cmd != PRINTCERTREQ; } @@ -2600,7 +2687,7 @@ public final class KeyTool { do { if (maxRetry-- < 0) { throw new RuntimeException(rb.getString( - "Too may retries, program terminated")); + "Too many retries, program terminated")); } commonName = inputString(in, rb.getString("What is your first and last name?"), @@ -3086,7 +3173,7 @@ public final class KeyTool { do { if (maxRetry-- < 0) { throw new RuntimeException(rb.getString( - "Too may retries, program terminated")); + "Too many retries, program terminated")); } System.err.print(prompt); System.err.flush(); @@ -3258,7 +3345,8 @@ public final class KeyTool { int nmatch = 0; for (int i = 0; i] [-sigalg ]")); - System.err.println(rb.getString - ("\t [-dname ]")); - System.err.println(rb.getString - ("\t [-file ] [-keypass ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); + // Left and right sides of the options list + String[] left = new String[command.options.length]; + String[] right = new String[command.options.length]; - System.err.println(rb.getString - ("-changealias [-v] [-protected] -alias -destalias ")); - System.err.println(rb.getString - ("\t [-keypass ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); + // Check if there's an unknown option + boolean found = false; - System.err.println(rb.getString - ("-delete [-v] [-protected] -alias ")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString - ("-exportcert [-v] [-rfc] [-protected]")); - System.err.println(rb.getString - ("\t [-alias ] [-file ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString - ("-genkeypair [-v] [-protected]")); - System.err.println(rb.getString - ("\t [-alias ]")); - System.err.println(rb.getString - ("\t [-keyalg ] [-keysize ]")); - System.err.println(rb.getString - ("\t [-sigalg ] [-dname ]")); - System.err.println(rb.getString - ("\t [-startdate ]")); - System.err.println(rb.getString - ("\t [-ext [:critical][=]]...")); - System.err.println(rb.getString - ("\t [-validity ] [-keypass ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString - ("-gencert [-v] [-rfc] [-protected]")); - System.err.println(rb.getString - ("\t [-infile ] [-outfile ]")); - System.err.println(rb.getString - ("\t [-alias ]")); - System.err.println(rb.getString - ("\t [-dname ]")); - System.err.println(rb.getString - ("\t [-sigalg ]")); - System.err.println(rb.getString - ("\t [-startdate ]")); - System.err.println(rb.getString - ("\t [-ext [:critical][=]]...")); - System.err.println(rb.getString - ("\t [-validity ] [-keypass ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString - ("-genseckey [-v] [-protected]")); - System.err.println(rb.getString - ("\t [-alias ] [-keypass ]")); - System.err.println(rb.getString - ("\t [-keyalg ] [-keysize ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString("-help")); - System.err.println(); - - System.err.println(rb.getString - ("-importcert [-v] [-noprompt] [-trustcacerts] [-protected]")); - System.err.println(rb.getString - ("\t [-alias ]")); - System.err.println(rb.getString - ("\t [-file ] [-keypass ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString - ("-importkeystore [-v] ")); - System.err.println(rb.getString - ("\t [-srckeystore ] [-destkeystore ]")); - System.err.println(rb.getString - ("\t [-srcstoretype ] [-deststoretype ]")); - System.err.println(rb.getString - ("\t [-srcstorepass ] [-deststorepass ]")); - System.err.println(rb.getString - ("\t [-srcprotected] [-destprotected]")); - System.err.println(rb.getString - ("\t [-srcprovidername ]\n\t [-destprovidername ]")); - System.err.println(rb.getString - ("\t [-srcalias [-destalias ]")); - System.err.println(rb.getString - ("\t [-srckeypass ] [-destkeypass ]]")); - System.err.println(rb.getString - ("\t [-noprompt]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString - ("-keypasswd [-v] [-alias ]")); - System.err.println(rb.getString - ("\t [-keypass ] [-new ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString - ("-list [-v | -rfc] [-protected]")); - System.err.println(rb.getString - ("\t [-alias ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); - System.err.println(); - - System.err.println(rb.getString - ("-printcert [-v] [-rfc] [-file | -sslserver ]")); - System.err.println(); - - System.err.println(rb.getString - ("-printcertreq [-v] [-file ]")); - System.err.println(); - - System.err.println(rb.getString - ("-storepasswd [-v] [-new ]")); - System.err.println(rb.getString - ("\t [-keystore ] [-storepass ]")); - System.err.println(rb.getString - ("\t [-storetype ] [-providername ]")); - System.err.println(rb.getString - ("\t [-providerclass [-providerarg ]] ...")); - System.err.println(rb.getString - ("\t [-providerpath ]")); + // Length of left side of options list + int lenLeft = 0; + for (int j=0; j lenLeft) { + lenLeft = left[j].length(); + } + right[j] = rb.getString(opt[2]); + found = true; + break; + } + } + if (!found) { + throw new RuntimeException("ERROR: CANNOT FIND " + command.options[j]); + } + } + for (int j=0; j needs an argument.")).format(source)); tinyHelp(); } + + private char[] getPass(String modifier, String arg) { + char[] output = getPassWithModifier(modifier, arg); + if (output != null) return output; + tinyHelp(); + return null; // Useless, tinyHelp() already exits. + } + + // This method also used by JarSigner + public static char[] getPassWithModifier(String modifier, String arg) { + if (modifier == null) { + return arg.toCharArray(); + } else if (collator.compare(modifier, "env") == 0) { + String value = System.getenv(arg); + if (value == null) { + System.err.println(rb.getString( + "Cannot find environment variable: ") + arg); + return null; + } else { + return value.toCharArray(); + } + } else if (collator.compare(modifier, "file") == 0) { + try { + URL url = null; + try { + url = new URL(arg); + } catch (java.net.MalformedURLException mue) { + File f = new File(arg); + if (f.exists()) { + url = f.toURI().toURL(); + } else { + System.err.println(rb.getString( + "Cannot find file: ") + arg); + return null; + } + } + BufferedReader br = new BufferedReader(new InputStreamReader( + url.openStream())); + String value = br.readLine(); + br.close(); + if (value == null) { + return new char[0]; + } else { + return value.toCharArray(); + } + } catch (IOException ioe) { + System.err.println(ioe); + return null; + } + } else { + System.err.println(rb.getString("Unknown password type: ") + + modifier); + return null; + } + } } // This class is exactly the same as com.sun.tools.javac.util.Pair, @@ -3960,3 +3945,4 @@ class Pair { return new Pair(a,b); } } + diff --git a/jdk/make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasPath.java b/jdk/src/share/classes/sun/security/util/PermissionFactory.java similarity index 79% rename from jdk/make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasPath.java rename to jdk/src/share/classes/sun/security/util/PermissionFactory.java index f5459e1dcdb..10356051fa3 100644 --- a/jdk/make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasPath.java +++ b/jdk/src/share/classes/sun/security/util/PermissionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2009 Sun Microsystems, Inc. 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 @@ -22,13 +22,15 @@ * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ -package org.jdesktop.swingx.designer.utils; + +package sun.security.util; + +import java.security.Permission; /** - * HasPath - interface for model nodes that can provide there path in the tree - * - * @author Created by Jasper Potts (Jul 2, 2007) + * A factory object that creates Permission objects. */ -public interface HasPath { - public String getPath(); + +public interface PermissionFactory { + T newPermission(String name); } diff --git a/jdk/src/share/classes/sun/security/util/Resources.java b/jdk/src/share/classes/sun/security/util/Resources.java index 9b3931b68a1..686e91469a8 100644 --- a/jdk/src/share/classes/sun/security/util/Resources.java +++ b/jdk/src/share/classes/sun/security/util/Resources.java @@ -46,18 +46,149 @@ public class Resources extends java.util.ListResourceBundle { {"*******************************************\n\n", "*******************************************\n\n"}, - // keytool + // keytool: Help part + {" [OPTION]...", " [OPTION]..."}, + {"Options:", "Options:"}, + {"Use \"keytool -help\" for all available commands", + "Use \"keytool -help\" for all available commands"}, + {"Key and Certificate Management Tool", + "Key and Certificate Management Tool"}, + {"Commands:", "Commands:"}, + {"Use \"keytool -command_name -help\" for usage of command_name", + "Use \"keytool -command_name -help\" for usage of command_name"}, + // keytool: help: commands + {"Generates a certificate request", + "Generates a certificate request"}, //-certreq + {"Changes an entry's alias", + "Changes an entry's alias"}, //-changealias + {"Deletes an entry", + "Deletes an entry"}, //-delete + {"Exports certificate", + "Exports certificate"}, //-exportcert + {"Generates a key pair", + "Generates a key pair"}, //-genkeypair + {"Generates a secret key", + "Generates a secret key"}, //-genseckey + {"Generates certificate from a certificate request", + "Generates certificate from a certificate request"}, //-gencert + {"Imports entries from a JDK 1.1.x-style identity database", + "Imports entries from a JDK 1.1.x-style identity database"}, //-identitydb + {"Imports a certificate or a certificate chain", + "Imports a certificate or a certificate chain"}, //-importcert + {"Imports one or all entries from another keystore", + "Imports one or all entries from another keystore"}, //-importkeystore + {"Clones a key entry", + "Clones a key entry"}, //-keyclone + {"Changes the key password of an entry", + "Changes the key password of an entry"}, //-keypasswd + {"Lists entries in a keystore", + "Lists entries in a keystore"}, //-list + {"Prints the content of a certificate", + "Prints the content of a certificate"}, //-printcert + {"Prints the content of a certificate request", + "Prints the content of a certificate request"}, //-printcertreq + {"Generates a self-signed certificate", + "Generates a self-signed certificate"}, //-selfcert + {"Changes the store password of a keystore", + "Changes the store password of a keystore"}, //-storepasswd + // keytool: help: options + {"alias name of the entry to process", + "alias name of the entry to process"}, //-alias + {"destination alias", + "destination alias"}, //-destalias + {"destination key password", + "destination key password"}, //-destkeypass + {"destination keystore name", + "destination keystore name"}, //-destkeystore + {"destination keystore password protected", + "destination keystore password protected"}, //-destprotected + {"destination keystore provider name", + "destination keystore provider name"}, //-destprovidername + {"destination keystore password", + "destination keystore password"}, //-deststorepass + {"destination keystore type", + "destination keystore type"}, //-deststoretype + {"distinguished name", + "distinguished name"}, //-dname + {"X.509 extension", + "X.509 extension"}, //-ext + {"output file name", + "output file name"}, //-file + {"input file name", + "input file name"}, //-file + {"input file name", + "input file name"}, //-infile + {"key algorithm name", + "key algorithm name"}, //-keyalg + {"key password", + "key password"}, //-keypass + {"key bit size", + "key bit size"}, //-keysize + {"keystore name", + "keystore name"}, //-keystore + {"new password", + "new password"}, //-new + {"do not prompt", + "do not prompt"}, //-noprompt + {"output file name", + "output file name"}, //-outfile + {"password through protected mechanism", + "password through protected mechanism"}, //-protected + {"provider argument", + "provider argument"}, //-providerarg + {"provider class name", + "provider class name"}, //-providerclass + {"provider name", + "provider name"}, //-providername + {"provider classpath", + "provider classpath"}, //-providerpath + {"output in RFC style", + "output in RFC style"}, //-rfc + {"signature algorithm name", + "signature algorithm name"}, //-sigalg + {"source alias", + "source alias"}, //-srcalias + {"source keystore password", + "source keystore password"}, //-srckeypass + {"source keystore name", + "source keystore name"}, //-srckeystore + {"source keystore password protected", + "source keystore password protected"}, //-srcprotected + {"source keystore provider name", + "source keystore provider name"}, //-srcprovidername + {"source keystore password", + "source keystore password"}, //-srcstorepass + {"source keystore type", + "source keystore type"}, //-srcstoretype + {"SSL server host and port", + "SSL server host and port"}, //-sslserver + {"certificate validity start date/time", + "certificate validity start date/time"}, //-startdate + {"keystore password", + "keystore password"}, //-storepass + {"keystore type", + "keystore type"}, //-storetype + {"trust certificates from cacerts", + "trust certificates from cacerts"}, //-trustcacerts + {"verbose output", + "verbose output"}, //-v + {"validity number of days", + "validity number of days"}, //-validity + // keytool: Running part {"keytool error: ", "keytool error: "}, {"Illegal option: ", "Illegal option: "}, {"Illegal value: ", "Illegal value: "}, - {"Try keytool -help","Try keytool -help"}, + {"Unknown password type: ", "Unknown password type: "}, + {"Cannot find environment variable: ", + "Cannot find environment variable: "}, + {"Cannot find file: ", "Cannot find file: "}, {"Command option needs an argument.", "Command option {0} needs an argument."}, {"Warning: Different store and key passwords not supported for PKCS12 KeyStores. Ignoring user-specified value.", "Warning: Different store and key passwords not supported for PKCS12 KeyStores. Ignoring user-specified {0} value."}, {"-keystore must be NONE if -storetype is {0}", "-keystore must be NONE if -storetype is {0}"}, - {"Too may retries, program terminated", - "Too may retries, program terminated"}, + {"Too many retries, program terminated", + "Too many retries, program terminated"}, {"-storepasswd and -keypasswd commands not supported if -storetype is {0}", "-storepasswd and -keypasswd commands not supported if -storetype is {0}"}, {"-keypasswd commands not supported if -storetype is PKCS12", @@ -77,7 +208,6 @@ public class Resources extends java.util.ListResourceBundle { "Validity must be greater than zero"}, {"provName not a provider", "{0} not a provider"}, {"Usage error: no command provided", "Usage error: no command provided"}, - {"Usage error, is not a legal command", "Usage error, {0} is not a legal command"}, {"Source keystore file exists, but is empty: ", "Source keystore file exists, but is empty: "}, {"Please specify -srckeystore", "Please specify -srckeystore"}, {"Must not specify both -v and -rfc with 'list' command", @@ -279,7 +409,6 @@ public class Resources extends java.util.ListResourceBundle { "Secret Key not generated, alias <{0}> already exists"}, {"Please provide -keysize for secret key generation", "Please provide -keysize for secret key generation"}, - {"keytool usage:\n", "keytool usage:\n"}, {"Extensions: ", "Extensions: "}, {"(Empty value)", "(Empty value)"}, @@ -297,139 +426,6 @@ public class Resources extends java.util.ListResourceBundle { {"Odd number of hex digits found: ", "Odd number of hex digits found: "}, {"command {0} is ambiguous:", "command {0} is ambiguous:"}, - {"-certreq [-v] [-protected]", - "-certreq [-v] [-protected]"}, - {"\t [-alias ] [-sigalg ]", - "\t [-alias ] [-sigalg ]"}, - {"\t [-dname ]", "\t [-dname ]"}, - {"\t [-file ] [-keypass ]", - "\t [-file ] [-keypass ]"}, - {"\t [-keystore ] [-storepass ]", - "\t [-keystore ] [-storepass ]"}, - {"\t [-storetype ] [-providername ]", - "\t [-storetype ] [-providername ]"}, - {"\t [-providerclass [-providerarg ]] ...", - "\t [-providerclass [-providerarg ]] ..."}, - {"\t [-providerpath ]", - "\t [-providerpath ]"}, - {"-delete [-v] [-protected] -alias ", - "-delete [-v] [-protected] -alias "}, - /** rest is same as -certreq starting from -keystore **/ - - //{"-export [-v] [-rfc] [-protected]", - // "-export [-v] [-rfc] [-protected]"}, - {"-exportcert [-v] [-rfc] [-protected]", - "-exportcert [-v] [-rfc] [-protected]"}, - {"\t [-alias ] [-file ]", - "\t [-alias ] [-file ]"}, - /** rest is same as -certreq starting from -keystore **/ - - //{"-genkey [-v] [-protected]", - // "-genkey [-v] [-protected]"}, - {"-genkeypair [-v] [-protected]", - "-genkeypair [-v] [-protected]"}, - {"\t [-alias ]", "\t [-alias ]"}, - {"\t [-keyalg ] [-keysize ]", - "\t [-keyalg ] [-keysize ]"}, - {"\t [-sigalg ] [-dname ]", - "\t [-sigalg ] [-dname ]"}, - {"\t [-startdate ]", - "\t [-startdate ]"}, - {"\t [-validity ] [-keypass ]", - "\t [-validity ] [-keypass ]"}, - /** rest is same as -certreq starting from -keystore **/ - {"-gencert [-v] [-rfc] [-protected]", - "-gencert [-v] [-rfc] [-protected]"}, - {"\t [-infile ] [-outfile ]", - "\t [-infile ] [-outfile ]"}, - {"\t [-sigalg ]", - "\t [-sigalg ]"}, - {"\t [-ext [:critical][=]]...", - "\t [-ext [:critical][=]]..."}, - - {"-genseckey [-v] [-protected]", - "-genseckey [-v] [-protected]"}, - /** rest is same as -certreq starting from -keystore **/ - - {"-help", "-help"}, - //{"-identitydb [-v] [-protected]", - // "-identitydb [-v] [-protected]"}, - //{"\t [-file ]", "\t [-file ]"}, - /** rest is same as -certreq starting from -keystore **/ - - //{"-import [-v] [-noprompt] [-trustcacerts] [-protected]", - // "-import [-v] [-noprompt] [-trustcacerts] [-protected]"}, - {"-importcert [-v] [-noprompt] [-trustcacerts] [-protected]", - "-importcert [-v] [-noprompt] [-trustcacerts] [-protected]"}, - {"\t [-alias ]", "\t [-alias ]"}, - {"\t [-alias ] [-keypass ]", - "\t [-alias ] [-keypass ]"}, - {"\t [-file ] [-keypass ]", - "\t [-file ] [-keypass ]"}, - /** rest is same as -certreq starting from -keystore **/ - - {"-importkeystore [-v] ", - "-importkeystore [-v] "}, - {"\t [-srckeystore ] [-destkeystore ]", - "\t [-srckeystore ] [-destkeystore ]"}, - {"\t [-srcstoretype ] [-deststoretype ]", - "\t [-srcstoretype ] [-deststoretype ]"}, - {"\t [-srcprotected] [-destprotected]", - "\t [-srcprotected] [-destprotected]"}, - {"\t [-srcstorepass ] [-deststorepass ]", - "\t [-srcstorepass ] [-deststorepass ]"}, - {"\t [-srcprovidername ]\n\t [-destprovidername ]", // line too long, split to 2 - "\t [-srcprovidername ]\n\t [-destprovidername ]"}, - {"\t [-srcalias [-destalias ]", - "\t [-srcalias [-destalias ]"}, - {"\t [-srckeypass ] [-destkeypass ]]", - "\t [-srckeypass ] [-destkeypass ]]"}, - {"\t [-noprompt]", "\t [-noprompt]"}, - /** rest is same as -certreq starting from -keystore **/ - - {"-changealias [-v] [-protected] -alias -destalias ", - "-changealias [-v] [-protected] -alias -destalias "}, - {"\t [-keypass ]", "\t [-keypass ]"}, - - //{"-keyclone [-v] [-protected]", - // "-keyclone [-v] [-protected]"}, - //{"\t [-alias ] -dest ", - // "\t [-alias ] -dest "}, - //{"\t [-keypass ] [-new ]", - // "\t [-keypass ] [-new ]"}, - /** rest is same as -certreq starting from -keystore **/ - - {"-keypasswd [-v] [-alias ]", - "-keypasswd [-v] [-alias ]"}, - {"\t [-keypass ] [-new ]", - "\t [-keypass ] [-new ]"}, - /** rest is same as -certreq starting from -keystore **/ - - {"-list [-v | -rfc] [-protected]", - "-list [-v | -rfc] [-protected]"}, - {"\t [-alias ]", "\t [-alias ]"}, - /** rest is same as -certreq starting from -keystore **/ - - {"-printcert [-v] [-rfc] [-file | -sslserver ]", - "-printcert [-v] [-rfc] [-file | -sslserver ]"}, - {"-printcertreq [-v] [-file ]", - "-printcertreq [-v] [-file ]"}, - {"No certificate from the SSL server", - "No certificate from the SSL server"}, - - //{"-selfcert [-v] [-protected]", - // "-selfcert [-v] [-protected]"}, - {"\t [-alias ]", "\t [-alias ]"}, - //{"\t [-dname ] [-validity ]", - // "\t [-dname ] [-validity ]"}, - //{"\t [-keypass ] [-sigalg ]", - // "\t [-keypass ] [-sigalg ]"}, - /** rest is same as -certreq starting from -keystore **/ - - {"-storepasswd [-v] [-new ]", - "-storepasswd [-v] [-new ]"}, - /** rest is same as -certreq starting from -keystore **/ - // policytool {"Warning: A public key for alias 'signers[i]' does not exist. Make sure a KeyStore is properly configured.", "Warning: A public key for alias {0} does not exist. Make sure a KeyStore is properly configured."}, @@ -679,3 +675,4 @@ public class Resources extends java.util.ListResourceBundle { return contents; } } + diff --git a/jdk/src/share/classes/sun/security/util/SecurityConstants.java b/jdk/src/share/classes/sun/security/util/SecurityConstants.java index 43e2cd3d792..89c6fd7fdea 100644 --- a/jdk/src/share/classes/sun/security/util/SecurityConstants.java +++ b/jdk/src/share/classes/sun/security/util/SecurityConstants.java @@ -25,12 +25,12 @@ package sun.security.util; -import java.io.FilePermission; -import java.awt.AWTPermission; -import java.util.PropertyPermission; -import java.lang.RuntimePermission; import java.net.SocketPermission; import java.net.NetPermission; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.Permission; +import java.security.BasicPermission; import java.security.SecurityPermission; import java.security.AllPermission; import javax.security.auth.AuthPermission; @@ -71,45 +71,118 @@ public final class SecurityConstants { // sun.security.provider.PolicyFile public static final AllPermission ALL_PERMISSION = new AllPermission(); - // java.lang.SecurityManager - public static final AWTPermission TOPLEVEL_WINDOW_PERMISSION = - new AWTPermission("showWindowWithoutWarningBanner"); + /** + * Permission type used when AWT is not present. + */ + private static class FakeAWTPermission extends BasicPermission { + private static final long serialVersionUID = -1L; + public FakeAWTPermission(String name) { + super(name); + } + public String toString() { + return "(\"java.awt.AWTPermission\" \"" + getName() + "\")"; + } + } - // java.lang.SecurityManager - public static final AWTPermission ACCESS_CLIPBOARD_PERMISSION = - new AWTPermission("accessClipboard"); + /** + * Permission factory used when AWT is not present. + */ + private static class FakeAWTPermissionFactory + implements PermissionFactory + { + @Override + public FakeAWTPermission newPermission(String name) { + return new FakeAWTPermission(name); + } + } - // java.lang.SecurityManager - public static final AWTPermission CHECK_AWT_EVENTQUEUE_PERMISSION = - new AWTPermission("accessEventQueue"); + /** + * AWT Permissions used in the JDK. + */ + public static class AWT { + private AWT() { } - // java.awt.Dialog - public static final AWTPermission TOOLKIT_MODALITY_PERMISSION = - new AWTPermission("toolkitModality"); + /** + * The class name of the factory to create java.awt.AWTPermission objects. + */ + private static final String AWTFactory = "sun.awt.AWTPermissionFactory"; - // java.awt.Robot - public static final AWTPermission READ_DISPLAY_PIXELS_PERMISSION = - new AWTPermission("readDisplayPixels"); + /** + * The PermissionFactory to create AWT permissions (or fake permissions + * if AWT is not present). + */ + private static final PermissionFactory factory = permissionFactory(); - // java.awt.Robot - public static final AWTPermission CREATE_ROBOT_PERMISSION = - new AWTPermission("createRobot"); + private static PermissionFactory permissionFactory() { + Class c = AccessController + .doPrivileged(new PrivilegedAction>() { + public Class run() { + try { + return Class.forName(AWTFactory, true, null); + } catch (ClassNotFoundException e) { + // not available + return null; + } + }}); + if (c != null) { + // AWT present + try { + return (PermissionFactory)c.newInstance(); + } catch (InstantiationException x) { + throw new InternalError(x.getMessage()); + } catch (IllegalAccessException x) { + throw new InternalError(x.getMessage()); + } + } else { + // AWT not present + return new FakeAWTPermissionFactory(); + } + } - // java.awt.MouseInfo - public static final AWTPermission WATCH_MOUSE_PERMISSION = - new AWTPermission("watchMousePointer"); + private static Permission newAWTPermission(String name) { + return factory.newPermission(name); + } - // java.awt.Window - public static final AWTPermission SET_WINDOW_ALWAYS_ON_TOP_PERMISSION = - new AWTPermission("setWindowAlwaysOnTop"); + // java.lang.SecurityManager + public static final Permission TOPLEVEL_WINDOW_PERMISSION = + newAWTPermission("showWindowWithoutWarningBanner"); - // java.awt.Toolkit - public static final AWTPermission ALL_AWT_EVENTS_PERMISSION = - new AWTPermission("listenToAllAWTEvents"); + // java.lang.SecurityManager + public static final Permission ACCESS_CLIPBOARD_PERMISSION = + newAWTPermission("accessClipboard"); - // java.awt.SystemTray - public static final AWTPermission ACCESS_SYSTEM_TRAY_PERMISSION = - new AWTPermission("accessSystemTray"); + // java.lang.SecurityManager + public static final Permission CHECK_AWT_EVENTQUEUE_PERMISSION = + newAWTPermission("accessEventQueue"); + + // java.awt.Dialog + public static final Permission TOOLKIT_MODALITY_PERMISSION = + newAWTPermission("toolkitModality"); + + // java.awt.Robot + public static final Permission READ_DISPLAY_PIXELS_PERMISSION = + newAWTPermission("readDisplayPixels"); + + // java.awt.Robot + public static final Permission CREATE_ROBOT_PERMISSION = + newAWTPermission("createRobot"); + + // java.awt.MouseInfo + public static final Permission WATCH_MOUSE_PERMISSION = + newAWTPermission("watchMousePointer"); + + // java.awt.Window + public static final Permission SET_WINDOW_ALWAYS_ON_TOP_PERMISSION = + newAWTPermission("setWindowAlwaysOnTop"); + + // java.awt.Toolkit + public static final Permission ALL_AWT_EVENTS_PERMISSION = + newAWTPermission("listenToAllAWTEvents"); + + // java.awt.SystemTray + public static final Permission ACCESS_SYSTEM_TRAY_PERMISSION = + newAWTPermission("accessSystemTray"); + } // java.net.URL public static final NetPermission SPECIFY_HANDLER_PERMISSION = diff --git a/jdk/src/share/classes/sun/security/x509/AccessDescription.java b/jdk/src/share/classes/sun/security/x509/AccessDescription.java index 1544ea953be..0911018110f 100644 --- a/jdk/src/share/classes/sun/security/x509/AccessDescription.java +++ b/jdk/src/share/classes/sun/security/x509/AccessDescription.java @@ -113,7 +113,7 @@ public final class AccessDescription { } else { method = accessMethod.toString(); } - return ("accessMethod: " + method + + return ("\n accessMethod: " + method + "\n accessLocation: " + accessLocation.toString() + "\n"); } } diff --git a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java index 7dea6a14bec..fb6104dbce9 100644 --- a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java +++ b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java @@ -1,5 +1,5 @@ /* - * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1996-2009 Sun Microsystems, Inc. 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 @@ -531,6 +531,18 @@ public class AlgorithmId implements Serializable, DerEncoder { || name.equalsIgnoreCase("ECDSA")) { return AlgorithmId.sha1WithECDSA_oid; } + if (name.equalsIgnoreCase("SHA224withECDSA")) { + return AlgorithmId.sha224WithECDSA_oid; + } + if (name.equalsIgnoreCase("SHA256withECDSA")) { + return AlgorithmId.sha256WithECDSA_oid; + } + if (name.equalsIgnoreCase("SHA384withECDSA")) { + return AlgorithmId.sha384WithECDSA_oid; + } + if (name.equalsIgnoreCase("SHA512withECDSA")) { + return AlgorithmId.sha512WithECDSA_oid; + } // See if any of the installed providers supply a mapping from // the given algorithm name to an OID string diff --git a/jdk/src/share/classes/sun/swing/MenuItemLayoutHelper.java b/jdk/src/share/classes/sun/swing/MenuItemLayoutHelper.java index 1f0281e9be3..02ce9abe9b1 100644 --- a/jdk/src/share/classes/sun/swing/MenuItemLayoutHelper.java +++ b/jdk/src/share/classes/sun/swing/MenuItemLayoutHelper.java @@ -84,7 +84,6 @@ public class MenuItemLayoutHelper { private int minTextOffset; private int leftTextExtraWidth; - private int rightTextExtraWidth; private Rectangle viewRect; @@ -157,7 +156,6 @@ public class MenuItemLayoutHelper { private void calcExtraWidths() { leftTextExtraWidth = getLeftExtraWidth(text); - rightTextExtraWidth = getRightExtraWidth(text); } private int getLeftExtraWidth(String str) { @@ -169,15 +167,6 @@ public class MenuItemLayoutHelper { } } - private int getRightExtraWidth(String str) { - int rsb = SwingUtilities2.getRightSideBearing(mi, fm, str); - if (rsb > 0) { - return rsb; - } else { - return 0; - } - } - private void setOriginalWidths() { iconSize.origWidth = iconSize.width; textSize.origWidth = textSize.width; @@ -313,7 +302,7 @@ public class MenuItemLayoutHelper { verticalAlignment, horizontalAlignment, verticalTextPosition, horizontalTextPosition, viewRect, iconRect, textRect, gap); - textRect.width += leftTextExtraWidth + rightTextExtraWidth; + textRect.width += leftTextExtraWidth; Rectangle labelRect = iconRect.union(textRect); labelSize.height = labelRect.height; labelSize.width = labelRect.width; @@ -1121,10 +1110,6 @@ public class MenuItemLayoutHelper { return leftTextExtraWidth; } - public int getRightTextExtraWidth() { - return rightTextExtraWidth; - } - /** * Returns false if the component is a JMenu and it is a top * level menu (on the menubar). diff --git a/jdk/src/share/classes/sun/swing/SwingUtilities2.java b/jdk/src/share/classes/sun/swing/SwingUtilities2.java index 3a4bc2141c3..60681d56fbc 100644 --- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java +++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java @@ -27,7 +27,6 @@ package sun.swing; import java.security.*; import java.lang.reflect.*; -import java.lang.ref.SoftReference; import java.awt.*; import static java.awt.RenderingHints.*; import java.awt.event.*; @@ -54,7 +53,7 @@ import sun.security.util.SecurityConstants; import java.io.*; import java.util.*; import sun.font.FontDesignMetrics; -import sun.font.FontManager; +import sun.font.FontUtilities; import sun.java2d.SunGraphicsEnvironment; import java.util.concurrent.Callable; @@ -78,17 +77,23 @@ public class SwingUtilities2 { public static final Object LAF_STATE_KEY = new StringBuffer("LookAndFeel State"); - // Most of applications use 10 or less fonts simultaneously - private static final int STRONG_BEARING_CACHE_SIZE = 10; - // Strong cache for the left and right side bearings - // for STRONG_BEARING_CACHE_SIZE most recently used fonts. - private static BearingCacheEntry[] strongBearingCache = - new BearingCacheEntry[STRONG_BEARING_CACHE_SIZE]; - // Next index to insert an entry into the strong bearing cache - private static int strongBearingCacheNextIndex = 0; - // Soft cache for the left and right side bearings - private static Set> softBearingCache = - new HashSet>(); + // Maintain a cache of CACHE_SIZE fonts and the left side bearing + // of the characters falling into the range MIN_CHAR_INDEX to + // MAX_CHAR_INDEX. The values in fontCache are created as needed. + private static LSBCacheEntry[] fontCache; + // Windows defines 6 font desktop properties, we will therefore only + // cache the metrics for 6 fonts. + private static final int CACHE_SIZE = 6; + // nextIndex in fontCache to insert a font into. + private static int nextIndex; + // LSBCacheEntry used to search in fontCache to see if we already + // have an entry for a particular font + private static LSBCacheEntry searchKey; + + // getLeftSideBearing will consult all characters that fall in the + // range MIN_CHAR_INDEX to MAX_CHAR_INDEX. + private static final int MIN_CHAR_INDEX = (int)'W'; + private static final int MAX_CHAR_INDEX = (int)'W' + 1; public static final FontRenderContext DEFAULT_FRC = new FontRenderContext(null, false, false); @@ -183,6 +188,23 @@ public class SwingUtilities2 { private static final Object charsBufferLock = new Object(); private static char[] charsBuffer = new char[CHAR_BUFFER_SIZE]; + static { + fontCache = new LSBCacheEntry[CACHE_SIZE]; + } + + /** + * Fill the character buffer cache. Return the buffer length. + */ + private static int syncCharsBuffer(String s) { + int length = s.length(); + if ((charsBuffer == null) || (charsBuffer.length < length)) { + charsBuffer = s.toCharArray(); + } else { + s.getChars(0, length, charsBuffer, 0); + } + return length; + } + /** * checks whether TextLayout is required to handle characters. * @@ -193,7 +215,7 @@ public class SwingUtilities2 { * false if TextLayout is not required */ public static final boolean isComplexLayout(char[] text, int start, int limit) { - return FontManager.isComplexText(text, start, limit); + return FontUtilities.isComplexText(text, start, limit); } // @@ -226,22 +248,29 @@ public class SwingUtilities2 { /** * Returns the left side bearing of the first character of string. The - * left side bearing is calculated from the passed in FontMetrics. + * left side bearing is calculated from the passed in + * FontMetrics. If the passed in String is less than one + * character {@code 0} is returned. * * @param c JComponent that will display the string * @param fm FontMetrics used to measure the String width * @param string String to get the left side bearing for. + * @throws NullPointerException if {@code string} is {@code null} + * + * @return the left side bearing of the first character of string + * or {@code 0} if the string is empty */ public static int getLeftSideBearing(JComponent c, FontMetrics fm, String string) { - if ((string == null) || (string.length() == 0)) { - return 0; + int res = 0; + if (!string.isEmpty()) { + res = getLeftSideBearing(c, fm, string.charAt(0)); } - return getLeftSideBearing(c, fm, string.charAt(0)); + return res; } /** - * Returns the left side bearing of the specified character. The + * Returns the left side bearing of the first character of string. The * left side bearing is calculated from the passed in FontMetrics. * * @param c JComponent that will display the string @@ -250,105 +279,37 @@ public class SwingUtilities2 { */ public static int getLeftSideBearing(JComponent c, FontMetrics fm, char firstChar) { - return getBearing(c, fm, firstChar, true); - } + int charIndex = (int) firstChar; + if (charIndex < MAX_CHAR_INDEX && charIndex >= MIN_CHAR_INDEX) { + byte[] lsbs = null; - /** - * Returns the right side bearing of the last character of string. The - * right side bearing is calculated from the passed in FontMetrics. - * - * @param c JComponent that will display the string - * @param fm FontMetrics used to measure the String width - * @param string String to get the right side bearing for. - */ - public static int getRightSideBearing(JComponent c, FontMetrics fm, - String string) { - if ((string == null) || (string.length() == 0)) { - return 0; - } - return getRightSideBearing(c, fm, string.charAt(string.length() - 1)); - } - - /** - * Returns the right side bearing of the specified character. The - * right side bearing is calculated from the passed in FontMetrics. - * - * @param c JComponent that will display the string - * @param fm FontMetrics used to measure the String width - * @param lastChar Character to get the right side bearing for. - */ - public static int getRightSideBearing(JComponent c, FontMetrics fm, - char lastChar) { - return getBearing(c, fm, lastChar, false); - } - - /* Calculates the left and right side bearing for a character. - * Strongly caches bearings for STRONG_BEARING_CACHE_SIZE - * most recently used Fonts and softly caches as many as GC allows. - */ - private static int getBearing(JComponent comp, FontMetrics fm, char c, - boolean isLeftBearing) { - if (fm == null) { - if (comp == null) { - return 0; - } else { - fm = comp.getFontMetrics(comp.getFont()); - } - } - synchronized (SwingUtilities2.class) { - BearingCacheEntry entry = null; - BearingCacheEntry searchKey = new BearingCacheEntry(fm); - // See if we already have an entry in the strong cache - for (BearingCacheEntry cacheEntry : strongBearingCache) { - if (searchKey.equals(cacheEntry)) { - entry = cacheEntry; - break; + FontRenderContext frc = getFontRenderContext(c, fm); + Font font = fm.getFont(); + synchronized (SwingUtilities2.class) { + LSBCacheEntry entry = null; + if (searchKey == null) { + searchKey = new LSBCacheEntry(frc, font); + } else { + searchKey.reset(frc, font); } - } - // See if we already have an entry in the soft cache - if (entry == null) { - Iterator> iter = - softBearingCache.iterator(); - while (iter.hasNext()) { - BearingCacheEntry cacheEntry = iter.next().get(); - if (cacheEntry == null) { - // Remove discarded soft reference from the cache - iter.remove(); - continue; - } + // See if we already have an entry for this pair + for (LSBCacheEntry cacheEntry : fontCache) { if (searchKey.equals(cacheEntry)) { entry = cacheEntry; - putEntryInStrongCache(entry); break; } } + if (entry == null) { + // No entry for this pair, add it. + entry = searchKey; + fontCache[nextIndex] = searchKey; + searchKey = null; + nextIndex = (nextIndex + 1) % CACHE_SIZE; + } + return entry.getLeftSideBearing(firstChar); } - if (entry == null) { - // No entry, add it - entry = searchKey; - cacheEntry(entry); - } - return (isLeftBearing) - ? entry.getLeftSideBearing(c) - : entry.getRightSideBearing(c); } - } - - private synchronized static void cacheEntry(BearingCacheEntry entry) { - // Move the oldest entry from the strong cache into the soft cache - BearingCacheEntry oldestEntry = - strongBearingCache[strongBearingCacheNextIndex]; - if (oldestEntry != null) { - softBearingCache.add(new SoftReference(oldestEntry)); - } - // Put entry in the strong cache - putEntryInStrongCache(entry); - } - - private synchronized static void putEntryInStrongCache(BearingCacheEntry entry) { - strongBearingCache[strongBearingCacheNextIndex] = entry; - strongBearingCacheNextIndex = (strongBearingCacheNextIndex + 1) - % STRONG_BEARING_CACHE_SIZE; + return 0; } /** @@ -413,7 +374,21 @@ public class SwingUtilities2 { if (string == null || string.equals("")) { return 0; } - return fm.stringWidth(string); + boolean needsTextLayout = ((c != null) && + (c.getClientProperty(TextAttribute.NUMERIC_SHAPING) != null)); + if (needsTextLayout) { + synchronized(charsBufferLock) { + int length = syncCharsBuffer(string); + needsTextLayout = isComplexLayout(charsBuffer, 0, length); + } + } + if (needsTextLayout) { + TextLayout layout = createTextLayout(c, string, + fm.getFont(), fm.getFontRenderContext()); + return (int) layout.getAdvance(); + } else { + return fm.stringWidth(string); + } } @@ -454,21 +429,11 @@ public class SwingUtilities2 { String string, int availTextWidth) { // c may be null here. String clipString = "..."; - int stringLength = string.length(); availTextWidth -= SwingUtilities2.stringWidth(c, fm, clipString); - if (availTextWidth <= 0) { - //can not fit any characters - return clipString; - } - boolean needsTextLayout; synchronized (charsBufferLock) { - if (charsBuffer == null || charsBuffer.length < stringLength) { - charsBuffer = string.toCharArray(); - } else { - string.getChars(0, stringLength, charsBuffer, 0); - } + int stringLength = syncCharsBuffer(string); needsTextLayout = isComplexLayout(charsBuffer, 0, stringLength); if (!needsTextLayout) { @@ -485,6 +450,10 @@ public class SwingUtilities2 { if (needsTextLayout) { FontRenderContext frc = getFontRenderContext(c, fm); AttributedString aString = new AttributedString(string); + if (c != null) { + aString.addAttribute(TextAttribute.NUMERIC_SHAPING, + c.getClientProperty(TextAttribute.NUMERIC_SHAPING)); + } LineBreakMeasurer measurer = new LineBreakMeasurer(aString.getIterator(), frc); int nChars = measurer.nextOffset(availTextWidth); @@ -525,7 +494,7 @@ public class SwingUtilities2 { */ float screenWidth = (float) g2d.getFont().getStringBounds(text, DEFAULT_FRC).getWidth(); - TextLayout layout = new TextLayout(text, g2d.getFont(), + TextLayout layout = createTextLayout(c, text, g2d.getFont(), g2d.getFontRenderContext()); layout = layout.getJustifiedLayout(screenWidth); @@ -565,7 +534,21 @@ public class SwingUtilities2 { } } - g.drawString(text, x, y); + boolean needsTextLayout = ((c != null) && + (c.getClientProperty(TextAttribute.NUMERIC_SHAPING) != null)); + if (needsTextLayout) { + synchronized(charsBufferLock) { + int length = syncCharsBuffer(text); + needsTextLayout = isComplexLayout(charsBuffer, 0, length); + } + } + if (needsTextLayout) { + TextLayout layout = createTextLayout(c, text, g2.getFont(), + g2.getFontRenderContext()); + layout.draw(g2, x, y); + } else { + g.drawString(text, x, y); + } if (oldAAValue != null) { g2.setRenderingHint(KEY_TEXT_ANTIALIASING, oldAAValue); @@ -607,11 +590,7 @@ public class SwingUtilities2 { boolean needsTextLayout = isPrinting; if (!needsTextLayout) { synchronized (charsBufferLock) { - if (charsBuffer == null || charsBuffer.length < textLength) { - charsBuffer = text.toCharArray(); - } else { - text.getChars(0, textLength, charsBuffer, 0); - } + syncCharsBuffer(text); needsTextLayout = isComplexLayout(charsBuffer, 0, textLength); } @@ -627,7 +606,7 @@ public class SwingUtilities2 { Graphics2D g2d = getGraphics2D(g); if (g2d != null) { TextLayout layout = - new TextLayout(text, g2d.getFont(), + createTextLayout(c, text, g2d.getFont(), g2d.getFontRenderContext()); if (isPrinting) { float screenWidth = (float)g2d.getFont(). @@ -788,7 +767,7 @@ public class SwingUtilities2 { !isFontRenderContextPrintCompatible (deviceFontRenderContext, frc)) { TextLayout layout = - new TextLayout(new String(data,offset,length), + createTextLayout(c, new String(data, offset, length), g2d.getFont(), deviceFontRenderContext); float screenWidth = (float)g2d.getFont(). @@ -906,6 +885,20 @@ public class SwingUtilities2 { return retVal; } + private static TextLayout createTextLayout(JComponent c, String s, + Font f, FontRenderContext frc) { + Object shaper = (c == null ? + null : c.getClientProperty(TextAttribute.NUMERIC_SHAPING)); + if (shaper == null) { + return new TextLayout(s, f, frc); + } else { + Map a = new HashMap(); + a.put(TextAttribute.FONT, f); + a.put(TextAttribute.NUMERIC_SHAPING, shaper); + return new TextLayout(s, a, frc); + } + } + /* * Checks if two given FontRenderContexts are compatible for printing. * We can't just use equals as we want to exclude from the comparison : @@ -1063,99 +1056,72 @@ public class SwingUtilities2 { } /** - * BearingCacheEntry is used to cache left and right character bearings - * for a particular Font and FontRenderContext. + * LSBCacheEntry is used to cache the left side bearing (lsb) for + * a particular Font and FontRenderContext. + * This only caches characters that fall in the range + * MIN_CHAR_INDEX to MAX_CHAR_INDEX. */ - private static class BearingCacheEntry { - private FontMetrics fontMetrics; - private Font font; - private FontRenderContext frc; - private Map cache; - // Used for the creation of a GlyphVector + private static class LSBCacheEntry { + // Used to indicate a particular entry in lsb has not been set. + private static final byte UNSET = Byte.MAX_VALUE; + // Used in creating a GlyphVector to get the lsb private static final char[] oneChar = new char[1]; - public BearingCacheEntry(FontMetrics fontMetrics) { - this.fontMetrics = fontMetrics; - this.font = fontMetrics.getFont(); - this.frc = fontMetrics.getFontRenderContext(); - this.cache = new HashMap(); - assert (font != null && frc != null); + private byte[] lsbCache; + private Font font; + private FontRenderContext frc; + + + public LSBCacheEntry(FontRenderContext frc, Font font) { + lsbCache = new byte[MAX_CHAR_INDEX - MIN_CHAR_INDEX]; + reset(frc, font); + + } + + public void reset(FontRenderContext frc, Font font) { + this.font = font; + this.frc = frc; + for (int counter = lsbCache.length - 1; counter >= 0; counter--) { + lsbCache[counter] = UNSET; + } } public int getLeftSideBearing(char aChar) { - Short bearing = cache.get(aChar); - if (bearing == null) { - bearing = calcBearing(aChar); - cache.put(aChar, bearing); + int index = aChar - MIN_CHAR_INDEX; + assert (index >= 0 && index < (MAX_CHAR_INDEX - MIN_CHAR_INDEX)); + byte lsb = lsbCache[index]; + if (lsb == UNSET) { + oneChar[0] = aChar; + GlyphVector gv = font.createGlyphVector(frc, oneChar); + lsb = (byte) gv.getGlyphPixelBounds(0, frc, 0f, 0f).x; + if (lsb < 0) { + /* HRGB/HBGR LCD glyph images will always have a pixel + * on the left used in colour fringe reduction. + * Text rendering positions this correctly but here + * we are using the glyph image to adjust that position + * so must account for it. + */ + Object aaHint = frc.getAntiAliasingHint(); + if (aaHint == VALUE_TEXT_ANTIALIAS_LCD_HRGB || + aaHint == VALUE_TEXT_ANTIALIAS_LCD_HBGR) { + lsb++; + } + } + lsbCache[index] = lsb; } - return ((0xFF00 & bearing) >>> 8) - 127; - } + return lsb; - public int getRightSideBearing(char aChar) { - Short bearing = cache.get(aChar); - if (bearing == null) { - bearing = calcBearing(aChar); - cache.put(aChar, bearing); - } - return (0xFF & bearing) - 127; - } - /* Calculates left and right side bearings for a character. - * Makes an assumption that bearing is a value between -127 and +127. - * Stores LSB and RSB as single two-byte number (short): - * LSB is the high byte, RSB is the low byte. - */ - private short calcBearing(char aChar) { - oneChar[0] = aChar; - GlyphVector gv = font.createGlyphVector(frc, oneChar); - Rectangle pixelBounds = gv.getGlyphPixelBounds(0, frc, 0f, 0f); - - // Get bearings - int lsb = pixelBounds.x; - int rsb = pixelBounds.width - fontMetrics.charWidth(aChar); - - /* HRGB/HBGR LCD glyph images will always have a pixel - * on the left and a pixel on the right - * used in colour fringe reduction. - * Text rendering positions this correctly but here - * we are using the glyph image to adjust that position - * so must account for it. - */ - if (lsb < 0) { - Object aaHint = frc.getAntiAliasingHint(); - if (aaHint == VALUE_TEXT_ANTIALIAS_LCD_HRGB || - aaHint == VALUE_TEXT_ANTIALIAS_LCD_HBGR) { - lsb++; - } - } - if (rsb > 0) { - Object aaHint = frc.getAntiAliasingHint(); - if (aaHint == VALUE_TEXT_ANTIALIAS_LCD_HRGB || - aaHint == VALUE_TEXT_ANTIALIAS_LCD_HBGR) { - rsb--; - } - } - - // Make sure that LSB and RSB are valid (see 6472972) - if (lsb < -127 || lsb > 127) { - lsb = 0; - } - if (rsb < -127 || rsb > 127) { - rsb = 0; - } - - int bearing = ((lsb + 127) << 8) + (rsb + 127); - return (short)bearing; } public boolean equals(Object entry) { if (entry == this) { return true; } - if (!(entry instanceof BearingCacheEntry)) { + if (!(entry instanceof LSBCacheEntry)) { return false; } - BearingCacheEntry oEntry = (BearingCacheEntry)entry; + LSBCacheEntry oEntry = (LSBCacheEntry) entry; return (font.equals(oEntry.font) && frc.equals(oEntry.frc)); } @@ -1172,7 +1138,6 @@ public class SwingUtilities2 { } } - /* * here goes the fix for 4856343 [Problem with applet interaction * with system selection clipboard] @@ -1181,36 +1146,34 @@ public class SwingUtilities2 { * are to be performed */ - /** - * checks the security permissions for accessing system clipboard - * - * for untrusted context (see isTrustedContext) checks the - * permissions for the current event being handled - * - */ - public static boolean canAccessSystemClipboard() { - boolean canAccess = false; - if (!GraphicsEnvironment.isHeadless()) { - SecurityManager sm = System.getSecurityManager(); - if (sm == null) { - canAccess = true; - } else { - try { - sm.checkSystemClipboardAccess(); - canAccess = true; - } catch (SecurityException e) { - } - if (canAccess && ! isTrustedContext()) { - canAccess = canCurrentEventAccessSystemClipboard(true); - } - } - } - return canAccess; - } - + * checks the security permissions for accessing system clipboard + * + * for untrusted context (see isTrustedContext) checks the + * permissions for the current event being handled + * + */ + public static boolean canAccessSystemClipboard() { + boolean canAccess = false; + if (!GraphicsEnvironment.isHeadless()) { + SecurityManager sm = System.getSecurityManager(); + if (sm == null) { + canAccess = true; + } else { + try { + sm.checkSystemClipboardAccess(); + canAccess = true; + } catch (SecurityException e) { + } + if (canAccess && ! isTrustedContext()) { + canAccess = canCurrentEventAccessSystemClipboard(true); + } + } + } + return canAccess; + } /** - * Returns true if EventQueue.getCurrentEvent() has the permissions to + * Returns true if EventQueue.getCurrentEvent() has the permissions to * access the system clipboard */ public static boolean canCurrentEventAccessSystemClipboard() { @@ -1844,4 +1807,22 @@ public class SwingUtilities2 { boolean three) { return liesIn(rect, p, false, false, three); } + + /** + * Returns the {@code JViewport} instance for the {@code component} + * or {@code null}. + * + * @return the {@code JViewport} instance for the {@code component} + * or {@code null} + * @throws NullPointerException if {@code component} is {@code null} + */ + public static JViewport getViewport(Component component) { + do { + component = component.getParent(); + if (component instanceof JViewport) { + return (JViewport) component; + } + } while(component instanceof JLayer); + return null; + } } diff --git a/jdk/src/share/classes/sun/util/LocaleServiceProviderPool.java b/jdk/src/share/classes/sun/util/LocaleServiceProviderPool.java index 8fd21c9ce0a..9fcfe5b7abc 100644 --- a/jdk/src/share/classes/sun/util/LocaleServiceProviderPool.java +++ b/jdk/src/share/classes/sun/util/LocaleServiceProviderPool.java @@ -39,8 +39,8 @@ import java.util.ServiceLoader; import java.util.ServiceConfigurationError; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger; import java.util.spi.LocaleServiceProvider; +import sun.util.logging.PlatformLogger; import sun.util.resources.LocaleData; import sun.util.resources.OpenListResourceBundle; @@ -122,10 +122,15 @@ public final class LocaleServiceProviderPool { } }); } catch (PrivilegedActionException e) { - Logger.getLogger("sun.util.LocaleServiceProviderPool").config(e.toString()); + config(e.toString()); } } + private static void config(String message) { + PlatformLogger logger = PlatformLogger.getLogger("sun.util.LocaleServiceProviderPool"); + logger.config(message); + } + /** * Lazy loaded set of available locales. * Loading all locales is a very long operation. @@ -337,7 +342,7 @@ public final class LocaleServiceProviderPool { if (providersObj != null) { return providersObj; } else if (isObjectProvider) { - Logger.getLogger("sun.util.LocaleServiceProviderPool").config( + config( "A locale sensitive service provider returned null for a localized objects, which should not happen. provider: " + lsp + " locale: " + requested); } } diff --git a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java new file mode 100644 index 00000000000..e8523b81f8d --- /dev/null +++ b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java @@ -0,0 +1,635 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + + +package sun.util.logging; + +import java.lang.ref.WeakReference; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.text.MessageFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import sun.misc.JavaLangAccess; +import sun.misc.SharedSecrets; + +/** + * Platform logger provides an API for the JRE components to log + * messages. This enables the runtime components to eliminate the + * static dependency of the logging facility and also defers the + * java.util.logging initialization until it is enabled. + * In addition, the PlatformLogger API can be used if the logging + * module does not exist. + * + * If the logging facility is not enabled, the platform loggers + * will output log messages per the default logging configuration + * (see below). In this implementation, it does not log the + * the stack frame information issuing the log message. + * + * When the logging facility is enabled (at startup or runtime), + * the java.util.logging.Logger will be created for each platform + * logger and all log messages will be forwarded to the Logger + * to handle. + * + * Logging facility is "enabled" when one of the following + * conditions is met: + * 1) a system property "java.util.logging.config.class" or + * "java.util.logging.config.file" is set + * 2) java.util.logging.LogManager or java.util.logging.Logger + * is referenced that will trigger the logging initialization. + * + * Default logging configuration: + * global logging level = INFO + * handlers = java.util.logging.ConsoleHandler + * java.util.logging.ConsoleHandler.level = INFO + * java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter + * + * Limitation: + * /lib/logging.properties is the system-wide logging + * configuration defined in the specification and read in the + * default case to configure any java.util.logging.Logger instances. + * Platform loggers will not detect if /lib/logging.properties + * is modified. In other words, unless the java.util.logging API + * is used at runtime or the logging system properties is set, + * the platform loggers will use the default setting described above. + * The platform loggers are designed for JDK developers use and + * this limitation can be workaround with setting + * -Djava.util.logging.config.file system property. + * + * @since 1.7 + */ +public class PlatformLogger { + // Same values as java.util.logging.Level for easy mapping + public static final int OFF = Integer.MAX_VALUE; + public static final int SEVERE = 1000; + public static final int WARNING = 900; + public static final int INFO = 800; + public static final int CONFIG = 700; + public static final int FINE = 500; + public static final int FINER = 400; + public static final int FINEST = 300; + public static final int ALL = Integer.MIN_VALUE; + + private static final int defaultLevel = INFO; + private static boolean loggingEnabled; + static { + loggingEnabled = AccessController.doPrivileged( + new PrivilegedAction() { + public Boolean run() { + String cname = System.getProperty("java.util.logging.config.class"); + String fname = System.getProperty("java.util.logging.config.file"); + return (cname != null || fname != null); + } + }); + } + + // Table of known loggers. Maps names to PlatformLoggers. + private static Map> loggers = + new HashMap>(); + + /** + * Returns a PlatformLogger of a given name. + */ + public static synchronized PlatformLogger getLogger(String name) { + PlatformLogger log = null; + WeakReference ref = loggers.get(name); + if (ref != null) { + log = ref.get(); + } + if (log == null) { + log = new PlatformLogger(name); + loggers.put(name, new WeakReference(log)); + } + return log; + } + + /** + * Initialize java.util.logging.Logger objects for all platform loggers. + * This method is called from LogManager.readPrimordialConfiguration(). + */ + public static synchronized void redirectPlatformLoggers() { + if (loggingEnabled || !JavaLogger.supported) return; + + loggingEnabled = true; + for (Map.Entry> entry : loggers.entrySet()) { + WeakReference ref = entry.getValue(); + PlatformLogger plog = ref.get(); + if (plog != null) { + plog.newJavaLogger(); + } + } + } + + /** + * Creates a new JavaLogger that the platform logger uses + */ + private void newJavaLogger() { + logger = new JavaLogger(logger.name, logger.effectiveLevel); + } + + // logger may be replaced with a JavaLogger object + // when the logging facility is enabled + private volatile LoggerProxy logger; + + private PlatformLogger(String name) { + if (loggingEnabled) { + this.logger = new JavaLogger(name); + } else { + this.logger = new LoggerProxy(name); + } + } + + /** + * A convenience method to test if the logger is turned off. + * (i.e. its level is OFF). + */ + public boolean isEnabled() { + return logger.isEnabled(); + } + + /** + * Gets the name for this platform logger. + */ + public String getName() { + return logger.name; + } + + /** + * Returns true if a message of the given level would actually + * be logged by this logger. + */ + public boolean isLoggable(int level) { + return logger.isLoggable(level); + } + + /** + * Gets the current log level. Returns 0 if the current effective level + * is not set (equivalent to Logger.getLevel() returns null). + */ + public int getLevel() { + return logger.getLevel(); + } + + /** + * Sets the log level. + */ + public void setLevel(int newLevel) { + logger.setLevel(newLevel); + } + + /** + * Logs a SEVERE message. + */ + public void severe(String msg) { + logger.doLog(SEVERE, msg); + } + + public void severe(String msg, Throwable t) { + logger.doLog(SEVERE, msg, t); + } + + public void severe(String msg, Object... params) { + logger.doLog(SEVERE, msg, params); + } + + /** + * Logs a WARNING message. + */ + public void warning(String msg) { + logger.doLog(WARNING, msg); + } + + public void warning(String msg, Throwable t) { + logger.doLog(WARNING, msg, t); + } + + public void warning(String msg, Object... params) { + logger.doLog(WARNING, msg, params); + } + + /** + * Logs an INFO message. + */ + public void info(String msg) { + logger.doLog(INFO, msg); + } + + public void info(String msg, Throwable t) { + logger.doLog(INFO, msg, t); + } + + public void info(String msg, Object... params) { + logger.doLog(INFO, msg, params); + } + + /** + * Logs a CONFIG message. + */ + public void config(String msg) { + logger.doLog(CONFIG, msg); + } + + public void config(String msg, Throwable t) { + logger.doLog(CONFIG, msg, t); + } + + public void config(String msg, Object... params) { + logger.doLog(CONFIG, msg, params); + } + + /** + * Logs a FINE message. + */ + public void fine(String msg) { + logger.doLog(FINE, msg); + } + + public void fine(String msg, Throwable t) { + logger.doLog(FINE, msg, t); + } + + public void fine(String msg, Object... params) { + logger.doLog(FINE, msg, params); + } + + /** + * Logs a FINER message. + */ + public void finer(String msg) { + logger.doLog(FINER, msg); + } + + public void finer(String msg, Throwable t) { + logger.doLog(FINER, msg, t); + } + + public void finer(String msg, Object... params) { + logger.doLog(FINER, msg, params); + } + + /** + * Logs a FINEST message. + */ + public void finest(String msg) { + logger.doLog(FINEST, msg); + } + + public void finest(String msg, Throwable t) { + logger.doLog(FINEST, msg, t); + } + + public void finest(String msg, Object... params) { + logger.doLog(FINEST, msg, params); + } + + /** + * Default platform logging support - output messages to + * System.err - equivalent to ConsoleHandler with SimpleFormatter. + */ + static class LoggerProxy { + private static final PrintStream defaultStream = System.err; + private static final String lineSeparator = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { + return System.getProperty("line.separator"); + } + }); + + final String name; + volatile int levelValue; + volatile int effectiveLevel = 0; // current effective level value + + LoggerProxy(String name) { + this(name, defaultLevel); + } + + LoggerProxy(String name, int level) { + this.name = name; + this.levelValue = level == 0 ? defaultLevel : level; + } + + boolean isEnabled() { + return levelValue != OFF; + } + + int getLevel() { + return effectiveLevel; + } + + void setLevel(int newLevel) { + levelValue = newLevel; + effectiveLevel = newLevel; + } + + void doLog(int level, String msg) { + if (level < levelValue || levelValue == OFF) { + return; + } + defaultStream.println(format(level, msg, null)); + } + + void doLog(int level, String msg, Throwable thrown) { + if (level < levelValue || levelValue == OFF) { + return; + } + defaultStream.println(format(level, msg, thrown)); + } + + void doLog(int level, String msg, Object... params) { + if (level < levelValue || levelValue == OFF) { + return; + } + String newMsg = formatMessage(msg, params); + defaultStream.println(format(level, newMsg, null)); + } + + public boolean isLoggable(int level) { + if (level < levelValue || levelValue == OFF) { + return false; + } + return true; + } + + private static final String format = "{0,date} {0,time}"; + + private Object args[] = new Object[1]; + private MessageFormat formatter; + private Date dat; + + // Copied from java.util.logging.Formatter.formatMessage + private String formatMessage(String format, Object... parameters) { + // Do the formatting. + try { + if (parameters == null || parameters.length == 0) { + // No parameters. Just return format string. + return format; + } + // Is it a java.text style format? + // Ideally we could match with + // Pattern.compile("\\{\\d").matcher(format).find()) + // However the cost is 14% higher, so we cheaply check for + // 1 of the first 4 parameters + if (format.indexOf("{0") >= 0 || format.indexOf("{1") >=0 || + format.indexOf("{2") >=0|| format.indexOf("{3") >=0) { + return java.text.MessageFormat.format(format, parameters); + } + return format; + } catch (Exception ex) { + // Formatting failed: use format string. + return format; + } + } + + private synchronized String format(int level, String msg, Throwable thrown) { + StringBuffer sb = new StringBuffer(); + // Minimize memory allocations here. + if (dat == null) { + dat = new Date(); + formatter = new MessageFormat(format); + } + dat.setTime(System.currentTimeMillis()); + args[0] = dat; + StringBuffer text = new StringBuffer(); + formatter.format(args, text, null); + sb.append(text); + sb.append(" "); + sb.append(getCallerInfo()); + sb.append(lineSeparator); + sb.append(PlatformLogger.getLevelName(level)); + sb.append(": "); + sb.append(msg); + if (thrown != null) { + try { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + thrown.printStackTrace(pw); + pw.close(); + sb.append(sw.toString()); + } catch (Exception ex) { + throw new AssertionError(ex); + } + } + + return sb.toString(); + } + + // Returns the caller's class and method's name; best effort + // if cannot infer, return the logger's name. + private String getCallerInfo() { + String sourceClassName = null; + String sourceMethodName = null; + + JavaLangAccess access = SharedSecrets.getJavaLangAccess(); + Throwable throwable = new Throwable(); + int depth = access.getStackTraceDepth(throwable); + + String logClassName = "sun.util.logging.PlatformLogger"; + boolean lookingForLogger = true; + for (int ix = 0; ix < depth; ix++) { + // Calling getStackTraceElement directly prevents the VM + // from paying the cost of building the entire stack frame. + StackTraceElement frame = + access.getStackTraceElement(throwable, ix); + String cname = frame.getClassName(); + if (lookingForLogger) { + // Skip all frames until we have found the first logger frame. + if (cname.equals(logClassName)) { + lookingForLogger = false; + } + } else { + if (!cname.equals(logClassName)) { + // We've found the relevant frame. + sourceClassName = cname; + sourceMethodName = frame.getMethodName(); + break; + } + } + } + + if (sourceClassName != null) { + return sourceClassName + " " + sourceMethodName; + } else { + return name; + } + } + } + + /** + * JavaLogger forwards all the calls to its corresponding + * java.util.logging.Logger object. + */ + static class JavaLogger extends LoggerProxy { + private static final boolean supported; + private static final Class loggerClass; + private static final Class levelClass; + private static final Method getLoggerMethod; + private static final Method setLevelMethod; + private static final Method getLevelMethod; + private static final Method isLoggableMethod; + private static final Method logMethod; + private static final Method logThrowMethod; + private static final Method logParamsMethod; + private static final Map levelObjects = + new HashMap(); + + static { + loggerClass = getClass("java.util.logging.Logger"); + levelClass = getClass("java.util.logging.Level"); + getLoggerMethod = getMethod(loggerClass, "getLogger", String.class); + setLevelMethod = getMethod(loggerClass, "setLevel", levelClass); + getLevelMethod = getMethod(loggerClass, "getLevel"); + isLoggableMethod = getMethod(loggerClass, "isLoggable", levelClass); + logMethod = getMethod(loggerClass, "log", levelClass, String.class); + logThrowMethod = getMethod(loggerClass, "log", levelClass, String.class, Throwable.class); + logParamsMethod = getMethod(loggerClass, "log", levelClass, String.class, Object[].class); + supported = (loggerClass != null && levelClass != null && getLoggerMethod != null && + getLevelMethod != null && setLevelMethod != null && + logMethod != null && logThrowMethod != null && logParamsMethod != null); + if (supported) { + // initialize the map to Level objects + getLevelObjects(); + } + } + + private static Class getClass(String name) { + try { + return Class.forName(name, true, null); + } catch (ClassNotFoundException e) { + return null; + } + } + + private static Method getMethod(Class cls, String name, Class... parameterTypes) { + if (cls == null) return null; + + try { + return cls.getMethod(name, parameterTypes); + } catch (NoSuchMethodException e) { + throw new AssertionError(e); + } + } + + private static Object invoke(Method m, Object obj, Object... params) { + try { + return m.invoke(obj, params); + } catch (IllegalAccessException e) { + throw new AssertionError(e); + } catch (InvocationTargetException e) { + throw new AssertionError(e); + } + } + + private static void getLevelObjects() { + // get all java.util.logging.Level objects + Method parseLevelMethod = getMethod(levelClass, "parse", String.class); + int[] levelArray = new int[] {OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL}; + for (int l : levelArray) { + Object o = invoke(parseLevelMethod, null, getLevelName(l)); + levelObjects.put(l, o); + } + } + + private final Object javaLogger; + JavaLogger(String name) { + this(name, 0); + } + + JavaLogger(String name, int level) { + super(name, level); + this.javaLogger = invoke(getLoggerMethod, null, name); + if (level != 0) { + // level has been updated and so set the Logger's level + invoke(setLevelMethod, javaLogger, levelObjects.get(level)); + } + } + + /** + * Let Logger.log() do the filtering since if the level of a + * platform logger is altered directly from + * java.util.logging.Logger.setLevel(), the levelValue will + * not be updated. + */ + void doLog(int level, String msg) { + invoke(logMethod, javaLogger, levelObjects.get(level), msg); + } + + void doLog(int level, String msg, Throwable t) { + invoke(logThrowMethod, javaLogger, levelObjects.get(level), msg, t); + } + + void doLog(int level, String msg, Object... params) { + invoke(logParamsMethod, javaLogger, levelObjects.get(level), msg, params); + } + + boolean isEnabled() { + Object level = invoke(getLevelMethod, javaLogger); + return level == null || level.equals(levelObjects.get(OFF)) == false; + } + + int getLevel() { + Object level = invoke(getLevelMethod, javaLogger); + if (level != null) { + for (Map.Entry l : levelObjects.entrySet()) { + if (level == l.getValue()) { + return l.getKey(); + } + } + } + return 0; + } + + void setLevel(int newLevel) { + levelValue = newLevel; + invoke(setLevelMethod, javaLogger, levelObjects.get(newLevel)); + } + + public boolean isLoggable(int level) { + return (Boolean) invoke(isLoggableMethod, javaLogger, levelObjects.get(level)); + } + } + + + private static String getLevelName(int level) { + switch (level) { + case OFF : return "OFF"; + case SEVERE : return "SEVERE"; + case WARNING : return "WARNING"; + case INFO : return "INFO"; + case CONFIG : return "CONFIG"; + case FINE : return "FINE"; + case FINER : return "FINER"; + case FINEST : return "FINEST"; + case ALL : return "ALL"; + default : return "UNKNOWN"; + } + } + +} diff --git a/jdk/src/share/demo/jvmti/waiters/Agent.cpp b/jdk/src/share/demo/jvmti/waiters/Agent.cpp index 30786133d50..f4da70281fd 100644 --- a/jdk/src/share/demo/jvmti/waiters/Agent.cpp +++ b/jdk/src/share/demo/jvmti/waiters/Agent.cpp @@ -72,36 +72,30 @@ Agent::get_monitor(jvmtiEnv *jvmti, JNIEnv *env, jobject object) { jvmtiError err; Monitor *m; + jlong tag; - /* We use tags to track these, the tag is the Monitor pointer */ - err = jvmti->RawMonitorEnter(lock); { - check_jvmti_error(jvmti, err, "raw monitor enter"); - - /* The raw monitor enter/exit protects us from creating two - * instances for the same object. - */ - jlong tag; - - m = NULL; - tag = (jlong)0; - err = jvmti->GetTag(object, &tag); - check_jvmti_error(jvmti, err, "get tag"); - /*LINTED*/ - m = (Monitor *)(void *)(ptrdiff_t)tag; - if ( m == NULL ) { - m = new Monitor(jvmti, env, object); - /*LINTED*/ - tag = (jlong)(ptrdiff_t)(void *)m; - err = jvmti->SetTag(object, tag); - check_jvmti_error(jvmti, err, "set tag"); - /* Save monitor on list */ + m = NULL; + tag = (jlong)0; + err = jvmti->GetTag(object, &tag); + check_jvmti_error(jvmti, err, "get tag"); + /*LINTED*/ + m = (Monitor *)(void *)(ptrdiff_t)tag; + if ( m == NULL ) { + m = new Monitor(jvmti, env, object); + /* Save monitor on list */ + if (monitor_count == monitor_list_size) { + monitor_list_size += monitor_list_grow_size; monitor_list = (Monitor**)realloc((void*)monitor_list, - (monitor_count+1)*(int)sizeof(Monitor*)); - monitor_list[monitor_count++] = m; + (monitor_list_size)*(int)sizeof(Monitor*)); } - } err = jvmti->RawMonitorExit(lock); - check_jvmti_error(jvmti, err, "raw monitor exit"); - + monitor_list[monitor_count] = m; + m->set_slot(monitor_count); + monitor_count++; + /*LINTED*/ + tag = (jlong)(ptrdiff_t)(void *)m; + err = jvmti->SetTag(object, tag); + check_jvmti_error(jvmti, err, "set tag"); + } return m; } @@ -112,12 +106,11 @@ Agent::Agent(jvmtiEnv *jvmti, JNIEnv *env, jthread thread) stdout_message("Agent created..\n"); stdout_message("VMInit...\n"); - /* Create a Monitor lock to use */ - err = jvmti->CreateRawMonitor("waiters Agent lock", &lock); - check_jvmti_error(jvmti, err, "create raw monitor"); /* Start monitor list */ monitor_count = 0; - monitor_list = (Monitor**)malloc((int)sizeof(Monitor*)); + monitor_list_size = initial_monitor_list_size; + monitor_list = (Monitor**) + malloc(monitor_list_size*(int)sizeof(Monitor*)); } Agent::~Agent() @@ -134,9 +127,6 @@ void Agent::vm_death(jvmtiEnv *jvmti, JNIEnv *env) delete monitor_list[i]; } free(monitor_list); - /* Destroy the Monitor lock to use */ - err = jvmti->DestroyRawMonitor(lock); - check_jvmti_error(jvmti, err, "destroy raw monitor"); /* Print death message */ stdout_message("VMDeath...\n"); } @@ -215,8 +205,16 @@ void Agent::object_free(jvmtiEnv* jvmti, jlong tag) /* We just cast the tag to a C++ pointer and delete it. * we know it can only be a Monitor *. */ - Monitor *m; + Monitor *m; /*LINTED*/ m = (Monitor *)(ptrdiff_t)tag; + if (monitor_count > 1) { + /* Move the last element to this Monitor's slot */ + int slot = m->get_slot(); + Monitor *last = monitor_list[monitor_count-1]; + monitor_list[slot] = last; + last->set_slot(slot); + } + monitor_count--; delete m; } diff --git a/jdk/src/share/demo/jvmti/waiters/Agent.hpp b/jdk/src/share/demo/jvmti/waiters/Agent.hpp index 9885baf8ba3..65fe1227362 100644 --- a/jdk/src/share/demo/jvmti/waiters/Agent.hpp +++ b/jdk/src/share/demo/jvmti/waiters/Agent.hpp @@ -34,8 +34,12 @@ class Agent { private: - jrawMonitorID lock; + enum { + initial_monitor_list_size = 64, + monitor_list_grow_size = 16 + }; Monitor **monitor_list; + unsigned monitor_list_size; unsigned monitor_count; Thread *get_thread(jvmtiEnv *jvmti, JNIEnv *env, jthread thread); Monitor *get_monitor(jvmtiEnv *jvmti, JNIEnv *env, jobject object); diff --git a/jdk/src/share/demo/jvmti/waiters/Monitor.cpp b/jdk/src/share/demo/jvmti/waiters/Monitor.cpp index a5efc5b23b3..acd092a142a 100644 --- a/jdk/src/share/demo/jvmti/waiters/Monitor.cpp +++ b/jdk/src/share/demo/jvmti/waiters/Monitor.cpp @@ -73,6 +73,16 @@ Monitor::~Monitor() name, contends, waits, timeouts); } +int Monitor::get_slot() +{ + return slot; +} + +void Monitor::set_slot(int aslot) +{ + slot = aslot; +} + void Monitor::contended() { contends++; diff --git a/jdk/src/share/demo/jvmti/waiters/Monitor.hpp b/jdk/src/share/demo/jvmti/waiters/Monitor.hpp index 95b49560abd..af6dedda5b9 100644 --- a/jdk/src/share/demo/jvmti/waiters/Monitor.hpp +++ b/jdk/src/share/demo/jvmti/waiters/Monitor.hpp @@ -35,6 +35,7 @@ class Monitor { private: char name[64]; + int slot; unsigned contends; unsigned waits; unsigned timeouts; @@ -42,6 +43,8 @@ class Monitor { public: Monitor(jvmtiEnv *jvmti, JNIEnv *env, jobject object); ~Monitor(); + int get_slot(); + void set_slot(int i); void contended(); void waited(); void timeout(); diff --git a/jdk/src/share/javavm/export/jvm.h b/jdk/src/share/javavm/export/jvm.h index df8f27e6602..4f141d21fb8 100644 --- a/jdk/src/share/javavm/export/jvm.h +++ b/jdk/src/share/javavm/export/jvm.h @@ -374,6 +374,12 @@ JVM_FindPrimitiveClass(JNIEnv *env, const char *utf); JNIEXPORT void JNICALL JVM_ResolveClass(JNIEnv *env, jclass cls); +/* + * Find a class from a boot class loader. Returns NULL if class not found. + */ +JNIEXPORT jclass JNICALL +JVM_FindClassFromBootLoader(JNIEnv *env, const char *name); + /* * Find a class from a given class loader. Throw ClassNotFoundException * or NoClassDefFoundError depending on the value of the last diff --git a/jdk/src/share/lib/net.properties b/jdk/src/share/lib/net.properties index e941d50e3f4..da78a84d511 100644 --- a/jdk/src/share/lib/net.properties +++ b/jdk/src/share/lib/net.properties @@ -32,7 +32,7 @@ java.net.useSystemProxies=false # # http.proxyHost= # http.proxyPort=80 -# http.nonProxyHosts=localhost|127.0.0.1 +http.nonProxyHosts=localhost|127.*|[::1] # # HTTPS Proxy Settings. proxyHost is the name of the proxy server # (e.g. proxy.mydomain.com), proxyPort is the port number to use (default @@ -49,7 +49,7 @@ java.net.useSystemProxies=false # # ftp.proxyHost= # ftp.proxyPort=80 -# ftp.nonProxyHosts=localhost|127.0.0.1 +ftp.nonProxyHosts=localhost|127.*|[::1] # # Gopher Proxy settings. proxyHost is the name of the proxy server # (e.g. proxy.mydomain.com), proxyPort is the port number to use (default diff --git a/jdk/src/share/native/common/check_code.c b/jdk/src/share/native/common/check_code.c index f76c8f81735..5561a0e2483 100644 --- a/jdk/src/share/native/common/check_code.c +++ b/jdk/src/share/native/common/check_code.c @@ -338,7 +338,8 @@ static void read_all_code(context_type *context, jclass cb, int num_methods, int** code_lengths, unsigned char*** code); static void verify_method(context_type *context, jclass cb, int index, int code_length, unsigned char* code); -static void free_all_code(int num_methods, int* lengths, unsigned char** code); +static void free_all_code(context_type* context, int num_methods, + unsigned char** code); static void verify_field(context_type *context, jclass cb, int index); static void verify_opcode_operands (context_type *, unsigned int inumber, int offset); @@ -813,11 +814,11 @@ VerifyClassForMajorVersion(JNIEnv *env, jclass cb, char *buffer, jint len, /* Look at each method */ for (i = JVM_GetClassFieldsCount(env, cb); --i >= 0;) verify_field(context, cb, i); - num_methods = JVM_GetClassMethodsCount(env, cb); - read_all_code(context, cb, num_methods, &code_lengths, &code); - for (i = num_methods - 1; i >= 0; --i) + num_methods = JVM_GetClassMethodsCount(env, cb); + read_all_code(context, cb, num_methods, &code_lengths, &code); + for (i = num_methods - 1; i >= 0; --i) verify_method(context, cb, i, code_lengths[i], code[i]); - free_all_code(num_methods, code_lengths, code); + free_all_code(context, num_methods, code); result = CC_OK; } else { result = context->err_code; @@ -836,9 +837,6 @@ VerifyClassForMajorVersion(JNIEnv *env, jclass cb, char *buffer, jint len, if (context->exceptions) free(context->exceptions); - if (context->code) - free(context->code); - if (context->constant_types) free(context->constant_types); @@ -895,41 +893,42 @@ static void read_all_code(context_type* context, jclass cb, int num_methods, int** lengths_addr, unsigned char*** code_addr) { - int* lengths = malloc(sizeof(int) * num_methods); - unsigned char** code = malloc(sizeof(unsigned char*) * num_methods); - - *(lengths_addr) = lengths; - *(code_addr) = code; - - if (lengths == 0 || code == 0) { - CCout_of_memory(context); - } else { + int* lengths; + unsigned char** code; int i; + + lengths = malloc(sizeof(int) * num_methods); + check_and_push(context, lengths, VM_MALLOC_BLK); + + code = malloc(sizeof(unsigned char*) * num_methods); + check_and_push(context, code, VM_MALLOC_BLK); + + *(lengths_addr) = lengths; + *(code_addr) = code; + for (i = 0; i < num_methods; ++i) { - lengths[i] = JVM_GetMethodIxByteCodeLength(context->env, cb, i); - if (lengths[i] != 0) { - code[i] = malloc(sizeof(unsigned char) * (lengths[i] + 1)); - if (code[i] == NULL) { - CCout_of_memory(context); + lengths[i] = JVM_GetMethodIxByteCodeLength(context->env, cb, i); + if (lengths[i] > 0) { + code[i] = malloc(sizeof(unsigned char) * (lengths[i] + 1)); + check_and_push(context, code[i], VM_MALLOC_BLK); + JVM_GetMethodIxByteCode(context->env, cb, i, code[i]); } else { - JVM_GetMethodIxByteCode(context->env, cb, i, code[i]); + code[i] = NULL; } - } else { - code[i] = NULL; - } } - } } static void -free_all_code(int num_methods, int* lengths, unsigned char** code) +free_all_code(context_type* context, int num_methods, unsigned char** code) { int i; for (i = 0; i < num_methods; ++i) { - free(code[i]); + if (code[i] != NULL) { + pop_and_free(context); + } } - free(lengths); - free(code); + pop_and_free(context); /* code */ + pop_and_free(context); /* lengths */ } /* Verify the code of one method */ diff --git a/jdk/src/share/native/java/lang/ClassLoader.c b/jdk/src/share/native/java/lang/ClassLoader.c index bedf87ce7e6..b080fef2e53 100644 --- a/jdk/src/share/native/java/lang/ClassLoader.c +++ b/jdk/src/share/native/java/lang/ClassLoader.c @@ -237,6 +237,9 @@ Java_java_lang_ClassLoader_resolveClass0(JNIEnv *env, jobject this, JVM_ResolveClass(env, cls); } +/* + * Returns NULL if class not found. + */ JNIEXPORT jclass JNICALL Java_java_lang_ClassLoader_findBootstrapClass(JNIEnv *env, jobject loader, jstring classname) @@ -246,7 +249,6 @@ Java_java_lang_ClassLoader_findBootstrapClass(JNIEnv *env, jobject loader, char buf[128]; if (classname == NULL) { - JNU_ThrowClassNotFoundException(env, 0); return 0; } @@ -258,11 +260,10 @@ Java_java_lang_ClassLoader_findBootstrapClass(JNIEnv *env, jobject loader, VerifyFixClassname(clname); if (!VerifyClassname(clname, JNI_TRUE)) { /* expects slashed name */ - JNU_ThrowClassNotFoundException(env, clname); goto done; } - cls = JVM_FindClassFromClassLoader(env, clname, JNI_FALSE, 0, JNI_FALSE); + cls = JVM_FindClassFromBootLoader(env, clname); done: if (clname != buf) { diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/README b/jdk/src/share/native/java/util/zip/zlib-1.1.3/README deleted file mode 100644 index 97f28f42ffd..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/README +++ /dev/null @@ -1,151 +0,0 @@ -zlib 1.1.3 is a general purpose data compression library. All the code -is thread safe. The data format used by the zlib library -is described by RFCs (Request for Comments) 1950 to 1952 in the files -ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate -format) and rfc1952.txt (gzip format). These documents are also available in -other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact jloup@gzip.org). A usage -example of the library is given in the file example.c which also tests that -the library is working correctly. Another example is given in the file -minigzip.c. The compression library itself is composed of all source files -except example.c and minigzip.c. - -To compile all files and run the test program, follow the instructions -given at the top of Makefile. In short "make test; make install" -should work for most machines. For Unix: "configure; make test; make install" -For MSDOS, use one of the special makefiles such as Makefile.msc. -For VMS, use Make_vms.com or descrip.mms. - -Questions about zlib should be sent to , or to -Gilles Vollant for the Windows DLL version. -The zlib home page is http://www.cdrom.com/pub/infozip/zlib/ -The official zlib ftp site is ftp://ftp.cdrom.com/pub/infozip/zlib/ -Before reporting a problem, please check those sites to verify that -you have the latest version of zlib; otherwise get the latest version and -check whether the problem still exists or not. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available in -http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm - -There are minor changes by Sun Microsystems in 1.1.3.f-jdk as compared with -the official 1.1.3 version; see the file ChangeLog. - -The changes made in version 1.1.3 are documented in the file ChangeLog. -The main changes since 1.1.2 are: - -- fix "an inflate input buffer bug that shows up on rare but persistent - occasions" (Mark) -- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) -- fix gzseek(..., SEEK_SET) in write mode -- fix crc check after a gzeek (Frank Faubert) -- fix miniunzip when the last entry in a zip file is itself a zip file - (J Lillge) -- add contrib/asm586 and contrib/asm686 (Brian Raiter) - See http://www.muppetlabs.com/~breadbox/software/assembly.html -- add support for Delphi 3 in contrib/delphi (Bob Dellaca) -- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) -- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) -- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) -- added a FAQ file - -plus many changes for portability. - -Unsupported third party contributions are provided in directory "contrib". - -A Java implementation of zlib is available in the Java Development Kit 1.1 -http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html -See the zlib home page http://www.cdrom.com/pub/infozip/zlib/ for details. - -A Perl interface to zlib written by Paul Marquess -is in the CPAN (Comprehensive Perl Archive Network) sites, such as: -ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib* - -A Python interface to zlib written by A.M. Kuchling -is available in Python 1.5 and later versions, see -http://www.python.org/doc/lib/module-zlib.html - -A zlib binding for TCL written by Andreas Kupries -is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html - -An experimental package to read and write files in .zip format, -written on top of zlib by Gilles Vollant , is -available at http://www.winimage.com/zLibDll/unzip.html -and also in the contrib/minizip directory of zlib. - - -Notes for some targets: - -- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc - and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL - The zlib DLL support was initially done by Alessandro Iacopetti and is - now maintained by Gilles Vollant . Check the zlib DLL - home page at http://www.winimage.com/zLibDll - - From Visual Basic, you can call the DLL functions which do not take - a structure as argument: compress, uncompress and all gz* functions. - See contrib/visual-basic.txt for more information, or get - http://www.tcfb.com/dowseware/cmp-z-it.zip - -- For 64-bit Irix, deflate.c must be compiled without any optimization. - With -O, one libpng test fails. The test works in 32 bit mode (with - the -n32 compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 - it works when compiled with cc. - -- on Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 - is necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works - with other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. - -- For Turbo C the small model is supported only with reduced performance to - avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 - -- For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html - Per Harald Myrvang - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate - and zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; - they are too numerous to cite here. - -Copyright notice: - - (C) 1995-1998 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* -receiving lengthy legal documents to sign. The sources are provided -for free but without warranty of any kind. The library has been -entirely written by Jean-loup Gailly and Mark Adler; it does not -include third-party code. - -If you redistribute modified sources, we would appreciate that you include -in the file ChangeLog history information documenting your changes. diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/doc/algorithm.doc b/jdk/src/share/native/java/util/zip/zlib-1.1.3/doc/algorithm.doc deleted file mode 100644 index cdc830b5deb..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/doc/algorithm.doc +++ /dev/null @@ -1,213 +0,0 @@ -1. Compression algorithm (deflate) - -The deflation algorithm used by gzip (also zip and zlib) is a variation of -LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in -the input data. The second occurrence of a string is replaced by a -pointer to the previous string, in the form of a pair (distance, -length). Distances are limited to 32K bytes, and lengths are limited -to 258 bytes. When a string does not occur anywhere in the previous -32K bytes, it is emitted as a sequence of literal bytes. (In this -description, `string' must be taken as an arbitrary sequence of bytes, -and is not restricted to printable characters.) - -Literals or match lengths are compressed with one Huffman tree, and -match distances are compressed with another tree. The trees are stored -in a compact form at the start of each block. The blocks can have any -size (except that the compressed data for one block must fit in -available memory). A block is terminated when deflate() determines that -it would be useful to start another block with fresh trees. (This is -somewhat similar to the behavior of LZW-based _compress_.) - -Duplicated strings are found using a hash table. All input strings of -length 3 are inserted in the hash table. A hash index is computed for -the next 3 bytes. If the hash chain for this index is not empty, all -strings in the chain are compared with the current input string, and -the longest match is selected. - -The hash chains are searched starting with the most recent strings, to -favor small distances and thus take advantage of the Huffman encoding. -The hash chains are singly linked. There are no deletions from the -hash chains, the algorithm simply discards matches that are too old. - -To avoid a worst-case situation, very long hash chains are arbitrarily -truncated at a certain length, determined by a runtime option (level -parameter of deflateInit). So deflate() does not always find the longest -possible match but generally finds a match which is long enough. - -deflate() also defers the selection of matches with a lazy evaluation -mechanism. After a match of length N has been found, deflate() searches for -a longer match at the next input byte. If a longer match is found, the -previous match is truncated to a length of one (thus producing a single -literal byte) and the process of lazy evaluation begins again. Otherwise, -the original match is kept, and the next match search is attempted only N -steps later. - -The lazy match evaluation is also subject to a runtime parameter. If -the current match is long enough, deflate() reduces the search for a longer -match, thus speeding up the whole process. If compression ratio is more -important than speed, deflate() attempts a complete second search even if -the first match is already long enough. - -The lazy match evaluation is not performed for the fastest compression -modes (level parameter 1 to 3). For these fast modes, new strings -are inserted in the hash table only when no match was found, or -when the match is not too long. This degrades the compression ratio -but saves time since there are both fewer insertions and fewer searches. - - -2. Decompression algorithm (inflate) - -2.1 Introduction - -The real question is, given a Huffman tree, how to decode fast. The most -important realization is that shorter codes are much more common than -longer codes, so pay attention to decoding the short codes fast, and let -the long codes take longer to decode. - -inflate() sets up a first level table that covers some number of bits of -input less than the length of longest code. It gets that many bits from the -stream, and looks it up in the table. The table will tell if the next -code is that many bits or less and how many, and if it is, it will tell -the value, else it will point to the next level table for which inflate() -grabs more bits and tries to decode a longer code. - -How many bits to make the first lookup is a tradeoff between the time it -takes to decode and the time it takes to build the table. If building the -table took no time (and if you had infinite memory), then there would only -be a first level table to cover all the way to the longest code. However, -building the table ends up taking a lot longer for more bits since short -codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and set it -for the maximum speed. - -inflate() sends new trees relatively often, so it is possibly set for a -smaller first level table than an application that has only one tree for -all the data. For inflate, which has 286 possible codes for the -literal/length tree, the size of the first table is nine bits. Also the -distance trees have 30 possible values, and the size of the first table is -six bits. Note that for each of those cases, the table ended up one bit -longer than the ``average'' code length, i.e. the code length of an -approximately flat code which would be a little more than eight bits for -286 symbols and a little less than five bits for 30 symbols. It would be -interesting to see if optimizing the first level table for other -applications gave values within a bit or two of the flat code size. - - -2.2 More details on the inflate table lookup - -Ok, you want to know what this cleverly obfuscated inflate tree actually -looks like. You are correct that it's not a Huffman tree. It is simply a -lookup table for the first, let's say, nine bits of a Huffman symbol. The -symbol could be as short as one bit or as long as 15 bits. If a particular -symbol is shorter than nine bits, then that symbol's translation is duplicated -in all those entries that start with that symbol's bits. For example, if the -symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a -symbol is nine bits long, it appears in the table once. - -If the symbol is longer than nine bits, then that entry in the table points -to another similar table for the remaining bits. Again, there are duplicated -entries as needed. The idea is that most of the time the symbol will be short -and there will only be one table look up. (That's whole idea behind data -compression in the first place.) For the less frequent long symbols, there -will be two lookups. If you had a compression method with really long -symbols, you could have as many levels of lookups as is efficient. For -inflate, two is enough. - -So a table entry either points to another table (in which case nine bits in -the above example are gobbled), or it contains the translation for the symbol -and the number of bits to gobble. Then you start again with the next -ungobbled bit. - -You may wonder: why not just have one lookup table for how ever many bits the -longest symbol is? The reason is that if you do that, you end up spending -more time filling in duplicate symbol entries than you do actually decoding. -At least for deflate's output that generates new trees every several 10's of -kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code -would take too long if you're only decoding several thousand symbols. At the -other extreme, you could make a new table for every bit in the code. In fact, -that's essentially a Huffman tree. But then you spend two much time -traversing the tree while decoding, even for short symbols. - -So the number of bits for the first lookup table is a trade of the time to -fill out the table vs. the time spent looking at the second level and above of -the table. - -Here is an example, scaled down: - -The code being decoded, with 10 symbols, from 1 to 6 bits long: - -A: 0 -B: 10 -C: 1100 -D: 11010 -E: 11011 -F: 11100 -G: 11101 -H: 11110 -I: 111110 -J: 111111 - -Let's make the first table three bits long (eight entries): - -000: A,1 -001: A,1 -010: A,1 -011: A,1 -100: B,2 -101: B,2 -110: -> table X (gobble 3 bits) -111: -> table Y (gobble 3 bits) - -Each entry is what the bits decode to and how many bits that is, i.e. how -many bits to gobble. Or the entry points to another table, with the number of -bits to gobble implicit in the size of the table. - -Table X is two bits long since the longest code starting with 110 is five bits -long: - -00: C,1 -01: C,1 -10: D,2 -11: E,2 - -Table Y is three bits long since the longest code starting with 111 is six -bits long: - -000: F,2 -001: F,2 -010: G,2 -011: G,2 -100: H,2 -101: H,2 -110: I,3 -111: J,3 - -So what we have here are three tables with a total of 20 entries that had to -be constructed. That's compared to 64 entries for a single table. Or -compared to 16 entries for a Huffman tree (six two entry tables and one four -entry table). Assuming that the code ideally represents the probability of -the symbols, it takes on the average 1.25 lookups per symbol. That's compared -to one lookup for the single table, or 1.66 lookups per symbol for the -Huffman tree. - -There, I think that gives you a picture of what's going on. For inflate, the -meaning of a particular symbol is often more than just a letter. It can be a -byte (a "literal"), or it can be either a length or a distance which -indicates a base value and a number of bits to fetch after the code that is -added to the base value. Or it might be the special end-of-block code. The -data structures created in inftrees.c try to encode all that information -compactly in the tables. - - -Jean-loup Gailly Mark Adler -jloup@gzip.org madler@alumni.caltech.edu - - -References: - -[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data -Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, -pp. 337-343. - -``DEFLATE Compressed Data Format Specification'' available in -ftp://ds.internic.net/rfc/rfc1951.txt diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/example.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/example.c deleted file mode 100644 index d547fb8f07a..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/example.c +++ /dev/null @@ -1,584 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * example.c -- usage example of the zlib compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include -#include "zlib.h" - -#ifdef STDC -# include -# include -#else - extern void exit OF((int)); -#endif - -#if defined(VMS) || defined(RISCOS) -# define TESTFILE "foo-gz" -#else -# define TESTFILE "foo.gz" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -const char hello[] = "hello, hello!"; -/* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - */ - -const char dictionary[] = "hello"; -uLong dictId; /* Adler32 value of the dictionary */ - -void test_compress OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *out, const char *in, - Byte *uncompr, int uncomprLen)); -void test_deflate OF((Byte *compr, uLong comprLen)); -void test_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_deflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_flush OF((Byte *compr, uLong *comprLen)); -void test_sync OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_dict_deflate OF((Byte *compr, uLong comprLen)); -void test_dict_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Test compress() and uncompress() - */ -void test_compress(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - uLong len = strlen(hello)+1; - - err = compress(compr, &comprLen, (const Bytef*)hello, len); - CHECK_ERR(err, "compress"); - - strcpy((char*)uncompr, "garbage"); - - err = uncompress(uncompr, &uncomprLen, compr, comprLen); - CHECK_ERR(err, "uncompress"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad uncompress\n"); - exit(1); - } else { - printf("uncompress(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test read/write of .gz files - */ -void test_gzio(out, in, uncompr, uncomprLen) - const char *out; /* compressed output file */ - const char *in; /* compressed input file */ - Byte *uncompr; - int uncomprLen; -{ - int err; - int len = strlen(hello)+1; - gzFile file; - z_off_t pos; - - file = gzopen(out, "wb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - gzputc(file, 'h'); - if (gzputs(file, "ello") != 4) { - fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); - exit(1); - } - if (gzprintf(file, ", %s!", "hello") != 8) { - fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); - exit(1); - } - gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ - gzclose(file); - - file = gzopen(in, "rb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - } - strcpy((char*)uncompr, "garbage"); - - uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen); - if (uncomprLen != len) { - fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); - exit(1); - } else { - printf("gzread(): %s\n", (char *)uncompr); - } - - pos = gzseek(file, -8L, SEEK_CUR); - if (pos != 6 || gztell(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)gztell(file)); - exit(1); - } - - if (gzgetc(file) != ' ') { - fprintf(stderr, "gzgetc error\n"); - exit(1); - } - - gzgets(file, (char*)uncompr, uncomprLen); - uncomprLen = strlen((char*)uncompr); - if (uncomprLen != 6) { /* "hello!" */ - fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello+7)) { - fprintf(stderr, "bad gzgets after gzseek\n"); - exit(1); - } else { - printf("gzgets() after gzseek: %s\n", (char *)uncompr); - } - - gzclose(file); -} - -/* =========================================================================== - * Test deflate() with small buffers - */ -void test_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - int len = strlen(hello)+1; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (Bytef*)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != (uLong)len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = deflate(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with small buffers - */ -void test_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 0; - d_stream.next_out = uncompr; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { - d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate\n"); - exit(1); - } else { - printf("inflate(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test deflate() with large buffers and dynamic change of compression level - */ -void test_large_deflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_SPEED); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - /* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - */ - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - if (c_stream.avail_in != 0) { - fprintf(stderr, "deflate not greedy\n"); - exit(1); - } - - /* Feed in already compressed data and switch to no compression: */ - deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in = compr; - c_stream.avail_in = (uInt)comprLen/2; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - /* Switch back to compressing mode: */ - deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with large buffers - */ -void test_large_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - for (;;) { - d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (uInt)uncomprLen; - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "large inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (d_stream.total_out != 2*uncomprLen + comprLen/2) { - fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); - exit(1); - } else { - printf("large_inflate(): OK\n"); - } -} - -/* =========================================================================== - * Test deflate() with full flush - */ -void test_flush(compr, comprLen) - Byte *compr; - uLong *comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - int len = strlen(hello)+1; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (Bytef*)hello; - c_stream.next_out = compr; - c_stream.avail_in = 3; - c_stream.avail_out = (uInt)*comprLen; - err = deflate(&c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, "deflate"); - - compr[3]++; /* force an error in first compressed block */ - c_stream.avail_in = len - 3; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - CHECK_ERR(err, "deflate"); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - *comprLen = c_stream.total_out; -} - -/* =========================================================================== - * Test inflateSync() - */ -void test_sync(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 2; /* just read the zlib header */ - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - inflate(&d_stream, Z_NO_FLUSH); - CHECK_ERR(err, "inflate"); - - d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ - err = inflateSync(&d_stream); /* but skip the damaged part */ - CHECK_ERR(err, "inflateSync"); - - err = inflate(&d_stream, Z_FINISH); - if (err != Z_DATA_ERROR) { - fprintf(stderr, "inflate should report DATA_ERROR\n"); - /* Because of incorrect adler32 */ - exit(1); - } - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - printf("after inflateSync(): hel%s\n", (char *)uncompr); -} - -/* =========================================================================== - * Test deflate() with preset dictionary - */ -void test_dict_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - err = deflateSetDictionary(&c_stream, - (const Bytef*)dictionary, sizeof(dictionary)); - CHECK_ERR(err, "deflateSetDictionary"); - - dictId = c_stream.adler; - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - c_stream.next_in = (Bytef*)hello; - c_stream.avail_in = (uInt)strlen(hello)+1; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with a preset dictionary - */ -void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - for (;;) { - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, - sizeof(dictionary)); - } - CHECK_ERR(err, "inflate with dict"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate with dict\n"); - exit(1); - } else { - printf("inflate with dictionary: %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Usage: example [output.gz [input.gz]] - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - Byte *compr, *uncompr; - uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ - uLong uncomprLen = comprLen; - static const char* myVersion = ZLIB_VERSION; - - if (zlibVersion()[0] != myVersion[0]) { - fprintf(stderr, "incompatible zlib version\n"); - exit(1); - - } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { - fprintf(stderr, "warning: different zlib version\n"); - } - - compr = (Byte*)calloc((uInt)comprLen, 1); - uncompr = (Byte*)calloc((uInt)uncomprLen, 1); - /* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - */ - if (compr == Z_NULL || uncompr == Z_NULL) { - printf("out of memory\n"); - exit(1); - } - test_compress(compr, comprLen, uncompr, uncomprLen); - - test_gzio((argc > 1 ? argv[1] : TESTFILE), - (argc > 2 ? argv[2] : TESTFILE), - uncompr, (int)uncomprLen); - - test_deflate(compr, comprLen); - test_inflate(compr, comprLen, uncompr, uncomprLen); - - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - - test_flush(compr, &comprLen); - test_sync(compr, comprLen, uncompr, uncomprLen); - comprLen = uncomprLen; - - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - - exit(0); - return 0; /* to avoid warning */ -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infblock.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/infblock.c deleted file mode 100644 index 6faac062f27..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infblock.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * infblock.c -- interpret and process block types to last block - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "infblock.h" -#include "inftrees.h" -#include "infcodes.h" -#include "infutil.h" - -struct inflate_codes_state {int dummy;}; /* for buggy compilers */ - -/* simplify the use of the inflate_huft type with some defines */ -#define exop word.what.Exop -#define bits word.what.Bits - -/* Table for deflate from PKZIP's appnote.txt. */ -local const uInt border[] = { /* Order of the bit length code lengths */ - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - -/* - Notes beyond the 1.93a appnote.txt: - - 1. Distance pointers never point before the beginning of the output - stream. - 2. Distance pointers can point back across blocks, up to 32k away. - 3. There is an implied maximum of 7 bits for the bit length table and - 15 bits for the actual data. - 4. If only one code exists, then it is encoded using one bit. (Zero - would be more efficient, but perhaps a little confusing.) If two - codes exist, they are coded using one bit each (0 and 1). - 5. There is no way of sending zero distance codes--a dummy must be - sent if there are none. (History: a pre 2.0 version of PKZIP would - store blocks with no distance codes, but this was discovered to be - too harsh a criterion.) Valid only for 1.93a. 2.04c does allow - zero distance codes, which is sent as one code of zero bits in - length. - 6. There are up to 286 literal/length codes. Code 256 represents the - end-of-block. Note however that the static length tree defines - 288 codes just to fill out the Huffman codes. Codes 286 and 287 - cannot be used though, since there is no length base or extra bits - defined for them. Similarily, there are up to 30 distance codes. - However, static trees define 32 codes (all 5 bits) to fill out the - Huffman codes, but the last two had better not show up in the data. - 7. Unzip can check dynamic Huffman blocks for complete code sets. - The exception is that a single code would not be complete (see #4). - 8. The five bits following the block type is really the number of - literal codes sent minus 257. - 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits - (1+6+6). Therefore, to output three times the length, you output - three codes (1+1+1), whereas to output four times the same length, - you only need two codes (1+3). Hmm. - 10. In the tree reconstruction algorithm, Code = Code + Increment - only if BitLength(i) is not zero. (Pretty obvious.) - 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) - 12. Note: length code 284 can represent 227-258, but length code 285 - really is 258. The last length deserves its own, short code - since it gets used a lot in very redundant files. The length - 258 is special since 258 - 3 (the min match length) is 255. - 13. The literal/length and distance code bit lengths are read as a - single stream of lengths. It is possible (and advantageous) for - a repeat code (16, 17, or 18) to go across the boundary between - the two sets of lengths. - */ - - -void inflate_blocks_reset(s, z, c) -inflate_blocks_statef *s; -z_streamp z; -uLongf *c; -{ - if (c != Z_NULL) - *c = s->check; - if (s->mode == BTREE || s->mode == DTREE) - ZFREE(z, s->sub.trees.blens); - if (s->mode == CODES) - inflate_codes_free(s->sub.decode.codes, z); - s->mode = TYPE; - s->bitk = 0; - s->bitb = 0; - s->read = s->write = s->window; - if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0); - Tracev((stderr, "inflate: blocks reset\n")); -} - - -inflate_blocks_statef *inflate_blocks_new(z, c, w) -z_streamp z; -check_func c; -uInt w; -{ - inflate_blocks_statef *s; - - if ((s = (inflate_blocks_statef *)ZALLOC - (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) - return s; - if ((s->hufts = - (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL) - { - ZFREE(z, s); - return Z_NULL; - } - if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL) - { - ZFREE(z, s->hufts); - ZFREE(z, s); - return Z_NULL; - } - s->end = s->window + w; - s->checkfn = c; - s->mode = TYPE; - Tracev((stderr, "inflate: blocks allocated\n")); - inflate_blocks_reset(s, z, Z_NULL); - return s; -} - - -int inflate_blocks(s, z, r) -inflate_blocks_statef *s; -z_streamp z; -int r; -{ - uInt t; /* temporary storage */ - uLong b; /* bit buffer */ - uInt k; /* bits in bit buffer */ - Bytef *p; /* input data pointer */ - uInt n; /* bytes available there */ - Bytef *q; /* output window write pointer */ - uInt m; /* bytes to end of window or read pointer */ - - /* copy input/output information to locals (UPDATE macro restores) */ - LOAD - - /* process input based on current state */ - while (1) switch (s->mode) - { - case TYPE: - NEEDBITS(3) - t = (uInt)b & 7; - s->last = t & 1; - switch (t >> 1) - { - case 0: /* stored */ - Tracev((stderr, "inflate: stored block%s\n", - s->last ? " (last)" : "")); - DUMPBITS(3) - t = k & 7; /* go to byte boundary */ - DUMPBITS(t) - s->mode = LENS; /* get length of stored block */ - break; - case 1: /* fixed */ - Tracev((stderr, "inflate: fixed codes block%s\n", - s->last ? " (last)" : "")); - { - uInt bl, bd; - inflate_huft *tl, *td; - - inflate_trees_fixed(&bl, &bd, &tl, &td, z); - s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); - if (s->sub.decode.codes == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - } - DUMPBITS(3) - s->mode = CODES; - break; - case 2: /* dynamic */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - s->last ? " (last)" : "")); - DUMPBITS(3) - s->mode = TABLE; - break; - case 3: /* illegal */ - DUMPBITS(3) - s->mode = BAD; - z->msg = (char*)"invalid block type"; - r = Z_DATA_ERROR; - LEAVE - } - break; - case LENS: - NEEDBITS(32) - if ((((~b) >> 16) & 0xffff) != (b & 0xffff)) - { - s->mode = BAD; - z->msg = (char*)"invalid stored block lengths"; - r = Z_DATA_ERROR; - LEAVE - } - s->sub.left = (uInt)b & 0xffff; - b = k = 0; /* dump bits */ - Tracev((stderr, "inflate: stored length %u\n", s->sub.left)); - s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE); - break; - case STORED: - if (n == 0) - LEAVE - NEEDOUT - t = s->sub.left; - if (t > n) t = n; - if (t > m) t = m; - zmemcpy(q, p, t); - p += t; n -= t; - q += t; m -= t; - if ((s->sub.left -= t) != 0) - break; - Tracev((stderr, "inflate: stored end, %lu total out\n", - z->total_out + (q >= s->read ? q - s->read : - (s->end - s->read) + (q - s->window)))); - s->mode = s->last ? DRY : TYPE; - break; - case TABLE: - NEEDBITS(14) - s->sub.trees.table = t = (uInt)b & 0x3fff; -#ifndef PKZIP_BUG_WORKAROUND - if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) - { - s->mode = BAD; - z->msg = (char*)"too many length or distance symbols"; - r = Z_DATA_ERROR; - LEAVE - } -#endif - t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); - if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - DUMPBITS(14) - s->sub.trees.index = 0; - Tracev((stderr, "inflate: table sizes ok\n")); - s->mode = BTREE; - case BTREE: - while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10)) - { - NEEDBITS(3) - s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7; - DUMPBITS(3) - } - while (s->sub.trees.index < 19) - s->sub.trees.blens[border[s->sub.trees.index++]] = 0; - s->sub.trees.bb = 7; - t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb, - &s->sub.trees.tb, s->hufts, z); - if (t != Z_OK) - { - - r = t; - if (r == Z_DATA_ERROR) - { - ZFREE(z, s->sub.trees.blens); - s->mode = BAD; - } - LEAVE - } - s->sub.trees.index = 0; - Tracev((stderr, "inflate: bits tree ok\n")); - s->mode = DTREE; - case DTREE: - while (t = s->sub.trees.table, - s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) - { - inflate_huft *h; - uInt i, j, c; - - t = s->sub.trees.bb; - NEEDBITS(t) - h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]); - t = h->bits; - c = h->base; - if (c < 16) - { - DUMPBITS(t) - s->sub.trees.blens[s->sub.trees.index++] = c; - } - else /* c == 16..18 */ - { - i = c == 18 ? 7 : c - 14; - j = c == 18 ? 11 : 3; - NEEDBITS(t + i) - DUMPBITS(t) - j += (uInt)b & inflate_mask[i]; - DUMPBITS(i) - i = s->sub.trees.index; - t = s->sub.trees.table; - if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || - (c == 16 && i < 1)) - { - ZFREE(z, s->sub.trees.blens); - s->mode = BAD; - z->msg = (char*)"invalid bit length repeat"; - r = Z_DATA_ERROR; - LEAVE - } - c = c == 16 ? s->sub.trees.blens[i - 1] : 0; - do { - s->sub.trees.blens[i++] = c; - } while (--j); - s->sub.trees.index = i; - } - } - s->sub.trees.tb = Z_NULL; - { - uInt bl, bd; - inflate_huft *tl, *td; - inflate_codes_statef *c; - - bl = 9; /* must be <= 9 for lookahead assumptions */ - bd = 6; /* must be <= 9 for lookahead assumptions */ - t = s->sub.trees.table; - t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), - s->sub.trees.blens, &bl, &bd, &tl, &td, - s->hufts, z); - - if (t != Z_OK) - { - if (t == (uInt)Z_DATA_ERROR) - { - ZFREE(z, s->sub.trees.blens); - s->mode = BAD; - } - r = t; - LEAVE - } - Tracev((stderr, "inflate: trees ok\n")); - if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - s->sub.decode.codes = c; - } - ZFREE(z, s->sub.trees.blens); - s->mode = CODES; - case CODES: - UPDATE - if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) - return inflate_flush(s, z, r); - r = Z_OK; - inflate_codes_free(s->sub.decode.codes, z); - LOAD - Tracev((stderr, "inflate: codes end, %lu total out\n", - z->total_out + (q >= s->read ? q - s->read : - (s->end - s->read) + (q - s->window)))); - if (!s->last) - { - s->mode = TYPE; - break; - } - s->mode = DRY; - case DRY: - FLUSH - if (s->read != s->write) - LEAVE - s->mode = DONE; - case DONE: - r = Z_STREAM_END; - LEAVE - case BAD: - r = Z_DATA_ERROR; - LEAVE - default: - r = Z_STREAM_ERROR; - LEAVE - } -} - - -int inflate_blocks_free(s, z) -inflate_blocks_statef *s; -z_streamp z; -{ - inflate_blocks_reset(s, z, Z_NULL); - ZFREE(z, s->window); - ZFREE(z, s->hufts); - ZFREE(z, s); - Tracev((stderr, "inflate: blocks freed\n")); - return Z_OK; -} - - -void inflate_set_dictionary(s, d, n) -inflate_blocks_statef *s; -const Bytef *d; -uInt n; -{ - zmemcpy(s->window, d, n); - s->read = s->write = s->window + n; -} - - -/* Returns true if inflate is currently at the end of a block generated - * by Z_SYNC_FLUSH or Z_FULL_FLUSH. - * IN assertion: s != Z_NULL - */ -int inflate_blocks_sync_point(s) -inflate_blocks_statef *s; -{ - return s->mode == LENS; -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infblock.h b/jdk/src/share/native/java/util/zip/zlib-1.1.3/infblock.h deleted file mode 100644 index aa34602dff0..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infblock.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * infblock.h -- header to use infblock.c - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -struct inflate_blocks_state; -typedef struct inflate_blocks_state FAR inflate_blocks_statef; - -extern inflate_blocks_statef * inflate_blocks_new OF(( - z_streamp z, - check_func c, /* check function */ - uInt w)); /* window size */ - -extern int inflate_blocks OF(( - inflate_blocks_statef *, - z_streamp , - int)); /* initial return code */ - -extern void inflate_blocks_reset OF(( - inflate_blocks_statef *, - z_streamp , - uLongf *)); /* check value on output */ - -extern int inflate_blocks_free OF(( - inflate_blocks_statef *, - z_streamp)); - -extern void inflate_set_dictionary OF(( - inflate_blocks_statef *s, - const Bytef *d, /* dictionary */ - uInt n)); /* dictionary length */ - -extern int inflate_blocks_sync_point OF(( - inflate_blocks_statef *s)); diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infcodes.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/infcodes.c deleted file mode 100644 index ea561946304..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infcodes.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * infcodes.c -- process literals and length/distance pairs - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "infblock.h" -#include "infcodes.h" -#include "infutil.h" -#include "inffast.h" - -/* simplify the use of the inflate_huft type with some defines */ -#define exop word.what.Exop -#define bits word.what.Bits - -typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ - START, /* x: set up for LEN */ - LEN, /* i: get length/literal/eob next */ - LENEXT, /* i: getting length extra (have base) */ - DIST, /* i: get distance next */ - DISTEXT, /* i: getting distance extra */ - COPY, /* o: copying bytes in window, waiting for space */ - LIT, /* o: got literal, waiting for output space */ - WASH, /* o: got eob, possibly still output waiting */ - END, /* x: got eob and all data flushed */ - BADCODE} /* x: got error */ -inflate_codes_mode; - -/* inflate codes private state */ -struct inflate_codes_state { - - /* mode */ - inflate_codes_mode mode; /* current inflate_codes mode */ - - /* mode dependent information */ - uInt len; - union { - struct { - inflate_huft *tree; /* pointer into tree */ - uInt need; /* bits needed */ - } code; /* if LEN or DIST, where in tree */ - uInt lit; /* if LIT, literal */ - struct { - uInt get; /* bits to get for extra */ - uInt dist; /* distance back to copy from */ - } copy; /* if EXT or COPY, where and how much */ - } sub; /* submode */ - - /* mode independent information */ - Byte lbits; /* ltree bits decoded per branch */ - Byte dbits; /* dtree bits decoder per branch */ - inflate_huft *ltree; /* literal/length/eob tree */ - inflate_huft *dtree; /* distance tree */ - -}; - - -inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z) -uInt bl, bd; -inflate_huft *tl; -inflate_huft *td; /* need separate declaration for Borland C++ */ -z_streamp z; -{ - inflate_codes_statef *c; - - if ((c = (inflate_codes_statef *) - ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL) - { - c->mode = START; - c->lbits = (Byte)bl; - c->dbits = (Byte)bd; - c->ltree = tl; - c->dtree = td; - Tracev((stderr, "inflate: codes new\n")); - } - return c; -} - - -int inflate_codes(s, z, r) -inflate_blocks_statef *s; -z_streamp z; -int r; -{ - uInt j; /* temporary storage */ - inflate_huft *t; /* temporary pointer */ - uInt e; /* extra bits or operation */ - uLong b; /* bit buffer */ - uInt k; /* bits in bit buffer */ - Bytef *p; /* input data pointer */ - uInt n; /* bytes available there */ - Bytef *q; /* output window write pointer */ - uInt m; /* bytes to end of window or read pointer */ - Bytef *f; /* pointer to copy strings from */ - inflate_codes_statef *c = s->sub.decode.codes; /* codes state */ - - /* copy input/output information to locals (UPDATE macro restores) */ - LOAD - - /* process input and output based on current state */ - while (1) switch (c->mode) - { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ - case START: /* x: set up for LEN */ -#ifndef SLOW - if (m >= 258 && n >= 10) - { - UPDATE - r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z); - LOAD - if (r != Z_OK) - { - c->mode = r == Z_STREAM_END ? WASH : BADCODE; - break; - } - } -#endif /* !SLOW */ - c->sub.code.need = c->lbits; - c->sub.code.tree = c->ltree; - c->mode = LEN; - case LEN: /* i: get length/literal/eob next */ - j = c->sub.code.need; - NEEDBITS(j) - t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); - DUMPBITS(t->bits) - e = (uInt)(t->exop); - if (e == 0) /* literal */ - { - c->sub.lit = t->base; - Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", t->base)); - c->mode = LIT; - break; - } - if (e & 16) /* length */ - { - c->sub.copy.get = e & 15; - c->len = t->base; - c->mode = LENEXT; - break; - } - if ((e & 64) == 0) /* next table */ - { - c->sub.code.need = e; - c->sub.code.tree = t + t->base; - break; - } - if (e & 32) /* end of block */ - { - Tracevv((stderr, "inflate: end of block\n")); - c->mode = WASH; - break; - } - c->mode = BADCODE; /* invalid code */ - z->msg = (char*)"invalid literal/length code"; - r = Z_DATA_ERROR; - LEAVE - case LENEXT: /* i: getting length extra (have base) */ - j = c->sub.copy.get; - NEEDBITS(j) - c->len += (uInt)b & inflate_mask[j]; - DUMPBITS(j) - c->sub.code.need = c->dbits; - c->sub.code.tree = c->dtree; - Tracevv((stderr, "inflate: length %u\n", c->len)); - c->mode = DIST; - case DIST: /* i: get distance next */ - j = c->sub.code.need; - NEEDBITS(j) - t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); - DUMPBITS(t->bits) - e = (uInt)(t->exop); - if (e & 16) /* distance */ - { - c->sub.copy.get = e & 15; - c->sub.copy.dist = t->base; - c->mode = DISTEXT; - break; - } - if ((e & 64) == 0) /* next table */ - { - c->sub.code.need = e; - c->sub.code.tree = t + t->base; - break; - } - c->mode = BADCODE; /* invalid code */ - z->msg = (char*)"invalid distance code"; - r = Z_DATA_ERROR; - LEAVE - case DISTEXT: /* i: getting distance extra */ - j = c->sub.copy.get; - NEEDBITS(j) - c->sub.copy.dist += (uInt)b & inflate_mask[j]; - DUMPBITS(j) - Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); - c->mode = COPY; - case COPY: /* o: copying bytes in window, waiting for space */ -#ifndef __TURBOC__ /* Turbo C bug for following expression */ - f = (uInt)(q - s->window) < c->sub.copy.dist ? - s->end - (c->sub.copy.dist - (q - s->window)) : - q - c->sub.copy.dist; -#else - f = q - c->sub.copy.dist; - if ((uInt)(q - s->window) < c->sub.copy.dist) - f = s->end - (c->sub.copy.dist - (uInt)(q - s->window)); -#endif - while (c->len) - { - NEEDOUT - OUTBYTE(*f++) - if (f == s->end) - f = s->window; - c->len--; - } - c->mode = START; - break; - case LIT: /* o: got literal, waiting for output space */ - NEEDOUT - OUTBYTE(c->sub.lit) - c->mode = START; - break; - case WASH: /* o: got eob, possibly more output */ - if (k > 7) /* return unused byte, if any */ - { - Assert(k < 16, "inflate_codes grabbed too many bytes") - k -= 8; - n++; - p--; /* can always return one */ - } - FLUSH - if (s->read != s->write) - LEAVE - c->mode = END; - case END: - r = Z_STREAM_END; - LEAVE - case BADCODE: /* x: got error */ - r = Z_DATA_ERROR; - LEAVE - default: - r = Z_STREAM_ERROR; - LEAVE - } -#ifdef NEED_DUMMY_RETURN - return Z_STREAM_ERROR; /* Some dumb compilers complain without this */ -#endif -} - - -void inflate_codes_free(c, z) -inflate_codes_statef *c; -z_streamp z; -{ - ZFREE(z, c); - Tracev((stderr, "inflate: codes free\n")); -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infcodes.h b/jdk/src/share/native/java/util/zip/zlib-1.1.3/infcodes.h deleted file mode 100644 index 5be6a1cc7e5..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infcodes.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * infcodes.h -- header to use infcodes.c - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -struct inflate_codes_state; -typedef struct inflate_codes_state FAR inflate_codes_statef; - -extern inflate_codes_statef *inflate_codes_new OF(( - uInt, uInt, - inflate_huft *, inflate_huft *, - z_streamp )); - -extern int inflate_codes OF(( - inflate_blocks_statef *, - z_streamp , - int)); - -extern void inflate_codes_free OF(( - inflate_codes_statef *, - z_streamp )); diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inffast.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/inffast.c deleted file mode 100644 index 2d4f835fd5f..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inffast.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * inffast.c -- process literals and length/distance pairs fast - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "infblock.h" -#include "infcodes.h" -#include "infutil.h" -#include "inffast.h" - -struct inflate_codes_state {int dummy;}; /* for buggy compilers */ - -/* simplify the use of the inflate_huft type with some defines */ -#define exop word.what.Exop -#define bits word.what.Bits - -/* macros for bit input with no checking and for returning unused bytes */ -#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3;} - -/* Called with number of bytes left to write in window at least 258 - (the maximum string length) and number of input bytes available - at least ten. The ten bytes are six bytes for the longest length/ - distance pair plus four bytes for overloading the bit buffer. */ - -int inflate_fast(bl, bd, tl, td, s, z) -uInt bl, bd; -inflate_huft *tl; -inflate_huft *td; /* need separate declaration for Borland C++ */ -inflate_blocks_statef *s; -z_streamp z; -{ - inflate_huft *t; /* temporary pointer */ - uInt e; /* extra bits or operation */ - uLong b; /* bit buffer */ - uInt k; /* bits in bit buffer */ - Bytef *p; /* input data pointer */ - uInt n; /* bytes available there */ - Bytef *q; /* output window write pointer */ - uInt m; /* bytes to end of window or read pointer */ - uInt ml; /* mask for literal/length tree */ - uInt md; /* mask for distance tree */ - uInt c; /* bytes to copy */ - uInt d; /* distance back to copy from */ - Bytef *r; /* copy source pointer */ - - /* load input, output, bit values */ - LOAD - - /* initialize masks */ - ml = inflate_mask[bl]; - md = inflate_mask[bd]; - - /* do until not enough input or output space for fast loop */ - do { /* assume called with m >= 258 && n >= 10 */ - /* get literal/length code */ - GRABBITS(20) /* max bits for literal/length code */ - if ((e = (t = tl + ((uInt)b & ml))->exop) == 0) - { - DUMPBITS(t->bits) - Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? - "inflate: * literal '%c'\n" : - "inflate: * literal 0x%02x\n", t->base)); - *q++ = (Byte)t->base; - m--; - continue; - } - do { - DUMPBITS(t->bits) - if (e & 16) - { - /* get extra bits for length */ - e &= 15; - c = t->base + ((uInt)b & inflate_mask[e]); - DUMPBITS(e) - Tracevv((stderr, "inflate: * length %u\n", c)); - - /* decode distance base of block to copy */ - GRABBITS(15); /* max bits for distance code */ - e = (t = td + ((uInt)b & md))->exop; - do { - DUMPBITS(t->bits) - if (e & 16) - { - /* get extra bits to add to distance base */ - e &= 15; - GRABBITS(e) /* get extra bits (up to 13) */ - d = t->base + ((uInt)b & inflate_mask[e]); - DUMPBITS(e) - Tracevv((stderr, "inflate: * distance %u\n", d)); - - /* do the copy */ - m -= c; - if ((uInt)(q - s->window) >= d) /* offset before dest */ - { /* just copy */ - r = q - d; - *q++ = *r++; c--; /* minimum count is three, */ - *q++ = *r++; c--; /* so unroll loop a little */ - } - else /* else offset after destination */ - { - e = d - (uInt)(q - s->window); /* bytes from offset to end */ - r = s->end - e; /* pointer to offset */ - if (c > e) /* if source crosses, */ - { - c -= e; /* copy to end of window */ - do { - *q++ = *r++; - } while (--e); - r = s->window; /* copy rest from start of window */ - } - } - do { /* copy all or what's left */ - *q++ = *r++; - } while (--c); - break; - } - else if ((e & 64) == 0) - { - t += t->base; - e = (t += ((uInt)b & inflate_mask[e]))->exop; - } - else - { - z->msg = (char*)"invalid distance code"; - UNGRAB - UPDATE - return Z_DATA_ERROR; - } - } while (1); - break; - } - if ((e & 64) == 0) - { - t += t->base; - if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0) - { - DUMPBITS(t->bits) - Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? - "inflate: * literal '%c'\n" : - "inflate: * literal 0x%02x\n", t->base)); - *q++ = (Byte)t->base; - m--; - break; - } - } - else if (e & 32) - { - Tracevv((stderr, "inflate: * end of block\n")); - UNGRAB - UPDATE - return Z_STREAM_END; - } - else - { - z->msg = (char*)"invalid literal/length code"; - UNGRAB - UPDATE - return Z_DATA_ERROR; - } - } while (1); - } while (m >= 258 && n >= 10); - - /* not enough input or output--restore pointers and return */ - UNGRAB - UPDATE - return Z_OK; -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inffixed.h b/jdk/src/share/native/java/util/zip/zlib-1.1.3/inffixed.h deleted file mode 100644 index 988cb3733d1..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inffixed.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* inffixed.h -- table for decoding fixed codes - * Generated automatically by the maketree.c program - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -local uInt fixed_bl = 9; -local uInt fixed_bd = 5; -local inflate_huft fixed_tl[] = { - {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, - {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192}, - {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160}, - {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224}, - {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144}, - {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208}, - {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176}, - {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240}, - {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, - {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200}, - {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168}, - {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232}, - {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152}, - {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216}, - {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184}, - {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248}, - {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, - {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196}, - {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164}, - {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228}, - {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148}, - {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212}, - {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180}, - {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244}, - {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, - {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204}, - {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172}, - {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236}, - {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156}, - {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220}, - {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188}, - {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252}, - {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, - {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194}, - {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162}, - {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226}, - {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146}, - {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210}, - {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178}, - {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242}, - {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, - {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202}, - {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170}, - {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234}, - {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154}, - {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218}, - {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186}, - {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250}, - {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, - {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198}, - {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166}, - {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230}, - {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150}, - {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214}, - {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182}, - {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246}, - {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, - {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206}, - {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174}, - {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238}, - {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158}, - {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222}, - {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190}, - {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254}, - {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, - {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193}, - {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161}, - {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225}, - {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145}, - {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209}, - {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177}, - {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241}, - {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, - {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201}, - {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169}, - {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233}, - {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153}, - {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217}, - {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185}, - {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249}, - {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, - {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197}, - {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165}, - {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229}, - {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149}, - {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213}, - {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181}, - {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245}, - {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, - {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205}, - {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173}, - {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237}, - {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157}, - {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221}, - {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189}, - {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253}, - {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, - {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195}, - {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163}, - {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227}, - {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147}, - {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211}, - {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179}, - {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243}, - {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, - {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203}, - {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171}, - {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235}, - {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155}, - {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219}, - {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187}, - {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251}, - {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, - {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199}, - {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167}, - {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231}, - {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151}, - {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215}, - {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183}, - {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247}, - {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, - {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207}, - {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175}, - {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239}, - {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159}, - {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223}, - {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191}, - {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255} - }; -local inflate_huft fixed_td[] = { - {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097}, - {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385}, - {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193}, - {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577}, - {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145}, - {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577}, - {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289}, - {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577} - }; diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inflate.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/inflate.c deleted file mode 100644 index 4b6e3449d82..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inflate.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * inflate.c -- zlib interface to inflate modules - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "infblock.h" - -struct inflate_blocks_state {int dummy;}; /* for buggy compilers */ - -typedef enum { - METHOD, /* waiting for method byte */ - FLAG, /* waiting for flag byte */ - DICT4, /* four dictionary check bytes to go */ - DICT3, /* three dictionary check bytes to go */ - DICT2, /* two dictionary check bytes to go */ - DICT1, /* one dictionary check byte to go */ - DICT0, /* waiting for inflateSetDictionary */ - BLOCKS, /* decompressing blocks */ - CHECK4, /* four check bytes to go */ - CHECK3, /* three check bytes to go */ - CHECK2, /* two check bytes to go */ - CHECK1, /* one check byte to go */ - DONE, /* finished check, done */ - BAD} /* got an error--stay here */ -inflate_mode; - -/* inflate private state */ -struct internal_state { - - /* mode */ - inflate_mode mode; /* current inflate mode */ - - /* mode dependent information */ - union { - uInt method; /* if FLAGS, method byte */ - struct { - uLong was; /* computed check value */ - uLong need; /* stream check value */ - } check; /* if CHECK, check values to compare */ - uInt marker; /* if BAD, inflateSync's marker bytes count */ - } sub; /* submode */ - - /* mode independent information */ - int nowrap; /* flag for no wrapper */ - uInt wbits; /* log2(window size) (8..15, defaults to 15) */ - inflate_blocks_statef - *blocks; /* current inflate_blocks state */ - -}; - - -int ZEXPORT inflateReset(z) -z_streamp z; -{ - if (z == Z_NULL || z->state == Z_NULL) - return Z_STREAM_ERROR; - z->total_in = z->total_out = 0; - z->msg = Z_NULL; - z->state->mode = z->state->nowrap ? BLOCKS : METHOD; - inflate_blocks_reset(z->state->blocks, z, Z_NULL); - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - - -int ZEXPORT inflateEnd(z) -z_streamp z; -{ - if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL) - return Z_STREAM_ERROR; - if (z->state->blocks != Z_NULL) - inflate_blocks_free(z->state->blocks, z); - ZFREE(z, z->state); - z->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - - -int ZEXPORT inflateInit2_(z, w, version, stream_size) -z_streamp z; -int w; -const char *version; -int stream_size; -{ - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != sizeof(z_stream)) - return Z_VERSION_ERROR; - - /* initialize state */ - if (z == Z_NULL) - return Z_STREAM_ERROR; - z->msg = Z_NULL; - if (z->zalloc == Z_NULL) - { - z->zalloc = zcalloc; - z->opaque = (voidpf)0; - } - if (z->zfree == Z_NULL) z->zfree = zcfree; - if ((z->state = (struct internal_state FAR *) - ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) - return Z_MEM_ERROR; - z->state->blocks = Z_NULL; - - /* handle undocumented nowrap option (no zlib header or check) */ - z->state->nowrap = 0; - if (w < 0) - { - w = - w; - z->state->nowrap = 1; - } - - /* set window size */ - if (w < 8 || w > 15) - { - inflateEnd(z); - return Z_STREAM_ERROR; - } - z->state->wbits = (uInt)w; - - /* create inflate_blocks state */ - if ((z->state->blocks = - inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w)) - == Z_NULL) - { - inflateEnd(z); - return Z_MEM_ERROR; - } - Tracev((stderr, "inflate: allocated\n")); - - /* reset state */ - inflateReset(z); - return Z_OK; -} - - -int ZEXPORT inflateInit_(z, version, stream_size) -z_streamp z; -const char *version; -int stream_size; -{ - return inflateInit2_(z, DEF_WBITS, version, stream_size); -} - - -#define NEEDBYTE {if(z->avail_in==0)return r;r=f;} -#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++) - -int ZEXPORT inflate(z, f) -z_streamp z; -int f; -{ - int r; - uInt b; - - if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL) - return Z_STREAM_ERROR; - f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK; - r = Z_BUF_ERROR; - while (1) switch (z->state->mode) - { - case METHOD: - NEEDBYTE - if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED) - { - z->state->mode = BAD; - z->msg = (char*)"unknown compression method"; - z->state->sub.marker = 5; /* can't try inflateSync */ - break; - } - if ((z->state->sub.method >> 4) + 8 > z->state->wbits) - { - z->state->mode = BAD; - z->msg = (char*)"invalid window size"; - z->state->sub.marker = 5; /* can't try inflateSync */ - break; - } - z->state->mode = FLAG; - case FLAG: - NEEDBYTE - b = NEXTBYTE; - if (((z->state->sub.method << 8) + b) % 31) - { - z->state->mode = BAD; - z->msg = (char*)"incorrect header check"; - z->state->sub.marker = 5; /* can't try inflateSync */ - break; - } - Tracev((stderr, "inflate: zlib header ok\n")); - if (!(b & PRESET_DICT)) - { - z->state->mode = BLOCKS; - break; - } - z->state->mode = DICT4; - case DICT4: - NEEDBYTE - z->state->sub.check.need = (uLong)NEXTBYTE << 24; - z->state->mode = DICT3; - case DICT3: - NEEDBYTE - z->state->sub.check.need += (uLong)NEXTBYTE << 16; - z->state->mode = DICT2; - case DICT2: - NEEDBYTE - z->state->sub.check.need += (uLong)NEXTBYTE << 8; - z->state->mode = DICT1; - case DICT1: - NEEDBYTE - z->state->sub.check.need += (uLong)NEXTBYTE; - z->adler = z->state->sub.check.need; - z->state->mode = DICT0; - return Z_NEED_DICT; - case DICT0: - z->state->mode = BAD; - z->msg = (char*)"need dictionary"; - z->state->sub.marker = 0; /* can try inflateSync */ - return Z_STREAM_ERROR; - case BLOCKS: - r = inflate_blocks(z->state->blocks, z, r); - if (r == Z_DATA_ERROR) - { - z->state->mode = BAD; - z->state->sub.marker = 0; /* can try inflateSync */ - break; - } - if (r == Z_OK) - r = f; - if (r != Z_STREAM_END) - return r; - r = f; - inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was); - - /* zlib.h inflate() doc states that z->adler contains a checksum - of all uncompressed output even when returning Z_STREAM_END. */ - z->adler = z->state->sub.check.was; - - if (z->state->nowrap) - { - z->state->mode = DONE; - break; - } - z->state->mode = CHECK4; - case CHECK4: - NEEDBYTE - z->state->sub.check.need = (uLong)NEXTBYTE << 24; - z->state->mode = CHECK3; - case CHECK3: - NEEDBYTE - z->state->sub.check.need += (uLong)NEXTBYTE << 16; - z->state->mode = CHECK2; - case CHECK2: - NEEDBYTE - z->state->sub.check.need += (uLong)NEXTBYTE << 8; - z->state->mode = CHECK1; - case CHECK1: - NEEDBYTE - z->state->sub.check.need += (uLong)NEXTBYTE; - - if (z->state->sub.check.was != z->state->sub.check.need) - { - z->state->mode = BAD; - z->msg = (char*)"incorrect data check"; - z->state->sub.marker = 5; /* can't try inflateSync */ - break; - } - Tracev((stderr, "inflate: zlib check ok\n")); - z->state->mode = DONE; - case DONE: - return Z_STREAM_END; - case BAD: - return Z_DATA_ERROR; - default: - return Z_STREAM_ERROR; - } -#ifdef NEED_DUMMY_RETURN - return Z_STREAM_ERROR; /* Some dumb compilers complain without this */ -#endif -} - - -int ZEXPORT inflateSetDictionary(z, dictionary, dictLength) -z_streamp z; -const Bytef *dictionary; -uInt dictLength; -{ - uInt length = dictLength; - - if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0) - return Z_STREAM_ERROR; - - if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR; - z->adler = 1L; - - if (length >= ((uInt)1<state->wbits)) - { - length = (1<state->wbits)-1; - dictionary += dictLength - length; - } - inflate_set_dictionary(z->state->blocks, dictionary, length); - z->state->mode = BLOCKS; - return Z_OK; -} - - -int ZEXPORT inflateSync(z) -z_streamp z; -{ - uInt n; /* number of bytes to look at */ - Bytef *p; /* pointer to bytes */ - uInt m; /* number of marker bytes found in a row */ - uLong r, w; /* temporaries to save total_in and total_out */ - - /* set up */ - if (z == Z_NULL || z->state == Z_NULL) - return Z_STREAM_ERROR; - if (z->state->mode != BAD) - { - z->state->mode = BAD; - z->state->sub.marker = 0; - } - if ((n = z->avail_in) == 0) - return Z_BUF_ERROR; - p = z->next_in; - m = z->state->sub.marker; - - /* search */ - while (n && m < 4) - { - static const Byte mark[4] = {0, 0, 0xff, 0xff}; - if (*p == mark[m]) - m++; - else if (*p) - m = 0; - else - m = 4 - m; - p++, n--; - } - - /* restore */ - z->total_in += p - z->next_in; - z->next_in = p; - z->avail_in = n; - z->state->sub.marker = m; - - /* return no joy or set up to restart on a new block */ - if (m != 4) - return Z_DATA_ERROR; - r = z->total_in; w = z->total_out; - inflateReset(z); - z->total_in = r; z->total_out = w; - z->state->mode = BLOCKS; - return Z_OK; -} - - -/* Returns true if inflate is currently at the end of a block generated - * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH - * but removes the length bytes of the resulting empty stored block. When - * decompressing, PPP checks that at the end of input packet, inflate is - * waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(z) -z_streamp z; -{ - if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL) - return Z_STREAM_ERROR; - return inflate_blocks_sync_point(z->state->blocks); -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inftrees.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/inftrees.c deleted file mode 100644 index cc26dfa084b..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inftrees.c +++ /dev/null @@ -1,487 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" - -#if !defined(BUILDFIXED) && !defined(STDC) -# define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */ -#endif - -const char inflate_copyright[] = - " inflate 1.1.3.f-jdk Copyright 1995-1998 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ -struct internal_state {int dummy;}; /* for buggy compilers */ - -/* simplify the use of the inflate_huft type with some defines */ -#define exop word.what.Exop -#define bits word.what.Bits - - -local int huft_build OF(( - uIntf *, /* code lengths in bits */ - uInt, /* number of codes */ - uInt, /* number of "simple" codes */ - const uIntf *, /* list of base values for non-simple codes */ - const uIntf *, /* list of extra bits for non-simple codes */ - inflate_huft * FAR*,/* result: starting table */ - uIntf *, /* maximum lookup bits (returns actual) */ - inflate_huft *, /* space for trees */ - uInt *, /* hufts used in space */ - uIntf * )); /* space for values */ - -/* Tables for deflate from PKZIP's appnote.txt. */ -local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - /* see note #13 above about 258 */ -local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */ - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */ -local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577}; -local const uInt cpdext[30] = { /* Extra bits for distance codes */ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, - 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, - 12, 12, 13, 13}; - -/* - Huffman code decoding is performed using a multi-level table lookup. - The fastest way to decode is to simply build a lookup table whose - size is determined by the longest code. However, the time it takes - to build this table can also be a factor if the data being decoded - is not very long. The most common codes are necessarily the - shortest codes, so those codes dominate the decoding time, and hence - the speed. The idea is you can have a shorter table that decodes the - shorter, more probable codes, and then point to subsidiary tables for - the longer codes. The time it costs to decode the longer codes is - then traded against the time it takes to make longer tables. - - This results of this trade are in the variables lbits and dbits - below. lbits is the number of bits the first level table for literal/ - length codes can decode in one step, and dbits is the same thing for - the distance codes. Subsequent tables are also less than or equal to - those sizes. These values may be adjusted either when all of the - codes are shorter than that, in which case the longest code length in - bits is used, or when the shortest code is *longer* than the requested - table size, in which case the length of the shortest code in bits is - used. - - There are two different values for the two tables, since they code a - different number of possibilities each. The literal/length table - codes 286 possible values, or in a flat code, a little over eight - bits. The distance table codes 30 possible values, or a little less - than five bits, flat. The optimum values for speed end up being - about one bit more than those, so lbits is 8+1 and dbits is 5+1. - The optimum values may differ though from machine to machine, and - possibly even between compilers. Your mileage may vary. - */ - - -/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */ -#define BMAX 15 /* maximum bit length of any code */ - -local int huft_build(b, n, s, d, e, t, m, hp, hn, v) -uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ -uInt n; /* number of codes (assumed <= 288) */ -uInt s; /* number of simple-valued codes (0..s-1) */ -const uIntf *d; /* list of base values for non-simple codes */ -const uIntf *e; /* list of extra bits for non-simple codes */ -inflate_huft * FAR *t; /* result: starting table */ -uIntf *m; /* maximum lookup bits, returns actual */ -inflate_huft *hp; /* space for trees */ -uInt *hn; /* hufts used in space */ -uIntf *v; /* working area: values in order of bit length */ -/* Given a list of code lengths and a maximum table size, make a set of - tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR - if the given code set is incomplete (the tables are still built in this - case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of - lengths), or Z_MEM_ERROR if not enough memory. */ -{ - - uInt a; /* counter for codes of length k */ - uInt c[BMAX+1]; /* bit length count table */ - uInt f; /* i repeats in table every f entries */ - int g; /* maximum code length */ - int h; /* table level */ - register uInt i; /* counter, current code */ - register uInt j; /* counter */ - register int k; /* number of bits in current code */ - int l; /* bits per table (returned in m) */ - uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */ - register uIntf *p; /* pointer into c[], b[], or v[] */ - inflate_huft *q; /* points to current table */ - struct inflate_huft_s r; /* table entry for structure assignment */ - inflate_huft *u[BMAX]; /* table stack */ - register int w; /* bits before this table == (l * h) */ - uInt x[BMAX+1]; /* bit offsets, then code stack */ - uIntf *xp; /* pointer into x */ - int y; /* number of dummy codes added */ - uInt z; /* number of entries in current table */ - - - /* Generate counts for each bit length */ - p = c; -#define C0 *p++ = 0; -#define C2 C0 C0 C0 C0 -#define C4 C2 C2 C2 C2 - C4 /* clear c[]--assume BMAX+1 is 16 */ - p = b; i = n; - do { - c[*p++]++; /* assume all entries <= BMAX */ - } while (--i); - if (c[0] == n) /* null input--all zero length codes */ - { - *t = (inflate_huft *)Z_NULL; - *m = 0; - return Z_OK; - } - - - /* Find minimum and maximum length, bound *m by those */ - l = *m; - for (j = 1; j <= BMAX; j++) - if (c[j]) - break; - k = j; /* minimum code length */ - if ((uInt)l < j) - l = j; - for (i = BMAX; i; i--) - if (c[i]) - break; - g = i; /* maximum code length */ - if ((uInt)l > i) - l = i; - *m = l; - - - /* Adjust last length count to fill out codes, if needed */ - for (y = 1 << j; j < i; j++, y <<= 1) - if ((y -= c[j]) < 0) - return Z_DATA_ERROR; - if ((y -= c[i]) < 0) - return Z_DATA_ERROR; - c[i] += y; - - - /* Generate starting offsets into the value table for each length */ - x[1] = j = 0; - p = c + 1; xp = x + 2; - while (--i) { /* note that i == g from above */ - *xp++ = (j += *p++); - } - - - /* Make a table of values in order of bit lengths */ - p = b; i = 0; - do { - if ((j = *p++) != 0) - v[x[j]++] = i; - } while (++i < n); - n = x[g]; /* set n to length of v */ - - - /* Generate the Huffman codes and for each, make the table entries */ - x[0] = i = 0; /* first Huffman code is zero */ - p = v; /* grab values in bit order */ - h = -1; /* no tables yet--level -1 */ - w = -l; /* bits decoded == (l * h) */ - u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */ - q = (inflate_huft *)Z_NULL; /* ditto */ - z = 0; /* ditto */ - - /* go through the bit lengths (k already is bits in shortest code) */ - for (; k <= g; k++) - { - a = c[k]; - while (a--) - { - /* here i is the Huffman code of length k bits for value *p */ - /* make tables up to required level */ - while (k > w + l) - { - h++; - w += l; /* previous table always l bits */ - - /* compute minimum size table less than or equal to l bits */ - z = g - w; - z = z > (uInt)l ? (uInt)l : z; /* table size upper limit */ - if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ - { /* too few codes for k-w bit table */ - f -= a + 1; /* deduct codes from patterns left */ - xp = c + k; - if (j < z) - while (++j < z) /* try smaller tables up to z bits */ - { - if ((f <<= 1) <= *++xp) - break; /* enough codes to use up j bits */ - f -= *xp; /* else deduct codes from patterns */ - } - } - z = 1 << j; /* table entries for j-bit table */ - - /* allocate new table */ - if (*hn + z > MANY) /* (note: doesn't matter for fixed) */ - return Z_MEM_ERROR; /* not enough memory */ - u[h] = q = hp + *hn; - *hn += z; - - /* connect to last table, if there is one */ - if (h) - { - x[h] = i; /* save pattern for backing up */ - r.bits = (Byte)l; /* bits to dump before this table */ - r.exop = (Byte)j; /* bits in this table */ - j = i >> (w - l); - r.base = (uInt)(q - u[h-1] - j); /* offset to this table */ - u[h-1][j] = r; /* connect to last table */ - } - else - *t = q; /* first table is returned result */ - } - - /* set up table entry in r */ - r.bits = (Byte)(k - w); - if (p >= v + n) - r.exop = 128 + 64; /* out of values--invalid code */ - else if (*p < s) - { - r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */ - r.base = *p++; /* simple code is just the value */ - } - else - { - r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */ - r.base = d[*p++ - s]; - } - - /* fill code-like entries with r */ - f = 1 << (k - w); - for (j = i >> w; j < z; j += f) - q[j] = r; - - /* backwards increment the k-bit code i */ - for (j = 1 << (k - 1); i & j; j >>= 1) - i ^= j; - i ^= j; - - /* backup over finished tables */ - mask = (1 << w) - 1; /* needed on HP, cc -O bug */ - while ((i & mask) != x[h]) - { - h--; /* don't need to update q */ - w -= l; - mask = (1 << w) - 1; - } - } - } - - - /* Return Z_BUF_ERROR if we were given an incomplete table */ - return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK; -} - - -int inflate_trees_bits(c, bb, tb, hp, z) -uIntf *c; /* 19 code lengths */ -uIntf *bb; /* bits tree desired/actual depth */ -inflate_huft * FAR *tb; /* bits tree result */ -inflate_huft *hp; /* space for trees */ -z_streamp z; /* for messages */ -{ - int r; - uInt hn = 0; /* hufts used in space */ - uIntf *v; /* work area for huft_build */ - - if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL) - return Z_MEM_ERROR; - r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, - tb, bb, hp, &hn, v); - if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed dynamic bit lengths tree"; - else if (r == Z_BUF_ERROR || *bb == 0) - { - z->msg = (char*)"incomplete dynamic bit lengths tree"; - r = Z_DATA_ERROR; - } - ZFREE(z, v); - return r; -} - - -int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z) -uInt nl; /* number of literal/length codes */ -uInt nd; /* number of distance codes */ -uIntf *c; /* that many (total) code lengths */ -uIntf *bl; /* literal desired/actual bit depth */ -uIntf *bd; /* distance desired/actual bit depth */ -inflate_huft * FAR *tl; /* literal/length tree result */ -inflate_huft * FAR *td; /* distance tree result */ -inflate_huft *hp; /* space for trees */ -z_streamp z; /* for messages */ -{ - int r; - uInt hn = 0; /* hufts used in space */ - uIntf *v; /* work area for huft_build */ - - /* allocate work area */ - if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) - return Z_MEM_ERROR; - - /* build literal/length tree */ - r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v); - if (r != Z_OK || *bl == 0) - { - if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed literal/length tree"; - else if (r != Z_MEM_ERROR) - { - z->msg = (char*)"incomplete literal/length tree"; - r = Z_DATA_ERROR; - } - ZFREE(z, v); - return r; - } - - /* build distance tree */ - r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v); - if (r != Z_OK || (*bd == 0 && nl > 257)) - { - if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed distance tree"; - else if (r == Z_BUF_ERROR) { -#ifdef PKZIP_BUG_WORKAROUND - r = Z_OK; - } -#else - z->msg = (char*)"incomplete distance tree"; - r = Z_DATA_ERROR; - } - else if (r != Z_MEM_ERROR) - { - z->msg = (char*)"empty distance tree with lengths"; - r = Z_DATA_ERROR; - } - ZFREE(z, v); - return r; -#endif - } - - /* done */ - ZFREE(z, v); - return Z_OK; -} - - -/* build fixed tables only once--keep them here */ -#ifdef BUILDFIXED -local int fixed_built = 0; -#define FIXEDH 544 /* number of hufts used by fixed tables */ -local inflate_huft fixed_mem[FIXEDH]; -local uInt fixed_bl; -local uInt fixed_bd; -local inflate_huft *fixed_tl; -local inflate_huft *fixed_td; -#else -#include "inffixed.h" -#endif - - -int inflate_trees_fixed(bl, bd, tl, td, z) -uIntf *bl; /* literal desired/actual bit depth */ -uIntf *bd; /* distance desired/actual bit depth */ -inflate_huft * FAR *tl; /* literal/length tree result */ -inflate_huft * FAR *td; /* distance tree result */ -z_streamp z; /* for memory allocation */ -{ -#ifdef BUILDFIXED - /* build fixed tables if not already */ - if (!fixed_built) - { - int k; /* temporary variable */ - uInt f = 0; /* number of hufts used in fixed_mem */ - uIntf *c; /* length list for huft_build */ - uIntf *v; /* work area for huft_build */ - - /* allocate memory */ - if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) - return Z_MEM_ERROR; - if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) - { - ZFREE(z, c); - return Z_MEM_ERROR; - } - - /* literal table */ - for (k = 0; k < 144; k++) - c[k] = 8; - for (; k < 256; k++) - c[k] = 9; - for (; k < 280; k++) - c[k] = 7; - for (; k < 288; k++) - c[k] = 8; - fixed_bl = 9; - huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl, - fixed_mem, &f, v); - - /* distance table */ - for (k = 0; k < 30; k++) - c[k] = 5; - fixed_bd = 5; - huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd, - fixed_mem, &f, v); - - /* done */ - ZFREE(z, v); - ZFREE(z, c); - fixed_built = 1; - } -#endif - *bl = fixed_bl; - *bd = fixed_bd; - *tl = fixed_tl; - *td = fixed_td; - return Z_OK; -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inftrees.h b/jdk/src/share/native/java/util/zip/zlib-1.1.3/inftrees.h deleted file mode 100644 index dc5aed36a72..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inftrees.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Huffman code lookup table entry--this entry is four bytes for machines - that have 16-bit pointers (e.g. PC's in the small or medium model). */ - -typedef struct inflate_huft_s FAR inflate_huft; - -struct inflate_huft_s { - union { - struct { - Byte Exop; /* number of extra bits or operation */ - Byte Bits; /* number of bits in this code or subcode */ - } what; - uInt pad; /* pad structure to a power of 2 (4 bytes for */ - } word; /* 16-bit, 8 bytes for 32-bit int's) */ - uInt base; /* literal, length base, distance base, - or table offset */ -}; - -/* Maximum size of dynamic tree. The maximum found in a long but non- - exhaustive search was 1004 huft structures (850 for length/literals - and 154 for distances, the latter actually the result of an - exhaustive search). The actual maximum is not known, but the - value below is more than safe. */ -#define MANY 1440 - -extern int inflate_trees_bits OF(( - uIntf *, /* 19 code lengths */ - uIntf *, /* bits tree desired/actual depth */ - inflate_huft * FAR *, /* bits tree result */ - inflate_huft *, /* space for trees */ - z_streamp)); /* for messages */ - -extern int inflate_trees_dynamic OF(( - uInt, /* number of literal/length codes */ - uInt, /* number of distance codes */ - uIntf *, /* that many (total) code lengths */ - uIntf *, /* literal desired/actual bit depth */ - uIntf *, /* distance desired/actual bit depth */ - inflate_huft * FAR *, /* literal/length tree result */ - inflate_huft * FAR *, /* distance tree result */ - inflate_huft *, /* space for trees */ - z_streamp)); /* for messages */ - -extern int inflate_trees_fixed OF(( - uIntf *, /* literal desired/actual bit depth */ - uIntf *, /* distance desired/actual bit depth */ - inflate_huft * FAR *, /* literal/length tree result */ - inflate_huft * FAR *, /* distance tree result */ - z_streamp)); /* for memory allocation */ diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infutil.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/infutil.c deleted file mode 100644 index d7059ee67d3..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infutil.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * inflate_util.c -- data and routines common to blocks and codes - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "infblock.h" -#include "inftrees.h" -#include "infcodes.h" -#include "infutil.h" - -struct inflate_codes_state {int dummy;}; /* for buggy compilers */ - -/* And'ing with mask[n] masks the lower n bits */ -uInt inflate_mask[17] = { - 0x0000, - 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, - 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff -}; - - -/* copy as much as possible from the sliding window to the output area */ -int inflate_flush(s, z, r) -inflate_blocks_statef *s; -z_streamp z; -int r; -{ - uInt n; - Bytef *p; - Bytef *q; - - /* local copies of source and destination pointers */ - p = z->next_out; - q = s->read; - - /* compute number of bytes to copy as far as end of window */ - n = (uInt)((q <= s->write ? s->write : s->end) - q); - if (n > z->avail_out) n = z->avail_out; - if (n && r == Z_BUF_ERROR) r = Z_OK; - - /* update counters */ - z->avail_out -= n; - z->total_out += n; - - /* update check information */ - if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(s->check, q, n); - - /* copy as far as end of window */ - zmemcpy(p, q, n); - p += n; - q += n; - - /* see if more to copy at beginning of window */ - if (q == s->end) - { - /* wrap pointers */ - q = s->window; - if (s->write == s->end) - s->write = s->window; - - /* compute bytes to copy */ - n = (uInt)(s->write - q); - if (n > z->avail_out) n = z->avail_out; - if (n && r == Z_BUF_ERROR) r = Z_OK; - - /* update counters */ - z->avail_out -= n; - z->total_out += n; - - /* update check information */ - if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(s->check, q, n); - - /* copy */ - zmemcpy(p, q, n); - p += n; - q += n; - } - - /* update pointers */ - z->next_out = p; - s->read = q; - - /* done */ - return r; -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infutil.h b/jdk/src/share/native/java/util/zip/zlib-1.1.3/infutil.h deleted file mode 100644 index e5154d7f626..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/infutil.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * infutil.h -- types and macros common to blocks and codes - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -#ifndef _INFUTIL_H -#define _INFUTIL_H - -typedef enum { - TYPE, /* get type bits (3, including end bit) */ - LENS, /* get lengths for stored */ - STORED, /* processing stored block */ - TABLE, /* get table lengths */ - BTREE, /* get bit lengths tree for a dynamic block */ - DTREE, /* get length, distance trees for a dynamic block */ - CODES, /* processing fixed or dynamic block */ - DRY, /* output remaining window bytes */ - DONE, /* finished last block, done */ - BAD} /* got a data error--stuck here */ -inflate_block_mode; - -/* inflate blocks semi-private state */ -struct inflate_blocks_state { - - /* mode */ - inflate_block_mode mode; /* current inflate_block mode */ - - /* mode dependent information */ - union { - uInt left; /* if STORED, bytes left to copy */ - struct { - uInt table; /* table lengths (14 bits) */ - uInt index; /* index into blens (or border) */ - uIntf *blens; /* bit lengths of codes */ - uInt bb; /* bit length tree depth */ - inflate_huft *tb; /* bit length decoding tree */ - } trees; /* if DTREE, decoding info for trees */ - struct { - inflate_codes_statef - *codes; - } decode; /* if CODES, current state */ - } sub; /* submode */ - uInt last; /* true if this block is the last block */ - - /* mode independent information */ - uInt bitk; /* bits in bit buffer */ - uLong bitb; /* bit buffer */ - inflate_huft *hufts; /* single malloc for tree space */ - Bytef *window; /* sliding window */ - Bytef *end; /* one byte after sliding window */ - Bytef *read; /* window read pointer */ - Bytef *write; /* window write pointer */ - check_func checkfn; /* check function */ - uLong check; /* check on output */ - -}; - - -/* defines for inflate input/output */ -/* update pointers and return */ -#define UPDBITS {s->bitb=b;s->bitk=k;} -#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;} -#define UPDOUT {s->write=q;} -#define UPDATE {UPDBITS UPDIN UPDOUT} -#define LEAVE {UPDATE return inflate_flush(s,z,r);} -/* get bytes and bits */ -#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;} -#define NEEDBYTE {if(n)r=Z_OK;else LEAVE} -#define NEXTBYTE (n--,*p++) -#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<>=(j);k-=(j);} -/* output bytes */ -#define WAVAIL (uInt)(qread?s->read-q-1:s->end-q) -#define LOADOUT {q=s->write;m=(uInt)WAVAIL;} -#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}} -#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} -#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} -#define OUTBYTE(a) {*q++=(Byte)(a);m--;} -/* load local pointers */ -#define LOAD {LOADIN LOADOUT} - -/* masks for lower bits (size given to avoid silly warnings with Visual C++) */ -extern uInt inflate_mask[17]; - -/* copy as much as possible from the sliding window to the output area */ -extern int inflate_flush OF(( - inflate_blocks_statef *, - z_streamp , - int)); - -struct internal_state {int dummy;}; /* for buggy compilers */ - -#endif diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/minigzip.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/minigzip.c deleted file mode 100644 index 39b3847e14a..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/minigzip.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * minigzip.c -- simulate gzip using the zlib compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * minigzip is a minimal implementation of the gzip utility. This is - * only an example of using zlib and isn't meant to replace the - * full-featured gzip. No attempt is made to deal with file systems - * limiting names to 14 or 8+3 characters, etc... Error checking is - * very limited. So use minigzip only for testing; use gzip for the - * real thing. On MSDOS, use only on file names without extension - * or in pipe mode. - */ - -#include -#include "zlib.h" - -#ifdef STDC -# include -# include -#else - extern void exit OF((int)); -#endif - -#ifdef USE_MMAP -# include -# include -# include -#endif - -#if defined(MSDOS) || defined(OS2) || defined(WIN32) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#ifdef VMS -# define unlink delete -# define GZ_SUFFIX "-gz" -#endif -#ifdef RISCOS -# define unlink remove -# define GZ_SUFFIX "-gz" -# define fileno(file) file->__file -#endif -#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fileno */ -#endif - -#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ - extern int unlink OF((const char *)); -#endif - -#ifndef GZ_SUFFIX -# define GZ_SUFFIX ".gz" -#endif -#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) - -#define BUFLEN 16384 -#define MAX_NAME_LEN 1024 - -#ifdef MAXSEG_64K -# define local static - /* Needed for systems with limitation on stack size. */ -#else -# define local -#endif - -char *prog; - -void error OF((const char *msg)); -void gz_compress OF((FILE *in, gzFile out)); -#ifdef USE_MMAP -int gz_compress_mmap OF((FILE *in, gzFile out)); -#endif -void gz_uncompress OF((gzFile in, FILE *out)); -void file_compress OF((char *file, char *mode)); -void file_uncompress OF((char *file)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Display error message and exit - */ -void error(msg) - const char *msg; -{ - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); -} - -/* =========================================================================== - * Compress input to output then close both files. - */ - -void gz_compress(in, out) - FILE *in; - gzFile out; -{ - local char buf[BUFLEN]; - int len; - int err; - -#ifdef USE_MMAP - /* Try first compressing with mmap. If mmap fails (minigzip used in a - * pipe), use the normal fread loop. - */ - if (gz_compress_mmap(in, out) == Z_OK) return; -#endif - for (;;) { - len = fread(buf, 1, sizeof(buf), in); - if (ferror(in)) { - perror("fread"); - exit(1); - } - if (len == 0) break; - - if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); - } - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); -} - -#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ - -/* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. - */ -int gz_compress_mmap(in, out) - FILE *in; - gzFile out; -{ - int len; - int err; - int ifd = fileno(in); - caddr_t buf; /* mmap'ed buffer for the entire input file */ - off_t buf_len; /* length of the input file */ - struct stat sb; - - /* Determine the size of the file, needed for mmap: */ - if (fstat(ifd, &sb) < 0) return Z_ERRNO; - buf_len = sb.st_size; - if (buf_len <= 0) return Z_ERRNO; - - /* Now do the actual mmap: */ - buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); - if (buf == (caddr_t)(-1)) return Z_ERRNO; - - /* Compress the whole file at once: */ - len = gzwrite(out, (char *)buf, (unsigned)buf_len); - - if (len != (int)buf_len) error(gzerror(out, &err)); - - munmap(buf, buf_len); - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); - return Z_OK; -} -#endif /* USE_MMAP */ - -/* =========================================================================== - * Uncompress input to output then close both files. - */ -void gz_uncompress(in, out) - gzFile in; - FILE *out; -{ - local char buf[BUFLEN]; - int len; - int err; - - for (;;) { - len = gzread(in, buf, sizeof(buf)); - if (len < 0) error (gzerror(in, &err)); - if (len == 0) break; - - if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - error("failed fwrite"); - } - } - if (fclose(out)) error("failed fclose"); - - if (gzclose(in) != Z_OK) error("failed gzclose"); -} - - -/* =========================================================================== - * Compress the given file: create a corresponding .gz file and remove the - * original. - */ -void file_compress(file, mode) - char *file; - char *mode; -{ - local char outfile[MAX_NAME_LEN]; - FILE *in; - gzFile out; - - strcpy(outfile, file); - strcat(outfile, GZ_SUFFIX); - - in = fopen(file, "rb"); - if (in == NULL) { - perror(file); - exit(1); - } - out = gzopen(outfile, mode); - if (out == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); - exit(1); - } - gz_compress(in, out); - - unlink(file); -} - - -/* =========================================================================== - * Uncompress the given file and remove the original. - */ -void file_uncompress(file) - char *file; -{ - local char buf[MAX_NAME_LEN]; - char *infile, *outfile; - FILE *out; - gzFile in; - int len = strlen(file); - - strcpy(buf, file); - - if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { - infile = file; - outfile = buf; - outfile[len-3] = '\0'; - } else { - outfile = file; - infile = buf; - strcat(infile, GZ_SUFFIX); - } - in = gzopen(infile, "rb"); - if (in == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); - exit(1); - } - out = fopen(outfile, "wb"); - if (out == NULL) { - perror(file); - exit(1); - } - - gz_uncompress(in, out); - - unlink(infile); -} - - -/* =========================================================================== - * Usage: minigzip [-d] [-f] [-h] [-1 to -9] [files...] - * -d : decompress - * -f : compress with Z_FILTERED - * -h : compress with Z_HUFFMAN_ONLY - * -1 to -9 : compression level - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - int uncompr = 0; - gzFile file; - char outmode[20]; - - strcpy(outmode, "wb6 "); - - prog = argv[0]; - argc--, argv++; - - while (argc > 0) { - if (strcmp(*argv, "-d") == 0) - uncompr = 1; - else if (strcmp(*argv, "-f") == 0) - outmode[3] = 'f'; - else if (strcmp(*argv, "-h") == 0) - outmode[3] = 'h'; - else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && - (*argv)[2] == 0) - outmode[2] = (*argv)[1]; - else - break; - argc--, argv++; - } - if (argc == 0) { - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - if (uncompr) { - file = gzdopen(fileno(stdin), "rb"); - if (file == NULL) error("can't gzdopen stdin"); - gz_uncompress(file, stdout); - } else { - file = gzdopen(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - gz_compress(stdin, file); - } - } else { - do { - if (uncompr) { - file_uncompress(*argv); - } else { - file_compress(*argv, outmode); - } - } while (argv++, --argc); - } - exit(0); - return 0; /* to avoid warning */ -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zadler32.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/zadler32.c deleted file mode 100644 index c89b5283883..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zadler32.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zlib.h" - -#define BASE 65521L /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {s1 += buf[i]; s2 += s1;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -/* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ - unsigned long s1 = adler & 0xffff; - unsigned long s2 = (adler >> 16) & 0xffff; - int k; - - if (buf == Z_NULL) return 1L; - - while (len > 0) { - k = len < NMAX ? len : NMAX; - len -= k; - while (k >= 16) { - DO16(buf); - buf += 16; - k -= 16; - } - if (k != 0) do { - s1 += *buf++; - s2 += s1; - } while (--k); - s1 %= BASE; - s2 %= BASE; - } - return (s2 << 16) | s1; -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h b/jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h deleted file mode 100644 index bdcd0b33c1c..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef _ZCONF_H -#define _ZCONF_H - -/* for _LP64 */ -#include - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table - -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 -#endif -#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) -# ifndef __32BIT__ -# define __32BIT__ -# endif -#endif -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#if defined(MSDOS) && !defined(__32BIT__) -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) -# define STDC -#endif -#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) -# ifndef STDC -# define STDC -# endif -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Old Borland C incorrectly complains about missing returns: */ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) -# define NEED_DUMMY_RETURN -#endif - - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -#endif -#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) -# ifndef __32BIT__ -# define SMALL_MEDIUM -# define FAR _far -# endif -#endif - -/* Compile with -DZLIB_DLL for Windows DLL support */ -#if defined(ZLIB_DLL) -# if defined(_WINDOWS) || defined(WINDOWS) -# ifdef FAR -# undef FAR -# endif -# include -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR _cdecl _export -# endif -# endif -# if defined (__BORLANDC__) -# if (__BORLANDC__ >= 0x0500) && defined (WIN32) -# include -# define ZEXPORT __declspec(dllexport) WINAPI -# define ZEXPORTRVA __declspec(dllexport) WINAPIV -# else -# if defined (_Windows) && defined (__DLL__) -# define ZEXPORT _export -# define ZEXPORTVA _export -# endif -# endif -# endif -#endif - -#if defined (__BEOS__) -# if defined (ZLIB_DLL) -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -#endif - -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif -#ifndef ZEXTERN -# define ZEXTERN extern -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(MACOS) && !defined(TARGET_OS_MAC) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -#ifdef _LP64 -typedef unsigned int uLong; /* 32 bits or more */ -#else -typedef unsigned long uLong; /* 32 bits or more */ -#endif - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#ifdef HAVE_UNISTD_H -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(inflate_blocks,"INBL") -# pragma map(inflate_blocks_new,"INBLNE") -# pragma map(inflate_blocks_free,"INBLFR") -# pragma map(inflate_blocks_reset,"INBLRE") -# pragma map(inflate_codes_free,"INCOFR") -# pragma map(inflate_codes,"INCO") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_flush,"INFLU") -# pragma map(inflate_mask,"INMA") -# pragma map(inflate_set_dictionary,"INSEDI2") -# pragma map(inflate_copyright,"INCOPY") -# pragma map(inflate_trees_bits,"INTRBI") -# pragma map(inflate_trees_dynamic,"INTRDY") -# pragma map(inflate_trees_fixed,"INTRFI") -# pragma map(inflate_trees_free,"INTRFR") -#endif - -#endif /* _ZCONF_H */ diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zcrc32.c b/jdk/src/share/native/java/util/zip/zlib-1.1.3/zcrc32.c deleted file mode 100644 index a8097f2157b..00000000000 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zcrc32.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zlib.h" - -#define local static - -#ifdef DYNAMIC_CRC_TABLE - -local int crc_table_empty = 1; -local uLongf crc_table[256]; -local void make_crc_table OF((void)); - -/* - Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The table is simply the CRC of all possible eight bit values. This is all - the information needed to generate CRC's on data a byte at a time for all - combinations of CRC register values and incoming bytes. -*/ -local void make_crc_table() -{ - uLong c; - int n, k; - uLong poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0UL; - for (n = 0; n < sizeof(p)/sizeof(Byte); n++) - poly |= 1L << (31 - p[n]); - - for (n = 0; n < 256; n++) - { - c = (uLong)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[n] = c; - } - crc_table_empty = 0; -} -#else -/* ======================================================================== - * Table of CRC-32's of all single-byte values (made by make_crc_table) - */ -local const uLongf crc_table[256] = { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -}; -#endif - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const uLongf * ZEXPORT get_crc_table() -{ -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) make_crc_table(); -#endif - return (const uLongf *)crc_table; -} - -/* ========================================================================= */ -#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); -#define DO2(buf) DO1(buf); DO1(buf); -#define DO4(buf) DO2(buf); DO2(buf); -#define DO8(buf) DO4(buf); DO4(buf); - -/* ========================================================================= */ -uLong ZEXPORT crc32(crc, buf, len) - uLong crc; - const Bytef *buf; - uInt len; -{ - if (buf == Z_NULL) return 0UL; -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif - crc = crc ^ 0xffffffffUL; - while (len >= 8) - { - DO8(buf); - len -= 8; - } - if (len) do { - DO1(buf); - } while (--len); - return crc ^ 0xffffffffUL; -} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/ChangeLog b/jdk/src/share/native/java/util/zip/zlib-1.2.3/ChangeLog similarity index 54% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/ChangeLog rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/ChangeLog index 3f0ec04d1e2..7f6869d3235 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/ChangeLog +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/ChangeLog @@ -1,16 +1,390 @@ - ChangeLog file for zlib + ChangeLog file for zlib + +Changes in 1.2.3 (18 July 2005) +- Apply security vulnerability fixes to contrib/infback9 as well +- Clean up some text files (carriage returns, trailing space) +- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] + +Changes in 1.2.2.4 (11 July 2005) +- Add inflatePrime() function for starting inflation at bit boundary +- Avoid some Visual C warnings in deflate.c +- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit + compile +- Fix some spelling errors in comments [Betts] +- Correct inflateInit2() error return documentation in zlib.h +- Added zran.c example of compressed data random access to examples + directory, shows use of inflatePrime() +- Fix cast for assignments to strm->state in inflate.c and infback.c +- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] +- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] +- Add cast in trees.c t avoid a warning [Oberhumer] +- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] +- Update make_vms.com [Zinser] +- Initialize state->write in inflateReset() since copied in inflate_fast() +- Be more strict on incomplete code sets in inflate_table() and increase + ENOUGH and MAXD -- this repairs a possible security vulnerability for + invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for + discovering the vulnerability and providing test cases. +- Add ia64 support to configure for HP-UX [Smith] +- Add error return to gzread() for format or i/o error [Levin] +- Use malloc.h for OS/2 [Necasek] + +Changes in 1.2.2.3 (27 May 2005) +- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile +- Typecast fread() return values in gzio.c [Vollant] +- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) +- Fix crc check bug in gzread() after gzungetc() [Heiner] +- Add the deflateTune() function to adjust internal compression parameters +- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) +- Remove an incorrect assertion in examples/zpipe.c +- Add C++ wrapper in infback9.h [Donais] +- Fix bug in inflateCopy() when decoding fixed codes +- Note in zlib.h how much deflateSetDictionary() actually uses +- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) +- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] +- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] +- Add gzdirect() function to indicate transparent reads +- Update contrib/minizip [Vollant] +- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] +- Add casts in crc32.c to avoid warnings [Oberhumer] +- Add contrib/masmx64 [Vollant] +- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] + +Changes in 1.2.2.2 (30 December 2004) +- Replace structure assignments in deflate.c and inflate.c with zmemcpy to + avoid implicit memcpy calls (portability for no-library compilation) +- Increase sprintf() buffer size in gzdopen() to allow for large numbers +- Add INFLATE_STRICT to check distances against zlib header +- Improve WinCE errno handling and comments [Chang] +- Remove comment about no gzip header processing in FAQ +- Add Z_FIXED strategy option to deflateInit2() to force fixed trees +- Add updated make_vms.com [Coghlan], update README +- Create a new "examples" directory, move gzappend.c there, add zpipe.c, + fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. +- Add FAQ entry and comments in deflate.c on uninitialized memory access +- Add Solaris 9 make options in configure [Gilbert] +- Allow strerror() usage in gzio.c for STDC +- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] +- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] +- Use z_off_t for adler32_combine() and crc32_combine() lengths +- Make adler32() much faster for small len +- Use OS_CODE in deflate() default gzip header + +Changes in 1.2.2.1 (31 October 2004) +- Allow inflateSetDictionary() call for raw inflate +- Fix inflate header crc check bug for file names and comments +- Add deflateSetHeader() and gz_header structure for custom gzip headers +- Add inflateGetheader() to retrieve gzip headers +- Add crc32_combine() and adler32_combine() functions +- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list +- Use zstreamp consistently in zlib.h (inflate_back functions) +- Remove GUNZIP condition from definition of inflate_mode in inflate.h + and in contrib/inflate86/inffast.S [Truta, Anderson] +- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] +- Update projects/README.projects and projects/visualc6 [Truta] +- Update win32/DLL_FAQ.txt [Truta] +- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] +- Deprecate Z_ASCII; use Z_TEXT instead [Truta] +- Use a new algorithm for setting strm->data_type in trees.c [Truta] +- Do not define an exit() prototype in zutil.c unless DEBUG defined +- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] +- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() +- Fix Darwin build version identification [Peterson] + +Changes in 1.2.2 (3 October 2004) +- Update zlib.h comments on gzip in-memory processing +- Set adler to 1 in inflateReset() to support Java test suite [Walles] +- Add contrib/dotzlib [Ravn] +- Update win32/DLL_FAQ.txt [Truta] +- Update contrib/minizip [Vollant] +- Move contrib/visual-basic.txt to old/ [Truta] +- Fix assembler builds in projects/visualc6/ [Truta] + +Changes in 1.2.1.2 (9 September 2004) +- Update INDEX file +- Fix trees.c to update strm->data_type (no one ever noticed!) +- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] +- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) +- Add limited multitasking protection to DYNAMIC_CRC_TABLE +- Add NO_vsnprintf for VMS in zutil.h [Mozilla] +- Don't declare strerror() under VMS [Mozilla] +- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize +- Update contrib/ada [Anisimkov] +- Update contrib/minizip [Vollant] +- Fix configure to not hardcode directories for Darwin [Peterson] +- Fix gzio.c to not return error on empty files [Brown] +- Fix indentation; update version in contrib/delphi/ZLib.pas and + contrib/pascal/zlibpas.pas [Truta] +- Update mkasm.bat in contrib/masmx86 [Truta] +- Update contrib/untgz [Truta] +- Add projects/README.projects [Truta] +- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] +- Update win32/DLL_FAQ.txt [Truta] +- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] +- Remove an unnecessary assignment to curr in inftrees.c [Truta] +- Add OS/2 to exe builds in configure [Poltorak] +- Remove err dummy parameter in zlib.h [Kientzle] + +Changes in 1.2.1.1 (9 January 2004) +- Update email address in README +- Several FAQ updates +- Fix a big fat bug in inftrees.c that prevented decoding valid + dynamic blocks with only literals and no distance codes -- + Thanks to "Hot Emu" for the bug report and sample file +- Add a note to puff.c on no distance codes case. + +Changes in 1.2.1 (17 November 2003) +- Remove a tab in contrib/gzappend/gzappend.c +- Update some interfaces in contrib for new zlib functions +- Update zlib version number in some contrib entries +- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] +- Support shared libraries on Hurd and KFreeBSD [Brown] +- Fix error in NO_DIVIDE option of adler32.c + +Changes in 1.2.0.8 (4 November 2003) +- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas +- Add experimental NO_DIVIDE #define in adler32.c + - Possibly faster on some processors (let me know if it is) +- Correct Z_BLOCK to not return on first inflate call if no wrap +- Fix strm->data_type on inflate() return to correctly indicate EOB +- Add deflatePrime() function for appending in the middle of a byte +- Add contrib/gzappend for an example of appending to a stream +- Update win32/DLL_FAQ.txt [Truta] +- Delete Turbo C comment in README [Truta] +- Improve some indentation in zconf.h [Truta] +- Fix infinite loop on bad input in configure script [Church] +- Fix gzeof() for concatenated gzip files [Johnson] +- Add example to contrib/visual-basic.txt [Michael B.] +- Add -p to mkdir's in Makefile.in [vda] +- Fix configure to properly detect presence or lack of printf functions +- Add AS400 support [Monnerat] +- Add a little Cygwin support [Wilson] + +Changes in 1.2.0.7 (21 September 2003) +- Correct some debug formats in contrib/infback9 +- Cast a type in a debug statement in trees.c +- Change search and replace delimiter in configure from % to # [Beebe] +- Update contrib/untgz to 0.2 with various fixes [Truta] +- Add build support for Amiga [Nikl] +- Remove some directories in old that have been updated to 1.2 +- Add dylib building for Mac OS X in configure and Makefile.in +- Remove old distribution stuff from Makefile +- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X +- Update links in README + +Changes in 1.2.0.6 (13 September 2003) +- Minor FAQ updates +- Update contrib/minizip to 1.00 [Vollant] +- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] +- Update POSTINC comment for 68060 [Nikl] +- Add contrib/infback9 with deflate64 decoding (unsupported) +- For MVS define NO_vsnprintf and undefine FAR [van Burik] +- Add pragma for fdopen on MVS [van Burik] + +Changes in 1.2.0.5 (8 September 2003) +- Add OF to inflateBackEnd() declaration in zlib.h +- Remember start when using gzdopen in the middle of a file +- Use internal off_t counters in gz* functions to properly handle seeks +- Perform more rigorous check for distance-too-far in inffast.c +- Add Z_BLOCK flush option to return from inflate at block boundary +- Set strm->data_type on return from inflate + - Indicate bits unused, if at block boundary, and if in last block +- Replace size_t with ptrdiff_t in crc32.c, and check for correct size +- Add condition so old NO_DEFLATE define still works for compatibility +- FAQ update regarding the Windows DLL [Truta] +- INDEX update: add qnx entry, remove aix entry [Truta] +- Install zlib.3 into mandir [Wilson] +- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] +- Adapt the zlib interface to the new DLL convention guidelines [Truta] +- Introduce ZLIB_WINAPI macro to allow the export of functions using + the WINAPI calling convention, for Visual Basic [Vollant, Truta] +- Update msdos and win32 scripts and makefiles [Truta] +- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] +- Add contrib/ada [Anisimkov] +- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] +- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] +- Add contrib/masm686 [Truta] +- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm + [Truta, Vollant] +- Update contrib/delphi; rename to contrib/pascal; add example [Truta] +- Remove contrib/delphi2; add a new contrib/delphi [Truta] +- Avoid inclusion of the nonstandard in contrib/iostream, + and fix some method prototypes [Truta] +- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip + [Truta] +- Avoid the use of backslash (\) in contrib/minizip [Vollant] +- Fix file time handling in contrib/untgz; update makefiles [Truta] +- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines + [Vollant] +- Remove contrib/vstudio/vc15_16 [Vollant] +- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] +- Update README.contrib [Truta] +- Invert the assignment order of match_head and s->prev[...] in + INSERT_STRING [Truta] +- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings + [Truta] +- Compare function pointers with 0, not with NULL or Z_NULL [Truta] +- Fix prototype of syncsearch in inflate.c [Truta] +- Introduce ASMINF macro to be enabled when using an ASM implementation + of inflate_fast [Truta] +- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] +- Modify test_gzio in example.c to take a single file name as a + parameter [Truta] +- Exit the example.c program if gzopen fails [Truta] +- Add type casts around strlen in example.c [Truta] +- Remove casting to sizeof in minigzip.c; give a proper type + to the variable compared with SUFFIX_LEN [Truta] +- Update definitions of STDC and STDC99 in zconf.h [Truta] +- Synchronize zconf.h with the new Windows DLL interface [Truta] +- Use SYS16BIT instead of __32BIT__ to distinguish between + 16- and 32-bit platforms [Truta] +- Use far memory allocators in small 16-bit memory models for + Turbo C [Truta] +- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in + zlibCompileFlags [Truta] +- Cygwin has vsnprintf [Wilson] +- In Windows16, OS_CODE is 0, as in MSDOS [Truta] +- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] + +Changes in 1.2.0.4 (10 August 2003) +- Minor FAQ updates +- Be more strict when checking inflateInit2's windowBits parameter +- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well +- Add gzip wrapper option to deflateInit2 using windowBits +- Add updated QNX rule in configure and qnx directory [Bonnefoy] +- Make inflate distance-too-far checks more rigorous +- Clean up FAR usage in inflate +- Add casting to sizeof() in gzio.c and minigzip.c + +Changes in 1.2.0.3 (19 July 2003) +- Fix silly error in gzungetc() implementation [Vollant] +- Update contrib/minizip and contrib/vstudio [Vollant] +- Fix printf format in example.c +- Correct cdecl support in zconf.in.h [Anisimkov] +- Minor FAQ updates + +Changes in 1.2.0.2 (13 July 2003) +- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons +- Attempt to avoid warnings in crc32.c for pointer-int conversion +- Add AIX to configure, remove aix directory [Bakker] +- Add some casts to minigzip.c +- Improve checking after insecure sprintf() or vsprintf() calls +- Remove #elif's from crc32.c +- Change leave label to inf_leave in inflate.c and infback.c to avoid + library conflicts +- Remove inflate gzip decoding by default--only enable gzip decoding by + special request for stricter backward compatibility +- Add zlibCompileFlags() function to return compilation information +- More typecasting in deflate.c to avoid warnings +- Remove leading underscore from _Capital #defines [Truta] +- Fix configure to link shared library when testing +- Add some Windows CE target adjustments [Mai] +- Remove #define ZLIB_DLL in zconf.h [Vollant] +- Add zlib.3 [Rodgers] +- Update RFC URL in deflate.c and algorithm.txt [Mai] +- Add zlib_dll_FAQ.txt to contrib [Truta] +- Add UL to some constants [Truta] +- Update minizip and vstudio [Vollant] +- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h +- Expand use of NO_DUMMY_DECL to avoid all dummy structures +- Added iostream3 to contrib [Schwardt] +- Replace rewind() with fseek() for WinCE [Truta] +- Improve setting of zlib format compression level flags + - Report 0 for huffman and rle strategies and for level == 0 or 1 + - Report 2 only for level == 6 +- Only deal with 64K limit when necessary at compile time [Truta] +- Allow TOO_FAR check to be turned off at compile time [Truta] +- Add gzclearerr() function [Souza] +- Add gzungetc() function + +Changes in 1.2.0.1 (17 March 2003) +- Add Z_RLE strategy for run-length encoding [Truta] + - When Z_RLE requested, restrict matches to distance one + - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE +- Correct FASTEST compilation to allow level == 0 +- Clean up what gets compiled for FASTEST +- Incorporate changes to zconf.in.h [Vollant] + - Refine detection of Turbo C need for dummy returns + - Refine ZLIB_DLL compilation + - Include additional header file on VMS for off_t typedef +- Try to use _vsnprintf where it supplants vsprintf [Vollant] +- Add some casts in inffast.c +- Enchance comments in zlib.h on what happens if gzprintf() tries to + write more than 4095 bytes before compression +- Remove unused state from inflateBackEnd() +- Remove exit(0) from minigzip.c, example.c +- Get rid of all those darn tabs +- Add "check" target to Makefile.in that does the same thing as "test" +- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in +- Update contrib/inflate86 [Anderson] +- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] +- Add msdos and win32 directories with makefiles [Truta] +- More additions and improvements to the FAQ + +Changes in 1.2.0 (9 March 2003) +- New and improved inflate code + - About 20% faster + - Does not allocate 32K window unless and until needed + - Automatically detects and decompresses gzip streams + - Raw inflate no longer needs an extra dummy byte at end + - Added inflateBack functions using a callback interface--even faster + than inflate, useful for file utilities (gzip, zip) + - Added inflateCopy() function to record state for random access on + externally generated deflate streams (e.g. in gzip files) + - More readable code (I hope) +- New and improved crc32() + - About 50% faster, thanks to suggestions from Rodney Brown +- Add deflateBound() and compressBound() functions +- Fix memory leak in deflateInit2() +- Permit setting dictionary for raw deflate (for parallel deflate) +- Fix const declaration for gzwrite() +- Check for some malloc() failures in gzio.c +- Fix bug in gzopen() on single-byte file 0x1f +- Fix bug in gzread() on concatenated file with 0x1f at end of buffer + and next buffer doesn't start with 0x8b +- Fix uncompress() to return Z_DATA_ERROR on truncated input +- Free memory at end of example.c +- Remove MAX #define in trees.c (conflicted with some libraries) +- Fix static const's in deflate.c, gzio.c, and zutil.[ch] +- Declare malloc() and free() in gzio.c if STDC not defined +- Use malloc() instead of calloc() in zutil.c if int big enough +- Define STDC for AIX +- Add aix/ with approach for compiling shared library on AIX +- Add HP-UX support for shared libraries in configure +- Add OpenUNIX support for shared libraries in configure +- Use $cc instead of gcc to build shared library +- Make prefix directory if needed when installing +- Correct Macintosh avoidance of typedef Byte in zconf.h +- Correct Turbo C memory allocation when under Linux +- Use libz.a instead of -lz in Makefile (assure use of compiled library) +- Update configure to check for snprintf or vsnprintf functions and their + return value, warn during make if using an insecure function +- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that + is lost when library is used--resolution is to build new zconf.h +- Documentation improvements (in zlib.h): + - Document raw deflate and inflate + - Update RFCs URL + - Point out that zlib and gzip formats are different + - Note that Z_BUF_ERROR is not fatal + - Document string limit for gzprintf() and possible buffer overflow + - Note requirement on avail_out when flushing + - Note permitted values of flush parameter of inflate() +- Add some FAQs (and even answers) to the FAQ +- Add contrib/inflate86/ for x86 faster inflate +- Add contrib/blast/ for PKWare Data Compression Library decompression +- Add contrib/puff/ simple inflate for deflate format description + +Changes in 1.1.4 (11 March 2002) +- ZFREE was repeated on same allocation on some error conditions. + This creates a security problem described in + http://www.zlib.org/advisory-2002-03-11.txt +- Returned incorrect error (Z_MEM_ERROR) on some invalid data +- Avoid accesses before window for invalid distances with inflate window + less than 32K. +- force windowBits > 8 to avoid a bug in the encoder for a window size + of 256 bytes. (A complete fix will be available in 1.1.5). -Changes in 1.1.3.f-jdk (23 Apr 2003) by Sun Microsystems -- Backport security fixes from zlib 1.1.4 -- Minor tweaks for 64 bit architectures -- Remove warnings on Linux -- Fix minor typos in comments in zlib.h -- adler32.c was renamed to zadler32.c -- crc32.c was renamed to zcrc32.c, with signed longs made unsigned. -- Fixed bug in calculation of checksum in inflate.c -- GPL headers added - Changes in 1.1.3 (9 July 1998) - fix "an inflate input buffer bug that shows up on rare but persistent occasions" (Mark) @@ -166,7 +540,7 @@ Changes in 1.0.7 (20 Jan 1998) Changes in 1.0.6 (19 Jan 1998) - add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) -- Fix a deflate bug occuring only with compression level 0 (thanks to +- Fix a deflate bug occurring only with compression level 0 (thanks to Andy Buckler for finding this one). - In minigzip, pass transparently also the first byte for .Z files. - return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() @@ -184,13 +558,13 @@ Changes in 1.0.6 (19 Jan 1998) - added Makefile.nt (thanks to Stephen Williams) - added the unsupported "contrib" directory: contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). + 386 asm code replacing longest_match(). contrib/iostream/ by Kevin Ruland A C++ I/O streams interface to the zlib gz* functions contrib/iostream2/ by Tyge Løvset - Another C++ I/O streams interface + Another C++ I/O streams interface contrib/untgz/ by "Pedro A. Aranda Guti\irrez" - A very simple tar.gz file extractor using zlib + A very simple tar.gz file extractor using zlib contrib/visual-basic.txt by Carlos Rios How to use compress(), uncompress() and the gz* functions from VB. - pass params -f (filtered data), -h (huffman only), -1 to -9 (compression @@ -217,7 +591,7 @@ Changes in 1.0.6 (19 Jan 1998) - add NEED_DUMMY_RETURN for Borland - use variable z_verbose for tracing in debug mode (L. Peter Deutsch). - allow compilation with CC -- defined STDC for OS/2 (David Charlap) +- defined STDC for OS/2 (David Charlap) - limit external names to 8 chars for MVS (Thomas Lund) - in minigzip.c, use static buffers only for 16-bit systems - fix suffix check for "minigzip -d foo.gz" @@ -242,7 +616,7 @@ Changes in 1.0.5 (3 Jan 98) - Eliminate memory leaks on error conditions in inflate - Removed some vestigial code in inflate - Update web address in README - + Changes in 1.0.4 (24 Jul 96) - In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF bit, so the decompressor could decompress all the correct data but went diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/README b/jdk/src/share/native/java/util/zip/zlib-1.2.3/README new file mode 100644 index 00000000000..758cc50020d --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/README @@ -0,0 +1,125 @@ +ZLIB DATA COMPRESSION LIBRARY + +zlib 1.2.3 is a general purpose data compression library. All the code is +thread safe. The data format used by the zlib library is described by RFCs +(Request for Comments) 1950 to 1952 in the files +http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) +and rfc1952.txt (gzip format). These documents are also available in other +formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html + +All functions of the compression library are documented in the file zlib.h +(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example +of the library is given in the file example.c which also tests that the library +is working correctly. Another example is given in the file minigzip.c. The +compression library itself is composed of all source files except example.c and +minigzip.c. + +To compile all files and run the test program, follow the instructions given at +the top of Makefile. In short "make test; make install" should work for most +machines. For Unix: "./configure; make test; make install". For MSDOS, use one +of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. + +Questions about zlib should be sent to , or to Gilles Vollant + for the Windows DLL version. The zlib home page is +http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, +please check this site to verify that you have the latest version of zlib; +otherwise get the latest version and check whether the problem still exists or +not. + +PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking +for help. + +Mark Nelson wrote an article about zlib for the Jan. 1997 +issue of Dr. Dobb's Journal; a copy of the article is available in +http://dogma.net/markn/articles/zlibtool/zlibtool.htm + +The changes made in version 1.2.3 are documented in the file ChangeLog. + +Unsupported third party contributions are provided in directory "contrib". + +A Java implementation of zlib is available in the Java Development Kit +http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html +See the zlib home page http://www.zlib.org for details. + +A Perl interface to zlib written by Paul Marquess is in the +CPAN (Comprehensive Perl Archive Network) sites +http://www.cpan.org/modules/by-module/Compress/ + +A Python interface to zlib written by A.M. Kuchling is +available in Python 1.5 and later versions, see +http://www.python.org/doc/lib/module-zlib.html + +A zlib binding for TCL written by Andreas Kupries is +availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html + +An experimental package to read and write files in .zip format, written on top +of zlib by Gilles Vollant , is available in the +contrib/minizip directory of zlib. + + +Notes for some targets: + +- For Windows DLL versions, please see win32/DLL_FAQ.txt + +- For 64-bit Irix, deflate.c must be compiled without any optimization. With + -O, one libpng test fails. The test works in 32 bit mode (with the -n32 + compiler flag). The compiler bug has been reported to SGI. + +- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works + when compiled with cc. + +- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is + necessary to get gzprintf working correctly. This is done by configure. + +- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with + other compilers. Use "make test" to check your compiler. + +- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. + +- For PalmOs, see http://palmzlib.sourceforge.net/ + +- When building a shared, i.e. dynamic library on Mac OS X, the library must be + installed before testing (do "make install" before "make test"), since the + library location is specified in the library. + + +Acknowledgments: + + The deflate format used by zlib was defined by Phil Katz. The deflate + and zlib specifications were written by L. Peter Deutsch. Thanks to all the + people who reported problems and suggested various improvements in zlib; + they are too numerous to cite here. + +Copyright notice: + + (C) 1995-2004 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* +receiving lengthy legal documents to sign. The sources are provided +for free but without warranty of any kind. The library has been +entirely written by Jean-loup Gailly and Mark Adler; it does not +include third-party code. + +If you redistribute modified sources, we would appreciate that you include +in the file ChangeLog history information documenting your changes. Please +read the FAQ for more information on the distribution of modified source +versions. diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/compress.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c similarity index 87% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/compress.c rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c index 8939a02f570..1407edf258a 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/compress.c +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c @@ -22,17 +22,14 @@ * have any questions. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * compress.c -- compress a memory buffer - * Copyright (C) 1995-1998 Jean-loup Gailly. +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-2003 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL #include "zlib.h" /* =========================================================================== @@ -94,3 +91,13 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) { return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); } + +/* =========================================================================== + If the default memLevel or windowBits for deflateInit() is changed, then + this function needs to be updated. + */ +uLong ZEXPORT compressBound (sourceLen) + uLong sourceLen; +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; +} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/crc32.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/crc32.h new file mode 100644 index 00000000000..e5d1805bd10 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/crc32.h @@ -0,0 +1,465 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const unsigned long FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, + 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, + 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, + 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, + 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, + 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, + 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, + 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, + 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, + 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, + 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, + 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, + 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, + 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, + 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, + 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, + 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, + 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, + 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, + 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, + 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, + 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, + 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, + 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, + 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, + 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, + 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, + 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, + 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, + 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, + 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, + 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, + 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, + 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, + 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, + 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, + 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, + 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, + 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, + 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, + 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, + 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, + 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, + 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, + 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, + 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, + 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, + 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, + 0xed3498beUL + }, + { + 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, + 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, + 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, + 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, + 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, + 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, + 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, + 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, + 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, + 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, + 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, + 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, + 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, + 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, + 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, + 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, + 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, + 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, + 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, + 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, + 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, + 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, + 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, + 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, + 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, + 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, + 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, + 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, + 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, + 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, + 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, + 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, + 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, + 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, + 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, + 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, + 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, + 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, + 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, + 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, + 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, + 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, + 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, + 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, + 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, + 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, + 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, + 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, + 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, + 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, + 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, + 0xf10605deUL +#endif + } +}; diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/deflate.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.c similarity index 72% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/deflate.c rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.c index 8bd71fcfca1..dcf42496cbe 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/deflate.c +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.c @@ -20,18 +20,10 @@ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-1998 Jean-loup Gailly. +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -69,7 +61,7 @@ * REFERENCES * * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in ftp://ds.internic.net/rfc/rfc1951.txt + * Available in http://www.ietf.org/rfc/rfc1951.txt * * A description of the Rabin and Karp algorithm is given in the book * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. @@ -79,10 +71,12 @@ * */ +/* @(#) $Id$ */ + #include "deflate.h" const char deflate_copyright[] = - " deflate 1.1.3.f-jdk Copyright 1995-1998 Jean-loup Gailly "; + " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -106,17 +100,22 @@ typedef block_state (*compress_func) OF((deflate_state *s, int flush)); local void fill_window OF((deflate_state *s)); local block_state deflate_stored OF((deflate_state *s, int flush)); local block_state deflate_fast OF((deflate_state *s, int flush)); +#ifndef FASTEST local block_state deflate_slow OF((deflate_state *s, int flush)); +#endif local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifndef FASTEST #ifdef ASMV void match_init OF((void)); /* asm code initialization */ uInt longest_match OF((deflate_state *s, IPos cur_match)); #else local uInt longest_match OF((deflate_state *s, IPos cur_match)); #endif +#endif +local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); #ifdef DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, @@ -153,10 +152,16 @@ typedef struct config_s { compress_func func; } config; +#ifdef FASTEST +local const config configuration_table[2] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ +#else local const config configuration_table[10] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* maximum speed, no lazy matches */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ /* 2 */ {4, 5, 16, 8, deflate_fast}, /* 3 */ {4, 6, 32, 32, deflate_fast}, @@ -165,7 +170,8 @@ local const config configuration_table[10] = { /* 6 */ {8, 16, 128, 128, deflate_slow}, /* 7 */ {8, 32, 128, 256, deflate_slow}, /* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */ +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ +#endif /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different @@ -175,7 +181,9 @@ local const config configuration_table[10] = { #define EQUAL 0 /* result of memcmp for equal strings */ +#ifndef NO_DUMMY_DECL struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ +#endif /* =========================================================================== * Update a hash value with the given input byte @@ -204,7 +212,7 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ #else #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #endif @@ -241,8 +249,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, int stream_size; { deflate_state *s; - int noheader = 0; - static const char* my_version = ZLIB_VERSION; + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; ushf *overlay; /* We overlay pending_buf and d_buf+l_buf. This works since the average @@ -256,32 +264,41 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; - if (strm->zalloc == Z_NULL) { + if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } - if (strm->zfree == Z_NULL) strm->zfree = zcfree; + if (strm->zfree == (free_func)0) strm->zfree = zcfree; - if (level == Z_DEFAULT_COMPRESSION) level = 6; #ifdef FASTEST - level = 1; + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; #endif - if (windowBits < 0) { /* undocumented feature: suppress zlib header */ - noheader = 1; + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; windowBits = -windowBits; } +#ifdef GZIP + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } +#endif if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_HUFFMAN_ONLY) { + strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } + if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); if (s == Z_NULL) return Z_MEM_ERROR; strm->state = (struct internal_state FAR *)s; s->strm = strm; - s->noheader = noheader; + s->wrap = wrap; + s->gzhead = Z_NULL; s->w_bits = windowBits; s->w_size = 1 << s->w_bits; s->w_mask = s->w_size - 1; @@ -303,6 +320,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { + s->status = FINISH_STATE; strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); deflateEnd (strm); return Z_MEM_ERROR; @@ -329,17 +347,18 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) IPos hash_head = 0; if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || - strm->state->status != INIT_STATE) return Z_STREAM_ERROR; + strm->state->wrap == 2 || + (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) + return Z_STREAM_ERROR; s = strm->state; - strm->adler = adler32(strm->adler, dictionary, dictLength); + if (s->wrap) + strm->adler = adler32(strm->adler, dictionary, dictLength); if (length < MIN_MATCH) return Z_OK; if (length > MAX_DIST(s)) { length = MAX_DIST(s); -#ifndef USE_DICT_HEAD dictionary += dictLength - length; /* use the tail of the dictionary */ -#endif } zmemcpy(s->window, dictionary, length); s->strstart = length; @@ -365,7 +384,9 @@ int ZEXPORT deflateReset (strm) deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + return Z_STREAM_ERROR; + } strm->total_in = strm->total_out = 0; strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ @@ -375,11 +396,15 @@ int ZEXPORT deflateReset (strm) s->pending = 0; s->pending_out = s->pending_buf; - if (s->noheader < 0) { - s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */ + if (s->wrap < 0) { + s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ } - s->status = s->noheader ? BUSY_STATE : INIT_STATE; - strm->adler = 1; + s->status = s->wrap ? INIT_STATE : BUSY_STATE; + strm->adler = +#ifdef GZIP + s->wrap == 2 ? crc32(0L, Z_NULL, 0) : +#endif + adler32(0L, Z_NULL, 0); s->last_flush = Z_NO_FLUSH; _tr_init(s); @@ -388,6 +413,29 @@ int ZEXPORT deflateReset (strm) return Z_OK; } +/* ========================================================================= */ +int ZEXPORT deflateSetHeader (strm, head) + z_streamp strm; + gz_headerp head; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (strm->state->wrap != 2) return Z_STREAM_ERROR; + strm->state->gzhead = head; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePrime (strm, bits, value) + z_streamp strm; + int bits; + int value; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + strm->state->bi_valid = bits; + strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); + return Z_OK; +} + /* ========================================================================= */ int ZEXPORT deflateParams(strm, level, strategy) z_streamp strm; @@ -401,10 +449,12 @@ int ZEXPORT deflateParams(strm, level, strategy) if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; - if (level == Z_DEFAULT_COMPRESSION) { - level = 6; - } - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) { +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } func = configuration_table[s->level].func; @@ -424,6 +474,66 @@ int ZEXPORT deflateParams(strm, level, strategy) return err; } +/* ========================================================================= */ +int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) + z_streamp strm; + int good_length; + int max_lazy; + int nice_length; + int max_chain; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + s->good_match = good_length; + s->max_lazy_match = max_lazy; + s->nice_match = nice_length; + s->max_chain_length = max_chain; + return Z_OK; +} + +/* ========================================================================= + * For the default windowBits of 15 and memLevel of 8, this function returns + * a close to exact, as well as small, upper bound on the compressed size. + * They are coded as constants here for a reason--if the #define's are + * changed, then this function needs to be changed as well. The return + * value for 15 and 8 only works for those exact settings. + * + * For any setting other than those defaults for windowBits and memLevel, + * the value returned is a conservative worst case for the maximum expansion + * resulting from using fixed blocks instead of stored blocks, which deflate + * can emit on compressed data for some combinations of the parameters. + * + * This function could be more sophisticated to provide closer upper bounds + * for every combination of windowBits and memLevel, as well as wrap. + * But even the conservative upper bound of about 14% expansion does not + * seem onerous for output buffer allocation. + */ +uLong ZEXPORT deflateBound(strm, sourceLen) + z_streamp strm; + uLong sourceLen; +{ + deflate_state *s; + uLong destLen; + + /* conservative upper bound */ + destLen = sourceLen + + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11; + + /* if can't get parameters, return conservative bound */ + if (strm == Z_NULL || strm->state == Z_NULL) + return destLen; + + /* if not default parameters, return conservative bound */ + s = strm->state; + if (s->w_bits != 15 || s->hash_bits != 8 + 7) + return destLen; + + /* default settings: return tight bound for that case */ + return compressBound(sourceLen); +} + /* ========================================================================= * Put a short in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in @@ -487,27 +597,185 @@ int ZEXPORT deflate (strm, flush) old_flush = s->last_flush; s->last_flush = flush; - /* Write the zlib header */ + /* Write the header */ if (s->status == INIT_STATE) { - - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags = (s->level-1) >> 1; - - if (level_flags > 3) level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - s->status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); +#ifdef GZIP + if (s->wrap == 2) { + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s->status = BUSY_STATE; + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); + } + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, + s->pending); + s->gzindex = 0; + s->status = EXTRA_STATE; + } + } + else +#endif + { + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; + else + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); } - strm->adler = 1L; } +#ifdef GZIP + if (s->status == EXTRA_STATE) { + if (s->gzhead->extra != NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + + while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) + break; + } + put_byte(s, s->gzhead->extra[s->gzindex]); + s->gzindex++; + } + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (s->gzindex == s->gzhead->extra_len) { + s->gzindex = 0; + s->status = NAME_STATE; + } + } + else + s->status = NAME_STATE; + } + if (s->status == NAME_STATE) { + if (s->gzhead->name != NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->name[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) { + s->gzindex = 0; + s->status = COMMENT_STATE; + } + } + else + s->status = COMMENT_STATE; + } + if (s->status == COMMENT_STATE) { + if (s->gzhead->comment != NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->comment[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) + s->status = HCRC_STATE; + } + else + s->status = HCRC_STATE; + } + if (s->status == HCRC_STATE) { + if (s->gzhead->hcrc) { + if (s->pending + 2 > s->pending_buf_size) + flush_pending(strm); + if (s->pending + 2 <= s->pending_buf_size) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + strm->adler = crc32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + } + } + else + s->status = BUSY_STATE; + } +#endif /* Flush as much pending output as possible */ if (s->pending != 0) { @@ -525,7 +793,7 @@ int ZEXPORT deflate (strm, flush) /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUFF_ERROR. + * returning Z_STREAM_END instead of Z_BUF_ERROR. */ } else if (strm->avail_in == 0 && flush <= old_flush && flush != Z_FINISH) { @@ -583,16 +851,31 @@ int ZEXPORT deflate (strm, flush) Assert(strm->avail_out > 0, "bug2"); if (flush != Z_FINISH) return Z_OK; - if (s->noheader) return Z_STREAM_END; + if (s->wrap <= 0) return Z_STREAM_END; - /* Write the zlib trailer (adler32) */ - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); + /* Write the trailer */ +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); + put_byte(s, (Byte)(strm->total_in & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); + } + else +#endif + { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ - s->noheader = -1; /* write the trailer only once! */ + if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ return s->pending != 0 ? Z_OK : Z_STREAM_END; } @@ -605,7 +888,12 @@ int ZEXPORT deflateEnd (strm) if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; status = strm->state->status; - if (status != INIT_STATE && status != BUSY_STATE && + if (status != INIT_STATE && + status != EXTRA_STATE && + status != NAME_STATE && + status != COMMENT_STATE && + status != HCRC_STATE && + status != BUSY_STATE && status != FINISH_STATE) { return Z_STREAM_ERROR; } @@ -645,12 +933,12 @@ int ZEXPORT deflateCopy (dest, source) ss = source->state; - *dest = *source; + zmemcpy(dest, source, sizeof(z_stream)); ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); if (ds == Z_NULL) return Z_MEM_ERROR; dest->state = (struct internal_state FAR *) ds; - *ds = *ss; + zmemcpy(ds, ss, sizeof(deflate_state)); ds->strm = dest; ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); @@ -679,7 +967,7 @@ int ZEXPORT deflateCopy (dest, source) ds->bl_desc.dyn_tree = ds->bl_tree; return Z_OK; -#endif +#endif /* MAXSEG_64K */ } /* =========================================================================== @@ -701,9 +989,14 @@ local int read_buf(strm, buf, size) strm->avail_in -= len; - if (!strm->state->noheader) { + if (strm->state->wrap == 1) { strm->adler = adler32(strm->adler, strm->next_in, len); } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, strm->next_in, len); + } +#endif zmemcpy(buf, strm->next_in, len); strm->next_in += len; strm->total_in += len; @@ -734,11 +1027,14 @@ local void lm_init (s) s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; +#ifndef FASTEST #ifdef ASMV match_init(); /* initialize the asm code */ #endif +#endif } +#ifndef FASTEST /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, @@ -752,7 +1048,6 @@ local void lm_init (s) /* For 80x86 and 680x0, an optimized version will be provided in match.asm or * match.S. The code will be functionally equivalent. */ -#ifndef FASTEST local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ @@ -805,7 +1100,12 @@ local uInt longest_match(s, cur_match) match = s->window + cur_match; /* Skip to next match if the match length cannot increase - * or if the match length is less than 2: + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. */ #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) /* This code assumes sizeof(unsigned short) == 2. Do not use @@ -890,12 +1190,13 @@ local uInt longest_match(s, cur_match) if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } +#endif /* ASMV */ +#endif /* FASTEST */ -#else /* FASTEST */ /* --------------------------------------------------------------------------- - * Optimized version for level == 1 only + * Optimized version for level == 1 or strategy == Z_RLE only */ -local uInt longest_match(s, cur_match) +local uInt longest_match_fast(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { @@ -945,10 +1246,8 @@ local uInt longest_match(s, cur_match) if (len < MIN_MATCH) return MIN_MATCH - 1; s->match_start = cur_match; - return len <= s->lookahead ? len : s->lookahead; + return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; } -#endif /* FASTEST */ -#endif /* ASMV */ #ifdef DEBUG /* =========================================================================== @@ -976,7 +1275,7 @@ local void check_match(s, start, match, length) } #else # define check_match(s, start, match, length) -#endif +#endif /* DEBUG */ /* =========================================================================== * Fill the window when the lookahead becomes insufficient. @@ -1000,19 +1299,22 @@ local void fill_window(s) more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); /* Deal with !@#$% 64K limit: */ - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if strstart == 0 - * and lookahead == 1 (input done one byte at time) - */ - more--; + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ - } else if (s->strstart >= wsize+MAX_DIST(s)) { + if (s->strstart >= wsize+MAX_DIST(s)) { zmemcpy(s->window, s->window+wsize, (unsigned)wsize); s->match_start -= wsize; @@ -1025,6 +1327,7 @@ local void fill_window(s) later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ + /* %%% avoid this when Z_RLE */ n = s->hash_size; p = &s->head[n]; do { @@ -1202,10 +1505,19 @@ local block_state deflate_fast(s, flush) * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ - if (s->strategy != Z_HUFFMAN_ONLY) { - s->match_length = longest_match (s, hash_head); +#ifdef FASTEST + if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) || + (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { + s->match_length = longest_match_fast (s, hash_head); } - /* longest_match() sets match_start */ +#else + if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { + s->match_length = longest_match (s, hash_head); + } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { + s->match_length = longest_match_fast (s, hash_head); + } +#endif + /* longest_match() or longest_match_fast() sets match_start */ } if (s->match_length >= MIN_MATCH) { check_match(s, s->strstart, s->match_start, s->match_length); @@ -1221,7 +1533,7 @@ local block_state deflate_fast(s, flush) #ifndef FASTEST if (s->match_length <= s->max_insert_length && s->lookahead >= MIN_MATCH) { - s->match_length--; /* string at strstart already in hash table */ + s->match_length--; /* string at strstart already in table */ do { s->strstart++; INSERT_STRING(s, s->strstart, hash_head); @@ -1257,6 +1569,7 @@ local block_state deflate_fast(s, flush) return flush == Z_FINISH ? finish_done : block_done; } +#ifndef FASTEST /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is @@ -1302,14 +1615,19 @@ local block_state deflate_slow(s, flush) * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ - if (s->strategy != Z_HUFFMAN_ONLY) { + if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { s->match_length = longest_match (s, hash_head); + } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { + s->match_length = longest_match_fast (s, hash_head); } - /* longest_match() sets match_start */ + /* longest_match() or longest_match_fast() sets match_start */ - if (s->match_length <= 5 && (s->strategy == Z_FILTERED || - (s->match_length == MIN_MATCH && - s->strstart - s->match_start > TOO_FAR))) { + if (s->match_length <= 5 && (s->strategy == Z_FILTERED +#if TOO_FAR <= 32767 + || (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR) +#endif + )) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. @@ -1378,3 +1696,65 @@ local block_state deflate_slow(s, flush) FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } +#endif /* FASTEST */ + +#if 0 +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +local block_state deflate_rle(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + uInt run; /* length of run */ + uInt max; /* maximum length of run */ + uInt prev; /* byte at distance one to match */ + Bytef *scan; /* scan for end of run */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest encodable run. + */ + if (s->lookahead < MAX_MATCH) { + fill_window(s); + if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + run = 0; + if (s->strstart > 0) { /* if there is a previous byte, that is */ + max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH; + scan = s->window + s->strstart - 1; + prev = *scan++; + do { + if (*scan++ != prev) + break; + } while (++run < max); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (run >= MIN_MATCH) { + check_match(s, s->strstart, s->strstart - 1, run); + _tr_tally_dist(s, 1, run - MIN_MATCH, bflush); + s->lookahead -= run; + s->strstart += run; + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} +#endif diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/deflate.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.h similarity index 93% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/deflate.h rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.h index 49dbe0f71dd..8e762943167 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/deflate.h +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.h @@ -22,14 +22,8 @@ * have any questions. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * deflate.h -- internal compression state - * Copyright (C) 1995-1998 Jean-loup Gailly +/* deflate.h -- internal compression state + * Copyright (C) 1995-2004 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -38,11 +32,21 @@ subject to change. Applications should only use zlib.h. */ -#ifndef _DEFLATE_H -#define _DEFLATE_H +/* @(#) $Id$ */ + +#ifndef DEFLATE_H +#define DEFLATE_H #include "zutil.h" +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer creation by deflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip encoding + should be left enabled. */ +#ifndef NO_GZIP +# define GZIP +#endif + /* =========================================================================== * Internal compression state. */ @@ -69,6 +73,10 @@ /* All codes must not exceed MAX_BITS bits */ #define INIT_STATE 42 +#define EXTRA_STATE 69 +#define NAME_STATE 73 +#define COMMENT_STATE 91 +#define HCRC_STATE 103 #define BUSY_STATE 113 #define FINISH_STATE 666 /* Stream status */ @@ -113,9 +121,10 @@ typedef struct internal_state { Bytef *pending_buf; /* output still pending */ ulg pending_buf_size; /* size of pending_buf */ Bytef *pending_out; /* next pending byte to output to the stream */ - int pending; /* nb of bytes in the pending buffer */ - int noheader; /* suppress zlib header and adler32 */ - Byte data_type; /* UNKNOWN, BINARY or ASCII */ + uInt pending; /* nb of bytes in the pending buffer */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + gz_headerp gzhead; /* gzip header information to write */ + uInt gzindex; /* where in extra, name, or comment */ Byte method; /* STORED (for zip only) or DEFLATED */ int last_flush; /* value of flush param for previous deflate call */ @@ -343,4 +352,4 @@ void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, flush = _tr_tally(s, distance, length) #endif -#endif +#endif /* DEFLATE_H */ diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/gzio.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/gzio.c similarity index 77% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/gzio.c rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/gzio.c index 95bdb7d9122..aae1d1550a9 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/gzio.c +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/gzio.c @@ -22,24 +22,26 @@ * have any questions. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * gzio.c -- IO on .gz files - * Copyright (C) 1995-1998 Jean-loup Gailly. +/* gzio.c -- IO on .gz files + * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h * - * Compile this file with -DNO_DEFLATE to avoid the compression code. + * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. */ +/* @(#) $Id$ */ + #include #include "zutil.h" +#ifdef NO_DEFLATE /* for compatibility with old definition */ +# define NO_GZCOMPRESS +#endif + +#ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ +#endif #ifndef Z_BUFSIZE # ifdef MAXSEG_64K @@ -52,10 +54,20 @@ struct internal_state {int dummy;}; /* for buggy compilers */ # define Z_PRINTF_BUFSIZE 4096 #endif +#ifdef __MVS__ +# pragma map (fdopen , "\174\174FDOPEN") + FILE *fdopen(int, const char *); +#endif + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern void free OF((voidpf ptr)); +#endif + #define ALLOC(size) malloc(size) #define TRYFREE(p) {if (p) free(p);} -static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ +static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ /* gzip flag byte */ #define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ @@ -77,7 +89,11 @@ typedef struct gz_stream { char *path; /* path name for debugging only */ int transparent; /* 1 if input file is not a .gz file */ char mode; /* 'w' or 'r' */ - long startpos; /* start of compressed data in file (header skipped) */ + z_off_t start; /* start of compressed data in file (header skipped) */ + z_off_t in; /* bytes into deflate or inflate */ + z_off_t out; /* bytes out of deflate or inflate */ + int back; /* one character push-back */ + int last; /* true if push-back is last character */ } gz_stream; @@ -93,7 +109,7 @@ local uLong getLong OF((gz_stream *s)); Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb"). The file is given either by file descriptor or path name (if fd == -1). - gz_open return NULL if the file could not be opened or if there was + gz_open returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). @@ -125,6 +141,9 @@ local gzFile gz_open (path, mode, fd) s->file = NULL; s->z_err = Z_OK; s->z_eof = 0; + s->in = 0; + s->out = 0; + s->back = EOF; s->crc = crc32(0L, Z_NULL, 0); s->msg = NULL; s->transparent = 0; @@ -145,6 +164,8 @@ local gzFile gz_open (path, mode, fd) strategy = Z_FILTERED; } else if (*p == 'h') { strategy = Z_HUFFMAN_ONLY; + } else if (*p == 'R') { + strategy = Z_RLE; } else { *m++ = *p; /* copy the mode */ } @@ -152,7 +173,7 @@ local gzFile gz_open (path, mode, fd) if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; if (s->mode == 'w') { -#ifdef NO_DEFLATE +#ifdef NO_GZCOMPRESS err = Z_STREAM_ERROR; #else err = deflateInit2(&(s->stream), level, @@ -191,15 +212,15 @@ local gzFile gz_open (path, mode, fd) */ fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); - s->startpos = 10L; + s->start = 10L; /* We use 10L instead of ftell(s->file) to because ftell causes an * fflush on some systems. This version of the library doesn't use - * startpos anyway in write mode, so this initialization is not + * start anyway in write mode, so this initialization is not * necessary. */ } else { check_header(s); /* skip the .gz header */ - s->startpos = (ftell(s->file) - s->stream.avail_in); + s->start = ftell(s->file) - s->stream.avail_in; } return (gzFile)s; @@ -223,7 +244,7 @@ gzFile ZEXPORT gzdopen (fd, mode) int fd; const char *mode; { - char name[20]; + char name[46]; /* allow for up to 128-bit integers */ if (fd < 0) return (gzFile)Z_NULL; sprintf(name, "", fd); /* for debugging */ @@ -267,7 +288,7 @@ local int get_byte(s) if (s->z_eof) return EOF; if (s->stream.avail_in == 0) { errno = 0; - s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; if (ferror(s->file)) s->z_err = Z_ERRNO; @@ -296,19 +317,33 @@ local void check_header(s) uInt len; int c; - /* Check the gzip magic header */ - for (len = 0; len < 2; len++) { - c = get_byte(s); - if (c != gz_magic[len]) { - if (len != 0) s->stream.avail_in++, s->stream.next_in--; - if (c != EOF) { - s->stream.avail_in++, s->stream.next_in--; - s->transparent = 1; - } - s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END; + /* Assure two bytes in the buffer so we can peek ahead -- handle case + where first byte of header is at the end of the buffer after the last + gzip segment */ + len = s->stream.avail_in; + if (len < 2) { + if (len) s->inbuf[0] = s->stream.next_in[0]; + errno = 0; + len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); + if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; + s->stream.avail_in += len; + s->stream.next_in = s->inbuf; + if (s->stream.avail_in < 2) { + s->transparent = s->stream.avail_in; return; } } + + /* Peek ahead to check the gzip magic header */ + if (s->stream.next_in[0] != gz_magic[0] || + s->stream.next_in[1] != gz_magic[1]) { + s->transparent = 1; + return; + } + s->stream.avail_in -= 2; + s->stream.next_in += 2; + + /* Check the rest of the gzip header */ method = get_byte(s); flags = get_byte(s); if (method != Z_DEFLATED || (flags & RESERVED) != 0) { @@ -352,7 +387,7 @@ local int destroy (s) if (s->stream.state != NULL) { if (s->mode == 'w') { -#ifdef NO_DEFLATE +#ifdef NO_GZCOMPRESS err = Z_STREAM_ERROR; #else err = deflateEnd(&(s->stream)); @@ -398,6 +433,19 @@ int ZEXPORT gzread (file, buf, len) s->stream.next_out = (Bytef*)buf; s->stream.avail_out = len; + if (s->stream.avail_out && s->back != EOF) { + *next_out++ = s->back; + s->stream.next_out++; + s->stream.avail_out--; + s->back = EOF; + s->out++; + start++; + if (s->last) { + s->z_err = Z_STREAM_END; + return 1; + } + } + while (s->stream.avail_out != 0) { if (s->transparent) { @@ -413,19 +461,19 @@ int ZEXPORT gzread (file, buf, len) s->stream.avail_in -= n; } if (s->stream.avail_out > 0) { - s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, - s->file); + s->stream.avail_out -= + (uInt)fread(next_out, 1, s->stream.avail_out, s->file); } len -= s->stream.avail_out; - s->stream.total_in += (uLong)len; - s->stream.total_out += (uLong)len; + s->in += len; + s->out += len; if (len == 0) s->z_eof = 1; return (int)len; } if (s->stream.avail_in == 0 && !s->z_eof) { errno = 0; - s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; if (ferror(s->file)) { @@ -435,7 +483,11 @@ int ZEXPORT gzread (file, buf, len) } s->stream.next_in = s->inbuf; } + s->in += s->stream.avail_in; + s->out += s->stream.avail_out; s->z_err = inflate(&(s->stream), Z_NO_FLUSH); + s->in -= s->stream.avail_in; + s->out -= s->stream.avail_out; if (s->z_err == Z_STREAM_END) { /* Check CRC and original size */ @@ -446,18 +498,13 @@ int ZEXPORT gzread (file, buf, len) s->z_err = Z_DATA_ERROR; } else { (void)getLong(s); - /* The uncompressed length returned by above getlong() may - * be different from s->stream.total_out) in case of - * concatenated .gz files. Check for such files: + /* The uncompressed length returned by above getlong() may be + * different from s->out in case of concatenated .gz files. + * Check for such files: */ check_header(s); if (s->z_err == Z_OK) { - uLong total_in = s->stream.total_in; - uLong total_out = s->stream.total_out; - inflateReset(&(s->stream)); - s->stream.total_in = total_in; - s->stream.total_out = total_out; s->crc = crc32(0L, Z_NULL, 0); } } @@ -466,6 +513,9 @@ int ZEXPORT gzread (file, buf, len) } s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + if (len == s->stream.avail_out && + (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO)) + return -1; return (int)(len - s->stream.avail_out); } @@ -483,6 +533,25 @@ int ZEXPORT gzgetc(file) } +/* =========================================================================== + Push one byte back onto the stream. +*/ +int ZEXPORT gzungetc(c, file) + int c; + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; + s->back = c; + s->out--; + s->last = (s->z_err == Z_STREAM_END); + if (s->last) s->z_err = Z_OK; + s->z_eof = 0; + return c; +} + + /* =========================================================================== Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an @@ -506,14 +575,14 @@ char * ZEXPORT gzgets(file, buf, len) } -#ifndef NO_DEFLATE +#ifndef NO_GZCOMPRESS /* =========================================================================== Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of bytes actually written (0 in case of error). */ int ZEXPORT gzwrite (file, buf, len) gzFile file; - const voidp buf; + voidpc buf; unsigned len; { gz_stream *s = (gz_stream*)file; @@ -534,7 +603,11 @@ int ZEXPORT gzwrite (file, buf, len) } s->stream.avail_out = Z_BUFSIZE; } + s->in += s->stream.avail_in; + s->out += s->stream.avail_out; s->z_err = deflate(&(s->stream), Z_NO_FLUSH); + s->in -= s->stream.avail_in; + s->out -= s->stream.avail_out; if (s->z_err != Z_OK) break; } s->crc = crc32(s->crc, (const Bytef *)buf, len); @@ -542,6 +615,7 @@ int ZEXPORT gzwrite (file, buf, len) return (int)(len - s->stream.avail_in); } + /* =========================================================================== Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of @@ -556,16 +630,30 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) va_list va; int len; + buf[sizeof(buf) - 1] = 0; va_start(va, format); -#ifdef HAS_vsnprintf - (void)vsnprintf(buf, sizeof(buf), format, va); -#else +#ifdef NO_vsnprintf +# ifdef HAS_vsprintf_void (void)vsprintf(buf, format, va); -#endif va_end(va); - len = strlen(buf); /* some *sprintf don't return the nb of bytes written */ - if (len <= 0) return 0; - + for (len = 0; len < sizeof(buf); len++) + if (buf[len] == 0) break; +# else + len = vsprintf(buf, format, va); + va_end(va); +# endif +#else +# ifdef HAS_vsnprintf_void + (void)vsnprintf(buf, sizeof(buf), format, va); + va_end(va); + len = strlen(buf); +# else + len = vsnprintf(buf, sizeof(buf), format, va); + va_end(va); +# endif +#endif + if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) + return 0; return gzwrite(file, buf, (unsigned)len); } #else /* not ANSI C */ @@ -580,16 +668,29 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, char buf[Z_PRINTF_BUFSIZE]; int len; -#ifdef HAS_snprintf - snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -#else + buf[sizeof(buf) - 1] = 0; +#ifdef NO_snprintf +# ifdef HAS_sprintf_void sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + for (len = 0; len < sizeof(buf); len++) + if (buf[len] == 0) break; +# else + len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#else +# ifdef HAS_snprintf_void + snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = strlen(buf); +# else + len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif #endif - len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */ - if (len <= 0) return 0; - + if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) + return 0; return gzwrite(file, buf, len); } #endif @@ -649,7 +750,9 @@ local int do_flush (file, flush) s->stream.avail_out = Z_BUFSIZE; } if (done) break; + s->out += s->stream.avail_out; s->z_err = deflate(&(s->stream), flush); + s->out -= s->stream.avail_out; /* Ignore the second of two consecutive flushes: */ if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; @@ -675,7 +778,7 @@ int ZEXPORT gzflush (file, flush) fflush(s->file); return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; } -#endif /* NO_DEFLATE */ +#endif /* NO_GZCOMPRESS */ /* =========================================================================== Sets the starting position for the next gzread or gzwrite on the given @@ -698,17 +801,18 @@ z_off_t ZEXPORT gzseek (file, offset, whence) } if (s->mode == 'w') { -#ifdef NO_DEFLATE +#ifdef NO_GZCOMPRESS return -1L; #else if (whence == SEEK_SET) { - offset -= s->stream.total_in; + offset -= s->in; } if (offset < 0) return -1L; /* At this point, offset is the number of zero bytes to write. */ if (s->inbuf == Z_NULL) { s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ + if (s->inbuf == Z_NULL) return -1L; zmemzero(s->inbuf, Z_BUFSIZE); } while (offset > 0) { @@ -720,30 +824,31 @@ z_off_t ZEXPORT gzseek (file, offset, whence) offset -= size; } - return (z_off_t)s->stream.total_in; + return s->in; #endif } /* Rest of function is for reading only */ /* compute absolute position */ if (whence == SEEK_CUR) { - offset += s->stream.total_out; + offset += s->out; } if (offset < 0) return -1L; if (s->transparent) { /* map to fseek */ + s->back = EOF; s->stream.avail_in = 0; s->stream.next_in = s->inbuf; if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; - s->stream.total_in = s->stream.total_out = (uLong)offset; + s->in = s->out = offset; return offset; } /* For a negative seek, rewind and use positive seek */ - if ((uLong)offset >= s->stream.total_out) { - offset -= s->stream.total_out; + if (offset >= s->out) { + offset -= s->out; } else if (gzrewind(file) < 0) { return -1L; } @@ -751,6 +856,13 @@ z_off_t ZEXPORT gzseek (file, offset, whence) if (offset != 0 && s->outbuf == Z_NULL) { s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); + if (s->outbuf == Z_NULL) return -1L; + } + if (offset && s->back != EOF) { + s->back = EOF; + s->out++; + offset--; + if (s->last) s->z_err = Z_STREAM_END; } while (offset > 0) { int size = Z_BUFSIZE; @@ -760,7 +872,7 @@ z_off_t ZEXPORT gzseek (file, offset, whence) if (size <= 0) return -1L; offset -= size; } - return (z_off_t)s->stream.total_out; + return s->out; } /* =========================================================================== @@ -775,17 +887,14 @@ int ZEXPORT gzrewind (file) s->z_err = Z_OK; s->z_eof = 0; + s->back = EOF; s->stream.avail_in = 0; s->stream.next_in = s->inbuf; s->crc = crc32(0L, Z_NULL, 0); - - if (s->startpos == 0) { /* not a compressed file */ - rewind(s->file); - return 0; - } - - (void) inflateReset(&s->stream); - return fseek(s->file, s->startpos, SEEK_SET); + if (!s->transparent) (void)inflateReset(&s->stream); + s->in = 0; + s->out = 0; + return fseek(s->file, s->start, SEEK_SET); } /* =========================================================================== @@ -808,7 +917,25 @@ int ZEXPORT gzeof (file) { gz_stream *s = (gz_stream*)file; - return (s == NULL || s->mode != 'r') ? 0 : s->z_eof; + /* With concatenated compressed files that can have embedded + * crc trailers, z_eof is no longer the only/best indicator of EOF + * on a gz_stream. Handle end-of-stream error explicitly here. + */ + if (s == NULL || s->mode != 'r') return 0; + if (s->z_eof) return 1; + return s->z_err == Z_STREAM_END; +} + +/* =========================================================================== + Returns 1 if reading and doing so transparently, otherwise zero. +*/ +int ZEXPORT gzdirect (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'r') return 0; + return s->transparent; } /* =========================================================================== @@ -850,33 +977,38 @@ local uLong getLong (s) int ZEXPORT gzclose (file) gzFile file; { - int err; gz_stream *s = (gz_stream*)file; if (s == NULL) return Z_STREAM_ERROR; if (s->mode == 'w') { -#ifdef NO_DEFLATE +#ifdef NO_GZCOMPRESS return Z_STREAM_ERROR; #else - err = do_flush (file, Z_FINISH); - if (err != Z_OK) return destroy((gz_stream*)file); + if (do_flush (file, Z_FINISH) != Z_OK) + return destroy((gz_stream*)file); putLong (s->file, s->crc); - putLong (s->file, s->stream.total_in); + putLong (s->file, (uLong)(s->in & 0xffffffff)); #endif } return destroy((gz_stream*)file); } +#ifdef STDC +# define zstrerror(errnum) strerror(errnum) +#else +# define zstrerror(errnum) "" +#endif + /* =========================================================================== - Returns the error message for the last error which occured on the + Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an - error occured in the file system and not in the compression library, + error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. */ -const char* ZEXPORT gzerror (file, errnum) +const char * ZEXPORT gzerror (file, errnum) gzFile file; int *errnum; { @@ -890,14 +1022,29 @@ const char* ZEXPORT gzerror (file, errnum) *errnum = s->z_err; if (*errnum == Z_OK) return (const char*)""; - m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); + m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); TRYFREE(s->msg); s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); + if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); strcpy(s->msg, s->path); strcat(s->msg, ": "); strcat(s->msg, m); return (const char*)s->msg; } + +/* =========================================================================== + Clear the error and end-of-file flags, and do the same for the real file. +*/ +void ZEXPORT gzclearerr (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL) return; + if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; + s->z_eof = 0; + clearerr(s->file); +} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/infback.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/infback.c new file mode 100644 index 00000000000..539f6c4d8ab --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/infback.c @@ -0,0 +1,647 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* infback.c -- inflate using a call-back interface + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + This code is largely copied from inflate.c. Normally either infback.o or + inflate.o would be linked into an application--not both. The interface + with inffast.c is retained so that optimized assembler-coded versions of + inflate_fast() can be used with either inflate.c or infback.c. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); + +/* + strm provides memory allocation functions in zalloc and zfree, or + Z_NULL to use the library memory allocation functions. + + windowBits is in the range 8..15, and window is a user-supplied + window and output buffer that is 2**windowBits bytes. + */ +int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) +z_streamp strm; +int windowBits; +unsigned char FAR *window; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL || window == Z_NULL || + windowBits < 8 || windowBits > 15) + return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *)ZALLOC(strm, 1, + sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->dmax = 32768U; + state->wbits = windowBits; + state->wsize = 1U << windowBits; + state->window = window; + state->write = 0; + state->whave = 0; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +/* Macros for inflateBack(): */ + +/* Load returned state from inflate_fast() */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Set state from registers for inflate_fast() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Assure that some input is available. If input is requested, but denied, + then return a Z_BUF_ERROR from inflateBack(). */ +#define PULL() \ + do { \ + if (have == 0) { \ + have = in(in_desc, &next); \ + if (have == 0) { \ + next = Z_NULL; \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflateBack() + with an error if there is no input available. */ +#define PULLBYTE() \ + do { \ + PULL(); \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflateBack() with + an error. */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Assure that some output space is available, by writing out the window + if it's full. If the write fails, return from inflateBack() with a + Z_BUF_ERROR. */ +#define ROOM() \ + do { \ + if (left == 0) { \ + put = state->window; \ + left = state->wsize; \ + state->whave = left; \ + if (out(out_desc, put, left)) { \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* + strm provides the memory allocation functions and window buffer on input, + and provides information on the unused input on return. For Z_DATA_ERROR + returns, strm will also provide an error message. + + in() and out() are the call-back input and output functions. When + inflateBack() needs more input, it calls in(). When inflateBack() has + filled the window with output, or when it completes with data in the + window, it calls out() to write out the data. The application must not + change the provided input until in() is called again or inflateBack() + returns. The application must not change the window/output buffer until + inflateBack() returns. + + in() and out() are called with a descriptor parameter provided in the + inflateBack() call. This parameter can be a structure that provides the + information required to do the read or write, as well as accumulated + information on the input and output such as totals and check values. + + in() should return zero on failure. out() should return non-zero on + failure. If either in() or out() fails, than inflateBack() returns a + Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it + was in() or out() that caused in the error. Otherwise, inflateBack() + returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format + error, or Z_MEM_ERROR if it could not allocate memory for the state. + inflateBack() can also return Z_STREAM_ERROR if the input parameters + are not correct, i.e. strm is Z_NULL or the state was not initialized. + */ +int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) +z_streamp strm; +in_func in; +void FAR *in_desc; +out_func out; +void FAR *out_desc; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code this; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + /* Check that the strm exists and that the state was initialized */ + if (strm == Z_NULL || strm->state == Z_NULL) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* Reset the state */ + strm->msg = Z_NULL; + state->mode = TYPE; + state->last = 0; + state->whave = 0; + next = strm->next_in; + have = next != Z_NULL ? strm->avail_in : 0; + hold = 0; + bits = 0; + put = state->window; + left = state->wsize; + + /* Inflate until end of block marked as last */ + for (;;) + switch (state->mode) { + case TYPE: + /* determine and dispatch block type */ + if (state->last) { + BYTEBITS(); + state->mode = DONE; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + + case STORED: + /* get and verify stored block length */ + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + + /* copy stored block from input to output */ + while (state->length != 0) { + copy = state->length; + PULL(); + ROOM(); + if (copy > have) copy = have; + if (copy > left) copy = left; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + + case TABLE: + /* get dynamic table entries descriptor */ + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + + /* get code length code lengths (not a typo) */ + state->have = 0; + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + + /* get length and distance code code lengths */ + state->have = 0; + while (state->have < state->nlen + state->ndist) { + for (;;) { + this = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if (this.val < 16) { + NEEDBITS(this.bits); + DROPBITS(this.bits); + state->lens[state->have++] = this.val; + } + else { + if (this.val == 16) { + NEEDBITS(this.bits + 2); + DROPBITS(this.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = (unsigned)(state->lens[state->have - 1]); + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (this.val == 17) { + NEEDBITS(this.bits + 3); + DROPBITS(this.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(this.bits + 7); + DROPBITS(this.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* build code tables */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { + RESTORE(); + if (state->whave < state->wsize) + state->whave = state->wsize - left; + inflate_fast(strm, state->wsize); + LOAD(); + break; + } + + /* get a literal, length, or end-of-block code */ + for (;;) { + this = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if (this.op && (this.op & 0xf0) == 0) { + last = this; + for (;;) { + this = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + this.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(this.bits); + state->length = (unsigned)this.val; + + /* process literal */ + if (this.op == 0) { + Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", this.val)); + ROOM(); + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + } + + /* process end of block */ + if (this.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + + /* invalid code */ + if (this.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + + /* length code -- get extra bits, if any */ + state->extra = (unsigned)(this.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + + /* get distance code */ + for (;;) { + this = state->distcode[BITS(state->distbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if ((this.op & 0xf0) == 0) { + last = this; + for (;;) { + this = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + this.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(this.bits); + if (this.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)this.val; + + /* get distance extra bits, if any */ + state->extra = (unsigned)(this.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } + if (state->offset > state->wsize - (state->whave < state->wsize ? + left : 0)) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + + /* copy match from window to output */ + do { + ROOM(); + copy = state->wsize - state->offset; + if (copy < left) { + from = put + copy; + copy = left - copy; + } + else { + from = put - state->offset; + copy = left; + } + if (copy > state->length) copy = state->length; + state->length -= copy; + left -= copy; + do { + *put++ = *from++; + } while (--copy); + } while (state->length != 0); + break; + + case DONE: + /* inflate stream terminated properly -- write leftover output */ + ret = Z_STREAM_END; + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left)) + ret = Z_BUF_ERROR; + } + goto inf_leave; + + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + + default: /* can't happen, but makes compilers happy */ + ret = Z_STREAM_ERROR; + goto inf_leave; + } + + /* Return unused input */ + inf_leave: + strm->next_in = next; + strm->avail_in = have; + return ret; +} + +int ZEXPORT inflateBackEnd(strm) +z_streamp strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.c new file mode 100644 index 00000000000..5dae7a2e590 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.c @@ -0,0 +1,342 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* inffast.c -- fast decoding + * Copyright (C) 1995-2004 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifndef ASMINF + +/* Allow machine dependent optimization for post-increment or pre-increment. + Based on testing to date, + Pre-increment preferred for: + - PowerPC G3 (Adler) + - MIPS R5000 (Randers-Pehrson) + Post-increment preferred for: + - none + No measurable difference: + - Pentium III (Anderson) + - M68060 (Nikl) + */ +#ifdef POSTINC +# define OFF 0 +# define PUP(a) *(a)++ +#else +# define OFF 1 +# define PUP(a) *++(a) +#endif + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state->mode == LEN + strm->avail_in >= 6 + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 + + On return, state->mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm->avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +void inflate_fast(strm, start) +z_streamp strm; +unsigned start; /* inflate()'s starting value for strm->avail_out */ +{ + struct inflate_state FAR *state; + unsigned char FAR *in; /* local strm->next_in */ + unsigned char FAR *last; /* while in < last, enough input available */ + unsigned char FAR *out; /* local strm->next_out */ + unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ + unsigned char FAR *end; /* while out < end, enough space available */ +#ifdef INFLATE_STRICT + unsigned dmax; /* maximum distance from zlib header */ +#endif + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned write; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ + unsigned long hold; /* local strm->hold */ + unsigned bits; /* local strm->bits */ + code const FAR *lcode; /* local strm->lencode */ + code const FAR *dcode; /* local strm->distcode */ + unsigned lmask; /* mask for first level of length codes */ + unsigned dmask; /* mask for first level of distance codes */ + code this; /* retrieved table entry */ + unsigned op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + unsigned len; /* match length, unused bytes */ + unsigned dist; /* match distance */ + unsigned char FAR *from; /* where to copy match from */ + + /* copy state to local variables */ + state = (struct inflate_state FAR *)strm->state; + in = strm->next_in - OFF; + last = in + (strm->avail_in - 5); + out = strm->next_out - OFF; + beg = out - (start - strm->avail_out); + end = out + (strm->avail_out - 257); +#ifdef INFLATE_STRICT + dmax = state->dmax; +#endif + wsize = state->wsize; + whave = state->whave; + write = state->write; + window = state->window; + hold = state->hold; + bits = state->bits; + lcode = state->lencode; + dcode = state->distcode; + lmask = (1U << state->lenbits) - 1; + dmask = (1U << state->distbits) - 1; + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + do { + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + this = lcode[hold & lmask]; + dolen: + op = (unsigned)(this.bits); + hold >>= op; + bits -= op; + op = (unsigned)(this.op); + if (op == 0) { /* literal */ + Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", this.val)); + PUP(out) = (unsigned char)(this.val); + } + else if (op & 16) { /* length base */ + len = (unsigned)(this.val); + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + len += (unsigned)hold & ((1U << op) - 1); + hold >>= op; + bits -= op; + } + Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + this = dcode[hold & dmask]; + dodist: + op = (unsigned)(this.bits); + hold >>= op; + bits -= op; + op = (unsigned)(this.op); + if (op & 16) { /* distance base */ + dist = (unsigned)(this.val); + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + } + dist += (unsigned)hold & ((1U << op) - 1); +#ifdef INFLATE_STRICT + if (dist > dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + hold >>= op; + bits -= op; + Tracevv((stderr, "inflate: distance %u\n", dist)); + op = (unsigned)(out - beg); /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + from = window - OFF; + if (write == 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + else if (write < op) { /* wrap around window */ + from += wsize + write - op; + op -= write; + if (op < len) { /* some from end of window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = window - OFF; + if (write < len) { /* some from start of window */ + op = write; + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + } + else { /* contiguous in window */ + from += write - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + while (len > 2) { + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + else { + from = out - dist; /* copy direct from output */ + do { /* minimum length is three */ + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } while (len > 2); + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + } + else if ((op & 64) == 0) { /* 2nd level distance code */ + this = dcode[this.val + (hold & ((1U << op) - 1))]; + goto dodist; + } + else { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + } + else if ((op & 64) == 0) { /* 2nd level length code */ + this = lcode[this.val + (hold & ((1U << op) - 1))]; + goto dolen; + } + else if (op & 32) { /* end-of-block */ + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + else { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + } while (in < last && out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + in -= len; + bits -= len << 3; + hold &= (1U << bits) - 1; + + /* update state and return */ + strm->next_in = in + OFF; + strm->next_out = out + OFF; + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); + strm->avail_out = (unsigned)(out < end ? + 257 + (end - out) : 257 - (out - end)); + state->hold = hold; + state->bits = bits; + return; +} + +/* + inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): + - Using bit fields for code structure + - Different op definition to avoid & for extra bits (do & for table bits) + - Three separate decoding do-loops for direct, window, and write == 0 + - Special case for distance > 1 copies to do overlapped load and store copy + - Explicit branch predictions (based on measured branch probabilities) + - Deferring match copy and interspersed it with decoding subsequent codes + - Swapping literal/length else + - Swapping window/direct else + - Larger unrolled copy loops (three is about right) + - Moving len -= 3 statement into middle of loop + */ + +#endif /* !ASMINF */ diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inffast.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.h similarity index 74% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/inffast.h rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.h index cdbc9110f73..17ef8cace9f 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/inffast.h +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.h @@ -22,14 +22,8 @@ * have any questions. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * inffast.h -- header to use inffast.c - * Copyright (C) 1995-1998 Mark Adler +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-2003 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -38,10 +32,4 @@ subject to change. Applications should only use zlib.h. */ -extern int inflate_fast OF(( - uInt, - uInt, - inflate_huft *, - inflate_huft *, - inflate_blocks_statef *, - z_streamp )); +void inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffixed.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffixed.h new file mode 100644 index 00000000000..a73b430e45a --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffixed.h @@ -0,0 +1,118 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + + /* inffixed.h -- table for decoding fixed codes + * Generated automatically by makefixed(). + */ + + /* WARNING: this file should *not* be used by applications. It + is part of the implementation of the compression library and + is subject to change. Applications should only use zlib.h. + */ + + static const code lenfix[512] = { + {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, + {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, + {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, + {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, + {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, + {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, + {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, + {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, + {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, + {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, + {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, + {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, + {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, + {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, + {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, + {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, + {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, + {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, + {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, + {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, + {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, + {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, + {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, + {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, + {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, + {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, + {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, + {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, + {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, + {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, + {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, + {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, + {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, + {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, + {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, + {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, + {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, + {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, + {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, + {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, + {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, + {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, + {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, + {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, + {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, + {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, + {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, + {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, + {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, + {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, + {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, + {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, + {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, + {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, + {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, + {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, + {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, + {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, + {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, + {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, + {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, + {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, + {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, + {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, + {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, + {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, + {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, + {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, + {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, + {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, + {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, + {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, + {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, + {0,9,255} + }; + + static const code distfix[32] = { + {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, + {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, + {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, + {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, + {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, + {22,5,193},{64,5,0} + }; diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.c new file mode 100644 index 00000000000..d20360114a8 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.c @@ -0,0 +1,1392 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* inflate.c -- zlib decompression + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * Change history: + * + * 1.2.beta0 24 Nov 2002 + * - First version -- complete rewrite of inflate to simplify code, avoid + * creation of window when not needed, minimize use of window when it is + * needed, make inffast.c even faster, implement gzip decoding, and to + * improve code readability and style over the previous zlib inflate code + * + * 1.2.beta1 25 Nov 2002 + * - Use pointers for available input and output checking in inffast.c + * - Remove input and output counters in inffast.c + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 + * - Remove unnecessary second byte pull from length extra in inffast.c + * - Unroll direct copy to three copies per loop in inffast.c + * + * 1.2.beta2 4 Dec 2002 + * - Change external routine names to reduce potential conflicts + * - Correct filename to inffixed.h for fixed tables in inflate.c + * - Make hbuf[] unsigned char to match parameter type in inflate.c + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) + * to avoid negation problem on Alphas (64 bit) in inflate.c + * + * 1.2.beta3 22 Dec 2002 + * - Add comments on state->bits assertion in inffast.c + * - Add comments on op field in inftrees.h + * - Fix bug in reuse of allocated window after inflateReset() + * - Remove bit fields--back to byte structure for speed + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths + * - Change post-increments to pre-increments in inflate_fast(), PPC biased? + * - Add compile time option, POSTINC, to use post-increments instead (Intel?) + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used + * - Use local copies of stream next and avail values, as well as local bit + * buffer and bit count in inflate()--for speed when inflate_fast() not used + * + * 1.2.beta4 1 Jan 2003 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings + * - Move a comment on output buffer sizes from inffast.c to inflate.c + * - Add comments in inffast.c to introduce the inflate_fast() routine + * - Rearrange window copies in inflate_fast() for speed and simplification + * - Unroll last copy for window match in inflate_fast() + * - Use local copies of window variables in inflate_fast() for speed + * - Pull out common write == 0 case for speed in inflate_fast() + * - Make op and len in inflate_fast() unsigned for consistency + * - Add FAR to lcode and dcode declarations in inflate_fast() + * - Simplified bad distance check in inflate_fast() + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new + * source file infback.c to provide a call-back interface to inflate for + * programs like gzip and unzip -- uses window as output buffer to avoid + * window copying + * + * 1.2.beta5 1 Jan 2003 + * - Improved inflateBack() interface to allow the caller to provide initial + * input in strm. + * - Fixed stored blocks bug in inflateBack() + * + * 1.2.beta6 4 Jan 2003 + * - Added comments in inffast.c on effectiveness of POSTINC + * - Typecasting all around to reduce compiler warnings + * - Changed loops from while (1) or do {} while (1) to for (;;), again to + * make compilers happy + * - Changed type of window in inflateBackInit() to unsigned char * + * + * 1.2.beta7 27 Jan 2003 + * - Changed many types to unsigned or unsigned short to avoid warnings + * - Added inflateCopy() function + * + * 1.2.0 9 Mar 2003 + * - Changed inflateBack() interface to provide separate opaque descriptors + * for the in() and out() functions + * - Changed inflateBack() argument and in_func typedef to swap the length + * and buffer address return values for the input function + * - Check next_in and next_out for Z_NULL on entry to inflate() + * + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifdef MAKEFIXED +# ifndef BUILDFIXED +# define BUILDFIXED +# endif +#endif + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); +local int updatewindow OF((z_streamp strm, unsigned out)); +#ifdef BUILDFIXED + void makefixed OF((void)); +#endif +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, + unsigned len)); + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + strm->total_in = strm->total_out = state->total = 0; + strm->msg = Z_NULL; + strm->adler = 1; /* to support ill-conceived Java test suite */ + state->mode = HEAD; + state->last = 0; + state->havedict = 0; + state->dmax = 32768U; + state->head = Z_NULL; + state->wsize = 0; + state->whave = 0; + state->write = 0; + state->hold = 0; + state->bits = 0; + state->lencode = state->distcode = state->next = state->codes; + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +int ZEXPORT inflatePrime(strm, bits, value) +z_streamp strm; +int bits; +int value; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + value &= (1L << bits) - 1; + state->hold += value << state->bits; + state->bits += bits; + return Z_OK; +} + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL) return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *) + ZALLOC(strm, 1, sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + if (windowBits < 0) { + state->wrap = 0; + windowBits = -windowBits; + } + else { + state->wrap = (windowBits >> 4) + 1; +#ifdef GUNZIP + if (windowBits < 48) windowBits &= 15; +#endif + } + if (windowBits < 8 || windowBits > 15) { + ZFREE(strm, state); + strm->state = Z_NULL; + return Z_STREAM_ERROR; + } + state->wbits = (unsigned)windowBits; + state->window = Z_NULL; + return inflateReset(strm); +} + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ + return inflateInit2_(strm, DEF_WBITS, version, stream_size); +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +#ifdef MAKEFIXED +#include + +/* + Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also + defines BUILDFIXED, so the tables are built on the fly. makefixed() writes + those tables to stdout, which would be piped to inffixed.h. A small program + can simply call makefixed to do this: + + void makefixed(void); + + int main(void) + { + makefixed(); + return 0; + } + + Then that can be linked with zlib built with MAKEFIXED defined and run: + + a.out > inffixed.h + */ +void makefixed() +{ + unsigned low, size; + struct inflate_state state; + + fixedtables(&state); + puts(" /* inffixed.h -- table for decoding fixed codes"); + puts(" * Generated automatically by makefixed()."); + puts(" */"); + puts(""); + puts(" /* WARNING: this file should *not* be used by applications."); + puts(" It is part of the implementation of this library and is"); + puts(" subject to change. Applications should only use zlib.h."); + puts(" */"); + puts(""); + size = 1U << 9; + printf(" static const code lenfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 7) == 0) printf("\n "); + printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, + state.lencode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); + size = 1U << 5; + printf("\n static const code distfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 6) == 0) printf("\n "); + printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, + state.distcode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); +} +#endif /* MAKEFIXED */ + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +local int updatewindow(strm, out) +z_streamp strm; +unsigned out; +{ + struct inflate_state FAR *state; + unsigned copy, dist; + + state = (struct inflate_state FAR *)strm->state; + + /* if it hasn't been done already, allocate space for the window */ + if (state->window == Z_NULL) { + state->window = (unsigned char FAR *) + ZALLOC(strm, 1U << state->wbits, + sizeof(unsigned char)); + if (state->window == Z_NULL) return 1; + } + + /* if window not in use yet, initialize */ + if (state->wsize == 0) { + state->wsize = 1U << state->wbits; + state->write = 0; + state->whave = 0; + } + + /* copy state->wsize or less output bytes into the circular window */ + copy = out - strm->avail_out; + if (copy >= state->wsize) { + zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + state->write = 0; + state->whave = state->wsize; + } + else { + dist = state->wsize - state->write; + if (dist > copy) dist = copy; + zmemcpy(state->window + state->write, strm->next_out - copy, dist); + copy -= dist; + if (copy) { + zmemcpy(state->window, strm->next_out - copy, copy); + state->write = copy; + state->whave = state->wsize; + } + else { + state->write += dist; + if (state->write == state->wsize) state->write = 0; + if (state->whave < state->wsize) state->whave += dist; + } + } + return 0; +} + +/* Macros for inflate(): */ + +/* check function to use adler32() for zlib or crc32() for gzip */ +#ifdef GUNZIP +# define UPDATE(check, buf, len) \ + (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) +#else +# define UPDATE(check, buf, len) adler32(check, buf, len) +#endif + +/* check macros for header crc */ +#ifdef GUNZIP +# define CRC2(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + check = crc32(check, hbuf, 2); \ + } while (0) + +# define CRC4(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + hbuf[2] = (unsigned char)((word) >> 16); \ + hbuf[3] = (unsigned char)((word) >> 24); \ + check = crc32(check, hbuf, 4); \ + } while (0) +#endif + +/* Load registers with state in inflate() for speed */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Restore state from registers in inflate() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflate() + if there is no input available. */ +#define PULLBYTE() \ + do { \ + if (have == 0) goto inf_leave; \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflate(). */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Reverse the bytes in a 32-bit value */ +#define REVERSE(q) \ + ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +/* + inflate() uses a state machine to process as much input data and generate as + much output data as possible before returning. The state machine is + structured roughly as follows: + + for (;;) switch (state) { + ... + case STATEn: + if (not enough input data or output space to make progress) + return; + ... make progress ... + state = STATEm; + break; + ... + } + + so when inflate() is called again, the same case is attempted again, and + if the appropriate resources are provided, the machine proceeds to the + next state. The NEEDBITS() macro is usually the way the state evaluates + whether it can proceed or should return. NEEDBITS() does the return if + the requested bits are not available. The typical use of the BITS macros + is: + + NEEDBITS(n); + ... do something with BITS(n) ... + DROPBITS(n); + + where NEEDBITS(n) either returns from inflate() if there isn't enough + input left to load n bits into the accumulator, or it continues. BITS(n) + gives the low n bits in the accumulator. When done, DROPBITS(n) drops + the low n bits off the accumulator. INITBITS() clears the accumulator + and sets the number of available bits to zero. BYTEBITS() discards just + enough bits to put the accumulator on a byte boundary. After BYTEBITS() + and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. + + NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return + if there is no input available. The decoding of variable length codes uses + PULLBYTE() directly in order to pull just enough bytes to decode the next + code, and no more. + + Some states loop until they get enough input, making sure that enough + state information is maintained to continue the loop where it left off + if NEEDBITS() returns in the loop. For example, want, need, and keep + would all have to actually be part of the saved state in case NEEDBITS() + returns: + + case STATEw: + while (want < need) { + NEEDBITS(n); + keep[want++] = BITS(n); + DROPBITS(n); + } + state = STATEx; + case STATEx: + + As shown above, if the next state is also the next case, then the break + is omitted. + + A state may also return if there is not enough output space available to + complete that state. Those states are copying stored data, writing a + literal byte, and copying a matching string. + + When returning, a "goto inf_leave" is used to update the total counters, + update the check value, and determine whether any progress has been made + during that inflate() call in order to return the proper return code. + Progress is defined as a change in either strm->avail_in or strm->avail_out. + When there is a window, goto inf_leave will update the window with the last + output written. If a goto inf_leave occurs in the middle of decompression + and there is no window currently, goto inf_leave will create one and copy + output to the window for the next call of inflate(). + + In this implementation, the flush parameter of inflate() only affects the + return code (per zlib.h). inflate() always writes as much as possible to + strm->next_out, given the space available and the provided input--the effect + documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers + the allocation of and copying into a sliding window until necessary, which + provides the effect documented in zlib.h for Z_FINISH when the entire input + stream available. So the only thing the flush parameter actually does is: + when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + will return Z_BUF_ERROR if it has not reached the end of the stream. + */ + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned in, out; /* save starting available input and output */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code this; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ +#ifdef GUNZIP + unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ +#endif + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0)) + return Z_STREAM_ERROR; + + state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ + LOAD(); + in = have; + out = left; + ret = Z_OK; + for (;;) + switch (state->mode) { + case HEAD: + if (state->wrap == 0) { + state->mode = TYPEDO; + break; + } + NEEDBITS(16); +#ifdef GUNZIP + if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + state->check = crc32(0L, Z_NULL, 0); + CRC2(state->check, hold); + INITBITS(); + state->mode = FLAGS; + break; + } + state->flags = 0; /* expect zlib header */ + if (state->head != Z_NULL) + state->head->done = -1; + if (!(state->wrap & 1) || /* check if zlib header allowed */ +#else + if ( +#endif + ((BITS(8) << 8) + (hold >> 8)) % 31) { + strm->msg = (char *)"incorrect header check"; + state->mode = BAD; + break; + } + if (BITS(4) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + DROPBITS(4); + len = BITS(4) + 8; + if (len > state->wbits) { + strm->msg = (char *)"invalid window size"; + state->mode = BAD; + break; + } + state->dmax = 1U << len; + Tracev((stderr, "inflate: zlib header ok\n")); + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = hold & 0x200 ? DICTID : TYPE; + INITBITS(); + break; +#ifdef GUNZIP + case FLAGS: + NEEDBITS(16); + state->flags = (int)(hold); + if ((state->flags & 0xff) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + if (state->flags & 0xe000) { + strm->msg = (char *)"unknown header flags set"; + state->mode = BAD; + break; + } + if (state->head != Z_NULL) + state->head->text = (int)((hold >> 8) & 1); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = TIME; + case TIME: + NEEDBITS(32); + if (state->head != Z_NULL) + state->head->time = hold; + if (state->flags & 0x0200) CRC4(state->check, hold); + INITBITS(); + state->mode = OS; + case OS: + NEEDBITS(16); + if (state->head != Z_NULL) { + state->head->xflags = (int)(hold & 0xff); + state->head->os = (int)(hold >> 8); + } + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); + state->length = (unsigned)(hold); + if (state->head != Z_NULL) + state->head->extra_len = (unsigned)hold; + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + } + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; + if (copy > have) copy = have; + if (copy) { + if (state->head != Z_NULL && + state->head->extra != Z_NULL) { + len = state->head->extra_len - state->length; + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); + } + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + state->length -= copy; + } + if (state->length) goto inf_leave; + } + state->length = 0; + state->mode = NAME; + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->name != Z_NULL && + state->length < state->head->name_max) + state->head->name[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->comment != Z_NULL && + state->length < state->head->comm_max) + state->head->comment[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); + if (hold != (state->check & 0xffff)) { + strm->msg = (char *)"header crc mismatch"; + state->mode = BAD; + break; + } + INITBITS(); + } + if (state->head != Z_NULL) { + state->head->hcrc = (int)((state->flags >> 9) & 1); + state->head->done = 1; + } + strm->adler = state->check = crc32(0L, Z_NULL, 0); + state->mode = TYPE; + break; +#endif + case DICTID: + NEEDBITS(32); + strm->adler = state->check = REVERSE(hold); + INITBITS(); + state->mode = DICT; + case DICT: + if (state->havedict == 0) { + RESTORE(); + return Z_NEED_DICT; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; + case TYPE: + if (flush == Z_BLOCK) goto inf_leave; + case TYPEDO: + if (state->last) { + BYTEBITS(); + state->mode = CHECK; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + case STORED: + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + state->mode = COPY; + case COPY: + copy = state->length; + if (copy) { + if (copy > have) copy = have; + if (copy > left) copy = left; + if (copy == 0) goto inf_leave; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + break; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + case TABLE: + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + state->have = 0; + state->mode = LENLENS; + case LENLENS: + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + state->have = 0; + state->mode = CODELENS; + case CODELENS: + while (state->have < state->nlen + state->ndist) { + for (;;) { + this = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if (this.val < 16) { + NEEDBITS(this.bits); + DROPBITS(this.bits); + state->lens[state->have++] = this.val; + } + else { + if (this.val == 16) { + NEEDBITS(this.bits + 2); + DROPBITS(this.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = state->lens[state->have - 1]; + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (this.val == 17) { + NEEDBITS(this.bits + 3); + DROPBITS(this.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(this.bits + 7); + DROPBITS(this.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* build code tables */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); + inflate_fast(strm, out); + LOAD(); + break; + } + for (;;) { + this = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if (this.op && (this.op & 0xf0) == 0) { + last = this; + for (;;) { + this = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + this.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(this.bits); + state->length = (unsigned)this.val; + if ((int)(this.op) == 0) { + Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", this.val)); + state->mode = LIT; + break; + } + if (this.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + if (this.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + state->extra = (unsigned)(this.op) & 15; + state->mode = LENEXT; + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->mode = DIST; + case DIST: + for (;;) { + this = state->distcode[BITS(state->distbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if ((this.op & 0xf0) == 0) { + last = this; + for (;;) { + this = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + this.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(this.bits); + if (this.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)this.val; + state->extra = (unsigned)(this.op) & 15; + state->mode = DISTEXT; + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } +#ifdef INFLATE_STRICT + if (state->offset > state->dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + if (state->offset > state->whave + out - left) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; + if (state->offset > copy) { /* copy from window */ + copy = state->offset - copy; + if (copy > state->write) { + copy -= state->write; + from = state->window + (state->wsize - copy); + } + else + from = state->window + (state->write - copy); + if (copy > state->length) copy = state->length; + } + else { /* copy from output */ + from = put - state->offset; + copy = state->length; + } + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = *from++; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; + case LIT: + if (left == 0) goto inf_leave; + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + case CHECK: + if (state->wrap) { + NEEDBITS(32); + out -= left; + strm->total_out += out; + state->total += out; + if (out) + strm->adler = state->check = + UPDATE(state->check, put - out, out); + out = left; + if (( +#ifdef GUNZIP + state->flags ? hold : +#endif + REVERSE(hold)) != state->check) { + strm->msg = (char *)"incorrect data check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: check matches trailer\n")); + } +#ifdef GUNZIP + state->mode = LENGTH; + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); + if (hold != (state->total & 0xffffffffUL)) { + strm->msg = (char *)"incorrect length check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: length matches trailer\n")); + } +#endif + state->mode = DONE; + case DONE: + ret = Z_STREAM_END; + goto inf_leave; + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + default: + return Z_STREAM_ERROR; + } + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: + RESTORE(); + if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) + if (updatewindow(strm, out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + in -= strm->avail_in; + out -= strm->avail_out; + strm->total_in += in; + strm->total_out += out; + state->total += out; + if (state->wrap && out) + strm->adler = state->check = + UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 64 : 0) + + (state->mode == TYPE ? 128 : 0); + if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) + ret = Z_BUF_ERROR; + return ret; +} + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->window != Z_NULL) ZFREE(strm, state->window); + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) +z_streamp strm; +const Bytef *dictionary; +uInt dictLength; +{ + struct inflate_state FAR *state; + unsigned long id; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->wrap != 0 && state->mode != DICT) + return Z_STREAM_ERROR; + + /* check for correct dictionary id */ + if (state->mode == DICT) { + id = adler32(0L, Z_NULL, 0); + id = adler32(id, dictionary, dictLength); + if (id != state->check) + return Z_DATA_ERROR; + } + + /* copy dictionary to window */ + if (updatewindow(strm, strm->avail_out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + if (dictLength > state->wsize) { + zmemcpy(state->window, dictionary + dictLength - state->wsize, + state->wsize); + state->whave = state->wsize; + } + else { + zmemcpy(state->window + state->wsize - dictLength, dictionary, + dictLength); + state->whave = dictLength; + } + state->havedict = 1; + Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +int ZEXPORT inflateGetHeader(strm, head) +z_streamp strm; +gz_headerp head; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; + + /* save header structure */ + state->head = head; + head->done = 0; + return Z_OK; +} + +/* + Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found + or when out of input. When called, *have is the number of pattern bytes + found in order so far, in 0..3. On return *have is updated to the new + state. If on return *have equals four, then the pattern was found and the + return value is how many bytes were read including the last byte of the + pattern. If *have is less than four, then the pattern has not been found + yet and the return value is len. In the latter case, syncsearch() can be + called again with more data and the *have state. *have is initialized to + zero for the first call. + */ +local unsigned syncsearch(have, buf, len) +unsigned FAR *have; +unsigned char FAR *buf; +unsigned len; +{ + unsigned got; + unsigned next; + + got = *have; + next = 0; + while (next < len && got < 4) { + if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) + got++; + else if (buf[next]) + got = 0; + else + got = 4 - got; + next++; + } + *have = got; + return next; +} + +int ZEXPORT inflateSync(strm) +z_streamp strm; +{ + unsigned len; /* number of bytes to look at or looked at */ + long long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + + /* check parameters */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; + + /* if first time, start search in bit buffer */ + if (state->mode != SYNC) { + state->mode = SYNC; + state->hold <<= state->bits & 7; + state->bits -= state->bits & 7; + len = 0; + while (state->bits >= 8) { + buf[len++] = (unsigned char)(state->hold); + state->hold >>= 8; + state->bits -= 8; + } + state->have = 0; + syncsearch(&(state->have), buf, len); + } + + /* search available input */ + len = syncsearch(&(state->have), strm->next_in, strm->avail_in); + strm->avail_in -= len; + strm->next_in += len; + strm->total_in += len; + + /* return no joy or set up to restart inflate() on a new block */ + if (state->have != 4) return Z_DATA_ERROR; + in = strm->total_in; out = strm->total_out; + inflateReset(strm); + strm->total_in = in; strm->total_out = out; + state->mode = TYPE; + return Z_OK; +} + +/* + Returns true if inflate is currently at the end of a block generated by + Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + implementation to provide an additional safety check. PPP uses + Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored + block. When decompressing, PPP checks that at the end of input packet, + inflate is waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + return state->mode == STORED && state->bits == 0; +} + +int ZEXPORT inflateCopy(dest, source) +z_streamp dest; +z_streamp source; +{ + struct inflate_state FAR *state; + struct inflate_state FAR *copy; + unsigned char FAR *window; + unsigned wsize; + + /* check input */ + if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)source->state; + + /* allocate space */ + copy = (struct inflate_state FAR *) + ZALLOC(source, 1, sizeof(struct inflate_state)); + if (copy == Z_NULL) return Z_MEM_ERROR; + window = Z_NULL; + if (state->window != Z_NULL) { + window = (unsigned char FAR *) + ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); + if (window == Z_NULL) { + ZFREE(source, copy); + return Z_MEM_ERROR; + } + } + + /* copy state */ + zmemcpy(dest, source, sizeof(z_stream)); + zmemcpy(copy, state, sizeof(struct inflate_state)); + if (state->lencode >= state->codes && + state->lencode <= state->codes + ENOUGH - 1) { + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + } + copy->next = copy->codes + (state->next - state->codes); + if (window != Z_NULL) { + wsize = 1U << state->wbits; + zmemcpy(window, state->window, wsize); + } + copy->window = window; + dest->state = (struct internal_state FAR *)copy; + return Z_OK; +} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.h new file mode 100644 index 00000000000..b33312c8d71 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.h @@ -0,0 +1,139 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2004 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN, /* i: waiting for length/lit code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ + LENGTH, /* i: waiting for 32-bit length (gzip) */ + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to the BAD or MEM mode -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME + NAME -> COMMENT -> HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + Read deflate blocks: + TYPE -> STORED or TABLE or LEN or CHECK + STORED -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN + Read deflate codes: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 7K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + gz_headerp head; /* where to save gzip header information */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned write; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ +}; diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.c new file mode 100644 index 00000000000..20fd1b34347 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.c @@ -0,0 +1,353 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#define MAXBITS 15 + +const char inflate_copyright[] = + " inflate 1.2.3 Copyright 1995-2005 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* + Build a set of tables to decode the provided canonical Huffman code. + The code lengths are lens[0..codes-1]. The result starts at *table, + whose indices are 0..2^bits-1. work is a writable array of at least + lens shorts, which is used as a work area. type is the type of code + to be generated, CODES, LENS, or DISTS. On return, zero is success, + -1 is an invalid code, and +1 means that ENOUGH isn't enough. table + on return points to the next available entry's address. bits is the + requested root table index bits, and on return it is the actual root + table index bits. It will differ if the request is greater than the + longest code or if it is less than the shortest code. + */ +int inflate_table(type, lens, codes, table, bits, work) +codetype type; +unsigned short FAR *lens; +unsigned codes; +code FAR * FAR *table; +unsigned FAR *bits; +unsigned short FAR *work; +{ + unsigned len; /* a code's length in bits */ + unsigned sym; /* index of code symbols */ + unsigned min, max; /* minimum and maximum code lengths */ + unsigned root; /* number of index bits for root table */ + unsigned curr; /* number of index bits for current table */ + unsigned drop; /* code bits to drop for sub-table */ + int left; /* number of prefix codes available */ + unsigned used; /* code entries in table used */ + unsigned huff; /* Huffman code */ + unsigned incr; /* for incrementing code, index */ + unsigned fill; /* index for replicating entries */ + unsigned low; /* low bits for current root entry */ + unsigned mask; /* mask for low root bits */ + code this; /* table entry for duplication */ + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ + int end; /* use base and extra for symbol > end */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + static const unsigned short lext[31] = { /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196}; + static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0}; + static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64}; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) + count[len] = 0; + for (sym = 0; sym < codes; sym++) + count[lens[sym]]++; + + /* bound code lengths, force root to be within code lengths */ + root = *bits; + for (max = MAXBITS; max >= 1; max--) + if (count[max] != 0) break; + if (root > max) root = max; + if (max == 0) { /* no symbols to code at all */ + this.op = (unsigned char)64; /* invalid code marker */ + this.bits = (unsigned char)1; + this.val = (unsigned short)0; + *(*table)++ = this; /* make a table to force an error */ + *(*table)++ = this; + *bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min <= MAXBITS; min++) + if (count[min] != 0) break; + if (root < min) root = min; + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) return -1; /* over-subscribed */ + } + if (left > 0 && (type == CODES || max != 1)) + return -1; /* incomplete set */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + count[len]; + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) + if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked when a LENS table is being made + against the space in *table, ENOUGH, minus the maximum space needed by + the worst case distance code, MAXD. This should never happen, but the + sufficiency of ENOUGH has not been proven exhaustively, hence the check. + This assumes that when type == LENS, bits == 9. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ + end = 19; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; + extra -= 257; + end = 256; + break; + default: /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize state for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = *table; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = (unsigned)(-1); /* trigger new sub-table when len > root */ + used = 1U << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if (type == LENS && used >= ENOUGH - MAXD) + return 1; + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + this.bits = (unsigned char)(len - drop); + if ((int)(work[sym]) < end) { + this.op = (unsigned char)0; + this.val = work[sym]; + } + else if ((int)(work[sym]) > end) { + this.op = (unsigned char)(extra[work[sym]]); + this.val = base[work[sym]]; + } + else { + this.op = (unsigned char)(32 + 64); /* end of block */ + this.val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1U << (len - drop); + fill = 1U << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + next[(huff >> drop) + fill] = this; + } while (fill != 0); + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + + /* go to next symbol, update count, len */ + sym++; + if (--(count[len]) == 0) { + if (len == max) break; + len = lens[work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) != low) { + /* if first time, transition to sub-tables */ + if (drop == 0) + drop = root; + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = (int)(1 << curr); + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) break; + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1U << curr; + if (type == LENS && used >= ENOUGH - MAXD) + return 1; + + /* point entry in root table to sub-table */ + low = huff & mask; + (*table)[low].op = (unsigned char)curr; + (*table)[low].bits = (unsigned char)root; + (*table)[low].val = (unsigned short)(next - *table); + } + } + + /* + Fill in rest of table for incomplete codes. This loop is similar to the + loop above in incrementing huff for table indices. It is assumed that + len is equal to curr + drop, so there is no loop needed to increment + through high index bits. When the current sub-table is filled, the loop + drops back to the root table to fill in any remaining entries there. + */ + this.op = (unsigned char)64; /* invalid code marker */ + this.bits = (unsigned char)(len - drop); + this.val = (unsigned short)0; + while (huff != 0) { + /* when done with sub-table, drop back to root table */ + if (drop != 0 && (huff & mask) != low) { + drop = 0; + len = root; + next = *table; + this.bits = (unsigned char)len; + } + + /* put invalid code marker in table */ + next[huff >> drop] = this; + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + } + + /* set return parameters */ + *table += used; + *bits = root; + return 0; +} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h new file mode 100644 index 00000000000..d3510730a42 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h @@ -0,0 +1,79 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of dynamic tree. The maximum found in a long but non- + exhaustive search was 1444 code structures (852 for length/literals + and 592 for distances, the latter actually the result of an + exhaustive search). The true maximum is not known, but the value + below is more than safe. */ +#define ENOUGH 2048 +#define MAXD 592 + +/* Type of code to build for inftable() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +extern int inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java new file mode 100644 index 00000000000..068a0aaf881 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java @@ -0,0 +1,16 @@ +(1)renamed + adler32.c -> zadler32.c + zcrc32c -> zcrc32.c + +(2)added _LP64 to make uLong a 32-bit int on 64-bit platform + zconf.h: + uLong -> 32-bit int + +(3)updated crc32.c/crc32() + unsigned long -> uLong + +(4)updated zlib.h (to support > 4G zipfile): + total_in/out: uLong -> long long + +(5)updated upinflate.c/inflateSync() + unsigned long in, out; --> long long in, out; diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff new file mode 100644 index 00000000000..6bd57b97321 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff @@ -0,0 +1,25 @@ +--- /home/sherman/TL/zlib-1.2.3_ORG/crc32.c Sun Jun 12 16:56:07 2005 ++++ zcrc32.c Tue Aug 25 14:22:41 2009 +@@ -216,8 +216,8 @@ + #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + + /* ========================================================================= */ +-unsigned long ZEXPORT crc32(crc, buf, len) +- unsigned long crc; ++uLong ZEXPORT crc32(crc, buf, len) ++ uLong crc; + const unsigned char FAR *buf; + unsigned len; + { +@@ -234,9 +234,9 @@ + + endian = 1; + if (*((unsigned char *)(&endian))) +- return crc32_little(crc, buf, len); ++ return (uLong)crc32_little(crc, buf, len); + else +- return crc32_big(crc, buf, len); ++ return (uLong)crc32_big(crc, buf, len); + } + #endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff new file mode 100644 index 00000000000..1280ac80b9c --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff @@ -0,0 +1,11 @@ +--- /home/sherman/TL/zlib-1.2.3_ORG/inflate.c Tue Jun 14 14:50:12 2005 ++++ inflate.c Tue Aug 25 14:22:09 2009 +@@ -1263,7 +1263,7 @@ + z_streamp strm; + { + unsigned len; /* number of bytes to look at or looked at */ +- unsigned long in, out; /* temporary to save total_in and total_out */ ++ long long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff new file mode 100644 index 00000000000..04edcb2d203 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff @@ -0,0 +1,24 @@ +--- /home/sherman/TL/zlib-1.2.3_ORG/zconf.h Fri May 27 23:40:35 2005 ++++ zconf.h Tue Aug 25 14:22:28 2009 +@@ -8,6 +8,9 @@ + #ifndef ZCONF_H + #define ZCONF_H + ++/* for _LP64 */ ++#include ++ + /* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. +@@ -261,7 +264,11 @@ + typedef unsigned char Byte; /* 8 bits */ + #endif + typedef unsigned int uInt; /* 16 bits or more */ ++#ifdef _LP64 ++typedef unsigned int uLong; /* 32 bits or more */ ++#else + typedef unsigned long uLong; /* 32 bits or more */ ++#endif + + #ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff new file mode 100644 index 00000000000..043f4ed774d --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff @@ -0,0 +1,25 @@ +--- /home/sherman/TL/zlib-1.2.3_ORG/zlib.h Sun Jul 17 19:26:49 2005 ++++ zlib.h Tue Aug 25 14:22:50 2009 +@@ -82,11 +82,11 @@ + typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ +- uLong total_in; /* total nb of input bytes read so far */ ++ long long total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ +- uLong total_out; /* total nb of bytes output so far */ ++ long long total_out;/* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ +@@ -1348,7 +1348,7 @@ + + ZEXTERN const char * ZEXPORT zError OF((int)); + ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +-ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); ++ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table OF((void)); + + #ifdef __cplusplus + } diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/trees.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.c similarity index 96% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/trees.c rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.c index 8dc2967a510..016c7153260 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/trees.c +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.c @@ -22,14 +22,8 @@ * have any questions. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-1998 Jean-loup Gailly +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2005 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -59,6 +53,8 @@ * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ +/* @(#) $Id$ */ + /* #define GEN_TREES_H */ #include "deflate.h" @@ -258,7 +254,6 @@ local void send_bits(s, value, length) #endif /* DEBUG */ -#define MAX(a,b) (a >= b ? a : b) /* the arguments must not have side effects */ /* =========================================================================== @@ -584,7 +579,7 @@ local void gen_bitlen(s, desc) while (n != 0) { m = s->heap[--h]; if (m > max_code) continue; - if (tree[m].Len != (unsigned) bits) { + if ((unsigned) tree[m].Len != (unsigned) bits) { Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s->opt_len += ((long)bits - (long)tree[m].Len) *(long)tree[m].Freq; @@ -703,7 +698,8 @@ local void build_tree(s, desc) /* Create a new node father of n and m */ tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1); + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); tree[n].Dad = tree[m].Dad = (ush)node; #ifdef DUMP_BL_TREE if (tree == s->bl_tree) { @@ -958,8 +954,9 @@ void _tr_flush_block(s, buf, stored_len, eof) /* Build the Huffman trees unless a stored block is forced */ if (s->level > 0) { - /* Check if the file is ascii or binary */ - if (s->data_type == Z_UNKNOWN) set_data_type(s); + /* Check if the file is binary or text */ + if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN) + set_data_type(s); /* Construct the literal and distance trees */ build_tree(s, (tree_desc *)(&(s->l_desc))); @@ -978,7 +975,7 @@ void _tr_flush_block(s, buf, stored_len, eof) */ max_blindex = build_bl_tree(s); - /* Determine the best encoding. Compute first the block length in bytes*/ + /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s->opt_len+3+7)>>3; static_lenb = (s->static_len+3+7)>>3; @@ -1010,7 +1007,7 @@ void _tr_flush_block(s, buf, stored_len, eof) #ifdef FORCE_STATIC } else if (static_lenb >= 0) { /* force static trees */ #else - } else if (static_lenb == opt_lenb) { + } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { #endif send_bits(s, (STATIC_TREES<<1)+eof, 3); compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); @@ -1135,7 +1132,8 @@ local void compress_block(s, ltree, dtree) } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow"); + Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + "pendingBuf overflow"); } while (lx < s->last_lit); @@ -1144,21 +1142,24 @@ local void compress_block(s, ltree, dtree) } /* =========================================================================== - * Set the data type to ASCII or BINARY, using a crude approximation: - * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise. - * IN assertion: the fields freq of dyn_ltree are set and the total of all - * frequencies does not exceed 64K (to fit in an int on 16 bit machines). + * Set the data type to BINARY or TEXT, using a crude approximation: + * set it to Z_TEXT if all symbols are either printable characters (33 to 255) + * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise. + * IN assertion: the fields Freq of dyn_ltree are set. */ local void set_data_type(s) deflate_state *s; { - int n = 0; - unsigned ascii_freq = 0; - unsigned bin_freq = 0; - while (n < 7) bin_freq += s->dyn_ltree[n++].Freq; - while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq; - while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq; - s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII); + int n; + + for (n = 0; n < 9; n++) + if (s->dyn_ltree[n].Freq != 0) + break; + if (n == 9) + for (n = 14; n < 32; n++) + if (s->dyn_ltree[n].Freq != 0) + break; + s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY; } /* =========================================================================== diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/trees.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.h similarity index 99% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/trees.h rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.h index 3e0e1760784..179cc859aaa 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/trees.h +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.h @@ -149,3 +149,4 @@ local const int base_dist[D_CODES] = { 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 }; + diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/uncompr.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c similarity index 87% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/uncompr.c rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c index c0946927ca1..d3f67218110 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/uncompr.c +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c @@ -22,17 +22,14 @@ * have any questions. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-1998 Jean-loup Gailly. +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-2003 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL #include "zlib.h" /* =========================================================================== @@ -77,7 +74,9 @@ int ZEXPORT uncompress (dest, destLen, source, sourceLen) err = inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { inflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; } *destLen = stream.total_out; diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zadler32.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zadler32.c new file mode 100644 index 00000000000..7312da208e6 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zadler32.c @@ -0,0 +1,173 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2004 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +#define BASE 65521UL /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +/* use NO_DIVIDE if your processor does not do division in hardware */ +#ifdef NO_DIVIDE +# define MOD(a) \ + do { \ + if (a >= (BASE << 16)) a -= (BASE << 16); \ + if (a >= (BASE << 15)) a -= (BASE << 15); \ + if (a >= (BASE << 14)) a -= (BASE << 14); \ + if (a >= (BASE << 13)) a -= (BASE << 13); \ + if (a >= (BASE << 12)) a -= (BASE << 12); \ + if (a >= (BASE << 11)) a -= (BASE << 11); \ + if (a >= (BASE << 10)) a -= (BASE << 10); \ + if (a >= (BASE << 9)) a -= (BASE << 9); \ + if (a >= (BASE << 8)) a -= (BASE << 8); \ + if (a >= (BASE << 7)) a -= (BASE << 7); \ + if (a >= (BASE << 6)) a -= (BASE << 6); \ + if (a >= (BASE << 5)) a -= (BASE << 5); \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +# define MOD4(a) \ + do { \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +#else +# define MOD(a) a %= BASE +# define MOD4(a) a %= BASE +#endif + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) { + adler += buf[0]; + if (adler >= BASE) + adler -= BASE; + sum2 += adler; + if (sum2 >= BASE) + sum2 -= BASE; + return adler | (sum2 << 16); + } + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (buf == Z_NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) { + while (len--) { + adler += *buf++; + sum2 += adler; + } + if (adler >= BASE) + adler -= BASE; + MOD4(sum2); /* only added so many BASE's */ + return adler | (sum2 << 16); + } + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; + n = NMAX / 16; /* NMAX is divisible by 16 */ + do { + DO16(buf); /* 16 sums unrolled */ + buf += 16; + } while (--n); + MOD(adler); + MOD(sum2); + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + if (len) { /* avoid modulos if none remaining */ + while (len >= 16) { + len -= 16; + DO16(buf); + buf += 16; + } + while (len--) { + adler += *buf++; + sum2 += adler; + } + MOD(adler); + MOD(sum2); + } + + /* return recombined sums */ + return adler | (sum2 << 16); +} + +/* ========================================================================= */ +uLong ZEXPORT adler32_combine(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off_t len2; +{ + unsigned long sum1; + unsigned long sum2; + unsigned rem; + + /* the derivation of this formula is left as an exercise for the reader */ + rem = (unsigned)(len2 % BASE); + sum1 = adler1 & 0xffff; + sum2 = rem * sum1; + MOD(sum2); + sum1 += (adler2 & 0xffff) + BASE - 1; + sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; + if (sum1 > BASE) sum1 -= BASE; + if (sum1 > BASE) sum1 -= BASE; + if (sum2 > (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 > BASE) sum2 -= BASE; + return sum1 | (sum2 << 16); +} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zconf.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zconf.h new file mode 100644 index 00000000000..53dd821be1b --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zconf.h @@ -0,0 +1,363 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* for _LP64 */ +#include + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define deflatePrime z_deflatePrime +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table +# define zError z_zError + +# define alloc_func z_alloc_func +# define free_func z_free_func +# define in_func z_in_func +# define out_func z_out_func +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +#ifdef _LP64 +typedef unsigned int uLong; /* 32 bits or more */ +#else +typedef unsigned long uLong; /* 32 bits or more */ +#endif + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c new file mode 100644 index 00000000000..812988d3fc4 --- /dev/null +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c @@ -0,0 +1,447 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Thanks to Rodney Brown for his contribution of faster + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing + * tables for updating the shift register in one step with three exclusive-ors + * instead of four steps with four exclusive-ors. This results in about a + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for STDC and FAR definitions */ + +#define local static + +/* Find a four-byte integer type for crc32_little() and crc32_big(). */ +#ifndef NOBYFOUR +# ifdef STDC /* need ANSI C limits.h to determine sizes */ +# include +# define BYFOUR +# if (UINT_MAX == 0xffffffffUL) + typedef unsigned int u4; +# else +# if (ULONG_MAX == 0xffffffffUL) + typedef unsigned long u4; +# else +# if (USHRT_MAX == 0xffffffffUL) + typedef unsigned short u4; +# else +# undef BYFOUR /* can't find a four-byte integer type! */ +# endif +# endif +# endif +# endif /* STDC */ +#endif /* !NOBYFOUR */ + +/* Definitions for doing the crc four data bytes at a time. */ +#ifdef BYFOUR +# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ + (((w)&0xff00)<<8)+(((w)&0xff)<<24)) + local unsigned long crc32_little OF((unsigned long, + const unsigned char FAR *, unsigned)); + local unsigned long crc32_big OF((unsigned long, + const unsigned char FAR *, unsigned)); +# define TBLS 8 +#else +# define TBLS 1 +#endif /* BYFOUR */ + +/* Local functions for crc concatenation */ +local unsigned long gf2_matrix_times OF((unsigned long *mat, + unsigned long vec)); +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); + +#ifdef DYNAMIC_CRC_TABLE + +local volatile int crc_table_empty = 1; +local unsigned long FAR crc_table[TBLS][256]; +local void make_crc_table OF((void)); +#ifdef MAKECRCH + local void write_table OF((FILE *, const unsigned long FAR *)); +#endif /* MAKECRCH */ +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The first table is simply the CRC of all possible eight bit values. This is + all the information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. The remaining tables + allow for word-at-a-time CRC calculation for both big-endian and little- + endian machines, where a word is four bytes. +*/ +local void make_crc_table() +{ + unsigned long c; + int n, k; + unsigned long poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static volatile int first = 1; /* flag to limit concurrent making */ + static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* See if another task is already doing this (not thread-safe, but better + than nothing -- significantly reduces duration of vulnerability in + case the advice about DYNAMIC_CRC_TABLE is ignored) */ + if (first) { + first = 0; + + /* make exclusive-or pattern from polynomial (0xedb88320UL) */ + poly = 0UL; + for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) + poly |= 1UL << (31 - p[n]); + + /* generate a crc for every 8-bit value */ + for (n = 0; n < 256; n++) { + c = (unsigned long)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[0][n] = c; + } + +#ifdef BYFOUR + /* generate crc for each value followed by one, two, and three zeros, + and then the byte reversal of those as well as the first table */ + for (n = 0; n < 256; n++) { + c = crc_table[0][n]; + crc_table[4][n] = REV(c); + for (k = 1; k < 4; k++) { + c = crc_table[0][c & 0xff] ^ (c >> 8); + crc_table[k][n] = c; + crc_table[k + 4][n] = REV(c); + } + } +#endif /* BYFOUR */ + + crc_table_empty = 0; + } + else { /* not first */ + /* wait for the other guy to finish (not efficient, but rare) */ + while (crc_table_empty) + ; + } + +#ifdef MAKECRCH + /* write out CRC tables to crc32.h */ + { + FILE *out; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); + fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); + fprintf(out, "local const unsigned long FAR "); + fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); + write_table(out, crc_table[0]); +# ifdef BYFOUR + fprintf(out, "#ifdef BYFOUR\n"); + for (k = 1; k < 8; k++) { + fprintf(out, " },\n {\n"); + write_table(out, crc_table[k]); + } + fprintf(out, "#endif\n"); +# endif /* BYFOUR */ + fprintf(out, " }\n};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH +local void write_table(out, table) + FILE *out; + const unsigned long FAR *table; +{ + int n; + + for (n = 0; n < 256; n++) + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); +} +#endif /* MAKECRCH */ + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const unsigned long FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + return (const unsigned long FAR *)crc_table; +} + +/* ========================================================================= */ +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + +/* ========================================================================= */ +uLong ZEXPORT crc32(crc, buf, len) + uLong crc; + const unsigned char FAR *buf; + unsigned len; +{ + if (buf == Z_NULL) return 0UL; + +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + +#ifdef BYFOUR + if (sizeof(void *) == sizeof(ptrdiff_t)) { + u4 endian; + + endian = 1; + if (*((unsigned char *)(&endian))) + return (uLong)crc32_little(crc, buf, len); + else + return (uLong)crc32_big(crc, buf, len); + } +#endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; + while (len >= 8) { + DO8; + len -= 8; + } + if (len) do { + DO1; + } while (--len); + return crc ^ 0xffffffffUL; +} + +#ifdef BYFOUR + +/* ========================================================================= */ +#define DOLIT4 c ^= *buf4++; \ + c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 + +/* ========================================================================= */ +local unsigned long crc32_little(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = (u4)crc; + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + while (len >= 32) { + DOLIT32; + len -= 32; + } + while (len >= 4) { + DOLIT4; + len -= 4; + } + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + } while (--len); + c = ~c; + return (unsigned long)c; +} + +/* ========================================================================= */ +#define DOBIG4 c ^= *++buf4; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + +/* ========================================================================= */ +local unsigned long crc32_big(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = REV((u4)crc); + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; + } + while (len >= 4) { + DOBIG4; + len -= 4; + } + buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + } while (--len); + c = ~c; + return (unsigned long)(REV(c)); +} + +#endif /* BYFOUR */ + +#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ + +/* ========================================================================= */ +local unsigned long gf2_matrix_times(mat, vec) + unsigned long *mat; + unsigned long vec; +{ + unsigned long sum; + + sum = 0; + while (vec) { + if (vec & 1) + sum ^= *mat; + vec >>= 1; + mat++; + } + return sum; +} + +/* ========================================================================= */ +local void gf2_matrix_square(square, mat) + unsigned long *square; + unsigned long *mat; +{ + int n; + + for (n = 0; n < GF2_DIM; n++) + square[n] = gf2_matrix_times(mat, mat[n]); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off_t len2; +{ + int n; + unsigned long row; + unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ + unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ + + /* degenerate case */ + if (len2 == 0) + return crc1; + + /* put operator for one zero bit in odd */ + odd[0] = 0xedb88320L; /* CRC-32 polynomial */ + row = 1; + for (n = 1; n < GF2_DIM; n++) { + odd[n] = row; + row <<= 1; + } + + /* put operator for two zero bits in even */ + gf2_matrix_square(even, odd); + + /* put operator for four zero bits in odd */ + gf2_matrix_square(odd, even); + + /* apply len2 zeros to crc1 (first square will put the operator for one + zero byte, eight zero bits, in even) */ + do { + /* apply zeros operator for this bit of len2 */ + gf2_matrix_square(even, odd); + if (len2 & 1) + crc1 = gf2_matrix_times(even, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + if (len2 == 0) + break; + + /* another iteration of the loop with odd and even swapped */ + gf2_matrix_square(odd, even); + if (len2 & 1) + crc1 = gf2_matrix_times(odd, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + } while (len2 != 0); + + /* return combined crc */ + crc1 ^= crc2; + return crc1; +} diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zlib.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zlib.h similarity index 54% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/zlib.h rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/zlib.h index 00fdf06007d..b2896fdddaf 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zlib.h +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zlib.h @@ -20,20 +20,12 @@ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. */ -/* - This file is available under and governed by the GNU General Public - License version 2 only, as published by the Free Software Foundation. - However, the following notice accompanied the original version of this - file and, per its terms, should not be removed: +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.3, July 18th, 2005 - zlib.h -- interface of the 'zlib' general purpose compression library - version 1.1.3, July 9th, 1998 - - Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,18 +48,12 @@ The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). */ -/* This distribution of zlib 1.1.3.f-jdk contains changes by Sun Microsystems. - The changes, made on or before 23 Apr 2003, are are described in ChangeLog. - - For help or issues with these changes, please contact: tl-dev@sun.com -*/ - -#ifndef _ZLIB_H -#define _ZLIB_H +#ifndef ZLIB_H +#define ZLIB_H #include "zconf.h" @@ -75,7 +61,8 @@ extern "C" { #endif -#define ZLIB_VERSION "1.1.3.f-jdk" +#define ZLIB_VERSION "1.2.3" +#define ZLIB_VERNUM 0x1230 /* The 'zlib' compression library provides in-memory compression and @@ -90,8 +77,21 @@ extern "C" { application must provide more input and/or consume the output (providing more output space) before each call. + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio. + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never @@ -106,11 +106,11 @@ struct internal_state; typedef struct z_stream_s { Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ - long long total_in; /* total nb of input bytes read so far */ + long long total_in; /* total nb of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ - long long total_out; /* total nb of bytes output so far */ + long long total_out;/* total nb of bytes output so far */ char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ @@ -119,13 +119,36 @@ typedef struct z_stream_s { free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ - int data_type; /* best guess about the data type: ascii or binary */ + int data_type; /* best guess about the data type: binary or text */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; typedef z_stream FAR *z_streamp; +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + /* The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out @@ -165,7 +188,8 @@ typedef z_stream FAR *z_streamp; #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 -/* Allowed flush values; see deflate() below for details */ +#define Z_BLOCK 5 +/* Allowed flush values; see deflate() and inflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 @@ -188,13 +212,16 @@ typedef z_stream FAR *z_streamp; #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 -#define Z_ASCII 1 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 -/* Possible values of the data_type field */ +/* Possible values of the data_type field (though see inflate()) */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ @@ -266,6 +293,10 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumualte before producing output, in order to + maximize compression. + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular @@ -277,12 +308,14 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - the compression. + compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero - avail_out). + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there @@ -294,14 +327,14 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least - 0.1% larger than avail_in plus 12 bytes. If deflate does not return + the value returned by deflateBound (see below). If deflate does not return Z_STREAM_END, then it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). - deflate() may update data_type if it can make a good guess about - the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. @@ -310,7 +343,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. */ @@ -352,9 +387,9 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may - introduce some output latency (reading input without producing any output) - except when forced to flush. + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. The detailed semantics are as follows. inflate performs one or both of the following actions: @@ -378,11 +413,26 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); must be called again after making room in the output buffer because there might be more output pending. - If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much - output as possible to the output buffer. The flushing behavior of inflate is - not specified for values of the flush parameter other than Z_SYNC_FLUSH - and Z_FINISH, but the current implementation actually flushes as much output - as possible anyway. + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, + Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() stop + if and when it gets to the next deflate block boundary. When decoding the + zlib or gzip format, this will cause inflate() to return immediately after + the header and before the first block. When doing a raw inflate, inflate() + will go ahead and process the first block, and will return when it gets to + the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 + if inflate() is currently decoding the last block in the deflate stream, + plus 128 if inflate() returned immediately after decoding an end-of-block + code or decoding the complete header up to just before the first byte of the + deflate stream. The end-of-block will not be indicated until all of the + uncompressed data from that block has been written to strm->next_out. The + number of unused bits may in general be greater than seven, except when + bit 7 of data_type is set, in which case the number of unused bits will be + less than eight. inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step @@ -392,29 +442,44 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); uncompressed data. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The next operation on this stream must be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster routine + is never required, but can be used to inform inflate that a faster approach may be used for the single inflate() call. - If a preset dictionary is needed at this point (see inflateSetDictionary - below), inflate sets strm->adler to the adler32 checksum of the - dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise - it sets strm->adler to the adler32 checksum of all output produced - so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or - an error code as described below. At the end of the stream, inflate() - checks that its computed adler32 checksum is equal to that saved by the - compressor and returns Z_STREAM_END only if the checksum is correct. + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() will decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically. Any information + contained in the gzip header is not retained, so applications that need that + information should instead use raw inflate, see inflateInit2() below, or + inflateBack() and perform their own processing of the gzip header and + trailer. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect - adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if no progress is possible or if there was not - enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR - case, the application may then call inflateSync to look for a good - compression block. + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may then + call inflateSync() to look for a good compression block if a partial recovery + of the data is desired. */ @@ -451,11 +516,22 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, this version of the library. The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this + (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), + no header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory @@ -464,14 +540,18 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match). Filtered data consists mostly of small values with a - somewhat random distribution. In this case, the compression algorithm is - tuned to compress them better. The effect of Z_FILTERED is to force more - Huffman coding and less string matching; it is somewhat intermediate - between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects - the compression ratio but not the correctness of the compressed output even - if it is not set appropriately. + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as + Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy + parameter only affects the compression ratio but not the correctness of the + compressed output even if it is not set appropriately. Z_FIXED prevents the + use of dynamic Huffman codes, allowing for a simpler decoder for special + applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid @@ -500,13 +580,16 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size in deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. + put at the end of the dictionary, not at the front. In addition, the + current implementation of deflate will use at most the window size minus + 262 bytes of the provided dictionary. - Upon return of this function, strm->adler is set to the Adler32 value + Upon return of this function, strm->adler is set to the adler32 value of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler32 value + which dictionary has been used by the compressor. (The adler32 value applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is @@ -565,6 +648,72 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, if strm->avail_out was zero. */ +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() + or deflateInit2(). This would be used to allocate an output buffer + for deflation in a single pass, and so would be called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the + bits leftover from a previous deflate stream when appending to it. As such, + this function can only be used for raw deflate, and must be used before the + first deflate() call after a deflateInit2() or deflateReset(). bits must be + less than or equal to 16, and that many of the least significant bits of + value will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + /* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); @@ -576,16 +725,36 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used - instead. If a compressed stream with a larger window size is given as - input, inflate() will return with the error code Z_DATA_ERROR instead of - trying to allocate a larger window. + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 - does not perform any decompression apart from reading the zlib header if - present: this will be done by inflate(). (So next_in and avail_in may be - modified, but next_out and avail_out are unchanged.) + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is + a crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg + is set to null if there is no error message. inflateInit2 does not perform + any decompression apart from reading the zlib header if present: this will + be done by inflate(). (So next_in and avail_in may be modified, but next_out + and avail_out are unchanged.) */ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, @@ -593,16 +762,19 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate - if this call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler32 value returned by this call of - inflate. The compressor and decompressor must use exactly the same - dictionary (see deflateSetDictionary). + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler32 value). inflateSetDictionary does not + expected one (incorrect adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ @@ -622,6 +794,22 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); until success or end of the input data. */ +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, @@ -632,6 +820,205 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); stream state was inconsistent (such as zalloc or state being NULL). */ +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK can be used to + force inflate() to return immediately after header processing is complete + and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When + any of extra, name, or comment are not Z_NULL and the respective field is + not present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not + be allocated, or Z_VERSION_ERROR if the version of the library does not + match the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free + the allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects + only the raw deflate stream to decompress. This is different from the + normal behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format + error in the deflate stream (in which case strm->msg is set to indicate the + nature of the error), or Z_STREAM_ERROR if the stream was not properly + initialized. In the case of Z_BUF_ERROR, an input or output error can be + distinguished using strm->next_in which will be Z_NULL only if in() returned + an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to + out() returning non-zero. (in() will always be called before out(), so + strm->next_in is assured to be defined if out() returns non-zero.) Note + that inflateBack() cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + /* utility functions */ @@ -648,8 +1035,8 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least 0.1% larger than - sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the + size of the destination buffer, which must be at least the value returned + by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. This function can be used to compress a whole file at once if the input file is mmap'ed. @@ -665,14 +1052,22 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before + a compress() or compress2() call to allocate the destination buffer. +*/ + ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* @@ -688,7 +1083,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. */ @@ -699,8 +1094,9 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h". (See the description - of deflateInit2 for more information about the strategy parameter.) + Huffman only compression as in "wb1h", or 'R' for run-length encoding + as in "wb1R". (See the description of deflateInit2 for more information + about the strategy parameter.) gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. @@ -740,7 +1136,7 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); end of file, -1 for error). */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - const voidp buf, unsigned len)); + voidpc buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes actually written @@ -751,7 +1147,13 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); /* Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). + uncompressed bytes actually written (0 in case of error). The number of + uncompressed bytes written is limited to 4095. The caller should assure that + this limit is not exceeded. If it is exceeded, then gzprintf() will return + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); @@ -782,6 +1184,16 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); or -1 in case of end of file or error. */ +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read again later. + Only one character of push-back is allowed. gzungetc() returns the + character pushed, or -1 on failure. gzungetc() will fail if a + character has been pushed but not read yet, or if c is -1. The pushed + character will be discarded if the stream is repositioned with gzseek() + or gzrewind(). +*/ + ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter @@ -832,6 +1244,12 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); input stream, otherwise zero. */ +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns 1 if file is being read directly without decompression, otherwise + zero. +*/ + ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file @@ -848,6 +1266,13 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); to get the exact error code. */ +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + /* checksum functions */ /* @@ -857,7 +1282,6 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); */ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); - /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is NULL, this function returns @@ -873,12 +1297,21 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); if (adler != original_adler) error(); */ +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); +/* + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* - Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value - for the crc. Pre- and post-conditioning (one's complement) is performed - within this function so it shouldn't be done by the application. + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is NULL, this function returns the required initial + value for the for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. Usage example: uLong crc = crc32(0L, Z_NULL, 0); @@ -889,6 +1322,16 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); if (crc != original_crc) error(); */ +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + +/* + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + /* various hacks, don't look :) */ @@ -905,6 +1348,10 @@ ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int stream_size)); ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); #define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit(strm) \ @@ -914,18 +1361,21 @@ ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, (strategy), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) -#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; /* hack for buggy compilers */ #endif -ZEXTERN const char * ZEXPORT zError OF((int err)); +ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); +ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table OF((void)); #ifdef __cplusplus } #endif -#endif /* _ZLIB_H */ +#endif /* ZLIB_H */ diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zutil.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.c similarity index 70% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/zutil.c rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.c index df38b31f022..2c1c33286f0 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zutil.c +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.c @@ -22,26 +22,20 @@ * have any questions. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ +/* @(#) $Id$ */ + #include "zutil.h" +#ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ - -#ifndef STDC -extern void exit OF((int)); #endif -const char *z_errmsg[10] = { +const char * const z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ @@ -59,6 +53,89 @@ const char * ZEXPORT zlibVersion() return ZLIB_VERSION; } +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch (sizeof(uInt)) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch (sizeof(uLong)) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch (sizeof(voidpf)) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch (sizeof(z_off_t)) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#ifdef STDC +# ifdef NO_vsnprintf + flags += 1L << 25; +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf + flags += 1L << 25; +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + #ifdef DEBUG # ifndef verbose @@ -83,6 +160,13 @@ const char * ZEXPORT zError(err) return ERR_MSG(err); } +#if defined(_WIN32_WCE) + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif #ifndef HAVE_MEMCPY @@ -121,11 +205,12 @@ void zmemzero(dest, len) } #endif + +#ifdef SYS16BIT + #ifdef __TURBOC__ -#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__) -/* Small and medium model in Turbo C are for now limited to near allocation - * with reduced MAX_WBITS and MAX_MEM_LEVEL - */ +/* Turbo C in 16-bit mode */ + # define MY_ZCALLOC /* Turbo C malloc() does not allow dynamic allocation of 64K bytes @@ -197,11 +282,11 @@ void zcfree (voidpf opaque, voidpf ptr) ptr = opaque; /* just to make some compilers happy */ Assert(0, "zcfree: ptr not found"); } -#endif + #endif /* __TURBOC__ */ -#if defined(M_I86) && !defined(__32BIT__) +#ifdef M_I86 /* Microsoft C in 16-bit mode */ # define MY_ZCALLOC @@ -223,12 +308,15 @@ void zcfree (voidpf opaque, voidpf ptr) _hfree(ptr); } -#endif /* MSC */ +#endif /* M_I86 */ + +#endif /* SYS16BIT */ #ifndef MY_ZCALLOC /* Any system without a special alloc function */ #ifndef STDC +extern voidp malloc OF((uInt size)); extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif @@ -239,7 +327,8 @@ voidpf zcalloc (opaque, items, size) unsigned size; { if (opaque) items += size - size; /* make compiler happy */ - return (voidpf)calloc(items, size); + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); } void zcfree (opaque, ptr) diff --git a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zutil.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.h similarity index 74% rename from jdk/src/share/native/java/util/zip/zlib-1.1.3/zutil.h rename to jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.h index 76de8bd4ee4..55e8f36db6e 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.1.3/zutil.h +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.h @@ -20,18 +20,10 @@ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. */ -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file and, per its terms, should not be removed: - * - * zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -40,20 +32,35 @@ subject to change. Applications should only use zlib.h. */ -#ifndef _Z_UTIL_H -#define _Z_UTIL_H +/* @(#) $Id$ */ +#ifndef ZUTIL_H +#define ZUTIL_H + +#define ZLIB_INTERNAL #include "zlib.h" #ifdef STDC -# include +# ifndef _WIN32_WCE +# include +# endif # include # include #endif #ifdef NO_ERRNO_H +# ifdef _WIN32_WCE + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. We rename it to + * avoid conflict with other libraries that use the same workaround. + */ +# define errno z_errno +# endif extern int errno; #else -# include +# ifndef _WIN32_WCE +# include +# endif #endif #ifndef local @@ -66,15 +73,8 @@ typedef uch FAR uchf; typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; -#ifdef NEVER -#ifndef _LP64 -typedef unsigned long ulg; -#else -typedef unsigned int ulg; -#endif -#endif -extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] @@ -110,7 +110,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ /* target dependencies */ -#ifdef MSDOS +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) # define OS_CODE 0x00 # if defined(__TURBOC__) || defined(__BORLANDC__) # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) @@ -118,19 +118,15 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ void _Cdecl farfree( void *block ); void *_Cdecl farmalloc( unsigned long nbytes ); # else -# include +# include # endif # else /* MSC or DJGPP */ # include # endif #endif -#ifdef OS2 -# define OS_CODE 0x06 -#endif - -#ifdef WIN32 /* Window 95 & Windows NT */ -# define OS_CODE 0x0b +#ifdef AMIGA +# define OS_CODE 0x01 #endif #if defined(VAXC) || defined(VMS) @@ -139,14 +135,17 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") #endif -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - #if defined(ATARI) || defined(atarist) # define OS_CODE 0x05 #endif +#ifdef OS2 +# define OS_CODE 0x06 +# ifdef M_I86 + #include +# endif +#endif + #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os @@ -158,24 +157,37 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0F -#endif - #ifdef TOPS20 # define OS_CODE 0x0a #endif +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + #if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) -# define fdopen(fd,type) _fdopen(fd,type) +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif #endif - - /* Common defaults */ + /* common defaults */ #ifndef OS_CODE # define OS_CODE 0x03 /* assume Unix */ @@ -187,11 +199,37 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ /* functions */ -#ifdef HAVE_STRERROR - extern char *strerror OF((int)); -# define zstrerror(errnum) strerror(errnum) -#else -# define zstrerror(errnum) "" +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# define vsnprintf _vsnprintf +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif +#ifdef VMS +# define NO_vsnprintf #endif #if defined(pyr) @@ -244,8 +282,6 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #endif -typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf, - uInt len)); voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void zcfree OF((voidpf opaque, voidpf ptr)); @@ -254,4 +290,4 @@ void zcfree OF((voidpf opaque, voidpf ptr)); #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} -#endif /* _Z_UTIL_H */ +#endif /* ZUTIL_H */ diff --git a/jdk/src/share/native/sun/awt/giflib/gifalloc.c b/jdk/src/share/native/sun/awt/giflib/gifalloc.c index 18462471ce7..aae33e2c652 100644 --- a/jdk/src/share/native/sun/awt/giflib/gifalloc.c +++ b/jdk/src/share/native/sun/awt/giflib/gifalloc.c @@ -88,6 +88,7 @@ MakeMapObject(int ColorCount, Object->Colors = (GifColorType *)calloc(ColorCount, sizeof(GifColorType)); if (Object->Colors == (GifColorType *) NULL) { + free(Object); return ((ColorMapObject *) NULL); } diff --git a/jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp b/jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp index 9885687655f..590f8a40892 100644 --- a/jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp @@ -37,6 +37,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const { // NOTE: For now, we'll just pick the first alternative... @@ -64,3 +66,5 @@ le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, c return 0; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h b/jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h index 03e63c88b12..9d0e3b550d1 100644 --- a/jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h +++ b/jdk/src/share/native/sun/font/layout/AlternateSubstSubtables.h @@ -32,12 +32,19 @@ #ifndef __ALTERNATESUBSTITUTIONSUBTABLES_H #define __ALTERNATESUBSTITUTIONSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEGlyphFilter.h" #include "OpenTypeTables.h" #include "GlyphSubstitutionTables.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct AlternateSetTable { le_uint16 glyphCount; @@ -52,4 +59,5 @@ struct AlternateSubstitutionSubtable : GlyphSubstitutionSubtable le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/AnchorTables.cpp b/jdk/src/share/native/sun/font/layout/AnchorTables.cpp index caaf349afd6..3d13377d76e 100644 --- a/jdk/src/share/native/sun/font/layout/AnchorTables.cpp +++ b/jdk/src/share/native/sun/font/layout/AnchorTables.cpp @@ -35,6 +35,8 @@ #include "AnchorTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + void AnchorTable::getAnchor(LEGlyphID glyphID, const LEFontInstance *fontInstance, LEPoint &anchor) const { @@ -124,3 +126,6 @@ void Format3AnchorTable::getAnchor(const LEFontInstance *fontInstance, LEPoint & fontInstance->pixelsToUnits(pixels, anchor); } + +U_NAMESPACE_END + diff --git a/jdk/src/share/native/sun/font/layout/AnchorTables.h b/jdk/src/share/native/sun/font/layout/AnchorTables.h index d34124ecd1e..c267793559e 100644 --- a/jdk/src/share/native/sun/font/layout/AnchorTables.h +++ b/jdk/src/share/native/sun/font/layout/AnchorTables.h @@ -32,10 +32,17 @@ #ifndef __ANCHORTABLES_H #define __ANCHORTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + struct AnchorTable { le_uint16 anchorFormat; @@ -66,5 +73,7 @@ struct Format3AnchorTable : AnchorTable void getAnchor(const LEFontInstance *fontInstance, LEPoint &anchor) const; }; - +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp index 85b73a1626a..4d055a9dac5 100644 --- a/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp @@ -49,23 +49,25 @@ #include "ArabicShaping.h" #include "CanonShaping.h" +U_NAMESPACE_BEGIN + le_bool CharSubstitutionFilter::accept(LEGlyphID glyph) const { return fFontInstance->canDisplay((LEUnicode) glyph); } -ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine( - const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, - le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable) +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine) + +ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable) { fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount); fFeatureOrder = TRUE; } -ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine( - const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) +ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags) { fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount); @@ -86,9 +88,8 @@ ArabicOpenTypeLayoutEngine::~ArabicOpenTypeLayoutEngine() // Input: characters // Output: characters, char indices, tags // Returns: output character count -le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -124,8 +125,8 @@ le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[] return count; } -void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success) +void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return; @@ -137,24 +138,20 @@ void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], l } if (fGPOSTable != NULL) { - OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, - reverse, glyphStorage, success); + OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success); } else if (fGDEFTable != NULL) { GDEFMarkFilter filter(fGDEFTable); adjustMarkGlyphs(glyphStorage, &filter, success); } else { - GlyphDefinitionTableHeader *gdefTable = - (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable; + GlyphDefinitionTableHeader *gdefTable = (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable; GDEFMarkFilter filter(gdefTable); adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success); } } -UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine( - const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) +UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags) { fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable; @@ -169,8 +166,7 @@ UnicodeArabicOpenTypeLayoutEngine::~UnicodeArabicOpenTypeLayoutEngine() } // "glyphs", "indices" -> glyphs, indices -le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing( - LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -193,17 +189,14 @@ le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing( glyphStorage.adoptCharIndicesArray(tempGlyphStorage); - ArabicOpenTypeLayoutEngine::mapCharsToGlyphs(tempChars, 0, tempGlyphCount, FALSE, - TRUE, glyphStorage, success); + ArabicOpenTypeLayoutEngine::mapCharsToGlyphs(tempChars, 0, tempGlyphCount, FALSE, TRUE, glyphStorage, success); LE_DELETE_ARRAY(tempChars); return tempGlyphCount; } -void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_bool reverse, le_bool /*mirror*/, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool /*mirror*/, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return; @@ -228,9 +221,8 @@ void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[] } } -void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_bool reverse, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return; @@ -245,3 +237,6 @@ void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode cha adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success); } + +U_NAMESPACE_END + diff --git a/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h b/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h index 45b0082b3df..b8bd02b0963 100644 --- a/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h +++ b/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h @@ -43,6 +43,8 @@ #include "GlyphDefinitionTables.h" #include "GlyphPositioningTables.h" +U_NAMESPACE_BEGIN + /** * This class implements OpenType layout for Arabic fonts. It overrides * the characerProcessing method to assign the correct OpenType feature @@ -71,8 +73,8 @@ public: * * @internal */ - ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, - le_int32 languageCode, le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); + ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); /** * This constructor is used when the font requires a "canned" GSUB table which can't be known @@ -87,8 +89,8 @@ public: * * @internal */ - ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, - le_int32 languageCode, le_int32 typoFlags); + ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags); /** * The destructor, virtual for correct polymorphic invocation. @@ -97,6 +99,20 @@ public: */ virtual ~ArabicOpenTypeLayoutEngine(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + protected: /** @@ -108,8 +124,7 @@ protected: * @param offset - the index of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - TRUE if the characters are in a - * right to left directional run + * @param rightToLeft - TRUE if the characters are in a right to left directional run * * Output parameters: * @param outChars - the output character arrayt @@ -121,9 +136,8 @@ protected: * * @internal */ - virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** * This method applies the GPOS table if it is present, otherwise it ensures that all vowel @@ -142,11 +156,9 @@ protected: * * @internal */ - virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); - // static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, - // le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success); + // static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success); }; @@ -178,8 +190,8 @@ public: * * @internal */ - UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); + UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags); /** * The destructor, virtual for correct polymorphic invocation. @@ -208,8 +220,7 @@ protected: * * @internal */ - virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, - LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** * This method copies the input characters into the output glyph index array, @@ -227,8 +238,7 @@ protected: * * @internal */ - virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, le_bool mirror, + virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** @@ -245,8 +255,9 @@ protected: * * @internal */ - virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/ArabicShaping.cpp b/jdk/src/share/native/sun/font/layout/ArabicShaping.cpp index 4e476cae37f..140a7a0824a 100644 --- a/jdk/src/share/native/sun/font/layout/ArabicShaping.cpp +++ b/jdk/src/share/native/sun/font/layout/ArabicShaping.cpp @@ -35,6 +35,8 @@ #include "LEGlyphStorage.h" #include "ClassDefinitionTables.h" +U_NAMESPACE_BEGIN + // This table maps Unicode joining types to // ShapeTypes. const ArabicShaping::ShapeType ArabicShaping::shapeTypes[] = @@ -102,9 +104,7 @@ ArabicShaping::ShapeType ArabicShaping::getShapeType(LEUnicode c) #define markFeatureMask 0x00040000UL #define mkmkFeatureMask 0x00020000UL -#define ISOL_FEATURES (isolFeatureMask | ligaFeatureMask | msetFeatureMask | \ - markFeatureMask | ccmpFeatureMask | rligFeatureMask | caltFeatureMask | \ - dligFeatureMask | cswhFeatureMask | cursFeatureMask | kernFeatureMask | mkmkFeatureMask) +#define ISOL_FEATURES (isolFeatureMask | ligaFeatureMask | msetFeatureMask | markFeatureMask | ccmpFeatureMask | rligFeatureMask | caltFeatureMask | dligFeatureMask | cswhFeatureMask | cursFeatureMask | kernFeatureMask | mkmkFeatureMask) #define SHAPE_MASK 0xF0000000UL @@ -226,3 +226,5 @@ void ArabicShaping::shape(const LEUnicode *chars, le_int32 offset, le_int32 char adjustTags(erout, 2, glyphStorage); } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ArabicShaping.h b/jdk/src/share/native/sun/font/layout/ArabicShaping.h index 517ccf056ab..b3b3f9064c8 100644 --- a/jdk/src/share/native/sun/font/layout/ArabicShaping.h +++ b/jdk/src/share/native/sun/font/layout/ArabicShaping.h @@ -32,12 +32,19 @@ #ifndef __ARABICSHAPING_H #define __ARABICSHAPING_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; -class ArabicShaping { +class ArabicShaping /* not : public UObject because all methods are static */ { public: // Joining types enum JoiningTypes @@ -74,8 +81,8 @@ public: typedef le_int32 ShapeType; - static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, - le_int32 charMax, le_bool rightToLeft, LEGlyphStorage &glyphStorage); + static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax, + le_bool rightToLeft, LEGlyphStorage &glyphStorage); static const FeatureMap *getFeatureMap(le_int32 &count); @@ -88,8 +95,8 @@ private: static const le_uint8 shapingTypeTable[]; static const ShapeType shapeTypes[]; - static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, - LEGlyphStorage &glyphStorage); + static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, LEGlyphStorage &glyphStorage); }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h b/jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h index d7b109e3463..ad097c8415d 100644 --- a/jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h +++ b/jdk/src/share/native/sun/font/layout/AttachmentPosnSubtables.h @@ -32,12 +32,19 @@ #ifndef __ATTACHMENTPOSITIONINGSUBTABLES_H #define __ATTACHMENTPOSITIONINGSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" #include "GlyphPositioningTables.h" #include "ValueRecords.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct AttachmentPositioningSubtable : GlyphPositioningSubtable { Offset baseCoverageTableOffset; @@ -55,4 +62,6 @@ inline le_int32 AttachmentPositioningSubtable::getBaseCoverage(LEGlyphID baseGly return getGlyphCoverage(baseCoverageTableOffset, baseGlyphID); } +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/CanonData.cpp b/jdk/src/share/native/sun/font/layout/CanonData.cpp index 1450b5c9d8f..e3d14ad1de2 100644 --- a/jdk/src/share/native/sun/font/layout/CanonData.cpp +++ b/jdk/src/share/native/sun/font/layout/CanonData.cpp @@ -36,6 +36,8 @@ #include "LETypes.h" #include "CanonShaping.h" +U_NAMESPACE_BEGIN + const le_uint8 CanonShaping::glyphSubstitutionTable[] = { 0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x01, 0x58, 0x02, 0x86, 0x00, 0x12, 0x61, 0x72, 0x61, 0x62, 0x00, 0x6E, 0x62, 0x65, 0x6E, 0x67, 0x00, 0x82, 0x63, 0x79, 0x72, 0x6C, 0x00, 0x8E, 0x64, 0x65, @@ -3773,3 +3775,5 @@ const le_uint8 CanonShaping::glyphDefinitionTable[] = { 0x00, 0xDC, 0xD1, 0x85, 0xD1, 0x89, 0x00, 0xE6, 0xD1, 0x8A, 0xD1, 0x8B, 0x00, 0xDC, 0xD1, 0xAA, 0xD1, 0xAD, 0x00, 0xE6, 0xD2, 0x42, 0xD2, 0x44, 0x00, 0xE6 }; + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/CanonShaping.cpp b/jdk/src/share/native/sun/font/layout/CanonShaping.cpp index 77aca5e3e2e..a95eddf72f2 100644 --- a/jdk/src/share/native/sun/font/layout/CanonShaping.cpp +++ b/jdk/src/share/native/sun/font/layout/CanonShaping.cpp @@ -35,8 +35,9 @@ #include "GlyphDefinitionTables.h" #include "ClassDefinitionTables.h" -void CanonShaping::sortMarks(le_int32 *indices, - const le_int32 *combiningClasses, le_int32 index, le_int32 limit) +U_NAMESPACE_BEGIN + +void CanonShaping::sortMarks(le_int32 *indices, const le_int32 *combiningClasses, le_int32 index, le_int32 limit) { for (le_int32 j = index + 1; j < limit; j += 1) { le_int32 i; @@ -55,13 +56,11 @@ void CanonShaping::sortMarks(le_int32 *indices, } } -void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, - le_bool rightToLeft, LEUnicode *outChars, LEGlyphStorage &glyphStorage) +void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft, + LEUnicode *outChars, LEGlyphStorage &glyphStorage) { - const GlyphDefinitionTableHeader *gdefTable = - (const GlyphDefinitionTableHeader *) glyphDefinitionTable; - const ClassDefinitionTable *classTable = - gdefTable->getMarkAttachClassDefinitionTable(); + const GlyphDefinitionTableHeader *gdefTable = (const GlyphDefinitionTableHeader *) glyphDefinitionTable; + const ClassDefinitionTable *classTable = gdefTable->getMarkAttachClassDefinitionTable(); le_int32 *combiningClasses = LE_NEW_ARRAY(le_int32, charCount); le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount); LEErrorCode status = LE_NO_ERROR; @@ -103,3 +102,5 @@ void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, LE_DELETE_ARRAY(indices); LE_DELETE_ARRAY(combiningClasses); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/CanonShaping.h b/jdk/src/share/native/sun/font/layout/CanonShaping.h index 16a6a593f36..4980dda8e1c 100644 --- a/jdk/src/share/native/sun/font/layout/CanonShaping.h +++ b/jdk/src/share/native/sun/font/layout/CanonShaping.h @@ -34,20 +34,22 @@ #include "LETypes.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; -class CanonShaping +class CanonShaping /* not : public UObject because all members are static */ { public: static const le_uint8 glyphSubstitutionTable[]; static const le_uint8 glyphDefinitionTable[]; - static void reorderMarks(const LEUnicode *inChars, le_int32 charCount, - le_bool rightToLeft, LEUnicode *outChars, LEGlyphStorage &glyphStorage); + static void reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft, + LEUnicode *outChars, LEGlyphStorage &glyphStorage); private: - static void sortMarks(le_int32 *indices, const le_int32 *combiningClasses, - le_int32 index, le_int32 limit); + static void sortMarks(le_int32 *indices, const le_int32 *combiningClasses, le_int32 index, le_int32 limit); }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/CharSubstitutionFilter.h b/jdk/src/share/native/sun/font/layout/CharSubstitutionFilter.h index 7d4dbacff17..c1514cda170 100644 --- a/jdk/src/share/native/sun/font/layout/CharSubstitutionFilter.h +++ b/jdk/src/share/native/sun/font/layout/CharSubstitutionFilter.h @@ -35,6 +35,8 @@ #include "LETypes.h" #include "LEGlyphFilter.h" +U_NAMESPACE_BEGIN + class LEFontInstance; /** @@ -43,7 +45,7 @@ class LEFontInstance; * * @internal */ -class CharSubstitutionFilter : public LEGlyphFilter +class CharSubstitutionFilter : public UMemory, public LEGlyphFilter { private: /** @@ -98,4 +100,7 @@ public: le_bool accept(LEGlyphID glyph) const; }; +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp b/jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp index 49d3cd1d2d0..2988a34123d 100644 --- a/jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp +++ b/jdk/src/share/native/sun/font/layout/ClassDefinitionTables.cpp @@ -35,6 +35,8 @@ #include "ClassDefinitionTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_int32 ClassDefinitionTable::getGlyphClass(LEGlyphID glyphID) const { switch(SWAPW(classFormat)) { @@ -139,3 +141,5 @@ le_bool ClassDefFormat2Table::hasGlyphClass(le_int32 glyphClass) const return FALSE; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h b/jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h index b1ac42450d4..cd728e048de 100644 --- a/jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h +++ b/jdk/src/share/native/sun/font/layout/ClassDefinitionTables.h @@ -32,9 +32,16 @@ #ifndef __CLASSDEFINITIONTABLES_H #define __CLASSDEFINITIONTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + struct ClassDefinitionTable { le_uint16 classFormat; @@ -69,4 +76,5 @@ struct ClassDefFormat2Table : ClassDefinitionTable le_bool hasGlyphClass(le_int32 glyphClass) const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/ContextualGlyphInsertion.h b/jdk/src/share/native/sun/font/layout/ContextualGlyphInsertion.h index 229322ca845..d0b2bc6b27a 100644 --- a/jdk/src/share/native/sun/font/layout/ContextualGlyphInsertion.h +++ b/jdk/src/share/native/sun/font/layout/ContextualGlyphInsertion.h @@ -32,12 +32,19 @@ #ifndef __CONTEXTUALGLYPHINSERTION_H #define __CONTEXTUALGLYPHINSERTION_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" #include "StateTables.h" #include "MorphTables.h" #include "MorphStateTables.h" +U_NAMESPACE_BEGIN + struct ContextualGlyphInsertionHeader : MorphStateTableHeader { }; @@ -60,4 +67,5 @@ struct LigatureSubstitutionStateEntry : StateEntry ByteOffset markedInsertionListOffset; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp b/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp index 7168598ba39..1d8dab5c2ca 100644 --- a/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp +++ b/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.cpp @@ -39,6 +39,10 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ContextualGlyphSubstitutionProcessor) + ContextualGlyphSubstitutionProcessor::ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader) : StateTableProcessor(morphSubtableHeader) { @@ -57,8 +61,7 @@ void ContextualGlyphSubstitutionProcessor::beginStateTable() markGlyph = 0; } -ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, - le_int32 &currGlyph, EntryTableIndex index) +ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index) { const ContextualGlyphSubstitutionStateEntry *entry = &entryTable[index]; ByteOffset newState = SWAPW(entry->newStateOffset); @@ -97,3 +100,5 @@ ByteOffset ContextualGlyphSubstitutionProcessor::processStateEntry(LEGlyphStorag void ContextualGlyphSubstitutionProcessor::endStateTable() { } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h b/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h index 0acd3d5b1c7..80b91d57d63 100644 --- a/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h +++ b/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc.h @@ -32,12 +32,19 @@ #ifndef __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H #define __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "StateTableProcessor.h" #include "ContextualGlyphSubstitution.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class ContextualGlyphSubstitutionProcessor : public StateTableProcessor @@ -52,6 +59,20 @@ public: ContextualGlyphSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader); virtual ~ContextualGlyphSubstitutionProcessor(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: ContextualGlyphSubstitutionProcessor(); @@ -62,6 +83,8 @@ protected: le_int32 markGlyph; const ContextualGlyphSubstitutionHeader *contextualGlyphSubstitutionHeader; + }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h b/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h index 137c9c2815b..550b048b21c 100644 --- a/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h +++ b/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h @@ -32,11 +32,18 @@ #ifndef __CONTEXTUALGLYPHSUBSTITUTION_H #define __CONTEXTUALGLYPHSUBSTITUTION_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" #include "StateTables.h" #include "MorphTables.h" +U_NAMESPACE_BEGIN + struct ContextualGlyphSubstitutionHeader : MorphStateTableHeader { ByteOffset substitutionTableOffset; @@ -55,4 +62,5 @@ struct ContextualGlyphSubstitutionStateEntry : StateEntry WordOffset currOffset; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp b/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp index e5ca63192bc..e40d9103305 100644 --- a/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp @@ -24,7 +24,6 @@ */ /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * */ @@ -39,6 +38,8 @@ #include "CoverageTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + /* NOTE: This could be optimized somewhat by keeping track of the previous sequenceIndex in the loop and doing next() @@ -350,7 +351,7 @@ le_uint32 ChainingContextualSubstitutionSubtable::process(const LookupProcessor // NOTE: This could be a #define, but that seems to confuse // the Visual Studio .NET 2003 compiler on the calls to the -// GlyphIterator constructor. It somehow can't decide if +// GlyphIterator constructor. It somehow can't decide if // emptyFeatureList matches an le_uint32 or an le_uint16... static const FeatureMask emptyFeatureList = 0x00000000UL; @@ -542,3 +543,5 @@ le_uint32 ChainingContextualSubstitutionFormat3Subtable::process(const LookupPro return 0; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h b/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h index aa1873ca126..35131e033f1 100644 --- a/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h +++ b/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.h @@ -32,6 +32,11 @@ #ifndef __CONTEXTUALSUBSTITUTIONSUBTABLES_H #define __CONTEXTUALSUBSTITUTIONSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" @@ -39,6 +44,8 @@ #include "GlyphIterator.h" #include "LookupProcessor.h" +U_NAMESPACE_BEGIN + struct SubstitutionLookupRecord { le_uint16 sequenceIndex; @@ -218,4 +225,5 @@ struct ChainingContextualSubstitutionFormat3Subtable le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/CoverageTables.cpp b/jdk/src/share/native/sun/font/layout/CoverageTables.cpp index f168196afb9..022300f8788 100644 --- a/jdk/src/share/native/sun/font/layout/CoverageTables.cpp +++ b/jdk/src/share/native/sun/font/layout/CoverageTables.cpp @@ -35,6 +35,8 @@ #include "CoverageTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_int32 CoverageTable::getGlyphCoverage(LEGlyphID glyphID) const { switch(SWAPW(coverageFormat)) @@ -106,3 +108,5 @@ le_int32 CoverageFormat2Table::getGlyphCoverage(LEGlyphID glyphID) const return startCoverageIndex + (ttGlyphID - firstInRange); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/CoverageTables.h b/jdk/src/share/native/sun/font/layout/CoverageTables.h index 900b3de1718..11e33598728 100644 --- a/jdk/src/share/native/sun/font/layout/CoverageTables.h +++ b/jdk/src/share/native/sun/font/layout/CoverageTables.h @@ -32,9 +32,16 @@ #ifndef __COVERAGETABLES_H #define __COVERAGETABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + struct CoverageTable { le_uint16 coverageFormat; @@ -58,5 +65,5 @@ struct CoverageFormat2Table : CoverageTable le_int32 getGlyphCoverage(LEGlyphID glyphID) const; }; - +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp b/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp index 712fa4c25d5..1fecc4b4e87 100644 --- a/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp @@ -37,6 +37,8 @@ #include "OpenTypeUtilities.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const { LEGlyphID glyphID = glyphIterator->getCurrGlyphID(); @@ -68,3 +70,5 @@ le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const return 1; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h b/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h index 9cd19492c18..27bfcf7a8fd 100644 --- a/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h +++ b/jdk/src/share/native/sun/font/layout/CursiveAttachmentSubtables.h @@ -32,10 +32,17 @@ #ifndef __CURSIVEATTACHMENTSUBTABLES_H #define __CURSIVEATTACHMENTSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" #include "GlyphPositioningTables.h" +U_NAMESPACE_BEGIN + class LEFontInstance; class GlyphIterator; @@ -53,4 +60,7 @@ struct CursiveAttachmentSubtable : GlyphPositioningSubtable le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; }; +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/DefaultCharMapper.h b/jdk/src/share/native/sun/font/layout/DefaultCharMapper.h index 99700addcf5..332aa745d46 100644 --- a/jdk/src/share/native/sun/font/layout/DefaultCharMapper.h +++ b/jdk/src/share/native/sun/font/layout/DefaultCharMapper.h @@ -24,7 +24,6 @@ */ /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * */ @@ -32,9 +31,16 @@ #ifndef __DEFAULTCHARMAPPER_H #define __DEFAULTCHARMAPPER_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" +U_NAMESPACE_BEGIN + /** * This class is an instance of LECharMapper which * implements control character filtering and bidi @@ -42,7 +48,7 @@ * * @see LECharMapper */ -class DefaultCharMapper : public LECharMapper +class DefaultCharMapper : public UMemory, public LECharMapper { private: le_bool fFilterControls; @@ -77,4 +83,5 @@ public: LEUnicode32 mapChar(LEUnicode32 ch) const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/DeviceTables.cpp b/jdk/src/share/native/sun/font/layout/DeviceTables.cpp index d44b3a5540d..3a223e988eb 100644 --- a/jdk/src/share/native/sun/font/layout/DeviceTables.cpp +++ b/jdk/src/share/native/sun/font/layout/DeviceTables.cpp @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved * @@ -34,6 +35,8 @@ #include "DeviceTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + const le_uint16 DeviceTable::fieldMasks[] = {0x0003, 0x000F, 0x00FF}; const le_uint16 DeviceTable::fieldSignBits[] = {0x0002, 0x0008, 0x0080}; const le_uint16 DeviceTable::fieldBits[] = { 2, 4, 8}; @@ -62,3 +65,5 @@ le_int16 DeviceTable::getAdjustment(le_uint16 ppem) const return result; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/DeviceTables.h b/jdk/src/share/native/sun/font/layout/DeviceTables.h index 038aeb52a01..80c54c9a632 100644 --- a/jdk/src/share/native/sun/font/layout/DeviceTables.h +++ b/jdk/src/share/native/sun/font/layout/DeviceTables.h @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * @@ -32,10 +33,15 @@ #ifndef __DEVICETABLES_H #define __DEVICETABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" -#include "GlyphIterator.h" -#include "GlyphPositionAdjustments.h" + +U_NAMESPACE_BEGIN struct DeviceTable { @@ -52,5 +58,7 @@ private: static const le_uint16 fieldBits[]; }; - +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp b/jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp index 44edea1b0ba..008e2e0e5bf 100644 --- a/jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/ExtensionSubtables.cpp @@ -25,7 +25,8 @@ /* * - * (C) Copyright IBM Corp. 2003 - All Rights Reserved + * + * (C) Copyright IBM Corp. 2002 - All Rights Reserved * */ @@ -37,6 +38,9 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + + // FIXME: should look at the format too... maybe have a sub-class for it? le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const @@ -52,3 +56,5 @@ le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_ return 0; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ExtensionSubtables.h b/jdk/src/share/native/sun/font/layout/ExtensionSubtables.h index 5aa2121235a..1dedad86b97 100644 --- a/jdk/src/share/native/sun/font/layout/ExtensionSubtables.h +++ b/jdk/src/share/native/sun/font/layout/ExtensionSubtables.h @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 2002-2003 - All Rights Reserved * @@ -32,12 +33,19 @@ #ifndef __EXTENSIONSUBTABLES_H #define __EXTENSIONSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" #include "GlyphSubstitutionTables.h" #include "LookupProcessor.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct ExtensionSubtable //: GlyphSubstitutionSubtable { le_uint16 substFormat; @@ -48,4 +56,5 @@ struct ExtensionSubtable //: GlyphSubstitutionSubtable GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/Features.cpp b/jdk/src/share/native/sun/font/layout/Features.cpp index 339f819656a..09c2deba101 100644 --- a/jdk/src/share/native/sun/font/layout/Features.cpp +++ b/jdk/src/share/native/sun/font/layout/Features.cpp @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved * @@ -35,6 +36,8 @@ #include "Features.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + const FeatureTable *FeatureListTable::getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const { if (featureIndex >= SWAPW(featureCount)) { @@ -79,3 +82,5 @@ const FeatureTable *FeatureListTable::getFeatureTable(LETag featureTag) const return 0; #endif } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/Features.h b/jdk/src/share/native/sun/font/layout/Features.h index 5673fd42683..d816b9e93ce 100644 --- a/jdk/src/share/native/sun/font/layout/Features.h +++ b/jdk/src/share/native/sun/font/layout/Features.h @@ -32,9 +32,16 @@ #ifndef __FEATURES_H #define __FEATURES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + struct FeatureRecord { ATag featureTag; @@ -53,9 +60,10 @@ struct FeatureListTable le_uint16 featureCount; FeatureRecord featureRecordArray[ANY_NUMBER]; - const FeatureTable *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const; + const FeatureTable *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const; const FeatureTable *getFeatureTable(LETag featureTag) const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp b/jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp index e326f902d87..3c4abf63386 100644 --- a/jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp +++ b/jdk/src/share/native/sun/font/layout/GDEFMarkFilter.cpp @@ -34,6 +34,8 @@ #include "GDEFMarkFilter.h" #include "GlyphDefinitionTables.h" +U_NAMESPACE_BEGIN + GDEFMarkFilter::GDEFMarkFilter(const GlyphDefinitionTableHeader *gdefTable) { classDefTable = gdefTable->getGlyphClassDefinitionTable(); @@ -50,3 +52,5 @@ le_bool GDEFMarkFilter::accept(LEGlyphID glyph) const return glyphClass == gcdMarkGlyph; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h b/jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h index 0658cb4f22f..ccd149e595a 100644 --- a/jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h +++ b/jdk/src/share/native/sun/font/layout/GDEFMarkFilter.h @@ -32,11 +32,18 @@ #ifndef __GDEFMARKFILTER__H #define __GDEFMARKFILTER__H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEGlyphFilter.h" #include "GlyphDefinitionTables.h" -class GDEFMarkFilter : public LEGlyphFilter +U_NAMESPACE_BEGIN + +class GDEFMarkFilter : public UMemory, public LEGlyphFilter { private: const GlyphClassDefinitionTable *classDefTable; @@ -51,5 +58,5 @@ public: virtual le_bool accept(LEGlyphID glyph) const; }; - +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp index a039cface1b..b449dc776b7 100644 --- a/jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/GXLayoutEngine.cpp @@ -23,6 +23,7 @@ * */ + /* * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved @@ -36,8 +37,11 @@ #include "MorphTables.h" -GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, - le_int32 languageCode, const MorphTableHeader *morphTable) +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine) + +GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable) : LayoutEngine(fontInstance, scriptCode, languageCode, 0), fMorphTable(morphTable) { // nothing else to do? @@ -49,9 +53,7 @@ GXLayoutEngine::~GXLayoutEngine() } // apply 'mort' table -le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, - LEErrorCode &success) +le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -74,9 +76,8 @@ le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, } // apply positional tables -void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_bool /*reverse*/, - LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success) +void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/, + LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success) { if (LE_FAILURE(success)) { return; @@ -89,3 +90,5 @@ void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], // FIXME: no positional processing yet... } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GXLayoutEngine.h b/jdk/src/share/native/sun/font/layout/GXLayoutEngine.h index e333c828b99..9e3a114d8f5 100644 --- a/jdk/src/share/native/sun/font/layout/GXLayoutEngine.h +++ b/jdk/src/share/native/sun/font/layout/GXLayoutEngine.h @@ -23,6 +23,7 @@ * */ + /* * * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved @@ -37,6 +38,8 @@ #include "MorphTables.h" +U_NAMESPACE_BEGIN + class LEFontInstance; class LEGlyphStorage; @@ -70,8 +73,7 @@ public: * * @internal */ - GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, - le_int32 languageCode, const MorphTableHeader *morphTable); + GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable); /** * The destructor, virtual for correct polymorphic invocation. @@ -80,6 +82,20 @@ public: */ virtual ~GXLayoutEngine(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + protected: /** @@ -99,10 +115,8 @@ protected: * @param offset - the index of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - TRUE if the text is in a - * right to left directional run - * @param glyphStorage - the glyph storage object. The glyph - * and char index arrays will be set. + * @param rightToLeft - TRUE if the text is in a right to left directional run + * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. * * Output parameters: * @param success - set to an error code if the operation fails @@ -111,8 +125,7 @@ protected: * * @internal */ - virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, + virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** @@ -120,16 +133,18 @@ protected: * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables. * * Input parameters: - * @param glyphStorage - the object holding the glyph storage. - * The positions will be updated as needed. + * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed. * * Output parameters: * @param success - set to an error code if the operation fails * * @internal */ - virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, + LEGlyphStorage &glyphStorage, LEErrorCode &success); + }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp b/jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp index 64ac003d71c..32d6b1ee2f7 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp +++ b/jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.cpp @@ -34,6 +34,8 @@ #include "GlyphDefinitionTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + const GlyphClassDefinitionTable *GlyphDefinitionTableHeader::getGlyphClassDefinitionTable() const { return (const GlyphClassDefinitionTable *) ((char *) this + SWAPW(glyphClassDefOffset)); @@ -53,3 +55,5 @@ const MarkAttachClassDefinitionTable *GlyphDefinitionTableHeader::getMarkAttachC { return (const MarkAttachClassDefinitionTable *) ((char *) this + SWAPW(MarkAttachClassDefOffset)); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h b/jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h index d95f197dd03..cea437254ef 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h +++ b/jdk/src/share/native/sun/font/layout/GlyphDefinitionTables.h @@ -32,10 +32,17 @@ #ifndef __GLYPHDEFINITIONTABLES_H #define __GLYPHDEFINITIONTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" #include "ClassDefinitionTables.h" +U_NAMESPACE_BEGIN + typedef ClassDefinitionTable GlyphClassDefinitionTable; enum GlyphClassDefinitions @@ -110,4 +117,5 @@ struct GlyphDefinitionTableHeader const MarkAttachClassDefinitionTable *getMarkAttachClassDefinitionTable() const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/GlyphIterator.cpp b/jdk/src/share/native/sun/font/layout/GlyphIterator.cpp index 525494dbab0..f6e7b23e566 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphIterator.cpp +++ b/jdk/src/share/native/sun/font/layout/GlyphIterator.cpp @@ -38,11 +38,10 @@ #include "Lookups.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN -GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, - GlyphPositionAdjustments *theGlyphPositionAdjustments, - le_bool rightToLeft, le_uint16 theLookupFlags, FeatureMask theFeatureMask, - const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader) +GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags, + FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader) : direction(1), position(-1), nextLimit(-1), prevLimit(-1), glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments), srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), @@ -262,8 +261,8 @@ void GlyphIterator::setCurrGlyphBaseOffset(le_int32 baseOffset) glyphPositionAdjustments->setBaseOffset(position, baseOffset); } -void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, - float yPlacementAdjust, float xAdvanceAdjust, float yAdvanceAdjust) +void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust, + float xAdvanceAdjust, float yAdvanceAdjust) { if (direction < 0) { if (position <= nextLimit || position >= prevLimit) { @@ -281,8 +280,8 @@ void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, glyphPositionAdjustments->adjustYAdvance(position, yAdvanceAdjust); } -void GlyphIterator::setCurrGlyphPositionAdjustment(float xPlacementAdjust, - float yPlacementAdjust, float xAdvanceAdjust, float yAdvanceAdjust) +void GlyphIterator::setCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust, + float xAdvanceAdjust, float yAdvanceAdjust) { if (direction < 0) { if (position <= nextLimit || position >= prevLimit) { @@ -484,10 +483,11 @@ le_bool GlyphIterator::findMark2Glyph() do { newPosition -= direction; - } while (newPosition != prevLimit && glyphStorage[newPosition] != 0xFFFE && - filterGlyph(newPosition)); + } while (newPosition != prevLimit && glyphStorage[newPosition] != 0xFFFE && filterGlyph(newPosition)); position = newPosition; return position != prevLimit; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GlyphIterator.h b/jdk/src/share/native/sun/font/layout/GlyphIterator.h index e15f0f122a5..29338302ad3 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphIterator.h +++ b/jdk/src/share/native/sun/font/layout/GlyphIterator.h @@ -32,26 +32,24 @@ #ifndef __GLYPHITERATOR_H #define __GLYPHITERATOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" #include "GlyphDefinitionTables.h" -struct InsertionRecord -{ - InsertionRecord *next; - le_int32 position; - le_int32 count; - LEGlyphID glyphs[ANY_NUMBER]; -}; +U_NAMESPACE_BEGIN class LEGlyphStorage; class GlyphPositionAdjustments; -class GlyphIterator { +class GlyphIterator : public UMemory { public: - GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, - le_bool rightToLeft, le_uint16 theLookupFlags, FeatureMask theFeatureMask, - const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader); + GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags, + FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader); GlyphIterator(GlyphIterator &that); @@ -122,4 +120,5 @@ private: GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp b/jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp index 8b86a3ed751..1f35becc0e3 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp +++ b/jdk/src/share/native/sun/font/layout/GlyphLookupTables.cpp @@ -35,6 +35,8 @@ #include "GlyphLookupTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_bool GlyphLookupTableHeader::coversScript(LETag scriptTag) const { const ScriptListTable *scriptListTable = (const ScriptListTable *) ((char *)this + SWAPW(scriptListOffset)); @@ -51,3 +53,5 @@ le_bool GlyphLookupTableHeader::coversScriptAndLanguage(LETag scriptTag, LETag l // Note: don't have to SWAPW langSysTable->featureCount to check for non-zero. return langSysTable != NULL && langSysTable->featureCount != 0; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GlyphLookupTables.h b/jdk/src/share/native/sun/font/layout/GlyphLookupTables.h index 06729ae00d7..a44bed77a43 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphLookupTables.h +++ b/jdk/src/share/native/sun/font/layout/GlyphLookupTables.h @@ -32,9 +32,16 @@ #ifndef __GLYPHLOOKUPTABLES_H #define __GLYPHLOOKUPTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + struct GlyphLookupTableHeader { fixed32 version; @@ -46,4 +53,7 @@ struct GlyphLookupTableHeader le_bool coversScriptAndLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const; }; +U_NAMESPACE_END + #endif + diff --git a/jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp b/jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp index 533f961ad0f..e9a17e08f2c 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp +++ b/jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.cpp @@ -34,6 +34,8 @@ #include "LEGlyphStorage.h" #include "LEFontInstance.h" +U_NAMESPACE_BEGIN + #define CHECK_ALLOCATE_ARRAY(array, type, size) \ if (array == NULL) { \ array = (type *) new type[size]; \ @@ -185,3 +187,5 @@ LEPoint *GlyphPositionAdjustments::EntryExitPoint::getExitPoint(LEPoint &exitPoi return NULL; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.h b/jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.h index 6523b0bd0b5..722af2fdf13 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.h +++ b/jdk/src/share/native/sun/font/layout/GlyphPositionAdjustments.h @@ -32,16 +32,23 @@ #ifndef __GLYPHPOSITIONADJUSTMENTS_H #define __GLYPHPOSITIONADJUSTMENTS_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class LEFontInstance; -class GlyphPositionAdjustments +class GlyphPositionAdjustments : public UMemory { private: - class Adjustment { + class Adjustment : public UMemory { public: inline Adjustment(); @@ -78,7 +85,7 @@ private: // allow copying of this class because all of its fields are simple types }; - class EntryExitPoint + class EntryExitPoint : public UMemory { public: inline EntryExitPoint(); @@ -144,14 +151,11 @@ public: inline void adjustXAdvance(le_int32 index, float xAdjustment); inline void adjustYAdvance(le_int32 index, float yAdjustment); - void setEntryPoint(le_int32 index, LEPoint &newEntryPoint, - le_bool baselineIsLogicalEnd); - void setExitPoint(le_int32 index, LEPoint &newExitPoint, - le_bool baselineIsLogicalEnd); + void setEntryPoint(le_int32 index, LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd); + void setExitPoint(le_int32 index, LEPoint &newExitPoint, le_bool baselineIsLogicalEnd); void setCursiveGlyph(le_int32 index, le_bool baselineIsLogicalEnd); - void applyCursiveAdjustments(LEGlyphStorage &glyphStorage, le_bool rightToLeft, - const LEFontInstance *fontInstance); + void applyCursiveAdjustments(LEGlyphStorage &glyphStorage, le_bool rightToLeft, const LEFontInstance *fontInstance); }; inline GlyphPositionAdjustments::Adjustment::Adjustment() @@ -160,10 +164,8 @@ inline GlyphPositionAdjustments::Adjustment::Adjustment() // nothing else to do! } -inline GlyphPositionAdjustments::Adjustment::Adjustment(float xPlace, float yPlace, - float xAdv, float yAdv, le_int32 baseOff) - : xPlacement(xPlace), yPlacement(yPlace), xAdvance(xAdv), yAdvance(yAdv), - baseOffset(baseOff) +inline GlyphPositionAdjustments::Adjustment::Adjustment(float xPlace, float yPlace, float xAdv, float yAdv, le_int32 baseOff) + : xPlacement(xPlace), yPlacement(yPlace), xAdvance(xAdv), yAdvance(yAdv), baseOffset(baseOff) { // nothing else to do! } @@ -246,7 +248,7 @@ inline void GlyphPositionAdjustments::Adjustment::adjustYAdvance(float yAdjustme inline GlyphPositionAdjustments::EntryExitPoint::EntryExitPoint() : fFlags(0) { - fEntryPoint.fX = fEntryPoint.fY = fExitPoint.fX = fEntryPoint.fY = 0; + fEntryPoint.fX = fEntryPoint.fY = fExitPoint.fX = fExitPoint.fY = 0; } inline GlyphPositionAdjustments::EntryExitPoint::~EntryExitPoint() @@ -264,12 +266,10 @@ inline le_bool GlyphPositionAdjustments::EntryExitPoint::baselineIsLogicalEnd() return (fFlags & EEF_BASELINE_IS_LOGICAL_END) != 0; } -inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint( - LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd) +inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd) { if (baselineIsLogicalEnd) { - fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH | - EEF_BASELINE_IS_LOGICAL_END); + fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END); } else { fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH); } @@ -277,12 +277,10 @@ inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint( fEntryPoint = newEntryPoint; } -inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint( - LEPoint &newExitPoint, le_bool baselineIsLogicalEnd) +inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint(LEPoint &newExitPoint, le_bool baselineIsLogicalEnd) { if (baselineIsLogicalEnd) { - fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH | - EEF_BASELINE_IS_LOGICAL_END); + fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END); } else { fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH); } @@ -290,8 +288,7 @@ inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint( fExitPoint = newExitPoint; } -inline void GlyphPositionAdjustments::EntryExitPoint::setCursiveGlyph( - le_bool baselineIsLogicalEnd) +inline void GlyphPositionAdjustments::EntryExitPoint::setCursiveGlyph(le_bool baselineIsLogicalEnd) { if (baselineIsLogicalEnd) { fFlags |= (EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END); @@ -386,4 +383,5 @@ inline le_bool GlyphPositionAdjustments::hasCursiveGlyphs() const return fEntryExitPoints != NULL; } +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp b/jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp index 244e77e71e0..0253aa04ada 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp +++ b/jdk/src/share/native/sun/font/layout/GlyphPositioningTables.cpp @@ -24,7 +24,6 @@ */ /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * */ @@ -40,18 +39,18 @@ #include "LEGlyphStorage.h" #include "GlyphPositionAdjustments.h" -void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage, - GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft, - LETag scriptTag, LETag languageTag, - const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, - const LEFontInstance *fontInstance, - const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const -{ - GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, - featureMapCount, featureOrder); +U_NAMESPACE_BEGIN - processor.process(glyphStorage, glyphPositionAdjustments, rightToLeft, - glyphDefinitionTableHeader, fontInstance); +void GlyphPositioningTableHeader::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft, + LETag scriptTag, LETag languageTag, + const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, + const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const +{ + GlyphPositioningLookupProcessor processor(this, scriptTag, languageTag, featureMap, featureMapCount, featureOrder); + + processor.process(glyphStorage, glyphPositionAdjustments, rightToLeft, glyphDefinitionTableHeader, fontInstance); glyphPositionAdjustments->applyCursiveAdjustments(glyphStorage, rightToLeft, fontInstance); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h b/jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h index fbe124eadcd..346759bb466 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h +++ b/jdk/src/share/native/sun/font/layout/GlyphPositioningTables.h @@ -24,7 +24,6 @@ */ /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * */ @@ -32,11 +31,18 @@ #ifndef __GLYPHPOSITIONINGTABLES_H #define __GLYPHPOSITIONINGTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" #include "Lookups.h" #include "GlyphLookupTables.h" +U_NAMESPACE_BEGIN + class LEFontInstance; class LEGlyphStorage; class LEGlyphFilter; @@ -45,12 +51,10 @@ struct GlyphDefinitionTableHeader; struct GlyphPositioningTableHeader : public GlyphLookupTableHeader { - void process(LEGlyphStorage &glyphStorage, - GlyphPositionAdjustments *glyphPositionAdjustments, + void process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, le_bool rightToLeft, LETag scriptTag, LETag languageTag, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, - const LEFontInstance *fontInstance, - const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const; + const LEFontInstance *fontInstance, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const; }; enum GlyphPositioningSubtableTypes @@ -68,4 +72,5 @@ enum GlyphPositioningSubtableTypes typedef LookupSubtable GlyphPositioningSubtable; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp b/jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp index 967529a2ed6..46b03504a42 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp +++ b/jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp @@ -24,7 +24,6 @@ */ /* - * * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved * */ @@ -50,6 +49,8 @@ #include "GlyphPosnLookupProc.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + // Aside from the names, the contextual positioning subtables are // the same as the contextual substitution subtables. typedef ContextualSubstitutionSubtable ContextualPositioningSubtable; @@ -57,8 +58,7 @@ typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubt GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor( const GlyphPositioningTableHeader *glyphPositioningTableHeader, - LETag scriptTag, LETag languageTag, - const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) + LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) : LookupProcessor( (char *) glyphPositioningTableHeader, SWAPW(glyphPositioningTableHeader->scriptListOffset), @@ -166,3 +166,5 @@ le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *l GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor() { } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h b/jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h index 99ac45f7324..742672ac1b6 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h +++ b/jdk/src/share/native/sun/font/layout/GlyphPosnLookupProc.h @@ -24,7 +24,6 @@ */ /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * */ @@ -32,6 +31,11 @@ #ifndef __GLYPHPOSITIONINGLOOKUPPROCESSOR_H #define __GLYPHPOSITIONINGLOOKUPPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" @@ -42,12 +46,13 @@ #include "GlyphIterator.h" #include "LookupProcessor.h" +U_NAMESPACE_BEGIN + class GlyphPositioningLookupProcessor : public LookupProcessor { public: GlyphPositioningLookupProcessor(const GlyphPositioningTableHeader *glyphPositioningTableHeader, - LETag scriptTag, LETag languageTag, - const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder); + LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder); virtual ~GlyphPositioningLookupProcessor(); @@ -63,4 +68,5 @@ private: GlyphPositioningLookupProcessor &operator=(const GlyphPositioningLookupProcessor &other); // forbid copying of this class }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp b/jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp index 0b65f72c081..29c0018651a 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp +++ b/jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp @@ -48,17 +48,17 @@ #include "GlyphSubstLookupProc.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor( const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader, - LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, - const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) + LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) : LookupProcessor( (char *) glyphSubstitutionTableHeader, SWAPW(glyphSubstitutionTableHeader->scriptListOffset), SWAPW(glyphSubstitutionTableHeader->featureListOffset), SWAPW(glyphSubstitutionTableHeader->lookupListOffset), - scriptTag, languageTag, featureMap, featureMapCount, featureOrder) - , fFilter(filter) + scriptTag, languageTag, featureMap, featureMapCount, featureOrder), fFilter(filter) { // anything? } @@ -143,3 +143,5 @@ le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable * GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor() { } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h b/jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h index 2d9df0cb209..32b02efbc06 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h +++ b/jdk/src/share/native/sun/font/layout/GlyphSubstLookupProc.h @@ -24,7 +24,6 @@ */ /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * */ @@ -32,6 +31,11 @@ #ifndef __GLYPHSUBSTITUTIONLOOKUPPROCESSOR_H #define __GLYPHSUBSTITUTIONLOOKUPPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEGlyphFilter.h" #include "LEFontInstance.h" @@ -43,12 +47,13 @@ #include "GlyphIterator.h" #include "LookupProcessor.h" +U_NAMESPACE_BEGIN + class GlyphSubstitutionLookupProcessor : public LookupProcessor { public: GlyphSubstitutionLookupProcessor(const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader, - LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, - const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder); + LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder); virtual ~GlyphSubstitutionLookupProcessor(); @@ -65,4 +70,5 @@ private: GlyphSubstitutionLookupProcessor &operator=(const GlyphSubstitutionLookupProcessor &other); // forbid copying of this class }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp b/jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp index ef2d8002217..92455414722 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp +++ b/jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.cpp @@ -40,14 +40,15 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" -le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage, - le_bool rightToLeft, LETag scriptTag, LETag languageTag, - const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, - const LEGlyphFilter *filter, const FeatureMap *featureMap, - le_int32 featureMapCount, le_bool featureOrder) const +U_NAMESPACE_BEGIN + +le_int32 GlyphSubstitutionTableHeader::process(LEGlyphStorage &glyphStorage, le_bool rightToLeft, LETag scriptTag, LETag languageTag, + const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, + const LEGlyphFilter *filter, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const { - GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, - featureMapCount, featureOrder); + GlyphSubstitutionLookupProcessor processor(this, scriptTag, languageTag, filter, featureMap, featureMapCount, featureOrder); return processor.process(glyphStorage, NULL, rightToLeft, glyphDefinitionTableHeader, NULL); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h b/jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h index 0a56df14d5e..556dc06cc88 100644 --- a/jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h +++ b/jdk/src/share/native/sun/font/layout/GlyphSubstitutionTables.h @@ -32,22 +32,27 @@ #ifndef __GLYPHSUBSTITUTIONTABLES_H #define __GLYPHSUBSTITUTIONTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" #include "Lookups.h" #include "GlyphLookupTables.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class LEGlyphFilter; struct GlyphDefinitionTableHeader; struct GlyphSubstitutionTableHeader : public GlyphLookupTableHeader { - le_int32 process(LEGlyphStorage &glyphStorage, - le_bool rightToLeft, LETag scriptTag, LETag languageTag, - const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, - const LEGlyphFilter *filter, const FeatureMap *featureMap, - le_int32 featureMapCount, le_bool featureOrder) const; + le_int32 process(LEGlyphStorage &glyphStorage, le_bool rightToLeft, LETag scriptTag, LETag languageTag, + const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEGlyphFilter *filter, + const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder) const; }; enum GlyphSubstitutionSubtableTypes @@ -64,4 +69,5 @@ enum GlyphSubstitutionSubtableTypes typedef LookupSubtable GlyphSubstitutionSubtable; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp index d5573e021d3..5e7e93638cb 100644 --- a/jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/HanLayoutEngine.cpp @@ -24,7 +24,6 @@ */ /* - * * HanLayoutEngine.cpp: OpenType processing for Han fonts. * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved. @@ -41,6 +40,10 @@ #include "LEGlyphStorage.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(HanOpenTypeLayoutEngine) + #define loclFeatureTag LE_LOCL_FEATURE_TAG #define smplFeatureTag LE_SMPL_FEATURE_TAG #define tradFeatureTag LE_TRAD_FEATURE_TAG @@ -60,9 +63,8 @@ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap); #define features (loclFeatureMask) -HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, - const GlyphSubstitutionTableHeader *gsubTable) +HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable) { fFeatureMap = featureMap; @@ -74,9 +76,8 @@ HanOpenTypeLayoutEngine::~HanOpenTypeLayoutEngine() // nothing to do } -le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/, - LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/, + LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -104,3 +105,5 @@ le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], return count; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/HanLayoutEngine.h b/jdk/src/share/native/sun/font/layout/HanLayoutEngine.h index d14c17f76ed..3967be739cf 100644 --- a/jdk/src/share/native/sun/font/layout/HanLayoutEngine.h +++ b/jdk/src/share/native/sun/font/layout/HanLayoutEngine.h @@ -23,8 +23,8 @@ * */ + /* - * * HanLayoutEngine.h: OpenType processing for Han fonts. * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved. @@ -40,6 +40,8 @@ #include "GlyphSubstitutionTables.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; /** @@ -69,9 +71,8 @@ public: * * @internal */ - HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, - le_int32 languageCode, - le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); + HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); /** @@ -81,6 +82,20 @@ public: */ virtual ~HanOpenTypeLayoutEngine(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + protected: /** @@ -92,10 +107,8 @@ protected: * @param offset - the index of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - TRUE if the characters are in a - * right to left directional run - * @param glyphStorage - the object holding the glyph storage. The char - * index and auxillary data arrays will be set. + * @param rightToLeft - TRUE if the characters are in a right to left directional run + * @param glyphStorage - the object holding the glyph storage. The char index and auxillary data arrays will be set. * * Output parameters: * @param outChars - the output character arrayt @@ -107,9 +120,10 @@ protected: * * @internal */ - virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); + }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/IndicClassTables.cpp b/jdk/src/share/native/sun/font/layout/IndicClassTables.cpp index d606b255d7c..3a768313354 100644 --- a/jdk/src/share/native/sun/font/layout/IndicClassTables.cpp +++ b/jdk/src/share/native/sun/font/layout/IndicClassTables.cpp @@ -35,6 +35,8 @@ #include "OpenTypeUtilities.h" #include "IndicReordering.h" +U_NAMESPACE_BEGIN + // Split matra table indices #define _x1 (1 << CF_INDEX_SHIFT) #define _x2 (2 << CF_INDEX_SHIFT) @@ -279,7 +281,7 @@ static const IndicClassTable kndaClassTable = {0x0C80, 0x0CEF, 4, KNDA_SCRIPT_FL static const IndicClassTable mlymClassTable = {0x0D00, 0x0D6F, 3, MLYM_SCRIPT_FLAGS, mlymCharClasses, mlymSplitTable}; -static const IndicClassTable sinhClassTable = {0x0D80, 0x0DF4, 3, SINH_SCRIPT_FLAGS, sinhCharClasses, sinhSplitTable}; +static const IndicClassTable sinhClassTable = {0x0D80, 0x0DF4, 4, SINH_SCRIPT_FLAGS, sinhCharClasses, sinhSplitTable}; // // IndicClassTable addresses @@ -385,3 +387,5 @@ le_int32 IndicReordering::getWorstCaseExpansion(le_int32 scriptCode) return classTable->getWorstCaseExpansion(); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp index df88840dc6a..bc75c9e1da1 100644 --- a/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp @@ -45,20 +45,20 @@ #include "IndicReordering.h" -IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, - const GlyphSubstitutionTableHeader *gsubTable) - : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable), - fMPreFixups(NULL) +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicOpenTypeLayoutEngine) + +IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable) + : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable), fMPreFixups(NULL) { fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount); fFeatureOrder = TRUE; } -IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) - : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), - fMPreFixups(NULL) +IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) + : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fMPreFixups(NULL) { fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount); fFeatureOrder = TRUE; @@ -71,9 +71,8 @@ IndicOpenTypeLayoutEngine::~IndicOpenTypeLayoutEngine() // Input: characters, tags // Output: glyphs, char indices -le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -84,8 +83,7 @@ le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], return 0; } - le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, - rightToLeft, glyphStorage, success); + le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, rightToLeft, glyphStorage, success); if (LE_FAILURE(success)) { return 0; @@ -99,9 +97,8 @@ le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], // Input: characters // Output: characters, char indices, tags // Returns: output character count -le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -131,9 +128,10 @@ le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], // NOTE: assumes this allocates featureTags... // (probably better than doing the worst case stuff here...) - le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, - outChars, glyphStorage, &fMPreFixups); - glyphStorage.adoptGlyphCount(outCharCount); + le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups); + glyphStorage.adoptGlyphCount(outCharCount); return outCharCount; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h b/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h index bcaf528555b..c36fbcec992 100644 --- a/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h +++ b/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h @@ -43,6 +43,8 @@ #include "GlyphDefinitionTables.h" #include "GlyphPositioningTables.h" +U_NAMESPACE_BEGIN + class MPreFixups; class LEGlyphStorage; @@ -77,9 +79,8 @@ public: * * @internal */ - IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, - le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); + IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); /** * This constructor is used when the font requires a "canned" GSUB table which can't be known @@ -94,8 +95,8 @@ public: * * @internal */ - IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); + IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags); /** * The destructor, virtual for correct polymorphic invocation. @@ -104,6 +105,20 @@ public: */ virtual ~IndicOpenTypeLayoutEngine(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + protected: /** @@ -117,10 +132,9 @@ protected: * @param offset - the index of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - TRUE if the characters are in a - * right to left directional run - * @param glyphStorage - the glyph storage object. The glyph and character - * index arrays will be set. The auxillary data array will be set to the feature tags. + * @param rightToLeft - TRUE if the characters are in a right to left directional run + * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set. + * the auxillary data array will be set to the feature tags. * * Output parameters: * @param success - set to an error code if the operation fails @@ -129,9 +143,8 @@ protected: * * @internal */ - virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** * This method does character to glyph mapping, applies the GSUB table and applies @@ -147,11 +160,9 @@ protected: * @param offset - the index of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - TRUE if the characters are in a - * right to left directional run + * @param rightToLeft - TRUE if the characters are in a right to left directional run * @param featureTags - the feature tag array - * @param glyphStorage - the glyph storage object. The glyph and char - * index arrays will be set. + * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. * * Output parameters: * @param success - set to an error code if the operation fails @@ -163,12 +174,14 @@ protected: * * @internal */ - virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, - LEErrorCode &success); + virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEGlyphStorage &glyphStorage, LEErrorCode &success); private: + MPreFixups *fMPreFixups; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/IndicRearrangement.h b/jdk/src/share/native/sun/font/layout/IndicRearrangement.h index 1791264a3de..bb7a54acc32 100644 --- a/jdk/src/share/native/sun/font/layout/IndicRearrangement.h +++ b/jdk/src/share/native/sun/font/layout/IndicRearrangement.h @@ -32,12 +32,19 @@ #ifndef __INDICREARRANGEMENT_H #define __INDICREARRANGEMENT_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" #include "StateTables.h" #include "MorphTables.h" #include "MorphStateTables.h" +U_NAMESPACE_BEGIN + struct IndicRearrangementSubtableHeader : MorphStateTableHeader { }; @@ -78,4 +85,6 @@ struct IndicRearrangementStateEntry : StateEntry { }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp b/jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp index a1c23319e9e..c86aa72b116 100644 --- a/jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.cpp @@ -39,6 +39,10 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicRearrangementProcessor) + IndicRearrangementProcessor::IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader) : StateTableProcessor(morphSubtableHeader) { @@ -56,8 +60,7 @@ void IndicRearrangementProcessor::beginStateTable() lastGlyph = 0; } -ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, - le_int32 &currGlyph, EntryTableIndex index) +ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index) { const IndicRearrangementStateEntry *entry = &entryTable[index]; ByteOffset newState = SWAPW(entry->newStateOffset); @@ -416,3 +419,5 @@ void IndicRearrangementProcessor::doRearrangementAction(LEGlyphStorage &glyphSto break; } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h b/jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h index b12b1950cf0..be78b9fe1a4 100644 --- a/jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h +++ b/jdk/src/share/native/sun/font/layout/IndicRearrangementProcessor.h @@ -32,12 +32,19 @@ #ifndef __INDICREARRANGEMENTPROCESSOR_H #define __INDICREARRANGEMENTPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "StateTableProcessor.h" #include "IndicRearrangement.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class IndicRearrangementProcessor : public StateTableProcessor @@ -54,12 +61,28 @@ public: IndicRearrangementProcessor(const MorphSubtableHeader *morphSubtableHeader); virtual ~IndicRearrangementProcessor(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + protected: le_int32 firstGlyph; le_int32 lastGlyph; const IndicRearrangementStateEntry *entryTable; const IndicRearrangementSubtableHeader *indicRearrangementSubtableHeader; + }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/IndicReordering.cpp b/jdk/src/share/native/sun/font/layout/IndicReordering.cpp index 296c5da1c13..ba48638ffa9 100644 --- a/jdk/src/share/native/sun/font/layout/IndicReordering.cpp +++ b/jdk/src/share/native/sun/font/layout/IndicReordering.cpp @@ -36,6 +36,8 @@ #include "LEGlyphStorage.h" #include "MPreFixups.h" +U_NAMESPACE_BEGIN + #define initFeatureTag LE_INIT_FEATURE_TAG #define nuktFeatureTag LE_NUKT_FEATURE_TAG #define akhnFeatureTag LE_AKHN_FEATURE_TAG @@ -71,7 +73,7 @@ #define distFeatureMask 0x00020000UL #define initFeatureMask 0x00010000UL -class ReorderingOutput { +class ReorderingOutput : public UMemory { private: le_int32 fOutIndex; LEUnicode *fOutChars; @@ -187,8 +189,7 @@ public: fOutIndex += 1; } - le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex, - FeatureMask matraFeatures, le_bool wordStart) + le_bool noteMatra(const IndicClassTable *classTable, LEUnicode matra, le_uint32 matraIndex, FeatureMask matraFeatures, le_bool wordStart) { IndicClassTable::CharClass matraClass = classTable->getCharClass(matra); @@ -219,13 +220,12 @@ public: return FALSE; } - void noteVowelModifier(const IndicClassTable *classTable, LEUnicode vowelModifier, - le_uint32 vowelModifierIndex, FeatureMask vowelModifierFeatures) + void noteVowelModifier(const IndicClassTable *classTable, LEUnicode vowelModifier, le_uint32 vowelModifierIndex, FeatureMask vowelModifierFeatures) { IndicClassTable::CharClass vmClass = classTable->getCharClass(vowelModifier); fVMIndex = vowelModifierIndex; - fVMFeatures = vowelModifierFeatures; + fVMFeatures = vowelModifierFeatures; if (IndicClassTable::isVowelModifier(vmClass)) { switch (vmClass & CF_POS_MASK) { @@ -244,13 +244,12 @@ public: } } - void noteStressMark(const IndicClassTable *classTable, LEUnicode stressMark, - le_uint32 stressMarkIndex, FeatureMask stressMarkFeatures) + void noteStressMark(const IndicClassTable *classTable, LEUnicode stressMark, le_uint32 stressMarkIndex, FeatureMask stressMarkFeatures) { IndicClassTable::CharClass smClass = classTable->getCharClass(stressMark); fSMIndex = stressMarkIndex; - fSMFeatures = stressMarkFeatures; + fSMFeatures = stressMarkFeatures; if (IndicClassTable::isStressMark(smClass)) { switch (smClass & CF_POS_MASK) { @@ -360,9 +359,7 @@ enum }; // TODO: Find better names for these! -#define tagArray4 (nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | \ - blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | \ - blwmFeatureMask | abvmFeatureMask | distFeatureMask) +#define tagArray4 (nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask) #define tagArray3 (pstfFeatureMask | tagArray4) #define tagArray2 (halfFeatureMask | tagArray3) #define tagArray1 (blwfFeatureMask | tagArray2) @@ -415,8 +412,7 @@ const FeatureMap *IndicReordering::getFeatureMap(le_int32 &count) return featureMap; } -le_int32 IndicReordering::findSyllable(const IndicClassTable *classTable, - const LEUnicode *chars, le_int32 prev, le_int32 charCount) +le_int32 IndicReordering::findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount) { le_int32 cursor = prev; le_int8 state = 0; @@ -752,3 +748,5 @@ void IndicReordering::adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphS delete mpreFixups; } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/IndicReordering.h b/jdk/src/share/native/sun/font/layout/IndicReordering.h index 1b69e204b85..58327a31c69 100644 --- a/jdk/src/share/native/sun/font/layout/IndicReordering.h +++ b/jdk/src/share/native/sun/font/layout/IndicReordering.h @@ -32,9 +32,16 @@ #ifndef __INDICREORDERING_H #define __INDICREORDERING_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + // Characters that get refered to by name... #define C_SIGN_ZWNJ 0x200C #define C_SIGN_ZWJ 0x200D @@ -140,7 +147,7 @@ struct IndicClassTable static const IndicClassTable *getScriptClassTable(le_int32 scriptCode); }; -class IndicReordering { +class IndicReordering /* not : public UObject because all methods are static */ { public: static le_int32 getWorstCaseExpansion(le_int32 scriptCode); @@ -156,8 +163,7 @@ private: // do not instantiate IndicReordering(); - static le_int32 findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, - le_int32 prev, le_int32 charCount); + static le_int32 findSyllable(const IndicClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount); }; @@ -305,4 +311,5 @@ inline le_bool IndicClassTable::hasBelowBaseForm(LEUnicode ch) const return hasBelowBaseForm(getCharClass(ch)); } +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/KernTable.cpp b/jdk/src/share/native/sun/font/layout/KernTable.cpp index 8c7bae0d8f0..0f0979eb27d 100644 --- a/jdk/src/share/native/sun/font/layout/KernTable.cpp +++ b/jdk/src/share/native/sun/font/layout/KernTable.cpp @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved * @@ -39,6 +40,8 @@ #define DEBUG 0 +U_NAMESPACE_BEGIN + struct PairInfo { le_uint32 key; // sigh, MSVC compiler gags on union here le_int16 value; // fword, kern value in funits @@ -191,6 +194,12 @@ void KernTable::process(LEGlyphStorage& storage) float adjust = 0; for (int i = 1, e = storage.getGlyphCount(); i < e; ++i) { key = key << 16 | (storage[i] & 0xffff); + + // argh, to do a binary search, we need to have the pair list in sorted order + // but it is not in sorted order on win32 platforms because of the endianness difference + // so either I have to swap the element each time I examine it, or I have to swap + // all the elements ahead of time and store them in the font + const PairInfo* p = pairs; const PairInfo* tp = (const PairInfo*)(p + rangeShift); if (key > tp->key) { @@ -238,3 +247,6 @@ void KernTable::process(LEGlyphStorage& storage) storage.adjustPosition(storage.getGlyphCount(), adjust, 0, success); } } + +U_NAMESPACE_END + diff --git a/jdk/src/share/native/sun/font/layout/KernTable.h b/jdk/src/share/native/sun/font/layout/KernTable.h index 34633a39633..fb31625763b 100644 --- a/jdk/src/share/native/sun/font/layout/KernTable.h +++ b/jdk/src/share/native/sun/font/layout/KernTable.h @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 2004-2005 - All Rights Reserved * @@ -37,9 +38,12 @@ #endif #include "LETypes.h" +//#include "LEFontInstance.h" +//#include "LEGlyphStorage.h" #include +U_NAMESPACE_BEGIN struct PairInfo; class LEFontInstance; class LEGlyphStorage; @@ -67,4 +71,6 @@ class U_LAYOUT_API KernTable void process(LEGlyphStorage& storage); }; +U_NAMESPACE_END + #endif diff --git a/jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp index 78917b8c9a4..686d97bd72f 100644 --- a/jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.cpp @@ -23,8 +23,8 @@ * */ + /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * * This file is a modification of the ICU file IndicLayoutEngine.cpp @@ -38,17 +38,20 @@ #include "LEGlyphStorage.h" #include "KhmerReordering.h" -KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, - const GlyphSubstitutionTableHeader *gsubTable) +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(KhmerOpenTypeLayoutEngine) + +KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable) { fFeatureMap = KhmerReordering::getFeatureMap(fFeatureMapCount); fFeatureOrder = TRUE; } -KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) +KhmerOpenTypeLayoutEngine::KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags) : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags) { fFeatureMap = KhmerReordering::getFeatureMap(fFeatureMapCount); @@ -63,16 +66,14 @@ KhmerOpenTypeLayoutEngine::~KhmerOpenTypeLayoutEngine() // Input: characters // Output: characters, char indices, tags // Returns: output character count -le_int32 KhmerOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 KhmerOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; } - if (chars == NULL || offset < 0 || count < 0 || max < 0 || - offset >= max || offset + count > max) { + if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { success = LE_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -96,9 +97,10 @@ le_int32 KhmerOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], // NOTE: assumes this allocates featureTags... // (probably better than doing the worst case stuff here...) - le_int32 outCharCount = KhmerReordering::reorder(&chars[offset], count, - fScriptCode, outChars, glyphStorage); + le_int32 outCharCount = KhmerReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage); glyphStorage.adoptGlyphCount(outCharCount); return outCharCount; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h b/jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h index 24f1bed6706..3b383513054 100644 --- a/jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h +++ b/jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h @@ -23,6 +23,7 @@ * */ + /* * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved @@ -45,19 +46,18 @@ // #include "GlyphDefinitionTables.h" // #include "GlyphPositioningTables.h" +U_NAMESPACE_BEGIN + // class MPreFixups; // class LEGlyphStorage; /** * This class implements OpenType layout for Khmer OpenType fonts, as - * specified by Microsoft in "Creating and Supporting OpenType Fonts - * for Khmer Scripts" - * (http://www.microsoft.com/typography/otspec/indicot/default.htm) - * TODO: change url + * specified by Microsoft in "Creating and Supporting OpenType Fonts for + * Khmer Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm) TODO: change url * - * This class overrides the characterProcessing method to do Khmer - * character processing and reordering (See the MS spec. for more - * details) + * This class overrides the characterProcessing method to do Khmer character processing + * and reordering (See the MS spec. for more details) * * @internal */ @@ -65,11 +65,10 @@ class KhmerOpenTypeLayoutEngine : public OpenTypeLayoutEngine { public: /** - * This is the main constructor. It constructs an instance of - * KhmerOpenTypeLayoutEngine for a particular font, script and - * language. It takes the GSUB table as a parameter since - * LayoutEngine::layoutEngineFactory has to read the GSUB table to - * know that it has an Khmer OpenType font. + * This is the main constructor. It constructs an instance of KhmerOpenTypeLayoutEngine for + * a particular font, script and language. It takes the GSUB table as a parameter since + * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an + * Khmer OpenType font. * * @param fontInstance - the font * @param scriptCode - the script @@ -82,14 +81,12 @@ public: * * @internal */ - KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, - const GlyphSubstitutionTableHeader *gsubTable); + KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); /** - * This constructor is used when the font requires a "canned" GSUB - * table which can't be known until after this constructor has - * been invoked. + * This constructor is used when the font requires a "canned" GSUB table which can't be known + * until after this constructor has been invoked. * * @param fontInstance - the font * @param scriptCode - the script @@ -100,8 +97,8 @@ public: * * @internal */ - KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); + KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags); /** * The destructor, virtual for correct polymorphic invocation. @@ -110,25 +107,35 @@ public: */ virtual ~KhmerOpenTypeLayoutEngine(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + protected: /** - * This method does Khmer OpenType character processing. It - * assigns the OpenType feature tags to the characters, and may - * generate output characters which have been reordered. It may - * also split some vowels, resulting in more output characters - * than input characters. + * This method does Khmer OpenType character processing. It assigns the OpenType feature + * tags to the characters, and may generate output characters which have been reordered. + * It may also split some vowels, resulting in more output characters than input characters. * * Input parameters: * @param chars - the input character context * @param offset - the index of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - TRUE if the characters are in - * a right to left directional run - * @param glyphStorage - the glyph storage object. The glyph and - * character index arrays will be set. the auxillary data array - * will be set to the feature tags. + * @param rightToLeft - TRUE if the characters are in a right to left directional run + * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set. + * the auxillary data array will be set to the feature tags. * * Output parameters: * @param success - set to an error code if the operation fails @@ -137,9 +144,11 @@ protected: * * @internal */ - virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); + }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/KhmerReordering.cpp b/jdk/src/share/native/sun/font/layout/KhmerReordering.cpp index 8b6f1f9e285..bb0e5fa47c5 100644 --- a/jdk/src/share/native/sun/font/layout/KhmerReordering.cpp +++ b/jdk/src/share/native/sun/font/layout/KhmerReordering.cpp @@ -37,6 +37,9 @@ #include "KhmerReordering.h" #include "LEGlyphStorage.h" + +U_NAMESPACE_BEGIN + // Characters that get refered to by name... enum { @@ -53,35 +56,23 @@ enum enum { - // simple classes, they are used in the statetable (in this file) - // to control the length of a syllable they are also used to know - // where a character should be placed (location in reference to - // the base character) and also to know if a character, when - // independtly displayed, should be displayed with a dotted-circle - // to indicate error in syllable construction - + // simple classes, they are used in the statetable (in this file) to control the length of a syllable + // they are also used to know where a character should be placed (location in reference to the base character) + // and also to know if a character, when independtly displayed, should be displayed with a dotted-circle to + // indicate error in syllable construction _xx = KhmerClassTable::CC_RESERVED, - _sa = KhmerClassTable::CC_SIGN_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE - | KhmerClassTable::CF_POS_ABOVE, - _sp = KhmerClassTable::CC_SIGN_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE - | KhmerClassTable::CF_POS_AFTER, + _sa = KhmerClassTable::CC_SIGN_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_POS_ABOVE, + _sp = KhmerClassTable::CC_SIGN_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE| KhmerClassTable::CF_POS_AFTER, _c1 = KhmerClassTable::CC_CONSONANT | KhmerClassTable::CF_CONSONANT, _c2 = KhmerClassTable::CC_CONSONANT2 | KhmerClassTable::CF_CONSONANT, _c3 = KhmerClassTable::CC_CONSONANT3 | KhmerClassTable::CF_CONSONANT, - _rb = KhmerClassTable::CC_ROBAT | KhmerClassTable::CF_POS_ABOVE - | KhmerClassTable::CF_DOTTED_CIRCLE, - _cs = KhmerClassTable::CC_CONSONANT_SHIFTER | KhmerClassTable::CF_DOTTED_CIRCLE - | KhmerClassTable::CF_SHIFTER, - _dl = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BEFORE - | KhmerClassTable::CF_DOTTED_CIRCLE, - _db = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BELOW - | KhmerClassTable::CF_DOTTED_CIRCLE, - _da = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_ABOVE - | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_ABOVE_VOWEL, - _dr = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_AFTER - | KhmerClassTable::CF_DOTTED_CIRCLE, - _co = KhmerClassTable::CC_COENG | KhmerClassTable::CF_COENG - | KhmerClassTable::CF_DOTTED_CIRCLE, + _rb = KhmerClassTable::CC_ROBAT | KhmerClassTable::CF_POS_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE, + _cs = KhmerClassTable::CC_CONSONANT_SHIFTER | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_SHIFTER, + _dl = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BEFORE | KhmerClassTable::CF_DOTTED_CIRCLE, + _db = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_BELOW | KhmerClassTable::CF_DOTTED_CIRCLE, + _da = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_ABOVE | KhmerClassTable::CF_DOTTED_CIRCLE | KhmerClassTable::CF_ABOVE_VOWEL, + _dr = KhmerClassTable::CC_DEPENDENT_VOWEL | KhmerClassTable::CF_POS_AFTER | KhmerClassTable::CF_DOTTED_CIRCLE, + _co = KhmerClassTable::CC_COENG | KhmerClassTable::CF_COENG | KhmerClassTable::CF_DOTTED_CIRCLE, // split vowel _va = _da | KhmerClassTable::CF_SPLIT_VOWEL, @@ -90,13 +81,10 @@ enum // Character class tables - -// _xx character does not combine into syllable, such as numbers, -// puntuation marks, non-Khmer signs... +// _xx character does not combine into syllable, such as numbers, puntuation marks, non-Khmer signs... // _sa Sign placed above the base // _sp Sign placed after the base -// _c1 Consonant of type 1 or independent vowel (independent vowels -// behave as type 1 consonants) +// _c1 Consonant of type 1 or independent vowel (independent vowels behave as type 1 consonants) // _c2 Consonant of type 2 (only RO) // _c3 Consonant of type 3 // _rb Khmer sign robat u17CC. combining mark for subscript consonants @@ -105,13 +93,10 @@ enum // _db Dependent vowel placed below the base // _da Dependent vowel placed above the base // _dr Dependent vowel placed behind the base (right of the base) -// _co Khmer combining mark COENG u17D2, combines with the consonant -// or independent vowel following it to create a subscript consonant -// or independent vowel -// _va Khmer split vowel in wich the first part is before the base and -// the second one above the base -// _vr Khmer split vowel in wich the first part is before the base and -// the second one behind (right of) the base +// _co Khmer combining mark COENG u17D2, combines with the consonant or independent vowel following +// it to create a subscript consonant or independent vowel +// _va Khmer split vowel in wich the first part is before the base and the second one above the base +// _vr Khmer split vowel in wich the first part is before the base and the second one behind (right of) the base static const KhmerClassTable::CharClass khmerCharClasses[] = { @@ -129,19 +114,19 @@ static const KhmerClassTable::CharClass khmerCharClasses[] = // // -// The range of characters defined in the above table is defined -// here. FOr Khmer 1780 to 17DF Even if the Khmer range is bigger, all -// other characters are not combinable, and therefore treated as _xx +// The range of characters defined in the above table is defined here. FOr Khmer 1780 to 17DF +// Even if the Khmer range is bigger, all other characters are not combinable, and therefore treated +// as _xx static const KhmerClassTable khmerClassTable = {0x1780, 0x17df, khmerCharClasses}; -// Below we define how a character in the input string is either in -// the khmerCharClasses table (in which case we get its type back), a -// ZWJ or ZWNJ (two characters that may appear within the syllable, -// but are not in the table) we also get their type back, or an -// unknown object in which case we get _xx (CC_RESERVED) back +// Below we define how a character in the input string is either in the khmerCharClasses table +// (in which case we get its type back), a ZWJ or ZWNJ (two characters that may appear +// within the syllable, but are not in the table) we also get their type back, or an unknown object +// in which case we get _xx (CC_RESERVED) back KhmerClassTable::CharClass KhmerClassTable::getCharClass(LEUnicode ch) const { + if (ch == C_SIGN_ZWJ) { return CC_ZERO_WIDTH_J_MARK; } @@ -164,13 +149,14 @@ const KhmerClassTable *KhmerClassTable::getKhmerClassTable() -class ReorderingOutput { +class ReorderingOutput : public UMemory { private: le_int32 fOutIndex; LEUnicode *fOutChars; LEGlyphStorage &fGlyphStorage; + public: ReorderingOutput(LEUnicode *outChars, LEGlyphStorage &glyphStorage) : fOutIndex(0), fOutChars(outChars), fGlyphStorage(glyphStorage) @@ -232,18 +218,11 @@ public: #define abvmFeatureMask 0x00100000UL #define mkmkFeatureMask 0x00080000UL -#define tagPref (prefFeatureMask | presFeatureMask | \ - cligFeatureMask | distFeatureMask) -#define tagAbvf (abvfFeatureMask | abvsFeatureMask | \ - cligFeatureMask | distFeatureMask | abvmFeatureMask | mkmkFeatureMask) -#define tagPstf (blwfFeatureMask | blwsFeatureMask | prefFeatureMask | \ - presFeatureMask | pstfFeatureMask | pstsFeatureMask | cligFeatureMask | \ - distFeatureMask | blwmFeatureMask) -#define tagBlwf (blwfFeatureMask | blwsFeatureMask | cligFeatureMask | \ - distFeatureMask | blwmFeatureMask | mkmkFeatureMask) -#define tagDefault (prefFeatureMask | blwfFeatureMask | presFeatureMask | \ - blwsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | \ - blwmFeatureMask | mkmkFeatureMask) +#define tagPref (prefFeatureMask | presFeatureMask | cligFeatureMask | distFeatureMask) +#define tagAbvf (abvfFeatureMask | abvsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | mkmkFeatureMask) +#define tagPstf (blwfFeatureMask | blwsFeatureMask | prefFeatureMask | presFeatureMask | pstfFeatureMask | pstsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask) +#define tagBlwf (blwfFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | blwmFeatureMask | mkmkFeatureMask) +#define tagDefault (prefFeatureMask | blwfFeatureMask | presFeatureMask | blwsFeatureMask | cligFeatureMask | distFeatureMask | abvmFeatureMask | blwmFeatureMask | mkmkFeatureMask) @@ -274,35 +253,32 @@ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap); // The stateTable is used to calculate the end (the length) of a well // formed Khmer Syllable. // -// Each horizontal line is ordered exactly the same way as the values -// in KhmerClassTable CharClassValues in KhmerReordering.h This -// coincidence of values allows the follow up of the table. +// Each horizontal line is ordered exactly the same way as the values in KhmerClassTable +// CharClassValues in KhmerReordering.h This coincidence of values allows the +// follow up of the table. // -// Each line corresponds to a state, which does not necessarily need -// to be a type of component... for example, state 2 is a base, with -// is always a first character in the syllable, but the state could be -// produced a consonant of any type when it is the first character -// that is analysed (in ground state). +// Each line corresponds to a state, which does not necessarily need to be a type +// of component... for example, state 2 is a base, with is always a first character +// in the syllable, but the state could be produced a consonant of any type when +// it is the first character that is analysed (in ground state). // // Differentiating 3 types of consonants is necessary in order to // forbid the use of certain combinations, such as having a second -// coeng after a coeng RO. -// The inexistent possibility of having a type 3 after another type 3 -// is permitted, eliminating it would very much complicate the table, -// and it does not create typing problems, as the case above. +// coeng after a coeng RO, +// The inexistent possibility of having a type 3 after another type 3 is permitted, +// eliminating it would very much complicate the table, and it does not create typing +// problems, as the case above. // -// The table is quite complex, in order to limit the number of coeng -// consonants to 2 (by means of the table). +// The table is quite complex, in order to limit the number of coeng consonants +// to 2 (by means of the table). // // There a peculiarity, as far as Unicode is concerned: // - The consonant-shifter is considered in two possible different -// locations, the one considered in Unicode 3.0 and the one considered -// in Unicode 4.0. (there is a backwards compatibility problem in this -// standard). +// locations, the one considered in Unicode 3.0 and the one considered in +// Unicode 4.0. (there is a backwards compatibility problem in this standard). -// xx independent character, such as a number, punctuation sign or -// non-khmer char +// xx independent character, such as a number, punctuation sign or non-khmer char // // c1 Khmer consonant of type 1 or an independent vowel // that is, a letter in which the subscript for is only under the @@ -320,10 +296,9 @@ static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap); // // co coeng character (u17D2) // -// dv dependent vowel (including split vowels, they are treated in the -// same way). even if dv is not defined above, the component that is -// really tested for is KhmerClassTable::CC_DEPENDENT_VOWEL, which is -// common to all dependent vowels +// dv dependent vowel (including split vowels, they are treated in the same way). +// even if dv is not defined above, the component that is really tested for is +// KhmerClassTable::CC_DEPENDENT_VOWEL, which is common to all dependent vowels // // zwj Zero Width joiner // @@ -352,8 +327,7 @@ static const le_int8 khmerStateTable[][KhmerClassTable::CC_COUNT] = {-1, -1, -1, -1, 12, 13, -1, -1, 16, 17, 1, 14}, // 8 - First consonant of type 2 after coeng {-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, // 9 - First consonant or type 3 after ceong {-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, // 10 - Second Coeng (no register shifter before) - {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, // 11 - Second coeng consonant - // (or ind. vowel) no register shifter before + {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, // 11 - Second coeng consonant (or ind. vowel) no register shifter before {-1, -1, 1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, // 12 - Second ZWNJ before a register shifter {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, // 13 - Second register shifter {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, // 14 - ZWJ before vowel @@ -363,6 +337,7 @@ static const le_int8 khmerStateTable[][KhmerClassTable::CC_COUNT] = {-1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1}, // 18 - ZWJ after vowel {-1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, // 19 - Third coeng {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, // 20 - dependent vowel after a Robat + }; @@ -377,15 +352,13 @@ const FeatureMap *KhmerReordering::getFeatureMap(le_int32 &count) // Given an input string of characters and a location in which to start looking // calculate, using the state table, which one is the last character of the syllable // that starts in the starting position. -le_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable, - const LEUnicode *chars, le_int32 prev, le_int32 charCount) +le_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount) { le_int32 cursor = prev; le_int8 state = 0; while (cursor < charCount) { - KhmerClassTable::CharClass charClass = (classTable->getCharClass(chars[cursor]) - & KhmerClassTable::CF_CLASS_MASK); + KhmerClassTable::CharClass charClass = (classTable->getCharClass(chars[cursor]) & KhmerClassTable::CF_CLASS_MASK); state = khmerStateTable[state][charClass]; @@ -402,8 +375,8 @@ le_int32 KhmerReordering::findSyllable(const KhmerClassTable *classTable, // This is the real reordering function as applied to the Khmer language -le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, - le_int32 /*scriptCode*/, LEUnicode *outChars, LEGlyphStorage &glyphStorage) +le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 /*scriptCode*/, + LEUnicode *outChars, LEGlyphStorage &glyphStorage) { const KhmerClassTable *classTable = KhmerClassTable::getKhmerClassTable(); @@ -442,8 +415,7 @@ le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, // and because CC_CONSONANT2 is enough to identify it, as it is the only consonant // with this flag if ( (charClass & KhmerClassTable::CF_COENG) && (i + 1 < syllable) && - ( (classTable->getCharClass(chars[i + 1]) & - KhmerClassTable::CF_CLASS_MASK) == KhmerClassTable::CC_CONSONANT2) ) + ( (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_CLASS_MASK) == KhmerClassTable::CC_CONSONANT2) ) { coengRo = i; } @@ -455,16 +427,15 @@ le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, output.writeChar(C_RO, coengRo + 1, tagPref); } - // shall we add a dotted circle? If in the position in which - // the base should be (first char in the string) there is a - // character that has the Dotted circle flag (a character that - // cannot be a base) then write a dotted circle + // shall we add a dotted circle? + // If in the position in which the base should be (first char in the string) there is + // a character that has the Dotted circle flag (a character that cannot be a base) + // then write a dotted circle if (classTable->getCharClass(chars[prev]) & KhmerClassTable::CF_DOTTED_CIRCLE) { output.writeChar(C_DOTTED_CIRCLE, prev, tagDefault); } - // copy what is left to the output, skipping before vowels and - // coeng Ro if they are present + // copy what is left to the output, skipping before vowels and coeng Ro if they are present for (i = prev; i < syllable; i += 1) { charClass = classTable->getCharClass(chars[i]); @@ -515,30 +486,14 @@ le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, // and there is an extra rule for C_VOWEL_AA + C_SIGN_NIKAHIT also for two // different positions, right after the shifter or after a vowel (Unicode 4) if ( (charClass & KhmerClassTable::CF_SHIFTER) && (i + 1 < syllable) ) { - if (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_ABOVE_VOWEL ) { - output.writeChar(chars[i], i, tagBlwf); - break; - } - if (i + 2 < syllable && - ( (classTable->getCharClass(chars[i + 1]) & - KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA) && - ( (classTable->getCharClass(chars[i + 2]) & - KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) ) - { - output.writeChar(chars[i], i, tagBlwf); - break; - } - if (i + 3 < syllable && (classTable->getCharClass(chars[i + 3]) & - KhmerClassTable::CF_ABOVE_VOWEL) ) - { - output.writeChar(chars[i], i, tagBlwf); - break; - } - if (i + 4 < syllable && - ( (classTable->getCharClass(chars[i + 3]) & - KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA) && - ( (classTable->getCharClass(chars[i + 4]) & - KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) ) + if ((classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_ABOVE_VOWEL) + || (i + 2 < syllable + && ( (classTable->getCharClass(chars[i + 1]) & KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA) + && ( (classTable->getCharClass(chars[i + 2]) & KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT)) + || (i + 3 < syllable && (classTable->getCharClass(chars[i + 3]) & KhmerClassTable::CF_ABOVE_VOWEL)) + || (i + 4 < syllable + && ( (classTable->getCharClass(chars[i + 3]) & KhmerClassTable::CF_CLASS_MASK) == C_VOWEL_AA) + && ( (classTable->getCharClass(chars[i + 4]) & KhmerClassTable::CF_CLASS_MASK) == C_SIGN_NIKAHIT) ) ) { output.writeChar(chars[i], i, tagBlwf); break; @@ -556,3 +511,6 @@ le_int32 KhmerReordering::reorder(const LEUnicode *chars, le_int32 charCount, return output.getOutputIndex(); } + + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/KhmerReordering.h b/jdk/src/share/native/sun/font/layout/KhmerReordering.h index 92b6158576a..349bf2b91f4 100644 --- a/jdk/src/share/native/sun/font/layout/KhmerReordering.h +++ b/jdk/src/share/native/sun/font/layout/KhmerReordering.h @@ -24,7 +24,6 @@ */ /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * * This file is a modification of the ICU file IndicReordering.h @@ -35,80 +34,60 @@ #ifndef __KHMERREORDERING_H #define __KHMERREORDERING_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; // Vocabulary - -// Base -> -// A consonant or an independent vowel in its full (not -// subscript) form. It is the center of the syllable, it can be -// souranded by coeng (subscript) consonants, vowels, split -// vowels, signs... but there is only one base in a syllable, it -// has to be coded as the first character of the syllable. -// split vowel -> -// vowel that has two parts placed separately (e.g. Before and -// after the consonant). Khmer language has five of them. Khmer -// split vowels either have one part before the base and one after -// the base or they have a part before the base and a part above -// the base. The first part of all Khmer split vowels is the same -// character, identical to the glyph of Khmer dependent vowel SRA -// EI -// coeng -> -// modifier used in Khmer to construct coeng (subscript) -// consonants differently than indian languages, the coeng -// modifies the consonant that follows it, not the one preceding -// it Each consonant has two forms, the base form and the -// subscript form the base form is the normal one (using the -// consonants code-point), the subscript form is displayed when -// the combination coeng + consonant is encountered. -// Consonant of type 1 -> -// A consonant which has subscript for that only occupies space -// under a base consonant -// Consonant of type 2 -> -// Its subscript form occupies space under and before the base -// (only one, RO) -// Consonant of Type 3 -> -// Its subscript form occupies space under and after the base -// (KHO, CHHO, THHO, BA, YO, SA) -// Consonant shifter -> -// Khmer has to series of consonants. The same dependent vowel has -// different sounds if it is attached to a consonant of the first -// series or a consonant of the second series Most consonants have -// an equivalent in the other series, but some of theme exist only -// in one series (for example SA). If we want to use the consonant -// SA with a vowel sound that can only be done with a vowel sound -// that corresponds to a vowel accompanying a consonant of the -// other series, then we need to use a consonant shifter: TRIISAP -// or MUSIKATOAN x17C9 y x17CA. TRIISAP changes a first series -// consonant to second series sound and MUSIKATOAN a second series -// consonant to have a first series vowel sound. Consonant -// shifter are both normally supercript marks, but, when they are -// followed by a superscript, they change shape and take the form -// of subscript dependent vowel SRA U. If they are in the same -// syllable as a coeng consonant, Unicode 3.0 says that they -// should be typed before the coeng. Unicode 4.0 breaks the -// standard and says that it should be placed after the coeng -// consonant. -// Dependent vowel -> -// In khmer dependent vowels can be placed above, below, before or -// after the base Each vowel has its own position. Only one vowel -// per syllable is allowed. -// Signs -> -// Khmer has above signs and post signs. Only one above sign -// and/or one post sign are Allowed in a syllable. +// Base -> A consonant or an independent vowel in its full (not subscript) form. It is the +// center of the syllable, it can be souranded by coeng (subscript) consonants, vowels, +// split vowels, signs... but there is only one base in a syllable, it has to be coded as +// the first character of the syllable. +// split vowel --> vowel that has two parts placed separately (e.g. Before and after the consonant). +// Khmer language has five of them. Khmer split vowels either have one part before the +// base and one after the base or they have a part before the base and a part above the base. +// The first part of all Khmer split vowels is the same character, identical to +// the glyph of Khmer dependent vowel SRA EI +// coeng --> modifier used in Khmer to construct coeng (subscript) consonants +// Differently than indian languages, the coeng modifies the consonant that follows it, +// not the one preceding it Each consonant has two forms, the base form and the subscript form +// the base form is the normal one (using the consonants code-point), the subscript form is +// displayed when the combination coeng + consonant is encountered. +// Consonant of type 1 -> A consonant which has subscript for that only occupies space under a base consonant +// Consonant of type 2.-> Its subscript form occupies space under and before the base (only one, RO) +// Consonant of Type 3 -> Its subscript form occupies space under and after the base (KHO, CHHO, THHO, BA, YO, SA) +// Consonant shifter -> Khmer has to series of consonants. The same dependent vowel has different sounds +// if it is attached to a consonant of the first series or a consonant of the second series +// Most consonants have an equivalent in the other series, but some of theme exist only in +// one series (for example SA). If we want to use the consonant SA with a vowel sound that +// can only be done with a vowel sound that corresponds to a vowel accompanying a consonant +// of the other series, then we need to use a consonant shifter: TRIISAP or MUSIKATOAN +// x17C9 y x17CA. TRIISAP changes a first series consonant to second series sound and +// MUSIKATOAN a second series consonant to have a first series vowel sound. +// Consonant shifter are both normally supercript marks, but, when they are followed by a +// superscript, they change shape and take the form of subscript dependent vowel SRA U. +// If they are in the same syllable as a coeng consonant, Unicode 3.0 says that they +// should be typed before the coeng. Unicode 4.0 breaks the standard and says that it should +// be placed after the coeng consonant. +// Dependent vowel -> In khmer dependent vowels can be placed above, below, before or after the base +// Each vowel has its own position. Only one vowel per syllable is allowed. +// Signs -> Khmer has above signs and post signs. Only one above sign and/or one post sign are +// Allowed in a syllable. +// // -// This list must include all types of components that can be used -// inside a syllable -struct KhmerClassTable +struct KhmerClassTable // This list must include all types of components that can be used inside a syllable { - // order is important here! This order must be the same that is - // found in each horizontal line in the statetable for Khmer (file - // KhmerReordering.cpp). - enum CharClassValues + enum CharClassValues // order is important here! This order must be the same that is found in each horizontal + // line in the statetable for Khmer (file KhmerReordering.cpp). { CC_RESERVED = 0, CC_CONSONANT = 1, // consonant of type 1 or independent vowel @@ -116,8 +95,7 @@ struct KhmerClassTable CC_CONSONANT3 = 3, // Consonant of type 3 CC_ZERO_WIDTH_NJ_MARK = 4, // Zero Width non joiner character (0x200C) CC_CONSONANT_SHIFTER = 5, - CC_ROBAT = 6, // Khmer special diacritic accent - // -treated differently in state table + CC_ROBAT = 6, // Khmer special diacritic accent -treated differently in state table CC_COENG = 7, // Subscript consonant combining character CC_DEPENDENT_VOWEL = 8, CC_SIGN_ABOVE = 9, @@ -131,10 +109,8 @@ struct KhmerClassTable CF_CLASS_MASK = 0x0000FFFF, CF_CONSONANT = 0x01000000, // flag to speed up comparing - CF_SPLIT_VOWEL = 0x02000000, // flag for a split vowel -> the first part - // is added in front of the syllable - CF_DOTTED_CIRCLE = 0x04000000, // add a dotted circle if a character with - // this flag is the first in a syllable + CF_SPLIT_VOWEL = 0x02000000, // flag for a split vowel -> the first part is added in front of the syllable + CF_DOTTED_CIRCLE = 0x04000000, // add a dotted circle if a character with this flag is the first in a syllable CF_COENG = 0x08000000, // flag to speed up comparing CF_SHIFTER = 0x10000000, // flag to speed up comparing CF_ABOVE_VOWEL = 0x20000000, // flag to speed up comparing @@ -161,10 +137,10 @@ struct KhmerClassTable }; -class KhmerReordering { +class KhmerReordering /* not : public UObject because all methods are static */ { public: - static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount, - le_int32 scriptCode, LEUnicode *outChars, LEGlyphStorage &glyphStorage); + static le_int32 reorder(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode, + LEUnicode *outChars, LEGlyphStorage &glyphStorage); static const FeatureMap *getFeatureMap(le_int32 &count); @@ -172,8 +148,10 @@ private: // do not instantiate KhmerReordering(); - static le_int32 findSyllable(const KhmerClassTable *classTable, - const LEUnicode *chars, le_int32 prev, le_int32 charCount); + static le_int32 findSyllable(const KhmerClassTable *classTable, const LEUnicode *chars, le_int32 prev, le_int32 charCount); + }; + +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LEFontInstance.cpp b/jdk/src/share/native/sun/font/layout/LEFontInstance.cpp index 72290c721ef..619a0cee4c5 100644 --- a/jdk/src/share/native/sun/font/layout/LEFontInstance.cpp +++ b/jdk/src/share/native/sun/font/layout/LEFontInstance.cpp @@ -24,7 +24,6 @@ */ /* - * ******************************************************************************* * * Copyright (C) 1999-2005, International Business Machines @@ -42,6 +41,10 @@ #include "LEFontInstance.h" #include "LEGlyphStorage.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEFontInstance) + const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const { @@ -59,7 +62,7 @@ const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int } void LEFontInstance::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, - le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const + le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const { le_int32 i, out = 0, dir = 1; @@ -100,3 +103,5 @@ LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *map return mapCharToGlyph(mappedChar); } +U_NAMESPACE_END + diff --git a/jdk/src/share/native/sun/font/layout/LEFontInstance.h b/jdk/src/share/native/sun/font/layout/LEFontInstance.h index 7c3e52515a0..f336177f7fd 100644 --- a/jdk/src/share/native/sun/font/layout/LEFontInstance.h +++ b/jdk/src/share/native/sun/font/layout/LEFontInstance.h @@ -34,6 +34,12 @@ #define __LEFONTINSTANCE_H #include "LETypes.h" +/** + * \file + * \brief C++ API: Layout Engine Font Instance object + */ + +U_NAMESPACE_BEGIN /** * Instances of this class are used by LEFontInstance::mapCharsToGlyphs and @@ -44,7 +50,7 @@ * * @stable ICU 3.2 */ -class LECharMapper +class LECharMapper /* not : public UObject because this is an interface/mixin class */ { public: /** @@ -97,7 +103,7 @@ class LEGlyphStorage; * * @draft ICU 3.0 */ -class LEFontInstance +class U_LAYOUT_API LEFontInstance : public UObject { public: @@ -160,8 +166,7 @@ public: * * @stable ICU 3.2 */ - virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, - le_int32 limit, le_int32 script, LEErrorCode &success) const; + virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const; // // Font file access @@ -238,8 +243,7 @@ public: * * @draft ICU 3.0 */ - virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, - le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const; + virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const; /** * This method maps a single character to a glyph index, using the @@ -502,6 +506,21 @@ public: * @stable ICU 3.2 */ virtual le_int32 getLineHeight() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 3.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 3.2 + */ + static UClassID getStaticClassID(); + }; inline le_bool LEFontInstance::canDisplay(LEUnicode32 ch) const @@ -562,4 +581,7 @@ inline le_int32 LEFontInstance::getLineHeight() const return getAscent() + getDescent() + getLeading(); } +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/LEGlyphFilter.h b/jdk/src/share/native/sun/font/layout/LEGlyphFilter.h index f93ceb239bd..87e029db1c5 100644 --- a/jdk/src/share/native/sun/font/layout/LEGlyphFilter.h +++ b/jdk/src/share/native/sun/font/layout/LEGlyphFilter.h @@ -34,14 +34,15 @@ #include "LETypes.h" +U_NAMESPACE_BEGIN + /** * This is a helper class that is used to * recognize a set of glyph indices. * * @internal */ -class LEGlyphFilter -{ +class LEGlyphFilter /* not : public UObject because this is an interface/mixin class */ { public: /** * Destructor. @@ -63,4 +64,5 @@ public: virtual le_bool accept(LEGlyphID glyph) const = 0; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp b/jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp index 693f92f7123..25984286510 100644 --- a/jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp +++ b/jdk/src/share/native/sun/font/layout/LEGlyphStorage.cpp @@ -24,7 +24,6 @@ */ /* - * ********************************************************************** * Copyright (C) 1998-2005, International Business Machines * Corporation and others. All Rights Reserved. @@ -35,6 +34,10 @@ #include "LEInsertionList.h" #include "LEGlyphStorage.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEGlyphStorage) + LEGlyphStorage::LEGlyphStorage() : fGlyphCount(0), fGlyphs(NULL), fCharIndices(NULL), fPositions(NULL), fAuxData(NULL), fInsertionList(NULL), fSrcIndex(0), fDestIndex(0) @@ -603,3 +606,6 @@ le_bool LEGlyphStorage::applyInsertion(le_int32 atPosition, le_int32 count, LEGl return FALSE; } + +U_NAMESPACE_END + diff --git a/jdk/src/share/native/sun/font/layout/LEGlyphStorage.h b/jdk/src/share/native/sun/font/layout/LEGlyphStorage.h index 945e409eff2..47684f6ec8e 100644 --- a/jdk/src/share/native/sun/font/layout/LEGlyphStorage.h +++ b/jdk/src/share/native/sun/font/layout/LEGlyphStorage.h @@ -24,7 +24,6 @@ */ /* - * ********************************************************************** * Copyright (C) 1998-2005, International Business Machines * Corporation and others. All Rights Reserved. @@ -37,6 +36,13 @@ #include "LETypes.h" #include "LEInsertionList.h" +/** + * \file + * \brief C++ API: This class encapsulates the per-glyph storage used by the ICU LayoutEngine. + */ + +U_NAMESPACE_BEGIN + /** * This class encapsulates the per-glyph storage used by the ICU LayoutEngine. * For each glyph it holds the glyph ID, the index of the backing store character @@ -50,7 +56,7 @@ * * @draft ICU 3.6 */ -class U_LAYOUT_API LEGlyphStorage : protected LEInsertionCallback +class U_LAYOUT_API LEGlyphStorage : public UObject, protected LEInsertionCallback { private: /** @@ -112,35 +118,37 @@ private: protected: /** - * This implements LEInsertionCallback. The - * LEInsertionList will call this method once for - * each insertion. + * This implements LEInsertionCallback. The LEInsertionList + * will call this method once for each insertion. * * @param atPosition the position of the insertion * @param count the number of glyphs being inserted * @param newGlyphs the address of the new glyph IDs * - * @return true if LEInsertionList - * should stop processing the insertion list after this insertion. + * @return true if LEInsertionList should stop + * processing the insertion list after this insertion. * * @see LEInsertionList.h * * @draft ICU 3.0 */ - virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, - LEGlyphID newGlyphs[]); + virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]); public: /** - * Allocates an empty LEGlyphStorage object. You must - * call allocateGlyphArray, allocatePositions and - * allocateAuxData to allocate the data. + * Allocates an empty LEGlyphStorage object. You must call + * allocateGlyphArray, allocatePositions and allocateAuxData + * to allocate the data. + * + * @draft ICU 3.0 */ LEGlyphStorage(); /** * The destructor. This will deallocate all of the arrays. + * + * @draft ICU 3.0 */ ~LEGlyphStorage(); @@ -154,9 +162,9 @@ public: inline le_int32 getGlyphCount() const; /** - * This method copies the glyph array into a caller supplied - * array. The caller must ensure that the array is large enough - * to hold all the glyphs. + * This method copies the glyph array into a caller supplied array. + * The caller must ensure that the array is large enough to hold all + * the glyphs. * * @param glyphs - the destiniation glyph array * @param success - set to an error code if the operation fails @@ -166,10 +174,10 @@ public: void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const; /** - * This method copies the glyph array into a caller supplied - * array, ORing in extra bits. (This functionality is needed by - * the JDK, which uses 32 bits pre glyph idex, with the high 16 - * bits encoding the composite font slot number) + * This method copies the glyph array into a caller supplied array, + * ORing in extra bits. (This functionality is needed by the JDK, + * which uses 32 bits pre glyph idex, with the high 16 bits encoding + * the composite font slot number) * * @param glyphs - the destination (32 bit) glyph array * @param extraBits - this value will be ORed with each glyph index @@ -177,13 +185,12 @@ public: * * @draft ICU 3.0 */ - void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, - LEErrorCode &success) const; + void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const; /** - * This method copies the character index array into a caller - * supplied array. The caller must ensure that the array is large - * enough to hold a character index for each glyph. + * This method copies the character index array into a caller supplied array. + * The caller must ensure that the array is large enough to hold a + * character index for each glyph. * * @param charIndices - the destiniation character index array * @param success - set to an error code if the operation fails @@ -193,9 +200,9 @@ public: void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const; /** - * This method copies the character index array into a caller - * supplied array. The caller must ensure that the array is large - * enough to hold a character index for each glyph. + * This method copies the character index array into a caller supplied array. + * The caller must ensure that the array is large enough to hold a + * character index for each glyph. * * @param charIndices - the destiniation character index array * @param indexBase - an offset which will be added to each index @@ -203,14 +210,13 @@ public: * * @draft ICU 3.0 */ - void getCharIndices(le_int32 charIndices[], le_int32 indexBase, - LEErrorCode &success) const; + void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const; /** - * This method copies the position array into a caller supplied - * array. The caller must ensure that the array is large enough - * to hold an X and Y position for each glyph, plus an extra X and - * Y for the advance of the last glyph. + * This method copies the position array into a caller supplied array. + * The caller must ensure that the array is large enough to hold an + * X and Y position for each glyph, plus an extra X and Y for the + * advance of the last glyph. * * @param positions - the destiniation position array * @param success - set to an error code if the operation fails @@ -233,33 +239,27 @@ public: * * @draft ICU 3.0 */ - void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, - LEErrorCode &success) const; + void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const; /** - * This method allocates the glyph array, the char indices array - * and the insertion list. You must call this method before using - * the object. This method also initializes the char indices + * This method allocates the glyph array, the char indices array and the insertion list. You + * must call this method before using the object. This method also initializes the char indices * array. - * @param initialGlyphCount the initial size of the glyph and char - * indices arrays. - * @param rightToLeft true if the original input text - * is right to left. - * @param success set to an error code if the storage cannot be - * allocated of if the initial glyph count is not positive. + * + * @param initialGlyphCount the initial size of the glyph and char indices arrays. + * @param rightToLeft true if the original input text is right to left. + * @param success set to an error code if the storage cannot be allocated of if the initial + * glyph count is not positive. * * @draft ICU 3.0 */ - void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, - LEErrorCode &success); + void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, LEErrorCode &success); /** - * This method allocates the storage for the glyph positions. It - * allocates one extra X, Y position pair for the position just - * after the last glyph. + * This method allocates the storage for the glyph positions. It allocates one extra X, Y + * position pair for the position just after the last glyph. * - * @param success set to an error code if the positions array - * cannot be allocated. + * @param success set to an error code if the positions array cannot be allocated. * * @return the number of X, Y position pairs allocated. * @@ -270,8 +270,7 @@ public: /** * This method allocates the storage for the auxillary glyph data. * - * @param success set to an error code if the aulillary data array - * cannot be allocated. + * @param success set to an error code if the aulillary data array cannot be allocated. * * @return the size of the auxillary data array. * @@ -282,10 +281,8 @@ public: /** * Copy the entire auxillary data array. * - * @param auxData the auxillary data array will be copied to this - * address - * @param success set to an error code if the data cannot be - * copied + * @param auxData the auxillary data array will be copied to this address + * @param success set to an error code if the data cannot be copied * * @draft ICU 3.6 */ @@ -295,8 +292,7 @@ public: * Get the glyph ID for a particular glyph. * * @param glyphIndex the index into the glyph array - * @param success set to an error code if the glyph ID cannot be - * retrieved. + * @param success set to an error code if the glyph ID cannot be retrieved. * * @return the glyph ID * @@ -308,8 +304,7 @@ public: * Get the char index for a particular glyph. * * @param glyphIndex the index into the glyph array - * @param success set to an error code if the char index cannot be - * retrieved. + * @param success set to an error code if the char index cannot be retrieved. * * @return the character index * @@ -322,8 +317,7 @@ public: * Get the auxillary data for a particular glyph. * * @param glyphIndex the index into the glyph array - * @param success set to an error code if the auxillary data - * cannot be retrieved. + * @param success set to an error code if the auxillary data cannot be retrieved. * * @return the auxillary data * @@ -345,11 +339,10 @@ public: /** * Call this method to replace a single glyph in the glyph array - * with multiple glyphs. This method uses the - * LEInsertionList to do the insertion. It returns - * the address of storage where the new glyph IDs can be - * stored. They will not actually be inserted into the glyph array - * until applyInsertions is called. + * with multiple glyphs. This method uses the LEInsertionList + * to do the insertion. It returns the address of storage where the new + * glyph IDs can be stored. They will not actually be inserted into the + * glyph array until applyInsertions is called. * * @param atIndex the index of the glyph to be replaced * @param insertCount the number of glyphs to replace it with @@ -381,26 +374,22 @@ public: * * @param glyphIndex the index of the glyph * @param glyphID the new glyph ID - * @param success will be set to an error code if the glyph ID - * cannot be set. + * @param success will be set to an error code if the glyph ID cannot be set. * * @draft ICU 3.0 */ - void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID, - LEErrorCode &success); + void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID, LEErrorCode &success); /** * Set the char index for a particular glyph. * * @param glyphIndex the index of the glyph * @param charIndex the new char index - * @param success will be set to an error code if the char index - * cannot be set. + * @param success will be set to an error code if the char index cannot be set. * * @draft ICU 3.0 */ - void setCharIndex(le_int32 glyphIndex, le_int32 charIndex, - LEErrorCode &success); + void setCharIndex(le_int32 glyphIndex, le_int32 charIndex, LEErrorCode &success); /** * Set the X, Y position for a particular glyph. @@ -408,13 +397,11 @@ public: * @param glyphIndex the index of the glyph * @param x the new X position * @param y the new Y position - * @param success will be set to an error code if the position - * cannot be set. + * @param success will be set to an error code if the position cannot be set. * * @draft ICU 3.0 */ - void setPosition(le_int32 glyphIndex, float x, float y, - LEErrorCode &success); + void setPosition(le_int32 glyphIndex, float x, float y, LEErrorCode &success); /** * Adjust the X, Y position for a particular glyph. @@ -422,21 +409,18 @@ public: * @param glyphIndex the index of the glyph * @param xAdjust the adjustment to the glyph's X position * @param yAdjust the adjustment to the glyph's Y position - * @param success will be set to an error code if the glyph's - * position cannot be adjusted. + * @param success will be set to an error code if the glyph's position cannot be adjusted. * * @draft ICU 3.0 */ - void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, - LEErrorCode &success); + void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, LEErrorCode &success); /** * Set the auxillary data for a particular glyph. * * @param glyphIndex the index of the glyph * @param auxData the new auxillary data - * @param success will be set to an error code if the auxillary - * data cannot be set. + * @param success will be set to an error code if the auxillary data cannot be set. * * @draft ICU 3.6 */ @@ -511,14 +495,28 @@ public: void adoptGlyphCount(le_int32 newGlyphCount); /** - * This method frees the glyph, character index, position and - * auxillary data arrays so that the LayoutEngine can be reused to - * layout a different characer array. (This method is also called + * This method frees the glyph, character index, position and + * auxillary data arrays so that the LayoutEngine can be reused + * to layout a different characer array. (This method is also called * by the destructor) * * @draft ICU 3.0 */ void reset(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @draft ICU 3.0 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @draft ICU 3.0 + */ + static UClassID getStaticClassID(); }; inline le_int32 LEGlyphStorage::getGlyphCount() const @@ -531,4 +529,7 @@ inline LEGlyphID &LEGlyphStorage::operator[](le_int32 glyphIndex) const return fGlyphs[glyphIndex]; } + +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/LEInsertionList.cpp b/jdk/src/share/native/sun/font/layout/LEInsertionList.cpp index f40bfafb85f..d1f2288bf34 100644 --- a/jdk/src/share/native/sun/font/layout/LEInsertionList.cpp +++ b/jdk/src/share/native/sun/font/layout/LEInsertionList.cpp @@ -24,7 +24,6 @@ */ /* - * ********************************************************************** * Copyright (C) 1998-2004, International Business Machines * Corporation and others. All Rights Reserved. @@ -34,6 +33,8 @@ #include "LETypes.h" #include "LEInsertionList.h" +U_NAMESPACE_BEGIN + #define ANY_NUMBER 1 struct InsertionRecord @@ -44,6 +45,8 @@ struct InsertionRecord LEGlyphID glyphs[ANY_NUMBER]; }; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEInsertionList) + LEInsertionList::LEInsertionList(le_bool rightToLeft) : head(NULL), tail(NULL), growAmount(0), append(rightToLeft) { @@ -106,3 +109,5 @@ le_bool LEInsertionList::applyInsertions(LEInsertionCallback *callback) return FALSE; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/LEInsertionList.h b/jdk/src/share/native/sun/font/layout/LEInsertionList.h index bf549851440..d57258a6b47 100644 --- a/jdk/src/share/native/sun/font/layout/LEInsertionList.h +++ b/jdk/src/share/native/sun/font/layout/LEInsertionList.h @@ -24,7 +24,6 @@ */ /* - * ********************************************************************** * Copyright (C) 1998-2004, International Business Machines * Corporation and others. All Rights Reserved. @@ -36,6 +35,8 @@ #include "LETypes.h" +U_NAMESPACE_BEGIN + struct InsertionRecord; /** @@ -78,7 +79,7 @@ public: * * @internal */ -class LEInsertionList +class LEInsertionList : public UObject { public: /** @@ -140,6 +141,20 @@ public: */ void reset(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: /** @@ -174,4 +189,6 @@ private: le_bool append; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/LELanguages.h b/jdk/src/share/native/sun/font/layout/LELanguages.h index 55396c11263..8789bce4b77 100644 --- a/jdk/src/share/native/sun/font/layout/LELanguages.h +++ b/jdk/src/share/native/sun/font/layout/LELanguages.h @@ -25,10 +25,12 @@ /* * - * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved. + * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved. * * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS * YOU REALLY KNOW WHAT YOU'RE DOING. + * + * Generated on: 07/19/2005 01:01:08 PM PDT */ #ifndef __LELANGUAGES_H @@ -36,12 +38,19 @@ #include "LETypes.h" +/** + * \file + * \brief C++ API: List of language codes for LayoutEngine + */ + +U_NAMESPACE_BEGIN + /** * A provisional list of language codes. For now, * this is just a list of languages which the LayoutEngine * supports. * - * @draft ICU 3.0 + * @draft ICU 3.4 */ enum LanguageCodes { @@ -79,4 +88,5 @@ enum LanguageCodes { languageCodeCount = 30 }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LEScripts.h b/jdk/src/share/native/sun/font/layout/LEScripts.h index ca7a860c8f0..b5c7ba3809a 100644 --- a/jdk/src/share/native/sun/font/layout/LEScripts.h +++ b/jdk/src/share/native/sun/font/layout/LEScripts.h @@ -25,17 +25,23 @@ /* * - * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved. + * (C) Copyright IBM Corp. 1998-2005. All Rights Reserved. * * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS * YOU REALLY KNOW WHAT YOU'RE DOING. - * */ #ifndef __LESCRIPTS_H #define __LESCRIPTS_H #include "LETypes.h" +/** + * \file + * \brief C++ API: Constants for Unicode script values + */ + + +U_NAMESPACE_BEGIN /** * Constants for Unicode script values, generated using @@ -104,4 +110,5 @@ enum ScriptCodes { scriptCodeCount = 55 }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LEStandalone.h b/jdk/src/share/native/sun/font/layout/LEStandalone.h new file mode 100644 index 00000000000..74304e69732 --- /dev/null +++ b/jdk/src/share/native/sun/font/layout/LEStandalone.h @@ -0,0 +1,132 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +#ifndef __LESTANDALONE +#define __LESTANDALONE + +/* Definitions to make Layout Engine work away from ICU. */ +#ifndef U_NAMESPACE_BEGIN +#define U_NAMESPACE_BEGIN +#endif + +#ifndef U_NAMESPACE_END +#define U_NAMESPACE_END +#endif + +/* RTTI Definition */ +typedef const char *UClassID; +#ifndef UOBJECT_DEFINE_RTTI_IMPLEMENTATION +#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(x) UClassID x::getStaticClassID(){static char z=0; return (UClassID)&z; } UClassID x::getDynamicClassID() const{return x::getStaticClassID(); } +#endif + +/* UMemory's functions aren't used by the layout engine. */ +struct UMemory {}; +/* UObject's functions aren't used by the layout engine. */ +struct UObject {}; + +/* String handling */ +#include +#include + +/** + * A convenience macro to test for the success of a LayoutEngine call. + * + * @stable ICU 2.4 + */ +#define LE_SUCCESS(code) ((code)<=LE_NO_ERROR) + +/** + * A convenience macro to test for the failure of a LayoutEngine call. + * + * @stable ICU 2.4 + */ +#define LE_FAILURE(code) ((code)>LE_NO_ERROR) + + +#ifndef _LP64 +typedef long le_int32; +typedef unsigned long le_uint32; +#else +typedef int le_int32; +typedef unsigned int le_uint32; +#endif + +#define HAVE_LE_INT32 1 +#define HAVE_LE_UINT32 1 + +typedef unsigned short UChar; +typedef le_uint32 UChar32; + +typedef short le_int16; +#define HAVE_LE_INT16 1 + +typedef unsigned short le_uint16; +#define HAVE_LE_UINT16 + +typedef signed char le_int8; +#define HAVE_LE_INT8 + +typedef unsigned char le_uint8; +#define HAVE_LE_UINT8 + +typedef char UBool; + +/** + * Error codes returned by the LayoutEngine. + * + * @stable ICU 2.4 + */ +enum LEErrorCode { + /* informational */ + LE_NO_SUBFONT_WARNING = -127, // U_USING_DEFAULT_WARNING, + + /* success */ + LE_NO_ERROR = 0, // U_ZERO_ERROR, + + /* failures */ + LE_ILLEGAL_ARGUMENT_ERROR = 1, // U_ILLEGAL_ARGUMENT_ERROR, + LE_MEMORY_ALLOCATION_ERROR = 7, // U_MEMORY_ALLOCATION_ERROR, + LE_INDEX_OUT_OF_BOUNDS_ERROR = 8, //U_INDEX_OUTOFBOUNDS_ERROR, + LE_NO_LAYOUT_ERROR = 16, // U_UNSUPPORTED_ERROR, + LE_INTERNAL_ERROR = 5, // U_INTERNAL_PROGRAM_ERROR, + LE_FONT_FILE_NOT_FOUND_ERROR = 4, // U_FILE_ACCESS_ERROR, + LE_MISSING_FONT_TABLE_ERROR = 2 // U_MISSING_RESOURCE_ERROR +}; +#define HAVE_LEERRORCODE + +#define U_LAYOUT_API + +#define uprv_malloc malloc +#define uprv_free free +#define uprv_memcpy memcpy +#define uprv_realloc realloc + +#if !defined(U_IS_BIG_ENDIAN) + #ifdef _LITTLE_ENDIAN + #define U_IS_BIG_ENDIAN 0 + #endif +#endif + +#endif diff --git a/jdk/src/share/native/sun/font/layout/LESwaps.h b/jdk/src/share/native/sun/font/layout/LESwaps.h index d8deeb92524..75adeac20fb 100644 --- a/jdk/src/share/native/sun/font/layout/LESwaps.h +++ b/jdk/src/share/native/sun/font/layout/LESwaps.h @@ -26,7 +26,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * */ @@ -35,11 +35,12 @@ #include "LETypes.h" -#if !defined(U_IS_BIG_ENDIAN) - #ifdef _LITTLE_ENDIAN - #define U_IS_BIG_ENDIAN 0 - #endif -#endif +/** + * \file + * \brief C++ API: Endian independent access to data for LayoutEngine + */ + +U_NAMESPACE_BEGIN /** * A convenience macro which invokes the swapWord member function @@ -47,7 +48,6 @@ * * @stable ICU 2.8 */ - #if defined(U_IS_BIG_ENDIAN) #if U_IS_BIG_ENDIAN #define SWAPW(value) (value) @@ -64,7 +64,6 @@ * * @stable ICU 2.8 */ - #if defined(U_IS_BIG_ENDIAN) #if U_IS_BIG_ENDIAN #define SWAPL(value) (value) @@ -86,8 +85,7 @@ * * @stable ICU 2.8 */ -class LESwaps -{ +class U_LAYOUT_API LESwaps /* not : public UObject because all methods are static */ { public: #if !defined(U_IS_BIG_ENDIAN) @@ -144,4 +142,5 @@ private: LESwaps() {} // private - forbid instantiation }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LETypes.h b/jdk/src/share/native/sun/font/layout/LETypes.h index db66c5b0b7a..d3b91b38e65 100644 --- a/jdk/src/share/native/sun/font/layout/LETypes.h +++ b/jdk/src/share/native/sun/font/layout/LETypes.h @@ -23,7 +23,6 @@ * */ - /* * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved @@ -33,75 +32,99 @@ #ifndef __LETYPES_H #define __LETYPES_H +/** + * If LE_Standalone is defined, it must exist and contain + * definitions for some core ICU defines. + */ +#ifdef LE_STANDALONE +#include "LEStandalone.h" +#endif + +#ifdef LE_STANDALONE +/* Stand-alone Layout Engine- without ICU. */ +#include "LEStandalone.h" #define LE_USE_CMEMORY - -#ifdef LE_USE_CMEMORY -#include -#include -#endif - -#ifndef _LP64 -typedef long le_int32; -typedef unsigned long le_uint32; #else -typedef int le_int32; -typedef unsigned int le_uint32; +#if !defined(LE_USE_CMEMORY) && (defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_STATIC_IMPLEMENTATION) || defined(U_COMBINED_IMPLEMENTATION)) +#define LE_USE_CMEMORY #endif -typedef short le_int16; -typedef unsigned short le_uint16; -typedef signed char le_int8; -typedef unsigned char le_uint8; -typedef char le_bool; +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#ifdef LE_USE_CMEMORY +#include "cmemory.h" +#endif +#endif /* not standalone */ -typedef char UClassID; -#if 0 +U_NAMESPACE_BEGIN + +/*! + * \file + * \brief Basic definitions for the ICU LayoutEngine + */ + /** * A type used for signed, 32-bit integers. * * @stable ICU 2.4 */ +#ifndef HAVE_LE_INT32 typedef int32_t le_int32; +#endif /** * A type used for unsigned, 32-bit integers. * * @stable ICU 2.4 */ +#ifndef HAVE_LE_UINT32 typedef uint32_t le_uint32; +#endif /** * A type used for signed, 16-bit integers. * * @stable ICU 2.4 */ +#ifndef HAVE_LE_INT16 typedef int16_t le_int16; +#endif +#ifndef HAVE_LE_UINT16 /** * A type used for unsigned, 16-bit integers. * * @stable ICU 2.4 */ typedef uint16_t le_uint16; +#endif +#ifndef HAVE_LE_INT8 /** * A type used for signed, 8-bit integers. * * @stable ICU 2.4 */ typedef int8_t le_int8; +#endif +#ifndef HAVE_LE_UINT8 /** * A type used for unsigned, 8-bit integers. * * @stable ICU 2.4 */ typedef uint8_t le_uint8; - -typedef char le_bool; #endif +/** +* A type used for boolean values. +* +* @stable ICU 2.4 +*/ +typedef UBool le_bool; + #ifndef TRUE /** * Used for le_bool values which are true. @@ -264,21 +287,21 @@ typedef le_uint32 LEGlyphID; * * @stable ICU 2.4 */ -typedef le_uint16 LEUnicode16; +typedef UChar LEUnicode16; /** * Used to represent 32-bit Unicode code points. * * @stable ICU 2.4 */ -typedef le_uint32 LEUnicode32; +typedef UChar32 LEUnicode32; /** * Used to represent 16-bit Unicode code points. * * @deprecated since ICU 2.4. Use LEUnicode16 instead */ -typedef le_uint16 LEUnicode; +typedef UChar LEUnicode; /** * Used to hold a pair of (x, y) values which represent a point. @@ -325,7 +348,7 @@ typedef struct LEPoint LEPoint; * * @internal */ -#define LE_ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0]) +#define LE_ARRAY_COPY(dst, src, count) uprv_memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0]) /** * Allocate an array of basic types. This is used to isolate the rest of @@ -333,7 +356,7 @@ typedef struct LEPoint LEPoint; * * @internal */ -#define LE_NEW_ARRAY(type, count) (type *) malloc((count) * sizeof(type)) +#define LE_NEW_ARRAY(type, count) (type *) uprv_malloc((count) * sizeof(type)) /** * Re-allocate an array of basic types. This is used to isolate the rest of @@ -341,7 +364,7 @@ typedef struct LEPoint LEPoint; * * @internal */ -#define LE_GROW_ARRAY(array, newSize) realloc((void *) (array), (newSize) * sizeof (array)[0]) +#define LE_GROW_ARRAY(array, newSize) uprv_realloc((void *) (array), (newSize) * sizeof (array)[0]) /** * Free an array of basic types. This is used to isolate the rest of @@ -349,7 +372,7 @@ typedef struct LEPoint LEPoint; * * @internal */ -#define LE_DELETE_ARRAY(array) free((void *) (array)) +#define LE_DELETE_ARRAY(array) uprv_free((void *) (array)) #endif /** @@ -567,22 +590,24 @@ enum LEFeatureTags { * * @stable ICU 2.4 */ +#ifndef HAVE_LEERRORCODE enum LEErrorCode { /* informational */ - LE_NO_SUBFONT_WARNING = -127, // U_USING_DEFAULT_WARNING, + LE_NO_SUBFONT_WARNING = U_USING_DEFAULT_WARNING, /**< The font does not contain subfonts. */ /* success */ - LE_NO_ERROR = 0, // U_ZERO_ERROR, + LE_NO_ERROR = U_ZERO_ERROR, /**< No error, no warning. */ /* failures */ - LE_ILLEGAL_ARGUMENT_ERROR = 1, // U_ILLEGAL_ARGUMENT_ERROR, - LE_MEMORY_ALLOCATION_ERROR = 7, // U_MEMORY_ALLOCATION_ERROR, - LE_INDEX_OUT_OF_BOUNDS_ERROR = 8, //U_INDEX_OUTOFBOUNDS_ERROR, - LE_NO_LAYOUT_ERROR = 16, // U_UNSUPPORTED_ERROR, - LE_INTERNAL_ERROR = 5, // U_INTERNAL_PROGRAM_ERROR, - LE_FONT_FILE_NOT_FOUND_ERROR = 4, // U_FILE_ACCESS_ERROR, - LE_MISSING_FONT_TABLE_ERROR = 2 // U_MISSING_RESOURCE_ERROR + LE_ILLEGAL_ARGUMENT_ERROR = U_ILLEGAL_ARGUMENT_ERROR, /**< An illegal argument was detected. */ + LE_MEMORY_ALLOCATION_ERROR = U_MEMORY_ALLOCATION_ERROR, /**< Memory allocation error. */ + LE_INDEX_OUT_OF_BOUNDS_ERROR = U_INDEX_OUTOFBOUNDS_ERROR, /**< Trying to access an index that is out of bounds. */ + LE_NO_LAYOUT_ERROR = U_UNSUPPORTED_ERROR, /**< You must call layoutChars() first. */ + LE_INTERNAL_ERROR = U_INTERNAL_PROGRAM_ERROR, /**< An internal error was encountered. */ + LE_FONT_FILE_NOT_FOUND_ERROR = U_FILE_ACCESS_ERROR, /**< The requested font file cannot be opened. */ + LE_MISSING_FONT_TABLE_ERROR = U_MISSING_RESOURCE_ERROR /**< The requested font table does not exist. */ }; +#endif #ifndef XP_CPLUSPLUS /** @@ -598,14 +623,20 @@ typedef enum LEErrorCode LEErrorCode; * * @stable ICU 2.4 */ -#define LE_SUCCESS(code) ((code)<=LE_NO_ERROR) +#ifndef LE_FAILURE +#define LE_SUCCESS(code) (U_SUCCESS((UErrorCode)code)) +#endif /** * A convenience macro to test for the failure of a LayoutEngine call. * * @stable ICU 2.4 */ -#define LE_FAILURE(code) ((code)>LE_NO_ERROR) - -#define U_LAYOUT_API +#ifndef LE_FAILURE +#define LE_FAILURE(code) (U_FAILURE((UErrorCode)code)) #endif + +U_NAMESPACE_END +#endif + + diff --git a/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp index 0a877d32e52..916197bfc8f 100644 --- a/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp @@ -23,6 +23,7 @@ * */ + /* * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved @@ -40,6 +41,7 @@ #include "IndicLayoutEngine.h" #include "KhmerLayoutEngine.h" #include "ThaiLayoutEngine.h" +//#include "TibetanLayoutEngine.h" #include "GXLayoutEngine.h" #include "ScriptAndLanguageTags.h" #include "CharSubstitutionFilter.h" @@ -55,6 +57,8 @@ #include "KernTable.h" +U_NAMESPACE_BEGIN + const LEUnicode32 DefaultCharMapper::controlChars[] = { 0x0009, 0x000A, 0x000D, /*0x200C, 0x200D,*/ 0x200E, 0x200F, @@ -101,9 +105,7 @@ LEUnicode32 DefaultCharMapper::mapChar(LEUnicode32 ch) const } if (fMirror) { - le_int32 index = OpenTypeUtilities::search((le_uint32) ch, - (le_uint32 *)DefaultCharMapper::mirroredChars, - DefaultCharMapper::mirroredCharsCount); + le_int32 index = OpenTypeUtilities::search((le_uint32) ch, (le_uint32 *)DefaultCharMapper::mirroredChars, DefaultCharMapper::mirroredCharsCount); if (mirroredChars[index] == ch) { return DefaultCharMapper::srahCderorrim[index]; @@ -132,6 +134,9 @@ CharSubstitutionFilter::~CharSubstitutionFilter() // nothing to do } + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LayoutEngine) + #define ccmpFeatureTag LE_CCMP_FEATURE_TAG #define ccmpFeatureMask 0x80000000UL @@ -145,10 +150,9 @@ static const FeatureMap canonFeatureMap[] = static const le_int32 canonFeatureMapCount = LE_ARRAY_SIZE(canonFeatureMap); -LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, - le_int32 languageCode, le_int32 typoFlags) - : fGlyphStorage(NULL), fFontInstance(fontInstance), fScriptCode(scriptCode), - fLanguageCode(languageCode), fTypoFlags(typoFlags) +LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) + : fGlyphStorage(NULL), fFontInstance(fontInstance), fScriptCode(scriptCode), fLanguageCode(languageCode), + fTypoFlags(typoFlags) { fGlyphStorage = new LEGlyphStorage(); } @@ -158,8 +162,7 @@ le_int32 LayoutEngine::getGlyphCount() const return fGlyphStorage->getGlyphCount(); } -void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase, - LEErrorCode &success) const +void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const { fGlyphStorage->getCharIndices(charIndices, indexBase, success); } @@ -170,8 +173,7 @@ void LayoutEngine::getCharIndices(le_int32 charIndices[], LEErrorCode &success) } // Copy the glyphs into caller's (32-bit) glyph array, OR in extraBits -void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, - LEErrorCode &success) const +void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const { fGlyphStorage->getGlyphs(glyphs, extraBits, success); } @@ -218,15 +220,13 @@ void LayoutEngine::getGlyphPositions(float positions[], LEErrorCode &success) co fGlyphStorage->getGlyphPositions(positions, success); } -void LayoutEngine::getGlyphPosition(le_int32 glyphIndex, float &x, float &y, - LEErrorCode &success) const +void LayoutEngine::getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const { fGlyphStorage->getGlyphPosition(glyphIndex, x, y, success); } -le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, LEUnicode *&outChars, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -237,12 +237,7 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off return 0; } - if ((fTypoFlags & 0x4) == 0) { // no canonical processing - return count; - } - - const GlyphSubstitutionTableHeader *canonGSUBTable = - (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable; + const GlyphSubstitutionTableHeader *canonGSUBTable = (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable; LETag scriptTag = OpenTypeLayoutEngine::getScriptTag(fScriptCode); LETag langSysTag = OpenTypeLayoutEngine::getLangSysTag(fLanguageCode); le_int32 i, dir = 1, out = 0, outCharCount = count; @@ -256,16 +251,15 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off // We could just do the mark reordering for all scripts, but most // of them probably don't need it... if (fScriptCode == hebrScriptCode) { - reordered = LE_NEW_ARRAY(LEUnicode, count); + reordered = LE_NEW_ARRAY(LEUnicode, count); - if (reordered == NULL) { - success = LE_MEMORY_ALLOCATION_ERROR; - return 0; - } + if (reordered == NULL) { + success = LE_MEMORY_ALLOCATION_ERROR; + return 0; + } - CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, - reordered, glyphStorage); - inChars = reordered; + CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, reordered, glyphStorage); + inChars = reordered; } glyphStorage.allocateGlyphArray(count, rightToLeft, success); @@ -289,8 +283,7 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off LE_DELETE_ARRAY(reordered); } - outCharCount = canonGSUBTable->process(glyphStorage, rightToLeft, scriptTag, - langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE); + outCharCount = canonGSUBTable->process(glyphStorage, rightToLeft, scriptTag, langSysTag, NULL, substitutionFilter, canonFeatureMap, canonFeatureMapCount, FALSE); out = (rightToLeft? count - 1 : 0); @@ -305,35 +298,26 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off return outCharCount; } - -le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; } - if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || - offset + count > max) { - + if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { success = LE_ILLEGAL_ARGUMENT_ERROR; return 0; } LEUnicode *outChars = NULL; - le_int32 outCharCount = characterProcessing(chars, offset, count, max, - rightToLeft, outChars, glyphStorage, success); + le_int32 outCharCount = characterProcessing(chars, offset, count, max, rightToLeft, outChars, glyphStorage, success); if (outChars != NULL) { - mapCharsToGlyphs(outChars, 0, outCharCount, rightToLeft, rightToLeft, - glyphStorage, success); - // FIXME: a subclass may have allocated this, in which case this delete - // might not work... - LE_DELETE_ARRAY(outChars); + mapCharsToGlyphs(outChars, 0, outCharCount, rightToLeft, rightToLeft, glyphStorage, success); + LE_DELETE_ARRAY(outChars); // FIXME: a subclass may have allocated this, in which case this delete might not work... } else { - mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, - glyphStorage, success); + mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, glyphStorage, success); } return glyphStorage.getGlyphCount(); @@ -341,8 +325,7 @@ le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, // Input: glyphs // Output: positions -void LayoutEngine::positionGlyphs(LEGlyphStorage &glyphStorage, - float x, float y, LEErrorCode &success) +void LayoutEngine::positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success) { if (LE_FAILURE(success)) { return; @@ -369,9 +352,8 @@ void LayoutEngine::positionGlyphs(LEGlyphStorage &glyphStorage, glyphStorage.setPosition(glyphCount, x, y, success); } -void LayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +void LayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return; @@ -398,8 +380,7 @@ void LayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset return; } -void LayoutEngine::adjustMarkGlyphs(LEGlyphStorage &glyphStorage, - LEGlyphFilter *markFilter, LEErrorCode &success) +void LayoutEngine::adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success) { float xAdjust = 0; le_int32 p, glyphCount = glyphStorage.getGlyphCount(); @@ -435,9 +416,7 @@ void LayoutEngine::adjustMarkGlyphs(LEGlyphStorage &glyphStorage, glyphStorage.adjustPosition(glyphCount, xAdjust, 0, success); } -void LayoutEngine::adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, - le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, - LEErrorCode &success) +void LayoutEngine::adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success) { float xAdjust = 0; le_int32 c = 0, direction = 1, p; @@ -484,9 +463,8 @@ const void *LayoutEngine::getFontTable(LETag tableTag) const return fFontInstance->getFontTable(tableTag); } -void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, le_bool mirror, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return; @@ -496,32 +474,27 @@ void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, DefaultCharMapper charMapper(TRUE, mirror); - fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, - &charMapper, glyphStorage); + fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, &charMapper, glyphStorage); } // Input: characters, font? // Output: glyphs, positions, char indices // Returns: number of glyphs -le_int32 LayoutEngine::layoutChars(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - float x, float y, LEErrorCode &success) +le_int32 LayoutEngine::layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + float x, float y, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; } - if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || - offset + count > max) { - + if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { success = LE_ILLEGAL_ARGUMENT_ERROR; return 0; } le_int32 glyphCount; - glyphCount = computeGlyphs(chars, offset, count, max, rightToLeft, - *fGlyphStorage, success); + glyphCount = computeGlyphs(chars, offset, count, max, rightToLeft, *fGlyphStorage, success); positionGlyphs(*fGlyphStorage, x, y, success); adjustGlyphPositions(chars, offset, count, rightToLeft, *fGlyphStorage, success); @@ -533,17 +506,13 @@ void LayoutEngine::reset() fGlyphStorage->reset(); } -LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success) +LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success) { // 3 -> kerning and ligatures - return LayoutEngine::layoutEngineFactory(fontInstance, scriptCode, - languageCode, 3, success); + return LayoutEngine::layoutEngineFactory(fontInstance, scriptCode, languageCode, 3, success); } -LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, - LEErrorCode &success) +LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success) { static const le_uint32 gsubTableTag = LE_GSUB_TABLE_TAG; static const le_uint32 mortTableTag = LE_MORT_TABLE_TAG; @@ -552,18 +521,12 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan return NULL; } - // code2000 has GPOS kern feature tags for latn script - - const GlyphSubstitutionTableHeader *gsubTable = - (const GlyphSubstitutionTableHeader *) fontInstance->getFontTable(gsubTableTag); + const GlyphSubstitutionTableHeader *gsubTable = (const GlyphSubstitutionTableHeader *) fontInstance->getFontTable(gsubTableTag); LayoutEngine *result = NULL; LETag scriptTag = 0x00000000; LETag languageTag = 0x00000000; - if (gsubTable != NULL && - gsubTable->coversScript(scriptTag = - OpenTypeLayoutEngine::getScriptTag(scriptCode))) { - + if (gsubTable != NULL && gsubTable->coversScript(scriptTag = OpenTypeLayoutEngine::getScriptTag(scriptCode))) { switch (scriptCode) { case bengScriptCode: case devaScriptCode: @@ -575,13 +538,11 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan case tamlScriptCode: case teluScriptCode: case sinhScriptCode: - result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, - languageCode, typoFlags, gsubTable); + result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable); break; case arabScriptCode: - result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, - languageCode, typoFlags, gsubTable); + result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable); break; case haniScriptCode: @@ -593,33 +554,33 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan case zhtLanguageCode: case zhsLanguageCode: if (gsubTable->coversScriptAndLanguage(scriptTag, languageTag, TRUE)) { - result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, - languageCode, typoFlags, gsubTable); + result = new HanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable); break; } // note: falling through to default case. default: - result = new OpenTypeLayoutEngine(fontInstance, scriptCode, - languageCode, typoFlags, gsubTable); + result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable); break; } break; +#if 0 + case tibtScriptCode: + result = new TibetanOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable); + break; +#endif case khmrScriptCode: - result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode, - languageCode, typoFlags, gsubTable); + result = new KhmerOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable); break; default: - result = new OpenTypeLayoutEngine(fontInstance, scriptCode, - languageCode, typoFlags, gsubTable); + result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable); break; } } else { - const MorphTableHeader *morphTable = - (MorphTableHeader *) fontInstance->getFontTable(mortTableTag); + const MorphTableHeader *morphTable = (MorphTableHeader *) fontInstance->getFontTable(mortTableTag); if (morphTable != NULL) { result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, morphTable); @@ -636,16 +597,18 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan case teluScriptCode: case sinhScriptCode: { - result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, - languageCode, typoFlags); + result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags); break; } case arabScriptCode: - result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode, - languageCode, typoFlags); + //case hebrScriptCode: + result = new UnicodeArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags); break; + //case hebrScriptCode: + // return new HebrewOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags); + case thaiScriptCode: result = new ThaiLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags); break; @@ -667,3 +630,5 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan LayoutEngine::~LayoutEngine() { delete fGlyphStorage; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/LayoutEngine.h b/jdk/src/share/native/sun/font/layout/LayoutEngine.h index fef3b30390c..84cfc405ec4 100644 --- a/jdk/src/share/native/sun/font/layout/LayoutEngine.h +++ b/jdk/src/share/native/sun/font/layout/LayoutEngine.h @@ -23,6 +23,7 @@ * */ + /* * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved @@ -34,63 +35,61 @@ #include "LETypes.h" -#include +/** + * \file + * \brief C++ API: Virtual base class for complex text layout. + */ + +U_NAMESPACE_BEGIN class LEFontInstance; class LEGlyphFilter; class LEGlyphStorage; /** - * This is a virtual base class used to do complex text layout. The - * text must all be in a single font, script, and language. An - * instance of a LayoutEngine can be created by calling the - * layoutEngineFactory method. Fonts are identified by instances of - * the LEFontInstance class. Script and language codes are identified + * This is a virtual base class used to do complex text layout. The text must all + * be in a single font, script, and language. An instance of a LayoutEngine can be + * created by calling the layoutEngineFactory method. Fonts are identified by + * instances of the LEFontInstance class. Script and language codes are identified * by integer codes, which are defined in ScriptAndLanuageTags.h. * - * Note that this class is not public API. It is declared public so - * that it can be exported from the library that it is a part of. + * Note that this class is not public API. It is declared public so that it can be + * exported from the library that it is a part of. * - * The input to the layout process is an array of characters in - * logical order, and a starting X, Y position for the text. The - * output is an array of glyph indices, an array of character indices - * for the glyphs, and an array of glyph positions. These arrays are - * protected members of LayoutEngine which can be retreived by a - * public method. The reset method can be called to free these arrays - * so that the LayoutEngine can be reused. + * The input to the layout process is an array of characters in logical order, + * and a starting X, Y position for the text. The output is an array of glyph indices, + * an array of character indices for the glyphs, and an array of glyph positions. + * These arrays are protected members of LayoutEngine which can be retreived by a + * public method. The reset method can be called to free these arrays so that the + * LayoutEngine can be reused. * - * The layout process is done in three steps. There is a protected - * virtual method for each step. These methods have a default - * implementation which only does character to glyph mapping and - * default positioning using the glyph's advance widths. Subclasses - * can override these methods for more advanced layout. There is a - * public method which invokes the steps in the correct order. + * The layout process is done in three steps. There is a protected virtual method + * for each step. These methods have a default implementation which only does + * character to glyph mapping and default positioning using the glyph's advance + * widths. Subclasses can override these methods for more advanced layout. + * There is a public method which invokes the steps in the correct order. * * The steps are: * - * 1) Glyph processing - character to glyph mapping and any other - * glyph processing such as ligature substitution and contextual - * forms. + * 1) Glyph processing - character to glyph mapping and any other glyph processing + * such as ligature substitution and contextual forms. * - * 2) Glyph positioning - position the glyphs based on their advance - * widths. + * 2) Glyph positioning - position the glyphs based on their advance widths. * - * 3) Glyph position adjustments - adjustment of glyph positions for - * kerning, accent placement, etc. + * 3) Glyph position adjustments - adjustment of glyph positions for kerning, + * accent placement, etc. * - * NOTE: in all methods below, output parameters are references to - * pointers so the method can allocate and free the storage as - * needed. All storage allocated in this way is owned by the object - * which created it, and will be freed when it is no longer needed, or - * when the object's destructor is invoked. + * NOTE: in all methods below, output parameters are references to pointers so + * the method can allocate and free the storage as needed. All storage allocated + * in this way is owned by the object which created it, and will be freed when it + * is no longer needed, or when the object's destructor is invoked. * * @see LEFontInstance * @see ScriptAndLanguageTags.h * * @stable ICU 2.8 */ -class U_LAYOUT_API LayoutEngine -{ +class U_LAYOUT_API LayoutEngine : public UObject { protected: /** * The object which holds the glyph storage @@ -134,21 +133,21 @@ protected: le_int32 fTypoFlags; /** - * This constructs an instance for a given font, script and - * language. Subclass constructors + * This constructs an instance for a given font, script and language. Subclass constructors * must call this constructor. * * @param fontInstance - the font for the text * @param scriptCode - the script for the text * @param languageCode - the language for the text + * @param typoFlags - the typographic control flags for the text. Set bit 1 if kerning + * is desired, set bit 2 if ligature formation is desired. Others are reserved. * * @see LEFontInstance * @see ScriptAndLanguageTags.h * * @internal */ - LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, - le_int32 languageCode, le_int32 typoFlags); + LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); /** * This overrides the default no argument constructor to make it @@ -160,11 +159,10 @@ protected: LayoutEngine(); /** - * This method does any required pre-processing to the input - * characters. It may generate output characters that differ from - * the input charcters due to insertions, deletions, or - * reorderings. In such cases, it will also generate an output - * character index array reflecting these changes. + * This method does any required pre-processing to the input characters. It + * may generate output characters that differ from the input charcters due to + * insertions, deletions, or reorderings. In such cases, it will also generate an + * output character index array reflecting these changes. * * Subclasses must override this method. * @@ -173,44 +171,36 @@ protected: * @param offset - the index of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - TRUE if the characters are in a right to - * left directional run - * @param outChars - the output character array, if different from - * the input - * @param glyphStorage - the object that holds the per-glyph - * storage. The character index array may be set. + * @param rightToLeft - TRUE if the characters are in a right to left directional run + * @param outChars - the output character array, if different from the input + * @param glyphStorage - the object that holds the per-glyph storage. The character index array may be set. * @param success - set to an error code if the operation fails - * @return the output character count (input character count if no - * change) + * + * @return the output character count (input character count if no change) * * @internal */ - virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** - * This method does the glyph processing. It converts an array of - * characters into an array of glyph indices and character - * indices. The characters to be processed are passed in a - * surrounding context. The context is specified as a starting - * address and a maximum character count. An offset and a count - * are used to specify the characters to be processed. + * This method does the glyph processing. It converts an array of characters + * into an array of glyph indices and character indices. The characters to be + * processed are passed in a surrounding context. The context is specified as + * a starting address and a maximum character count. An offset and a count are + * used to specify the characters to be processed. * - * The default implementation of this method only does character - * to glyph mapping. Subclasses needing more elaborate glyph - * processing must override this method. + * The default implementation of this method only does character to glyph mapping. + * Subclasses needing more elaborate glyph processing must override this method. * * Input parameters: * @param chars - the character context * @param offset - the offset of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the context. - * @param rightToLeft - TRUE if the text is in a right to left - * directional run - * @param glyphStorage - the object which holds the per-glyph - * storage. The glyph and char indices arrays will be - * set. + * @param rightToLeft - TRUE if the text is in a right to left directional run + * @param glyphStorage - the object which holds the per-glyph storage. The glyph and char indices arrays + * will be set. * * Output parameters: * @param success - set to an error code if the operation fails @@ -219,60 +209,50 @@ protected: * * @internal */ - virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** - * This method does basic glyph positioning. The default - * implementation positions the glyphs based on their advance - * widths. This is sufficient for most uses. It is not expected - * that many subclasses will override this method. + * This method does basic glyph positioning. The default implementation positions + * the glyphs based on their advance widths. This is sufficient for most uses. It + * is not expected that many subclasses will override this method. * * Input parameters: - * @param glyphStorage - the object which holds the per-glyph storage. - * The glyph position array will be set. + * @param glyphStorage - the object which holds the per-glyph storage. The glyph position array will be set. * @param x - the starting X position * @param y - the starting Y position * @param success - set to an error code if the operation fails * * @internal */ - virtual void positionGlyphs(LEGlyphStorage &glyphStorage, - float x, float y, LEErrorCode &success); + virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success); /** - * This method does positioning adjustments like accent - * positioning and kerning. The default implementation does - * nothing. Subclasses needing position adjustments must override - * this method. + * This method does positioning adjustments like accent positioning and + * kerning. The default implementation does nothing. Subclasses needing + * position adjustments must override this method. * - * Note that this method has both characters and glyphs as input - * so that it can use the character codes to determine glyph types - * if that information isn't directly available. (e.g. Some Arabic - * OpenType fonts don't have a GDEF table) + * Note that this method has both characters and glyphs as input so that + * it can use the character codes to determine glyph types if that information + * isn't directly available. (e.g. Some Arabic OpenType fonts don't have a GDEF + * table) * * @param chars - the input character context * @param offset - the offset of the first character to process * @param count - the number of characters to process - * @param reverse - TRUE if the glyphs in the glyph - * array have been reordered - * @param glyphStorage - the object which holds the per-glyph - * storage. The glyph positions will be adjusted as needed. - * @param success - output parameter set to an error code if the - * operation fails + * @param reverse - TRUE if the glyphs in the glyph array have been reordered + * @param glyphStorage - the object which holds the per-glyph storage. The glyph positions will be + * adjusted as needed. + * @param success - output parameter set to an error code if the operation fails * * @internal */ - virtual void adjustGlyphPositions(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_bool reverse, - LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** - * This method gets a table from the font associated with the - * text. The default implementation gets the table from the font - * instance. Subclasses which need to get the tables some other - * way must override this method. + * This method gets a table from the font associated with + * the text. The default implementation gets the table from + * the font instance. Subclasses which need to get the tables + * some other way must override this method. * * @param tableTag - the four byte table tag. * @@ -283,127 +263,106 @@ protected: virtual const void *getFontTable(LETag tableTag) const; /** - * This method does character to glyph mapping. The default - * implementation uses the font instance to do the mapping. It - * will allocate the glyph and character index arrays if they're - * not already allocated. If it allocates the character index - * array, it will fill it it. + * This method does character to glyph mapping. The default implementation + * uses the font instance to do the mapping. It will allocate the glyph and + * character index arrays if they're not already allocated. If it allocates the + * character index array, it will fill it it. * - * This method supports right to left text with the ability to - * store the glyphs in reverse order, and by supporting character - * mirroring, which will replace a character which has a left and - * right form, such as parens, with the opposite form before - * mapping it to a glyph index. + * This method supports right to left + * text with the ability to store the glyphs in reverse order, and by supporting + * character mirroring, which will replace a character which has a left and right + * form, such as parens, with the opposite form before mapping it to a glyph index. * * Input parameters: * @param chars - the input character context * @param offset - the offset of the first character to be mapped * @param count - the number of characters to be mapped - * @param reverse - if TRUE, the output will be in - * reverse order + * @param reverse - if TRUE, the output will be in reverse order * @param mirror - if TRUE, do character mirroring - * @param glyphStorage - the object which holds the per-glyph - * storage. The glyph and char indices arrays will be - * filled in. + * @param glyphStorage - the object which holds the per-glyph storage. The glyph and char + * indices arrays will be filled in. * @param success - set to an error code if the operation fails * * @see LEFontInstance * * @internal */ - virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, le_bool mirror, - LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** - * This is a convenience method that forces the advance width of - * mark glyphs to be zero, which is required for proper selection - * and highlighting. + * This is a convenience method that forces the advance width of mark + * glyphs to be zero, which is required for proper selection and highlighting. * - * @param glyphStorage - the object containing the per-glyph - * storage. The positions array will be modified. + * @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified. * @param markFilter - used to identify mark glyphs - * @param success - output parameter set to an error code if the - * operation fails + * @param success - output parameter set to an error code if the operation fails * * @see LEGlyphFilter * * @internal */ - static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, - LEGlyphFilter *markFilter, LEErrorCode &success); + static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success); /** - * This is a convenience method that forces the advance width of - * mark glyphs to be zero, which is required for proper selection - * and highlighting. This method uses the input characters to - * identify marks. This is required in cases where the font does - * not contain enough information to identify them based on the - * glyph IDs. + * This is a convenience method that forces the advance width of mark + * glyphs to be zero, which is required for proper selection and highlighting. + * This method uses the input characters to identify marks. This is required in + * cases where the font does not contain enough information to identify them based + * on the glyph IDs. * * @param chars - the array of input characters * @param charCount - the number of input characers - * @param glyphStorage - the object containing the per-glyph - * storage. The positions array will be modified. - * @param reverse - TRUE if the glyph array has been - * reordered + * @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified. + * @param reverse - TRUE if the glyph array has been reordered * @param markFilter - used to identify mark glyphs - * @param success - output parameter set to an error code if the - * operation fails + * @param success - output parameter set to an error code if the operation fails * * @see LEGlyphFilter * * @internal */ - static void adjustMarkGlyphs(const LEUnicode chars[], - le_int32 charCount, le_bool reverse, - LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, - LEErrorCode &success); + static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success); + public: /** * The destructor. It will free any storage allocated for the * glyph, character index and position arrays by calling the reset - * method. It is declared virtual so that it will be invoked by - * the subclass destructors. + * method. It is declared virtual so that it will be invoked by the + * subclass destructors. * * @stable ICU 2.8 */ virtual ~LayoutEngine(); /** - * This method will invoke the layout steps in their correct order - * by calling the 32 bit versions of the computeGlyphs and - * positionGlyphs methods.(It doesn't * call the - * adjustGlyphPositions method because that doesn't apply for - * default * processing.) It will compute the glyph, character - * index and position arrays. + * This method will invoke the layout steps in their correct order by calling + * the computeGlyphs, positionGlyphs and adjustGlyphPosition methods.. It will + * compute the glyph, character index and position arrays. * * @param chars - the input character context * @param offset - the offset of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - true if the characers are in a right to - * left directional run + * @param rightToLeft - TRUE if the characers are in a right to left directional run * @param x - the initial X position * @param y - the initial Y position - * @param success - output parameter set to an error code if the - * operation fails + * @param success - output parameter set to an error code if the operation fails + * * @return the number of glyphs in the glyph array * - * Note: the glyph, character index and position array can be - * accessed using the getter method below. + * Note; the glyph, character index and position array can be accessed + * using the getter method below. + * + * @stable ICU 2.8 */ - le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, float x, - float y, LEErrorCode &success); + virtual le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, float x, float y, LEErrorCode &success); /** - * This method returns the number of glyphs in the glyph - * array. Note that the number of glyphs will be greater than or - * equal to the number of characters used to create the - * LayoutEngine. + * This method returns the number of glyphs in the glyph array. Note + * that the number of glyphs will be greater than or equal to the number + * of characters used to create the LayoutEngine. * * @return the number of glyphs in the glyph array * @@ -412,9 +371,9 @@ public: le_int32 getGlyphCount() const; /** - * This method copies the glyph array into a caller supplied - * array. The caller must ensure that the array is large enough - * to hold all the glyphs. + * This method copies the glyph array into a caller supplied array. + * The caller must ensure that the array is large enough to hold all + * the glyphs. * * @param glyphs - the destiniation glyph array * @param success - set to an error code if the operation fails @@ -424,10 +383,10 @@ public: void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const; /** - * This method copies the glyph array into a caller supplied - * array, ORing in extra bits. (This functionality is needed by - * the JDK, which uses 32 bits pre glyph idex, with the high 16 - * bits encoding the composite font slot number) + * This method copies the glyph array into a caller supplied array, + * ORing in extra bits. (This functionality is needed by the JDK, + * which uses 32 bits pre glyph idex, with the high 16 bits encoding + * the composite font slot number) * * @param glyphs - the destination (32 bit) glyph array * @param extraBits - this value will be ORed with each glyph index @@ -435,13 +394,12 @@ public: * * @stable ICU 2.8 */ - virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, - LEErrorCode &success) const; + virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const; /** - * This method copies the character index array into a caller - * supplied array. The caller must ensure that the array is large - * enough to hold a character index for each glyph. + * This method copies the character index array into a caller supplied array. + * The caller must ensure that the array is large enough to hold a + * character index for each glyph. * * @param charIndices - the destiniation character index array * @param success - set to an error code if the operation fails @@ -451,9 +409,9 @@ public: void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const; /** - * This method copies the character index array into a caller - * supplied array. The caller must ensure that the array is large - * enough to hold a character index for each glyph. + * This method copies the character index array into a caller supplied array. + * The caller must ensure that the array is large enough to hold a + * character index for each glyph. * * @param charIndices - the destiniation character index array * @param indexBase - an offset which will be added to each index @@ -461,14 +419,13 @@ public: * * @stable ICU 2.8 */ - void getCharIndices(le_int32 charIndices[], le_int32 indexBase, - LEErrorCode &success) const; + void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const; /** - * This method copies the position array into a caller supplied - * array. The caller must ensure that the array is large enough - * to hold an X and Y position for each glyph, plus an extra X and - * Y for the advance of the last glyph. + * This method copies the position array into a caller supplied array. + * The caller must ensure that the array is large enough to hold an + * X and Y position for each glyph, plus an extra X and Y for the + * advance of the last glyph. * * @param positions - the destiniation position array * @param success - set to an error code if the operation fails @@ -491,8 +448,7 @@ public: * * @stable ICU 2.8 */ - void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, - LEErrorCode &success) const; + void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const; /** * This method frees the glyph, character index and position arrays @@ -511,8 +467,7 @@ public: * @param fontInstance - the font of the text * @param scriptCode - the script of the text * @param languageCode - the language of the text - * @param success - output parameter set to an error code if the - * operation fails + * @param success - output parameter set to an error code if the operation fails * * @return a LayoutEngine which can layout text in the given font. * @@ -520,17 +475,30 @@ public: * * @stable ICU 2.8 */ - static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success); + static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success); /** * Override of existing call that provides flags to control typography. * @draft ICU 3.4 */ - static LayoutEngine *layoutEngineFactory( - const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, - le_int32 typo_flags, LEErrorCode &success); + static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/LayoutTables.h b/jdk/src/share/native/sun/font/layout/LayoutTables.h index 7162d020ac9..8528adea150 100644 --- a/jdk/src/share/native/sun/font/layout/LayoutTables.h +++ b/jdk/src/share/native/sun/font/layout/LayoutTables.h @@ -32,11 +32,20 @@ #ifndef __LAYOUTTABLES_H #define __LAYOUTTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" +U_NAMESPACE_BEGIN + #define ANY_NUMBER 1 typedef le_int16 ByteOffset; typedef le_int16 WordOffset; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp b/jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp index 7120d0ab2c1..ade265da367 100644 --- a/jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp +++ b/jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp @@ -39,10 +39,14 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + #define ExtendedComplement(m) ((le_int32) (~((le_uint32) (m)))) #define SignBit(m) ((ExtendedComplement(m) >> 1) & (le_int32)(m)) #define SignExtend(v,m) (((v) & SignBit(m))? ((v) | ExtendedComplement(m)): (v)) +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LigatureSubstitutionProcessor) + LigatureSubstitutionProcessor::LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader) : StateTableProcessor(morphSubtableHeader) { @@ -63,8 +67,7 @@ void LigatureSubstitutionProcessor::beginStateTable() m = -1; } -ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, - le_int32 &currGlyph, EntryTableIndex index) +ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index) { const LigatureSubstitutionStateEntry *entry = &entryTable[index]; ByteOffset newState = SWAPW(entry->newStateOffset); @@ -135,3 +138,5 @@ ByteOffset LigatureSubstitutionProcessor::processStateEntry(LEGlyphStorage &glyp void LigatureSubstitutionProcessor::endStateTable() { } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/LigatureSubstProc.h b/jdk/src/share/native/sun/font/layout/LigatureSubstProc.h index 304cdbd3c9b..289b555b29c 100644 --- a/jdk/src/share/native/sun/font/layout/LigatureSubstProc.h +++ b/jdk/src/share/native/sun/font/layout/LigatureSubstProc.h @@ -32,12 +32,19 @@ #ifndef __LIGATURESUBSTITUTIONPROCESSOR_H #define __LIGATURESUBSTITUTIONPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "StateTableProcessor.h" #include "LigatureSubstitution.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; #define nComponents 16 @@ -54,6 +61,20 @@ public: LigatureSubstitutionProcessor(const MorphSubtableHeader *morphSubtableHeader); virtual ~LigatureSubstitutionProcessor(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: LigatureSubstitutionProcessor(); @@ -68,6 +89,8 @@ protected: le_int16 m; const LigatureSubstitutionHeader *ligatureSubstitutionHeader; + }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp b/jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp index dcc03b489b3..fa12ae97798 100644 --- a/jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved * @@ -37,6 +38,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_uint32 LigatureSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const { LEGlyphID glyph = glyphIterator->getCurrGlyphID(); @@ -92,3 +95,5 @@ le_uint32 LigatureSubstitutionSubtable::process(GlyphIterator *glyphIterator, co return 0; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h b/jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h index bcddf19123d..c222e9d5985 100644 --- a/jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h +++ b/jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.h @@ -32,12 +32,19 @@ #ifndef __LIGATURESUBSTITUTIONSUBTABLES_H #define __LIGATURESUBSTITUTIONSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEGlyphFilter.h" #include "OpenTypeTables.h" #include "GlyphSubstitutionTables.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct LigatureSetTable { le_uint16 ligatureCount; @@ -59,4 +66,5 @@ struct LigatureSubstitutionSubtable : GlyphSubstitutionSubtable le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LigatureSubstitution.h b/jdk/src/share/native/sun/font/layout/LigatureSubstitution.h index f204927d421..6dbcd1e20c1 100644 --- a/jdk/src/share/native/sun/font/layout/LigatureSubstitution.h +++ b/jdk/src/share/native/sun/font/layout/LigatureSubstitution.h @@ -32,12 +32,19 @@ #ifndef __LIGATURESUBSTITUTION_H #define __LIGATURESUBSTITUTION_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" #include "StateTables.h" #include "MorphTables.h" #include "MorphStateTables.h" +U_NAMESPACE_BEGIN + struct LigatureSubstitutionHeader : MorphStateTableHeader { ByteOffset ligatureActionTableOffset; @@ -65,4 +72,5 @@ enum LigatureActionFlags lafComponentOffsetMask = 0x3FFFFFFF }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp b/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp index e5e1acf5210..81e9be700c6 100644 --- a/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp @@ -42,6 +42,8 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const { @@ -65,10 +67,9 @@ le_uint32 LookupProcessor::applyLookupTable(const LookupTable *lookupTable, Glyp return 1; } -le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage, - GlyphPositionAdjustments *glyphPositionAdjustments, - le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, - const LEFontInstance *fontInstance) const +le_int32 LookupProcessor::process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, + le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, + const LEFontInstance *fontInstance) const { le_int32 glyphCount = glyphStorage.getGlyphCount(); @@ -133,8 +134,7 @@ le_int32 LookupProcessor::selectLookups(const FeatureTable *featureTable, Featur LookupProcessor::LookupProcessor(const char *baseAddress, Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset, - LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, - le_int32 featureMapCount, le_bool orderFeatures) + LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures) : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL), lookupOrderArray(NULL), lookupOrderCount(0) { @@ -296,3 +296,5 @@ LookupProcessor::~LookupProcessor() LE_DELETE_ARRAY(lookupOrderArray); LE_DELETE_ARRAY(lookupSelectArray); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/LookupProcessor.h b/jdk/src/share/native/sun/font/layout/LookupProcessor.h index 86e01c6850c..5ba598a22e1 100644 --- a/jdk/src/share/native/sun/font/layout/LookupProcessor.h +++ b/jdk/src/share/native/sun/font/layout/LookupProcessor.h @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * @@ -32,9 +33,18 @@ #ifndef __LOOKUPPROCESSOR_H #define __LOOKUPPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" +//#include "Lookups.h" +//#include "Features.h" + +U_NAMESPACE_BEGIN class LEFontInstance; class LEGlyphStorage; @@ -46,13 +56,10 @@ struct GlyphDefinitionTableHeader; struct LookupSubtable; struct LookupTable; -class LookupProcessor -{ +class LookupProcessor : public UMemory { public: - le_int32 process(LEGlyphStorage &glyphStorage, - GlyphPositionAdjustments *glyphPositionAdjustments, - le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, - const LEFontInstance *fontInstance) const; + le_int32 process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments, + le_bool rightToLeft, const GlyphDefinitionTableHeader *glyphDefinitionTableHeader, const LEFontInstance *fontInstance) const; le_uint32 applyLookupTable(const LookupTable *lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; @@ -64,19 +71,18 @@ public: virtual ~LookupProcessor(); protected: - LookupProcessor(const char *baseAddress, + LookupProcessor(const char *baseAddress, Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset, - LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, - le_int32 featureMapCount, le_bool orderFeatures); + LETag scriptTag, LETag languageTag, const FeatureMap *featureMap, le_int32 featureMapCount, le_bool orderFeatures); - LookupProcessor(); + LookupProcessor(); le_int32 selectLookups(const FeatureTable *featureTable, FeatureMask featureMask, le_int32 order); const LookupListTable *lookupListTable; const FeatureListTable *featureListTable; - FeatureMask *lookupSelectArray; + FeatureMask *lookupSelectArray; le_uint16 *lookupOrderArray; le_uint32 lookupOrderCount; @@ -87,4 +93,5 @@ private: LookupProcessor &operator=(const LookupProcessor &other); // forbid copying of this class }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/LookupTables.cpp b/jdk/src/share/native/sun/font/layout/LookupTables.cpp index 54de9a646af..17ed4280660 100644 --- a/jdk/src/share/native/sun/font/layout/LookupTables.cpp +++ b/jdk/src/share/native/sun/font/layout/LookupTables.cpp @@ -34,6 +34,8 @@ #include "LookupTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + /* These are the rolled-up versions of the uniform binary search. Someday, if we need more performance, we can un-roll them. @@ -104,3 +106,5 @@ const LookupSingle *BinarySearchLookupTable::lookupSingle(const LookupSingle *en return NULL; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/LookupTables.h b/jdk/src/share/native/sun/font/layout/LookupTables.h index 67be72ee698..d6d424b1d78 100644 --- a/jdk/src/share/native/sun/font/layout/LookupTables.h +++ b/jdk/src/share/native/sun/font/layout/LookupTables.h @@ -32,9 +32,16 @@ #ifndef __LOOKUPTABLES_H #define __LOOKUPTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" +U_NAMESPACE_BEGIN + enum LookupTableFormat { ltfSimpleArray = 0, @@ -104,4 +111,5 @@ struct TrimmedArrayLookupTable : LookupTable LookupValue valueArray[ANY_NUMBER]; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/Lookups.cpp b/jdk/src/share/native/sun/font/layout/Lookups.cpp index aac779e981d..13c59392384 100644 --- a/jdk/src/share/native/sun/font/layout/Lookups.cpp +++ b/jdk/src/share/native/sun/font/layout/Lookups.cpp @@ -35,6 +35,8 @@ #include "CoverageTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + const LookupTable *LookupListTable::getLookupTable(le_uint16 lookupTableIndex) const { if (lookupTableIndex >= SWAPW(lookupCount)) { @@ -63,3 +65,5 @@ le_int32 LookupSubtable::getGlyphCoverage(Offset tableOffset, LEGlyphID glyphID) return coverageTable->getGlyphCoverage(glyphID); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/Lookups.h b/jdk/src/share/native/sun/font/layout/Lookups.h index 86661231a0a..b360c233b6b 100644 --- a/jdk/src/share/native/sun/font/layout/Lookups.h +++ b/jdk/src/share/native/sun/font/layout/Lookups.h @@ -32,9 +32,16 @@ #ifndef __LOOKUPS_H #define __LOOKUPS_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + enum LookupFlags { lfBaselineIsLogicalEnd = 0x0001, // The MS spec. calls this flag "RightToLeft" but this name is more accurate @@ -79,6 +86,5 @@ inline le_int32 LookupSubtable::getGlyphCoverage(LEGlyphID glyphID) const return getGlyphCoverage(coverageTableOffset, glyphID); } - - +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/MPreFixups.cpp b/jdk/src/share/native/sun/font/layout/MPreFixups.cpp index 3d2588898bc..38a8aa8e959 100644 --- a/jdk/src/share/native/sun/font/layout/MPreFixups.cpp +++ b/jdk/src/share/native/sun/font/layout/MPreFixups.cpp @@ -33,6 +33,8 @@ #include "LEGlyphStorage.h" #include "MPreFixups.h" +U_NAMESPACE_BEGIN + struct FixupData { le_int32 fBaseIndex; @@ -92,7 +94,7 @@ void MPreFixups::apply(LEGlyphStorage &glyphStorage) for (i = 0; i < mpreCount; i += 1) { mpreSave[i] = glyphStorage[mpreIndex + i]; - indexSave[i] = glyphStorage.getCharIndex(mpreIndex + i, success); + indexSave[i] = glyphStorage.getCharIndex(mpreIndex + i, success); //charIndices[mpreIndex + i]; } for (i = 0; i < moveCount; i += 1) { @@ -112,3 +114,5 @@ void MPreFixups::apply(LEGlyphStorage &glyphStorage) LE_DELETE_ARRAY(mpreSave); } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/MPreFixups.h b/jdk/src/share/native/sun/font/layout/MPreFixups.h index 8f6e585332e..267ba10666d 100644 --- a/jdk/src/share/native/sun/font/layout/MPreFixups.h +++ b/jdk/src/share/native/sun/font/layout/MPreFixups.h @@ -32,14 +32,22 @@ #ifndef __MPREFIXUPS_H #define __MPREFIXUPS_H +/** + * \file + * \internal + */ + #include "LETypes.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; // Might want to make this a private member... struct FixupData; -class MPreFixups { +class MPreFixups : public UMemory +{ public: MPreFixups(le_int32 charCount); ~MPreFixups(); @@ -53,4 +61,7 @@ private: le_int32 fFixupCount; }; +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/MarkArrays.cpp b/jdk/src/share/native/sun/font/layout/MarkArrays.cpp index bba88877964..02833d43781 100644 --- a/jdk/src/share/native/sun/font/layout/MarkArrays.cpp +++ b/jdk/src/share/native/sun/font/layout/MarkArrays.cpp @@ -36,6 +36,8 @@ #include "MarkArrays.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_int32 MarkArray::getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, const LEFontInstance *fontInstance, LEPoint &anchor) const { @@ -58,3 +60,5 @@ le_int32 MarkArray::getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, cons return markClass; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/MarkArrays.h b/jdk/src/share/native/sun/font/layout/MarkArrays.h index 99c42cbbaf8..99c3161b786 100644 --- a/jdk/src/share/native/sun/font/layout/MarkArrays.h +++ b/jdk/src/share/native/sun/font/layout/MarkArrays.h @@ -32,10 +32,17 @@ #ifndef __MARKARRAYS_H #define __MARKARRAYS_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + struct MarkRecord { le_uint16 markClass; @@ -51,4 +58,7 @@ struct MarkArray LEPoint &anchor) const; }; +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp b/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp index 259ab207bf1..f26d33851d4 100644 --- a/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp @@ -40,6 +40,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + LEGlyphID MarkToBasePositioningSubtable::findBaseGlyph(GlyphIterator *glyphIterator) const { if (glyphIterator->prev()) { @@ -106,7 +108,6 @@ le_int32 MarkToBasePositioningSubtable::process(GlyphIterator *glyphIterator, co glyphIterator->setCurrGlyphBaseOffset(baseIterator.getCurrStreamPosition()); if (glyphIterator->isRightToLeft()) { - // dlf flip advance to local coordinate system glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX, anchorDiffY, -markAdvance.fX, -markAdvance.fY); } else { LEPoint baseAdvance; @@ -114,9 +115,10 @@ le_int32 MarkToBasePositioningSubtable::process(GlyphIterator *glyphIterator, co fontInstance->getGlyphAdvance(baseGlyph, pixels); fontInstance->pixelsToUnits(pixels, baseAdvance); - // flip advances to local coordinate system glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - baseAdvance.fX, anchorDiffY - baseAdvance.fY, -markAdvance.fX, -markAdvance.fY); } return 1; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h b/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h index b9309d4a763..a94e40d1192 100644 --- a/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h +++ b/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.h @@ -32,6 +32,11 @@ #ifndef __MARKTOBASEPOSITIONINGSUBTABLES_H #define __MARKTOBASEPOSITIONINGSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" @@ -39,6 +44,8 @@ #include "AttachmentPosnSubtables.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct MarkToBasePositioningSubtable : AttachmentPositioningSubtable { le_int32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; @@ -56,4 +63,6 @@ struct BaseArray BaseRecord baseRecordArray[ANY_NUMBER]; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp b/jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp index e67b62fa25d..3a8d12b9502 100644 --- a/jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp @@ -39,6 +39,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + LEGlyphID MarkToLigaturePositioningSubtable::findLigatureGlyph(GlyphIterator *glyphIterator) const { if (glyphIterator->prev()) { @@ -117,9 +119,10 @@ le_int32 MarkToLigaturePositioningSubtable::process(GlyphIterator *glyphIterator fontInstance->getGlyphAdvance(ligatureGlyph, pixels); fontInstance->pixelsToUnits(pixels, ligatureAdvance); - glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - ligatureAdvance.fX, - anchorDiffY - ligatureAdvance.fY, -markAdvance.fX, -markAdvance.fY); + glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - ligatureAdvance.fX, anchorDiffY - ligatureAdvance.fY, -markAdvance.fX, -markAdvance.fY); } return 1; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h b/jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h index f6cadc8c4b4..ef858cfa52c 100644 --- a/jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h +++ b/jdk/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.h @@ -32,6 +32,11 @@ #ifndef __MARKTOLIGATUREPOSITIONINGSUBTABLES_H #define __MARKTOLIGATUREPOSITIONINGSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" @@ -39,6 +44,8 @@ #include "AttachmentPosnSubtables.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct MarkToLigaturePositioningSubtable : AttachmentPositioningSubtable { le_int32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; @@ -62,4 +69,6 @@ struct LigatureArray Offset ligatureAttachTableOffsetArray[ANY_NUMBER]; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp b/jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp index 3048d13f92e..71ca5fd1fbb 100644 --- a/jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp @@ -40,6 +40,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + LEGlyphID MarkToMarkPositioningSubtable::findMark2Glyph(GlyphIterator *glyphIterator) const { if (glyphIterator->findMark2Glyph()) { @@ -88,7 +90,7 @@ le_int32 MarkToMarkPositioningSubtable::process(GlyphIterator *glyphIterator, co const AnchorTable *anchorTable = (const AnchorTable *) ((char *) mark2Array + anchorTableOffset); LEPoint mark2Anchor, markAdvance, pixels; - if (anchorTableOffset == 0) { // jb4729 + if (anchorTableOffset == 0) { // this seems to mean that the marks don't attach... return 0; } @@ -111,9 +113,10 @@ le_int32 MarkToMarkPositioningSubtable::process(GlyphIterator *glyphIterator, co fontInstance->getGlyphAdvance(mark2Glyph, pixels); fontInstance->pixelsToUnits(pixels, mark2Advance); - glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - mark2Advance.fX, - anchorDiffY - mark2Advance.fY, -markAdvance.fX, -markAdvance.fY); + glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - mark2Advance.fX, anchorDiffY - mark2Advance.fY, -markAdvance.fX, -markAdvance.fY); } return 1; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h b/jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h index f6acff37d9e..ca5d28e561b 100644 --- a/jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h +++ b/jdk/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.h @@ -32,6 +32,11 @@ #ifndef __MARKTOMARKPOSITIONINGSUBTABLES_H #define __MARKTOMARKPOSITIONINGSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" @@ -39,6 +44,8 @@ #include "AttachmentPosnSubtables.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct MarkToMarkPositioningSubtable : AttachmentPositioningSubtable { le_int32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; @@ -56,4 +63,6 @@ struct Mark2Array Mark2Record mark2RecordArray[ANY_NUMBER]; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/MirroredCharData.cpp b/jdk/src/share/native/sun/font/layout/MirroredCharData.cpp index 30cdded5b59..dfdd7a38748 100644 --- a/jdk/src/share/native/sun/font/layout/MirroredCharData.cpp +++ b/jdk/src/share/native/sun/font/layout/MirroredCharData.cpp @@ -36,6 +36,8 @@ #include "LETypes.h" #include "DefaultCharMapper.h" +U_NAMESPACE_BEGIN + const LEUnicode32 DefaultCharMapper::mirroredChars[] = { 0x0028, 0x0029, 0x003C, 0x003E, 0x005B, 0x005D, 0x007B, 0x007D, 0x00AB, 0x00BB, 0x2039, 0x203A, 0x2045, 0x2046, 0x207D, 0x207E, @@ -127,3 +129,5 @@ const LEUnicode32 DefaultCharMapper::srahCderorrim[] = { }; const le_int32 DefaultCharMapper::mirroredCharsCount = 332; + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/MorphStateTables.h b/jdk/src/share/native/sun/font/layout/MorphStateTables.h index 8ebe2be85a9..72032cf3644 100644 --- a/jdk/src/share/native/sun/font/layout/MorphStateTables.h +++ b/jdk/src/share/native/sun/font/layout/MorphStateTables.h @@ -32,14 +32,22 @@ #ifndef __MORPHSTATETABLES_H #define __MORPHSTATETABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" #include "MorphTables.h" #include "StateTables.h" +U_NAMESPACE_BEGIN + struct MorphStateTableHeader : MorphSubtableHeader { StateTableHeader stHeader; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/MorphTables.cpp b/jdk/src/share/native/sun/font/layout/MorphTables.cpp index 863d2a98893..0dce4dda157 100644 --- a/jdk/src/share/native/sun/font/layout/MorphTables.cpp +++ b/jdk/src/share/native/sun/font/layout/MorphTables.cpp @@ -42,6 +42,8 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + void MorphTableHeader::process(LEGlyphStorage &glyphStorage) const { const ChainHeader *chainHeader = chains; @@ -114,3 +116,5 @@ void MorphSubtableHeader::process(LEGlyphStorage &glyphStorage) const delete processor; } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/MorphTables.h b/jdk/src/share/native/sun/font/layout/MorphTables.h index 5eb58667bbc..8f3fd209eb5 100644 --- a/jdk/src/share/native/sun/font/layout/MorphTables.h +++ b/jdk/src/share/native/sun/font/layout/MorphTables.h @@ -32,9 +32,16 @@ #ifndef __MORPHTABLES_H #define __MORPHTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; typedef le_uint32 FeatureFlags; @@ -98,4 +105,6 @@ struct MorphSubtableHeader void process(LEGlyphStorage &glyphStorage) const; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp b/jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp index c54797c2e46..0a16190bc9a 100644 --- a/jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp @@ -37,6 +37,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_uint32 MultipleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const { LEGlyphID glyph = glyphIterator->getCurrGlyphID(); @@ -106,3 +108,5 @@ le_uint32 MultipleSubstitutionSubtable::process(GlyphIterator *glyphIterator, co return 0; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h b/jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h index 454627140aa..8aeceb8cb1c 100644 --- a/jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h +++ b/jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.h @@ -32,12 +32,19 @@ #ifndef __MULTIPLESUBSTITUTIONSUBTABLES_H #define __MULTIPLESUBSTITUTIONSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEGlyphFilter.h" #include "OpenTypeTables.h" #include "GlyphSubstitutionTables.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct SequenceTable { le_uint16 glyphCount; @@ -52,4 +59,5 @@ struct MultipleSubstitutionSubtable : GlyphSubstitutionSubtable le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubst.h b/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubst.h index 0f5b0f6c35c..c59686c2b98 100644 --- a/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubst.h +++ b/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubst.h @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved * @@ -32,14 +33,23 @@ #ifndef __NONCONTEXTUALGLYPHSUBSTITUTION_H #define __NONCONTEXTUALGLYPHSUBSTITUTION_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" #include "LookupTables.h" #include "MorphTables.h" +U_NAMESPACE_BEGIN + struct NonContextualGlyphSubstitutionHeader : MorphSubtableHeader { LookupTable table; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp b/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp index 0d748b1b429..87c9134aa8d 100644 --- a/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp +++ b/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.cpp @@ -41,6 +41,8 @@ #include "TrimmedArrayProcessor.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + NonContextualGlyphSubstitutionProcessor::NonContextualGlyphSubstitutionProcessor() { } @@ -79,3 +81,5 @@ SubtableProcessor *NonContextualGlyphSubstitutionProcessor::createInstance(const return NULL; } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h b/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h index b7ea92e0b08..6aa597edb21 100644 --- a/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h +++ b/jdk/src/share/native/sun/font/layout/NonContextualGlyphSubstProc.h @@ -32,11 +32,18 @@ #ifndef __NONCONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H #define __NONCONTEXTUALGLYPHSUBSTITUTIONPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "NonContextualGlyphSubst.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class NonContextualGlyphSubstitutionProcessor : public SubtableProcessor @@ -57,4 +64,5 @@ private: NonContextualGlyphSubstitutionProcessor &operator=(const NonContextualGlyphSubstitutionProcessor &other); // forbid copying of this class }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp index 40ea74c35e1..1835fe52532 100644 --- a/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp @@ -47,6 +47,10 @@ #include "GDEFMarkFilter.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(OpenTypeLayoutEngine) + #define ccmpFeatureTag LE_CCMP_FEATURE_TAG #define ligaFeatureTag LE_LIGA_FEATURE_TAG #define cligFeatureTag LE_CLIG_FEATURE_TAG @@ -78,7 +82,7 @@ static const FeatureMap featureMap[] = {ccmpFeatureTag, ccmpFeatureMask}, {ligaFeatureTag, ligaFeatureMask}, {cligFeatureTag, cligFeatureMask}, - {kernFeatureTag, kernFeatureMask}, + {kernFeatureTag, kernFeatureMask}, {paltFeatureTag, paltFeatureMask}, {markFeatureTag, markFeatureMask}, {mkmkFeatureTag, mkmkFeatureMask} @@ -86,19 +90,15 @@ static const FeatureMap featureMap[] = static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap); -OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, - const GlyphSubstitutionTableHeader *gsubTable) - : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), - fFeatureMask(minimalFeatures), fFeatureMap(featureMap), - fFeatureMapCount(featureMapCount), fFeatureOrder(FALSE), - fGSUBTable(gsubTable), fGDEFTable(NULL), fGPOSTable(NULL), - fSubstitutionFilter(NULL) +OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable) + : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fFeatureMask(minimalFeatures), + fFeatureMap(featureMap), fFeatureMapCount(featureMapCount), fFeatureOrder(FALSE), + fGSUBTable(gsubTable), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL) { static const le_uint32 gdefTableTag = LE_GDEF_TABLE_TAG; static const le_uint32 gposTableTag = LE_GPOS_TABLE_TAG; - const GlyphPositioningTableHeader *gposTable = - (const GlyphPositioningTableHeader *) getFontTable(gposTableTag); + const GlyphPositioningTableHeader *gposTable = (const GlyphPositioningTableHeader *) getFontTable(gposTableTag); // todo: switch to more flags and bitfield rather than list of feature tags? switch (typoFlags) { @@ -127,11 +127,10 @@ void OpenTypeLayoutEngine::reset() LayoutEngine::reset(); } -OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) - : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), - fFeatureOrder(FALSE), fGSUBTable(NULL), fGDEFTable(NULL), - fGPOSTable(NULL), fSubstitutionFilter(NULL) +OpenTypeLayoutEngine::OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags) + : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fFeatureOrder(FALSE), + fGSUBTable(NULL), fGDEFTable(NULL), fGPOSTable(NULL), fSubstitutionFilter(NULL) { setScriptAndLanguageTags(); } @@ -165,9 +164,8 @@ void OpenTypeLayoutEngine::setScriptAndLanguageTags() fLangSysTag = getLangSysTag(fLanguageCode); } -le_int32 OpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], - le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, - LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 OpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -178,8 +176,7 @@ le_int32 OpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], return 0; } - le_int32 outCharCount = LayoutEngine::characterProcessing(chars, offset, count, - max, rightToLeft, outChars, glyphStorage, success); + le_int32 outCharCount = LayoutEngine::characterProcessing(chars, offset, count, max, rightToLeft, outChars, glyphStorage, success); if (LE_FAILURE(success)) { return 0; @@ -197,16 +194,14 @@ le_int32 OpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], // Input: characters, tags // Output: glyphs, char indices -le_int32 OpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 OpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; } - if (chars == NULL || offset < 0 || count < 0 || max < 0 || - offset >= max || offset + count > max) { + if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { success = LE_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -218,16 +213,14 @@ le_int32 OpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 } if (fGSUBTable != NULL) { - count = fGSUBTable->process(glyphStorage, rightToLeft, - fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter, - fFeatureMap, fFeatureMapCount, fFeatureOrder); + count = fGSUBTable->process(glyphStorage, rightToLeft, fScriptTag, fLangSysTag, fGDEFTable, fSubstitutionFilter, + fFeatureMap, fFeatureMapCount, fFeatureOrder); } return count; } -le_int32 OpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 OpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -241,9 +234,7 @@ le_int32 OpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStor return glyphStorage.getGlyphCount(); } -le_int32 OpenTypeLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, - LEErrorCode &success) +le_int32 OpenTypeLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success) { LEUnicode *outChars = NULL; LEGlyphStorage fakeGlyphStorage; @@ -253,25 +244,19 @@ le_int32 OpenTypeLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 o return 0; } - if (chars == NULL || offset < 0 || count < 0 || max < 0 || - offset >= max || offset + count > max) { + if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { success = LE_ILLEGAL_ARGUMENT_ERROR; return 0; } - outCharCount = characterProcessing(chars, offset, count, max, rightToLeft, - outChars, fakeGlyphStorage, success); + outCharCount = characterProcessing(chars, offset, count, max, rightToLeft, outChars, fakeGlyphStorage, success); if (outChars != NULL) { - fakeGlyphCount = glyphProcessing(outChars, 0, outCharCount, outCharCount, - rightToLeft, fakeGlyphStorage, success); - // FIXME: a subclass may have allocated this, in which case - // this delete might not work... - LE_DELETE_ARRAY(outChars); + fakeGlyphCount = glyphProcessing(outChars, 0, outCharCount, outCharCount, rightToLeft, fakeGlyphStorage, success); + LE_DELETE_ARRAY(outChars); // FIXME: a subclass may have allocated this, in which case this delete might not work... //adjustGlyphs(outChars, 0, outCharCount, rightToLeft, fakeGlyphs, fakeGlyphCount); } else { - fakeGlyphCount = glyphProcessing(chars, offset, count, max, rightToLeft, - fakeGlyphStorage, success); + fakeGlyphCount = glyphProcessing(chars, offset, count, max, rightToLeft, fakeGlyphStorage, success); //adjustGlyphs(chars, offset, count, rightToLeft, fakeGlyphs, fakeGlyphCount); } @@ -281,8 +266,8 @@ le_int32 OpenTypeLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 o } // apply GPOS table, if any -void OpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success) +void OpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return; @@ -318,8 +303,8 @@ void OpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int3 } #endif - fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag, - fGDEFTable, fFontInstance, fFeatureMap, fFeatureMapCount, fFeatureOrder); + fGPOSTable->process(glyphStorage, adjustments, reverse, fScriptTag, fLangSysTag, fGDEFTable, fFontInstance, + fFeatureMap, fFeatureMapCount, fFeatureOrder); float xAdjust = 0, yAdjust = 0; @@ -354,4 +339,12 @@ void OpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int3 delete adjustments; } + +#if 0 + // Don't know why this is here... + LE_DELETE_ARRAY(fFeatureTags); + fFeatureTags = NULL; +#endif } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h b/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h index b0020cdf508..55092e73d29 100644 --- a/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h +++ b/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h @@ -23,9 +23,7 @@ * */ - /* - * * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved * */ @@ -42,6 +40,8 @@ #include "GlyphDefinitionTables.h" #include "GlyphPositioningTables.h" +U_NAMESPACE_BEGIN + /** * OpenTypeLayoutEngine implements complex text layout for OpenType fonts - that is * fonts which have GSUB and GPOS tables associated with them. In order to do this, @@ -87,7 +87,7 @@ public: * @internal */ OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, - le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); + le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable); /** * This constructor is used when the font requires a "canned" GSUB table which can't be known @@ -95,11 +95,12 @@ public: * * @param fontInstance - the font * @param scriptCode - the script - * @param languageCode - the language + * @param langaugeCode - the language * * @internal */ - OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); + OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, + le_int32 typoFlags); /** * The destructor, virtual for correct polymorphic invocation. @@ -132,6 +133,20 @@ public: */ static LETag getLangSysTag(le_int32 languageCode); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: /** @@ -254,9 +269,8 @@ protected: * * @internal */ - virtual le_int32 characterProcessing(const LEUnicode /*chars*/[], le_int32 offset, - le_int32 count, le_int32 max, le_bool /*rightToLeft*/, - LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 characterProcessing(const LEUnicode /*chars*/[], le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/, + LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** * This method does character to glyph mapping, and applies the GSUB table. The @@ -287,9 +301,8 @@ protected: * * @internal */ - virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, - LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEGlyphStorage &glyphStorage, LEErrorCode &success); /** * This method does any processing necessary to convert "fake" @@ -316,8 +329,7 @@ protected: * * @internal */ - virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, - LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** * This method applies the characterProcessing, glyphProcessing and glyphPostProcessing @@ -341,8 +353,7 @@ protected: * * @internal */ - virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, - le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** * This method uses the GPOS table, if there is one, to adjust the glyph positions. @@ -359,8 +370,7 @@ protected: * * @internal */ - virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, - le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); + virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success); /** * This method frees the feature tag array so that the @@ -372,4 +382,6 @@ protected: virtual void reset(); }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/OpenTypeTables.h b/jdk/src/share/native/sun/font/layout/OpenTypeTables.h index dec5c643bc6..1428633bfe1 100644 --- a/jdk/src/share/native/sun/font/layout/OpenTypeTables.h +++ b/jdk/src/share/native/sun/font/layout/OpenTypeTables.h @@ -32,8 +32,15 @@ #ifndef __OPENTYPETABLES_H #define __OPENTYPETABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" +U_NAMESPACE_BEGIN + #define ANY_NUMBER 1 typedef le_uint16 Offset; @@ -62,4 +69,5 @@ struct FeatureMap FeatureMask mask; }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp b/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp index 56491da200c..a87eb0a5a86 100644 --- a/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp +++ b/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp @@ -34,6 +34,8 @@ #include "OpenTypeUtilities.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + // // Finds the high bit by binary searching // through the bits in n. @@ -192,3 +194,7 @@ void OpenTypeUtilities::sort(le_uint16 *array, le_int32 count) array[i + 1] = v; } } + + + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h b/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h index 8c8f5358fc6..2154da962d2 100644 --- a/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h +++ b/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.h @@ -32,10 +32,17 @@ #ifndef __OPENTYPEUTILITIES_H #define __OPENTYPEUTILITIES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" -class OpenTypeUtilities { +U_NAMESPACE_BEGIN + +class OpenTypeUtilities /* not : public UObject because all methods are static */ { public: static le_int8 highBit(le_int32 value); static Offset getTagOffset(LETag tag, const TagAndOffsetRecord *records, le_int32 recordCount); @@ -48,4 +55,5 @@ private: OpenTypeUtilities() {} // private - forbid instantiation }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp b/jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp index 18cefc44634..435f91844ec 100644 --- a/jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp @@ -39,6 +39,8 @@ #include "OpenTypeUtilities.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_uint32 PairPositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const { switch(SWAPW(subtableFormat)) @@ -82,8 +84,7 @@ le_uint32 PairPositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const PairValueRecord *pairValueRecord = NULL; if (pairValueCount != 0) { - pairValueRecord = findPairValueRecord((TTGlyphID) LE_GET_GLYPH(secondGlyph), - pairSetTable->pairValueRecordArray, pairValueCount, recordSize); + pairValueRecord = findPairValueRecord((TTGlyphID) LE_GET_GLYPH(secondGlyph), pairSetTable->pairValueRecordArray, pairValueCount, recordSize); } if (pairValueRecord == NULL) { @@ -91,8 +92,7 @@ le_uint32 PairPositioningFormat1Subtable::process(GlyphIterator *glyphIterator, } if (valueFormat1 != 0) { - pairValueRecord->valueRecord1.adjustPosition(SWAPW(valueFormat1), (char *) this, - tempIterator, fontInstance); + pairValueRecord->valueRecord1.adjustPosition(SWAPW(valueFormat1), (char *) this, tempIterator, fontInstance); } if (valueFormat2 != 0) { @@ -171,3 +171,5 @@ const PairValueRecord *PairPositioningFormat1Subtable::findPairValueRecord(TTGly return NULL; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h b/jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h index b3ae1bc4382..76cb56498d1 100644 --- a/jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h +++ b/jdk/src/share/native/sun/font/layout/PairPositioningSubtables.h @@ -32,6 +32,11 @@ #ifndef __PAIRPOSITIONINGSUBTABLES_H #define __PAIRPOSITIONINGSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" @@ -39,6 +44,8 @@ #include "ValueRecords.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + // NOTE: ValueRecord has a variable size struct PairValueRecord { @@ -96,4 +103,7 @@ struct PairPositioningFormat2Subtable : PairPositioningSubtable le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; }; +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp b/jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp index 87bc205c095..58153971067 100644 --- a/jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp +++ b/jdk/src/share/native/sun/font/layout/ScriptAndLanguage.cpp @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved * @@ -35,6 +36,8 @@ #include "ScriptAndLanguage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + const LangSysTable *ScriptTable::findLanguage(LETag languageTag, le_bool exactMatch) const { le_uint16 count = SWAPW(langSysCount); @@ -79,3 +82,5 @@ const LangSysTable *ScriptListTable::findLanguage(LETag scriptTag, LETag languag return scriptTable->findLanguage(languageTag, exactMatch); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h b/jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h index 60b55f4bc39..b9102444a41 100644 --- a/jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h +++ b/jdk/src/share/native/sun/font/layout/ScriptAndLanguage.h @@ -32,9 +32,16 @@ #ifndef __SCRIPTANDLANGUAGE_H #define __SCRIPTANDLANGUAGE_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + typedef TagAndOffsetRecord LangSysRecord; struct LangSysTable @@ -65,4 +72,6 @@ struct ScriptListTable const LangSysTable *findLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch = FALSE) const; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp b/jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp index 305e6f08514..c5afc00f013 100644 --- a/jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp +++ b/jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp @@ -35,6 +35,8 @@ #include "ScriptAndLanguageTags.h" #include "OpenTypeLayoutEngine.h" +U_NAMESPACE_BEGIN + const LETag OpenTypeLayoutEngine::scriptTags[] = { zyyyScriptTag, /* 'zyyy' (COMMON) */ qaaiScriptTag, /* 'qaai' (INHERITED) */ @@ -125,3 +127,5 @@ const LETag OpenTypeLayoutEngine::languageTags[] = { zhsLanguageTag, /* 'ZHS' (Chinese (Simplified)) */ zhtLanguageTag /* 'ZHT' (Chinese (Traditional)) */ }; + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.h b/jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.h index 5422b8085b5..0dc50cc0acd 100644 --- a/jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.h +++ b/jdk/src/share/native/sun/font/layout/ScriptAndLanguageTags.h @@ -36,6 +36,13 @@ #include "LETypes.h" +U_NAMESPACE_BEGIN + +/** + * \file + * \internal + */ + const LETag zyyyScriptTag = 0x7A797979; /* 'zyyy' (COMMON) */ const LETag qaaiScriptTag = 0x71616169; /* 'qaai' (INHERITED) */ const LETag arabScriptTag = 0x61726162; /* 'arab' (ARABIC) */ @@ -126,4 +133,6 @@ const LETag zhpLanguageTag = 0x5A485020; /* 'ZHP' (Chinese (Phonetic)) */ const LETag zhsLanguageTag = 0x5A485320; /* 'ZHS' (Chinese (Simplified)) */ const LETag zhtLanguageTag = 0x5A485420; /* 'ZHT' (Chinese (Traditional)) */ + +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp b/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp index b5bc0b2bff1..2532229e732 100644 --- a/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp @@ -38,6 +38,10 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentArrayProcessor) + SegmentArrayProcessor::SegmentArrayProcessor() { } @@ -77,3 +81,5 @@ void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage) } } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h b/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h index f6e3177ca07..042d4472cde 100644 --- a/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h +++ b/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.h @@ -32,12 +32,19 @@ #ifndef __SEGMENTARRAYPROCESSOR_H #define __SEGMENTARRAYPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "NonContextualGlyphSubst.h" #include "NonContextualGlyphSubstProc.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class SegmentArrayProcessor : public NonContextualGlyphSubstitutionProcessor @@ -49,11 +56,28 @@ public: virtual ~SegmentArrayProcessor(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: SegmentArrayProcessor(); protected: const SegmentArrayLookupTable *segmentArrayLookupTable; + }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp b/jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp index 310b8720d3c..ffd5315d73f 100644 --- a/jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp @@ -38,6 +38,10 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentSingleProcessor) + SegmentSingleProcessor::SegmentSingleProcessor() { } @@ -71,3 +75,5 @@ void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage) } } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h b/jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h index bbc95f1c6cc..17507c772b6 100644 --- a/jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h +++ b/jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.h @@ -32,12 +32,19 @@ #ifndef __SEGMENTSINGLEPROCESSOR_H #define __SEGMENTSINGLEPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "NonContextualGlyphSubst.h" #include "NonContextualGlyphSubstProc.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class SegmentSingleProcessor : public NonContextualGlyphSubstitutionProcessor @@ -49,11 +56,28 @@ public: virtual ~SegmentSingleProcessor(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: SegmentSingleProcessor(); protected: const SegmentSingleLookupTable *segmentSingleLookupTable; + }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp b/jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp index 0fd5bcd58a3..d2efc38e145 100644 --- a/jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp +++ b/jdk/src/share/native/sun/font/layout/ShapingTypeData.cpp @@ -36,6 +36,8 @@ #include "LETypes.h" #include "ArabicShaping.h" +U_NAMESPACE_BEGIN + const le_uint8 ArabicShaping::shapingTypeTable[] = { 0x00, 0x02, 0x00, 0xAD, 0x00, 0xAD, 0x00, 0xAD, 0x00, 0x05, 0x03, 0x00, 0x03, 0x6F, 0x00, 0x05, 0x04, 0x83, 0x04, 0x86, 0x00, 0x05, 0x04, 0x88, 0x04, 0x89, 0x00, 0x05, 0x05, 0x91, 0x05, 0xB9, @@ -104,3 +106,5 @@ const le_uint8 ArabicShaping::shapingTypeTable[] = { 0xFE, 0x20, 0xFE, 0x23, 0x00, 0x05, 0xFE, 0xFF, 0xFE, 0xFF, 0x00, 0x05, 0xFF, 0xF9, 0xFF, 0xFB, 0x00, 0x05 }; + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp b/jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp index 8ba0fb0cb3e..2bf5eec3b9a 100644 --- a/jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp @@ -38,6 +38,10 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleArrayProcessor) + SimpleArrayProcessor::SimpleArrayProcessor() { } @@ -68,3 +72,5 @@ void SimpleArrayProcessor::process(LEGlyphStorage &glyphStorage) } } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h b/jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h index 6b387fe34c4..d8e8de6c84f 100644 --- a/jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h +++ b/jdk/src/share/native/sun/font/layout/SimpleArrayProcessor.h @@ -32,12 +32,19 @@ #ifndef __SIMPLEARRAYPROCESSOR_H #define __SIMPLEARRAYPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "NonContextualGlyphSubst.h" #include "NonContextualGlyphSubstProc.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class SimpleArrayProcessor : public NonContextualGlyphSubstitutionProcessor @@ -49,11 +56,28 @@ public: virtual ~SimpleArrayProcessor(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: SimpleArrayProcessor(); protected: const SimpleArrayLookupTable *simpleArrayLookupTable; + }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp b/jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp index 771625326cb..6411d40200f 100644 --- a/jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp @@ -38,6 +38,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const { switch(SWAPW(subtableFormat)) @@ -84,11 +86,12 @@ le_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph); if (coverageIndex >= 0) { - valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, - *glyphIterator, fontInstance); + valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance); return 1; } return 0; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h b/jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h index 10f8fe67d8a..9a9338f4ffd 100644 --- a/jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h +++ b/jdk/src/share/native/sun/font/layout/SinglePositioningSubtables.h @@ -32,6 +32,11 @@ #ifndef __SINGLEPOSITIONINGSUBTABLES_H #define __SINGLEPOSITIONINGSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" @@ -39,6 +44,8 @@ #include "ValueRecords.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct SinglePositioningSubtable : GlyphPositioningSubtable { le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; @@ -61,4 +68,7 @@ struct SinglePositioningFormat2Subtable : SinglePositioningSubtable le_uint32 process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; }; +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp b/jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp index d62c8cfa22d..44dae13da3b 100644 --- a/jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp +++ b/jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp @@ -37,6 +37,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + le_uint32 SingleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const { switch(SWAPW(subtableFormat)) @@ -98,3 +100,5 @@ le_uint32 SingleSubstitutionFormat2Subtable::process(GlyphIterator *glyphIterato return 0; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h b/jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h index 581e5b35475..bb1886c5cbf 100644 --- a/jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h +++ b/jdk/src/share/native/sun/font/layout/SingleSubstitutionSubtables.h @@ -32,12 +32,19 @@ #ifndef __SINGLESUBSTITUTIONSUBTABLES_H #define __SINGLESUBSTITUTIONSUBTABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEGlyphFilter.h" #include "OpenTypeTables.h" #include "GlyphSubstitutionTables.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + struct SingleSubstitutionSubtable : GlyphSubstitutionSubtable { le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; @@ -58,4 +65,7 @@ struct SingleSubstitutionFormat2Subtable : SingleSubstitutionSubtable le_uint32 process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter = NULL) const; }; +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp b/jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp index d5254cc1fc4..a2324682cb3 100644 --- a/jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/SingleTableProcessor.cpp @@ -38,6 +38,10 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SingleTableProcessor) + SingleTableProcessor::SingleTableProcessor() { } @@ -68,3 +72,5 @@ void SingleTableProcessor::process(LEGlyphStorage &glyphStorage) } } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SingleTableProcessor.h b/jdk/src/share/native/sun/font/layout/SingleTableProcessor.h index 6afb056f54d..f9ce6fec091 100644 --- a/jdk/src/share/native/sun/font/layout/SingleTableProcessor.h +++ b/jdk/src/share/native/sun/font/layout/SingleTableProcessor.h @@ -32,12 +32,19 @@ #ifndef __SINGLETABLEPROCESSOR_H #define __SINGLETABLEPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "NonContextualGlyphSubst.h" #include "NonContextualGlyphSubstProc.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class SingleTableProcessor : public NonContextualGlyphSubstitutionProcessor @@ -49,11 +56,27 @@ public: virtual ~SingleTableProcessor(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: SingleTableProcessor(); protected: const SingleTableLookupTable *singleTableLookupTable; + }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp b/jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp index a3898df69a9..b7589ef7f45 100644 --- a/jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp @@ -38,6 +38,8 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + StateTableProcessor::StateTableProcessor() { } @@ -96,3 +98,5 @@ void StateTableProcessor::process(LEGlyphStorage &glyphStorage) endStateTable(); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/StateTableProcessor.h b/jdk/src/share/native/sun/font/layout/StateTableProcessor.h index 09660c8fea7..9ace8d05d82 100644 --- a/jdk/src/share/native/sun/font/layout/StateTableProcessor.h +++ b/jdk/src/share/native/sun/font/layout/StateTableProcessor.h @@ -32,11 +32,18 @@ #ifndef __STATETABLEPROCESSOR_H #define __STATETABLEPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "MorphStateTables.h" #include "SubtableProcessor.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class StateTableProcessor : public SubtableProcessor @@ -72,4 +79,5 @@ private: StateTableProcessor &operator=(const StateTableProcessor &other); // forbid copying of this class }; +U_NAMESPACE_END #endif diff --git a/jdk/src/share/native/sun/font/layout/StateTables.h b/jdk/src/share/native/sun/font/layout/StateTables.h index 0854ad2f7cd..ee99097a34f 100644 --- a/jdk/src/share/native/sun/font/layout/StateTables.h +++ b/jdk/src/share/native/sun/font/layout/StateTables.h @@ -32,9 +32,16 @@ #ifndef __STATETABLES_H #define __STATETABLES_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LayoutTables.h" +U_NAMESPACE_BEGIN + struct StateTableHeader { le_int16 stateSize; @@ -78,4 +85,6 @@ struct StateEntry le_int16 flags; }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/SubstitutionLookups.cpp b/jdk/src/share/native/sun/font/layout/SubstitutionLookups.cpp index 3d2ac15c2e6..11a32062e33 100644 --- a/jdk/src/share/native/sun/font/layout/SubstitutionLookups.cpp +++ b/jdk/src/share/native/sun/font/layout/SubstitutionLookups.cpp @@ -39,6 +39,8 @@ #include "CoverageTables.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + /* NOTE: This could be optimized somewhat by keeping track of the previous sequenceIndex in the loop and doing next() @@ -65,3 +67,5 @@ void SubstitutionLookup::applySubstitutionLookups( lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance); } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SubstitutionLookups.h b/jdk/src/share/native/sun/font/layout/SubstitutionLookups.h index 40947c48519..6724b7364c3 100644 --- a/jdk/src/share/native/sun/font/layout/SubstitutionLookups.h +++ b/jdk/src/share/native/sun/font/layout/SubstitutionLookups.h @@ -32,6 +32,11 @@ #ifndef __SUBSTITUTIONLOOKUPS_H #define __SUBSTITUTIONLOOKUPS_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" @@ -39,6 +44,8 @@ #include "GlyphIterator.h" #include "LookupProcessor.h" +U_NAMESPACE_BEGIN + struct SubstitutionLookupRecord { le_uint16 sequenceIndex; @@ -56,4 +63,6 @@ struct SubstitutionLookup le_int32 position); }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp b/jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp index 6af7684d318..c76e7940cda 100644 --- a/jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/SubtableProcessor.cpp @@ -34,6 +34,8 @@ #include "SubtableProcessor.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + SubtableProcessor::SubtableProcessor() { } @@ -50,3 +52,5 @@ SubtableProcessor::SubtableProcessor(const MorphSubtableHeader *morphSubtableHea SubtableProcessor::~SubtableProcessor() { } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/SubtableProcessor.h b/jdk/src/share/native/sun/font/layout/SubtableProcessor.h index f5b84e85060..78ce978ff4b 100644 --- a/jdk/src/share/native/sun/font/layout/SubtableProcessor.h +++ b/jdk/src/share/native/sun/font/layout/SubtableProcessor.h @@ -32,13 +32,19 @@ #ifndef __SUBTABLEPROCESSOR_H #define __SUBTABLEPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; -class SubtableProcessor -{ +class SubtableProcessor : public UMemory { public: virtual void process(LEGlyphStorage &glyphStorage) = 0; virtual ~SubtableProcessor(); @@ -60,4 +66,6 @@ private: SubtableProcessor &operator=(const SubtableProcessor &other); // forbid copying of this class }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp index 5daf0f2d76a..ee9581c2a17 100644 --- a/jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.cpp @@ -38,8 +38,11 @@ #include "ThaiShaping.h" -ThaiLayoutEngine::ThaiLayoutEngine(const LEFontInstance *fontInstance, - le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ThaiLayoutEngine) + +ThaiLayoutEngine::ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags) : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags) { fErrorChar = 0x25CC; @@ -73,16 +76,13 @@ ThaiLayoutEngine::~ThaiLayoutEngine() // Output: glyphs, char indices // Returns: the glyph count // NOTE: this assumes that ThaiShaping::compose will allocate the outChars array... -le_int32 ThaiLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool /*rightToLeft*/, - LEGlyphStorage &glyphStorage, LEErrorCode &success) +le_int32 ThaiLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; } - if (chars == NULL || offset < 0 || count < 0 || max < 0 || - offset >= max || offset + count > max) { + if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { success = LE_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -107,8 +107,7 @@ le_int32 ThaiLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offse return 0; } - glyphCount = ThaiShaping::compose(chars, offset, count, fGlyphSet, fErrorChar, - outChars, glyphStorage); + glyphCount = ThaiShaping::compose(chars, offset, count, fGlyphSet, fErrorChar, outChars, glyphStorage); mapCharsToGlyphs(outChars, 0, glyphCount, FALSE, FALSE, glyphStorage, success); LE_DELETE_ARRAY(outChars); @@ -116,3 +115,5 @@ le_int32 ThaiLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offse glyphStorage.adoptGlyphCount(glyphCount); return glyphCount; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.h b/jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.h index 5e636f232dd..e64bc285cf1 100644 --- a/jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.h +++ b/jdk/src/share/native/sun/font/layout/ThaiLayoutEngine.h @@ -39,6 +39,8 @@ #include "ThaiShaping.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; /** @@ -66,8 +68,7 @@ public: * * @internal */ - ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, - le_int32 languageCode, le_int32 typoFlags); + ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags); /** * The destructor, virtual for correct polymorphic invocation. @@ -76,6 +77,20 @@ public: */ virtual ~ThaiLayoutEngine(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + protected: /** * A small integer indicating which Thai encoding @@ -109,10 +124,8 @@ protected: * @param offset - the index of the first character to process * @param count - the number of characters to process * @param max - the number of characters in the input context - * @param rightToLeft - TRUE if the text is in a - * right to left directional run - * @param glyphStorage - the glyph storage object. The glyph and - * char index arrays will be set. + * @param rightToLeft - TRUE if the text is in a right to left directional run + * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. * * Output parameters: * @param success - set to an error code if the operation fails @@ -123,10 +136,11 @@ protected: * * @internal */ - virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, - le_int32 count, le_int32 max, le_bool rightToLeft, + virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success); }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/ThaiShaping.cpp b/jdk/src/share/native/sun/font/layout/ThaiShaping.cpp index f5a476a8b45..d04230ccd43 100644 --- a/jdk/src/share/native/sun/font/layout/ThaiShaping.cpp +++ b/jdk/src/share/native/sun/font/layout/ThaiShaping.cpp @@ -35,6 +35,8 @@ #include "LEGlyphStorage.h" #include "ThaiShaping.h" +U_NAMESPACE_BEGIN + enum { CH_SPACE = 0x0020, CH_YAMAKKAN = 0x0E4E, @@ -248,9 +250,8 @@ le_uint8 ThaiShaping::doTransition (StateTransition transition, LEUnicode currCh return transition.nextState; } -le_uint8 ThaiShaping::getNextState(LEUnicode ch, le_uint8 prevState, le_int32 inputIndex, - le_uint8 glyphSet, LEUnicode errorChar, - le_uint8 &charClass, LEUnicode *output, LEGlyphStorage &glyphStorage, le_int32 &outputIndex) +le_uint8 ThaiShaping::getNextState(LEUnicode ch, le_uint8 prevState, le_int32 inputIndex, le_uint8 glyphSet, LEUnicode errorChar, + le_uint8 &charClass, LEUnicode *output, LEGlyphStorage &glyphStorage, le_int32 &outputIndex) { StateTransition transition; @@ -327,3 +328,5 @@ le_int32 ThaiShaping::compose(const LEUnicode *input, le_int32 offset, le_int32 return outputIndex; } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ThaiShaping.h b/jdk/src/share/native/sun/font/layout/ThaiShaping.h index ff7f8ef89f5..a17eb353959 100644 --- a/jdk/src/share/native/sun/font/layout/ThaiShaping.h +++ b/jdk/src/share/native/sun/font/layout/ThaiShaping.h @@ -32,13 +32,20 @@ #ifndef __THAISHAPING_H #define __THAISHAPING_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEGlyphFilter.h" #include "OpenTypeTables.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; -class ThaiShaping { +class ThaiShaping /* not : public UObject because all methods are static */ { public: enum { @@ -120,4 +127,7 @@ inline ThaiShaping::StateTransition ThaiShaping::getTransition(le_uint8 state, l return thaiStateTable[state][currClass]; } +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/layout/ThaiStateTables.cpp b/jdk/src/share/native/sun/font/layout/ThaiStateTables.cpp index 33f990bb882..dd620f4a6cb 100644 --- a/jdk/src/share/native/sun/font/layout/ThaiStateTables.cpp +++ b/jdk/src/share/native/sun/font/layout/ThaiStateTables.cpp @@ -24,6 +24,7 @@ */ /* + * * * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved * @@ -35,6 +36,8 @@ #include "LETypes.h" #include "ThaiShaping.h" +U_NAMESPACE_BEGIN + const le_uint8 ThaiShaping::classTable[] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F // ------------------------------------------------------------------------------- @@ -105,3 +108,5 @@ const ThaiShaping::StateTransition ThaiShaping::thaiStateTable[][ThaiShaping::cl /*50*/ {{ 0, tA}, { 1, tA}, {18, tA}, {35, tA}, { 0, tA}, { 0, tS}, { 0, tS}, { 0, tA}, { 0, tR}, { 0, tR}, { 0, tR}, {51, tC}, { 0, tR}, { 0, tC}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}}, /*51*/ {{ 0, tA}, { 1, tA}, {18, tA}, {35, tA}, { 0, tA}, { 0, tS}, { 0, tA}, { 0, tA}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}, { 0, tR}} }; + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp b/jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp index 203c7ab4ba8..e5e69197196 100644 --- a/jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp +++ b/jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.cpp @@ -38,6 +38,10 @@ #include "LEGlyphStorage.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TrimmedArrayProcessor) + TrimmedArrayProcessor::TrimmedArrayProcessor() { } @@ -72,3 +76,5 @@ void TrimmedArrayProcessor::process(LEGlyphStorage &glyphStorage) } } } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h b/jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h index bda94e05b36..2fe27fc0dfe 100644 --- a/jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h +++ b/jdk/src/share/native/sun/font/layout/TrimmedArrayProcessor.h @@ -32,12 +32,19 @@ #ifndef __TRIMMEDARRAYPROCESSOR_H #define __TRIMMEDARRAYPROCESSOR_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "MorphTables.h" #include "SubtableProcessor.h" #include "NonContextualGlyphSubst.h" #include "NonContextualGlyphSubstProc.h" +U_NAMESPACE_BEGIN + class LEGlyphStorage; class TrimmedArrayProcessor : public NonContextualGlyphSubstitutionProcessor @@ -49,6 +56,20 @@ public: virtual ~TrimmedArrayProcessor(); + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + private: TrimmedArrayProcessor(); @@ -56,6 +77,9 @@ protected: TTGlyphID firstGlyph; TTGlyphID lastGlyph; const TrimmedArrayLookupTable *trimmedArrayLookupTable; + }; +U_NAMESPACE_END #endif + diff --git a/jdk/src/share/native/sun/font/layout/ValueRecords.cpp b/jdk/src/share/native/sun/font/layout/ValueRecords.cpp index e592be01895..8fb4d87f504 100644 --- a/jdk/src/share/native/sun/font/layout/ValueRecords.cpp +++ b/jdk/src/share/native/sun/font/layout/ValueRecords.cpp @@ -37,6 +37,8 @@ #include "GlyphIterator.h" #include "LESwaps.h" +U_NAMESPACE_BEGIN + #define Nibble(value, nibble) ((value >> (nibble * 4)) & 0xF) #define NibbleBits(value, nibble) (bitsInNibble[Nibble(value, nibble)]) @@ -161,8 +163,8 @@ void ValueRecord::adjustPosition(ValueFormat valueFormat, const char *base, Glyp xPlacementAdjustment, yPlacementAdjustment, xAdvanceAdjustment, yAdvanceAdjustment); } -void ValueRecord::adjustPosition(le_int16 index, ValueFormat valueFormat, const char *base, - GlyphIterator &glyphIterator, const LEFontInstance *fontInstance) const +void ValueRecord::adjustPosition(le_int16 index, ValueFormat valueFormat, const char *base, GlyphIterator &glyphIterator, + const LEFontInstance *fontInstance) const { float xPlacementAdjustment = 0; float yPlacementAdjustment = 0; @@ -323,3 +325,5 @@ le_int16 ValueRecord::getFieldIndex(ValueFormat valueFormat, ValueRecordField fi return getFieldCount(valueFormat & beforeMasks[field]); } + +U_NAMESPACE_END diff --git a/jdk/src/share/native/sun/font/layout/ValueRecords.h b/jdk/src/share/native/sun/font/layout/ValueRecords.h index 599b10affe2..e390dfb5bfb 100644 --- a/jdk/src/share/native/sun/font/layout/ValueRecords.h +++ b/jdk/src/share/native/sun/font/layout/ValueRecords.h @@ -32,11 +32,18 @@ #ifndef __VALUERECORDS_H #define __VALUERECORDS_H +/** + * \file + * \internal + */ + #include "LETypes.h" #include "LEFontInstance.h" #include "OpenTypeTables.h" #include "GlyphIterator.h" +U_NAMESPACE_BEGIN + typedef le_uint16 ValueFormat; typedef le_int16 ValueRecordField; @@ -84,5 +91,7 @@ enum ValueFormatBits vfbAnyDevice = vfbXPlaDevice + vfbYPlaDevice + vfbXAdvDevice + vfbYAdvDevice }; - +U_NAMESPACE_END #endif + + diff --git a/jdk/src/share/native/sun/font/sunFont.c b/jdk/src/share/native/sun/font/sunFont.c index af8aa669808..3bd91451872 100644 --- a/jdk/src/share/native/sun/font/sunFont.c +++ b/jdk/src/share/native/sun/font/sunFont.c @@ -71,41 +71,14 @@ JNIEXPORT jlong JNICALL Java_sun_font_NullFontScaler_getGlyphImage void initLCDGammaTables(); -/* - * Class: sun_font_FontManager - * Method: getPlatformFontVar - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL -Java_sun_font_FontManager_getPlatformFontVar(JNIEnv *env, jclass cl) { - char *c = getenv("JAVA2D_USEPLATFORMFONT"); - if (c) { - return JNI_TRUE; - } else { - return JNI_FALSE; - } -} - /* placeholder for extern variable */ FontManagerNativeIDs sunFontIDs; JNIEXPORT void JNICALL -Java_sun_font_FontManager_initIDs +Java_sun_font_SunFontManager_initIDs (JNIEnv *env, jclass cls) { - jclass tmpClass = (*env)->FindClass(env, "java/awt/Font"); - - sunFontIDs.getFont2DMID = - (*env)->GetMethodID(env, tmpClass, "getFont2D", - "()Lsun/font/Font2D;"); - sunFontIDs.font2DHandle = - (*env)->GetFieldID(env, tmpClass, - "font2DHandle", "Lsun/font/Font2DHandle;"); - - sunFontIDs.createdFont = - (*env)->GetFieldID(env, tmpClass, "createdFont", "Z"); - - tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont"); + jclass tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont"); sunFontIDs.ttReadBlockMID = (*env)->GetMethodID(env, tmpClass, "readBlock", "(Ljava/nio/ByteBuffer;II)I"); @@ -207,40 +180,6 @@ JNIEXPORT FontManagerNativeIDs getSunFontIDs() { return sunFontIDs; } -JNIEXPORT jobject JNICALL -Java_sun_font_FontManager_getFont2D( - JNIEnv *env, - jclass clsFM, - jobject javaFont) { - - return (*env)->CallObjectMethod(env, javaFont, sunFontIDs.getFont2DMID); -} - -JNIEXPORT void JNICALL -Java_sun_font_FontManager_setFont2D( - JNIEnv *env, - jclass clsFM, - jobject javaFont, - jobject fontHandle) { - (*env)->SetObjectField(env, javaFont, sunFontIDs.font2DHandle, fontHandle); -} - -JNIEXPORT void JNICALL -Java_sun_font_FontManager_setCreatedFont( - JNIEnv *env, - jclass clsFM, - jobject javaFont) { - (*env)->SetBooleanField(env, javaFont, sunFontIDs.createdFont, JNI_TRUE); -} - -JNIEXPORT jboolean JNICALL -Java_sun_font_FontManager_isCreatedFont( - JNIEnv *env, - jclass clsFM, - jobject javaFont) { - return (*env)->GetBooleanField(env, javaFont, sunFontIDs.createdFont); -} - /* * Class: sun_font_StrikeCache * Method: freeIntPointer diff --git a/jdk/src/share/native/sun/font/sunfontids.h b/jdk/src/share/native/sun/font/sunfontids.h index 8ef15a6ce25..5f061977a4a 100644 --- a/jdk/src/share/native/sun/font/sunfontids.h +++ b/jdk/src/share/native/sun/font/sunfontids.h @@ -34,11 +34,6 @@ extern "C" { typedef struct FontManagerNativeIDs { - /* java/awt/Font methods & fields */ - jmethodID getFont2DMID; - jfieldID font2DHandle; - jfieldID createdFont; - /* sun/font/Font2D methods */ jmethodID getMapperMID; jmethodID getTableBytesMID; diff --git a/jdk/src/share/native/sun/misc/VM.c b/jdk/src/share/native/sun/misc/VM.c index 6dcc8d68ff9..73618dd9656 100644 --- a/jdk/src/share/native/sun/misc/VM.c +++ b/jdk/src/share/native/sun/misc/VM.c @@ -131,17 +131,6 @@ Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) { /* obtain the JVM version info */ (*func_p)(env, &info, sizeof(info)); - - if (info.is_kernel_jvm == 1) { - /* set the static field VM.kernelVM to true for kernel VM */ - fid = (*env)->GetStaticFieldID(env, cls, "kernelVM", "Z"); - if (fid != 0) { - (*env)->SetStaticBooleanField(env, cls, fid, info.is_kernel_jvm); - } else { - sprintf(errmsg, "Static kernelVM boolean field not found"); - JNU_ThrowInternalError(env, errmsg); - } - } } } diff --git a/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp b/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp index fb227e82cac..e847391a09b 100644 --- a/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp +++ b/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp @@ -24,7 +24,7 @@ */ #include -#include "ecc_impl.h" +#include "impl/ecc_impl.h" #define ILLEGAL_STATE_EXCEPTION "java/lang/IllegalStateException" #define INVALID_ALGORITHM_PARAMETER_EXCEPTION \ diff --git a/jdk/src/share/native/sun/security/ec/ec.c b/jdk/src/share/native/sun/security/ec/impl/ec.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec.c rename to jdk/src/share/native/sun/security/ec/impl/ec.c diff --git a/jdk/src/share/native/sun/security/ec/ec.h b/jdk/src/share/native/sun/security/ec/impl/ec.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec.h rename to jdk/src/share/native/sun/security/ec/impl/ec.h diff --git a/jdk/src/share/native/sun/security/ec/ec2.h b/jdk/src/share/native/sun/security/ec/impl/ec2.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec2.h rename to jdk/src/share/native/sun/security/ec/impl/ec2.h diff --git a/jdk/src/share/native/sun/security/ec/ec2_163.c b/jdk/src/share/native/sun/security/ec/impl/ec2_163.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec2_163.c rename to jdk/src/share/native/sun/security/ec/impl/ec2_163.c diff --git a/jdk/src/share/native/sun/security/ec/ec2_193.c b/jdk/src/share/native/sun/security/ec/impl/ec2_193.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec2_193.c rename to jdk/src/share/native/sun/security/ec/impl/ec2_193.c diff --git a/jdk/src/share/native/sun/security/ec/ec2_233.c b/jdk/src/share/native/sun/security/ec/impl/ec2_233.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec2_233.c rename to jdk/src/share/native/sun/security/ec/impl/ec2_233.c diff --git a/jdk/src/share/native/sun/security/ec/ec2_aff.c b/jdk/src/share/native/sun/security/ec/impl/ec2_aff.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec2_aff.c rename to jdk/src/share/native/sun/security/ec/impl/ec2_aff.c diff --git a/jdk/src/share/native/sun/security/ec/ec2_mont.c b/jdk/src/share/native/sun/security/ec/impl/ec2_mont.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec2_mont.c rename to jdk/src/share/native/sun/security/ec/impl/ec2_mont.c diff --git a/jdk/src/share/native/sun/security/ec/ec_naf.c b/jdk/src/share/native/sun/security/ec/impl/ec_naf.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ec_naf.c rename to jdk/src/share/native/sun/security/ec/impl/ec_naf.c diff --git a/jdk/src/share/native/sun/security/ec/ecc_impl.h b/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h similarity index 95% rename from jdk/src/share/native/sun/security/ec/ecc_impl.h rename to jdk/src/share/native/sun/security/ec/impl/ecc_impl.h index 702ab1daeb7..95fc93b3e71 100644 --- a/jdk/src/share/native/sun/security/ec/ecc_impl.h +++ b/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h @@ -240,10 +240,8 @@ typedef enum _SECStatus { /* This function is no longer required because the random bytes are now supplied by the caller. Force a failure. -VR -#define RNG_GenerateGlobalRandomBytes(p,l) SECFailure */ -#define RNG_GenerateGlobalRandomBytes(p,l) SECSuccess +#define RNG_GenerateGlobalRandomBytes(p,l) SECFailure #endif #define CHECK_MPI_OK(func) if (MP_OKAY > (err = func)) goto cleanup #define MP_TO_SEC_ERROR(err) @@ -259,13 +257,12 @@ extern SECItem * SECITEM_AllocItem(PRArenaPool *, SECItem *, unsigned int, int); extern SECStatus SECITEM_CopyItem(PRArenaPool *, SECItem *, const SECItem *, int); extern void SECITEM_FreeItem(SECItem *, boolean_t); -extern SECStatus EC_NewKey(ECParams *ecParams, ECPrivateKey **privKey, const unsigned char* random, int randomlen, int); -extern SECStatus EC_NewKeyFromSeed(ECParams *ecParams, ECPrivateKey **privKey, - const unsigned char *seed, int seedlen, int kmflag); +/* This function has been modified to accept an array of random bytes */ +extern SECStatus EC_NewKey(ECParams *ecParams, ECPrivateKey **privKey, + const unsigned char* random, int randomlen, int); +/* This function has been modified to accept an array of random bytes */ extern SECStatus ECDSA_SignDigest(ECPrivateKey *, SECItem *, const SECItem *, - const unsigned char* randon, int randomlen, int); -extern SECStatus ECDSA_SignDigestWithSeed(ECPrivateKey *, SECItem *, - const SECItem *, const unsigned char *seed, int seedlen, int kmflag); + const unsigned char* random, int randomlen, int); extern SECStatus ECDSA_VerifyDigest(ECPublicKey *, const SECItem *, const SECItem *, int); extern SECStatus ECDH_Derive(SECItem *, ECParams *, SECItem *, boolean_t, diff --git a/jdk/src/share/native/sun/security/ec/ecdecode.c b/jdk/src/share/native/sun/security/ec/impl/ecdecode.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecdecode.c rename to jdk/src/share/native/sun/security/ec/impl/ecdecode.c diff --git a/jdk/src/share/native/sun/security/ec/ecl-curve.h b/jdk/src/share/native/sun/security/ec/impl/ecl-curve.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecl-curve.h rename to jdk/src/share/native/sun/security/ec/impl/ecl-curve.h diff --git a/jdk/src/share/native/sun/security/ec/ecl-exp.h b/jdk/src/share/native/sun/security/ec/impl/ecl-exp.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecl-exp.h rename to jdk/src/share/native/sun/security/ec/impl/ecl-exp.h diff --git a/jdk/src/share/native/sun/security/ec/ecl-priv.h b/jdk/src/share/native/sun/security/ec/impl/ecl-priv.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecl-priv.h rename to jdk/src/share/native/sun/security/ec/impl/ecl-priv.h diff --git a/jdk/src/share/native/sun/security/ec/ecl.c b/jdk/src/share/native/sun/security/ec/impl/ecl.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecl.c rename to jdk/src/share/native/sun/security/ec/impl/ecl.c diff --git a/jdk/src/share/native/sun/security/ec/ecl.h b/jdk/src/share/native/sun/security/ec/impl/ecl.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecl.h rename to jdk/src/share/native/sun/security/ec/impl/ecl.h diff --git a/jdk/src/share/native/sun/security/ec/ecl_curve.c b/jdk/src/share/native/sun/security/ec/impl/ecl_curve.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecl_curve.c rename to jdk/src/share/native/sun/security/ec/impl/ecl_curve.c diff --git a/jdk/src/share/native/sun/security/ec/ecl_gf.c b/jdk/src/share/native/sun/security/ec/impl/ecl_gf.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecl_gf.c rename to jdk/src/share/native/sun/security/ec/impl/ecl_gf.c diff --git a/jdk/src/share/native/sun/security/ec/ecl_mult.c b/jdk/src/share/native/sun/security/ec/impl/ecl_mult.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecl_mult.c rename to jdk/src/share/native/sun/security/ec/impl/ecl_mult.c diff --git a/jdk/src/share/native/sun/security/ec/ecp.h b/jdk/src/share/native/sun/security/ec/impl/ecp.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp.h rename to jdk/src/share/native/sun/security/ec/impl/ecp.h diff --git a/jdk/src/share/native/sun/security/ec/ecp_192.c b/jdk/src/share/native/sun/security/ec/impl/ecp_192.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_192.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_192.c diff --git a/jdk/src/share/native/sun/security/ec/ecp_224.c b/jdk/src/share/native/sun/security/ec/impl/ecp_224.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_224.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_224.c diff --git a/jdk/src/share/native/sun/security/ec/ecp_256.c b/jdk/src/share/native/sun/security/ec/impl/ecp_256.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_256.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_256.c diff --git a/jdk/src/share/native/sun/security/ec/ecp_384.c b/jdk/src/share/native/sun/security/ec/impl/ecp_384.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_384.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_384.c diff --git a/jdk/src/share/native/sun/security/ec/ecp_521.c b/jdk/src/share/native/sun/security/ec/impl/ecp_521.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_521.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_521.c diff --git a/jdk/src/share/native/sun/security/ec/ecp_aff.c b/jdk/src/share/native/sun/security/ec/impl/ecp_aff.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_aff.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_aff.c diff --git a/jdk/src/share/native/sun/security/ec/ecp_jac.c b/jdk/src/share/native/sun/security/ec/impl/ecp_jac.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_jac.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_jac.c diff --git a/jdk/src/share/native/sun/security/ec/ecp_jm.c b/jdk/src/share/native/sun/security/ec/impl/ecp_jm.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_jm.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_jm.c diff --git a/jdk/src/share/native/sun/security/ec/ecp_mont.c b/jdk/src/share/native/sun/security/ec/impl/ecp_mont.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/ecp_mont.c rename to jdk/src/share/native/sun/security/ec/impl/ecp_mont.c diff --git a/jdk/src/share/native/sun/security/ec/logtab.h b/jdk/src/share/native/sun/security/ec/impl/logtab.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/logtab.h rename to jdk/src/share/native/sun/security/ec/impl/logtab.h diff --git a/jdk/src/share/native/sun/security/ec/mp_gf2m-priv.h b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m-priv.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/mp_gf2m-priv.h rename to jdk/src/share/native/sun/security/ec/impl/mp_gf2m-priv.h diff --git a/jdk/src/share/native/sun/security/ec/mp_gf2m.c b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/mp_gf2m.c rename to jdk/src/share/native/sun/security/ec/impl/mp_gf2m.c diff --git a/jdk/src/share/native/sun/security/ec/mp_gf2m.h b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/mp_gf2m.h rename to jdk/src/share/native/sun/security/ec/impl/mp_gf2m.h diff --git a/jdk/src/share/native/sun/security/ec/mpi-config.h b/jdk/src/share/native/sun/security/ec/impl/mpi-config.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/mpi-config.h rename to jdk/src/share/native/sun/security/ec/impl/mpi-config.h diff --git a/jdk/src/share/native/sun/security/ec/mpi-priv.h b/jdk/src/share/native/sun/security/ec/impl/mpi-priv.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/mpi-priv.h rename to jdk/src/share/native/sun/security/ec/impl/mpi-priv.h diff --git a/jdk/src/share/native/sun/security/ec/mpi.c b/jdk/src/share/native/sun/security/ec/impl/mpi.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/mpi.c rename to jdk/src/share/native/sun/security/ec/impl/mpi.c diff --git a/jdk/src/share/native/sun/security/ec/mpi.h b/jdk/src/share/native/sun/security/ec/impl/mpi.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/mpi.h rename to jdk/src/share/native/sun/security/ec/impl/mpi.h diff --git a/jdk/src/share/native/sun/security/ec/mplogic.c b/jdk/src/share/native/sun/security/ec/impl/mplogic.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/mplogic.c rename to jdk/src/share/native/sun/security/ec/impl/mplogic.c diff --git a/jdk/src/share/native/sun/security/ec/mplogic.h b/jdk/src/share/native/sun/security/ec/impl/mplogic.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/mplogic.h rename to jdk/src/share/native/sun/security/ec/impl/mplogic.h diff --git a/jdk/src/share/native/sun/security/ec/mpmontg.c b/jdk/src/share/native/sun/security/ec/impl/mpmontg.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/mpmontg.c rename to jdk/src/share/native/sun/security/ec/impl/mpmontg.c diff --git a/jdk/src/share/native/sun/security/ec/mpprime.h b/jdk/src/share/native/sun/security/ec/impl/mpprime.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/mpprime.h rename to jdk/src/share/native/sun/security/ec/impl/mpprime.h diff --git a/jdk/src/share/native/sun/security/ec/oid.c b/jdk/src/share/native/sun/security/ec/impl/oid.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/oid.c rename to jdk/src/share/native/sun/security/ec/impl/oid.c diff --git a/jdk/src/share/native/sun/security/ec/secitem.c b/jdk/src/share/native/sun/security/ec/impl/secitem.c similarity index 100% rename from jdk/src/share/native/sun/security/ec/secitem.c rename to jdk/src/share/native/sun/security/ec/impl/secitem.c diff --git a/jdk/src/share/native/sun/security/ec/secoidt.h b/jdk/src/share/native/sun/security/ec/impl/secoidt.h similarity index 100% rename from jdk/src/share/native/sun/security/ec/secoidt.h rename to jdk/src/share/native/sun/security/ec/impl/secoidt.h diff --git a/jdk/src/share/sample/nio/file/Xdd.java b/jdk/src/share/sample/nio/file/Xdd.java index b540b31fd1b..b5102976077 100644 --- a/jdk/src/share/sample/nio/file/Xdd.java +++ b/jdk/src/share/sample/nio/file/Xdd.java @@ -57,9 +57,9 @@ public class Xdd { Path file = (args.length == 1) ? Paths.get(args[0]) : Paths.get(args[2]); - // check that user defined attributes are supported by the file system + // check that user defined attributes are supported by the file store FileStore store = file.getFileStore(); - if (!store.supportsFileAttributeView("user")) { + if (!store.supportsFileAttributeView(UserDefinedFileAttributeView.class)) { System.err.format("UserDefinedFileAttributeView not supported on %s\n", store); System.exit(-1); diff --git a/jdk/src/share/transport/socket/socketTransport.c b/jdk/src/share/transport/socket/socketTransport.c index f960fae2d39..59ebcc9ad3c 100644 --- a/jdk/src/share/transport/socket/socketTransport.c +++ b/jdk/src/share/transport/socket/socketTransport.c @@ -134,15 +134,16 @@ setOptions(int fd) static jdwpTransportError handshake(int fd, jlong timeout) { - char *hello = "JDWP-Handshake"; + const char *hello = "JDWP-Handshake"; char b[16]; - int rv, received, i; + int rv, helloLen, received; if (timeout > 0) { dbgsysConfigureBlocking(fd, JNI_FALSE); } + helloLen = (int)strlen(hello); received = 0; - while (received < (int)strlen(hello)) { + while (received < helloLen) { int n; char *buf; if (timeout > 0) { @@ -154,7 +155,7 @@ handshake(int fd, jlong timeout) { } buf = b; buf += received; - n = dbgsysRecv(fd, buf, (int)strlen(hello)-received, 0); + n = dbgsysRecv(fd, buf, helloLen-received, 0); if (n == 0) { setLastError(0, "handshake failed - connection prematurally closed"); return JDWPTRANSPORT_ERROR_IO_ERROR; @@ -167,20 +168,19 @@ handshake(int fd, jlong timeout) { if (timeout > 0) { dbgsysConfigureBlocking(fd, JNI_TRUE); } - for (i=0; i<(int)strlen(hello); i++) { - if (b[i] != hello[i]) { - char msg[64]; - strcpy(msg, "handshake failed - received >"); - strncat(msg, b, strlen(hello)); - strcat(msg, "< - excepted >"); - strcat(msg, hello); - strcat(msg, "<"); - setLastError(0, msg); - return JDWPTRANSPORT_ERROR_IO_ERROR; - } + if (strncmp(b, hello, received) != 0) { + char msg[80+2*16]; + b[received] = '\0'; + /* + * We should really use snprintf here but it's not available on Windows. + * We can't use jio_snprintf without linking the transport against the VM. + */ + sprintf(msg, "handshake failed - received >%s< - expected >%s<", b, hello); + setLastError(0, msg); + return JDWPTRANSPORT_ERROR_IO_ERROR; } - if (dbgsysSend(fd, hello, (int)strlen(hello), 0) != (int)strlen(hello)) { + if (dbgsysSend(fd, (char*)hello, helloLen, 0) != helloLen) { RETURN_IO_ERROR("send failed during handshake"); } return JDWPTRANSPORT_ERROR_NONE; diff --git a/jdk/src/solaris/bin/java_md.c b/jdk/src/solaris/bin/java_md.c index 2e574ec2cec..73efc1090fd 100644 --- a/jdk/src/solaris/bin/java_md.c +++ b/jdk/src/solaris/bin/java_md.c @@ -1324,12 +1324,12 @@ FindBootStrapClass(JNIEnv *env, const char* classname) { if (findBootClass == NULL) { findBootClass = (FindClassFromBootLoader_t *)dlsym(RTLD_DEFAULT, - "JVM_FindClassFromClassLoader"); + "JVM_FindClassFromBootLoader"); if (findBootClass == NULL) { JLI_ReportErrorMessage(DLL_ERROR4, - "JVM_FindClassFromClassLoader"); + "JVM_FindClassFromBootLoader"); return NULL; } } - return findBootClass(env, classname, JNI_FALSE, (jobject)NULL, JNI_FALSE); + return findBootClass(env, classname); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java b/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java index ea485b2be9f..d0abaa0a97a 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java @@ -31,8 +31,6 @@ import java.awt.peer.TrayIconPeer; import sun.awt.*; import java.awt.image.*; import java.text.BreakIterator; -import java.util.logging.Logger; -import java.util.logging.Level; import java.util.concurrent.ArrayBlockingQueue; import java.security.AccessController; import java.security.PrivilegedAction; diff --git a/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java b/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java index 3291b1e5103..38e94e0f3ab 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java +++ b/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java @@ -33,7 +33,7 @@ import java.util.List; import java.util.ArrayList; import java.util.Iterator; import sun.awt.motif.X11FontMetrics; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; // FIXME: implement multi-select /* @@ -43,7 +43,7 @@ import java.util.logging.*; * posting of Item or ActionEvents */ public class ListHelper implements XScrollbarClient { - private static final Logger log = Logger.getLogger("sun.awt.X11.ListHelper"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.ListHelper"); private final int FOCUS_INSET = 1; @@ -263,7 +263,7 @@ public class ListHelper implements XScrollbarClient { } public int y2index(int y) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("y=" + y +", firstIdx=" + firstDisplayedIndex() +", itemHeight=" + getItemHeight() + ",item_margin=" + ITEM_MARGIN); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/UnsafeXDisposerRecord.java b/jdk/src/solaris/classes/sun/awt/X11/UnsafeXDisposerRecord.java index eee63aee4ae..fded9dc2fc7 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/UnsafeXDisposerRecord.java +++ b/jdk/src/solaris/classes/sun/awt/X11/UnsafeXDisposerRecord.java @@ -25,10 +25,10 @@ package sun.awt.X11; import sun.misc.Unsafe; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; class UnsafeXDisposerRecord implements sun.java2d.DisposerRecord { - private static final Logger log = Logger.getLogger("sun.awt.X11.UnsafeXDisposerRecord"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.UnsafeXDisposerRecord"); private static Unsafe unsafe = XlibWrapper.unsafe; final long[] unsafe_ptrs, x_ptrs; final String name; @@ -59,11 +59,11 @@ class UnsafeXDisposerRecord implements sun.java2d.DisposerRecord { XToolkit.awtLock(); try { if (!disposed) { - if (XlibWrapper.isBuildInternal && "Java2D Disposer".equals(Thread.currentThread().getName()) && log.isLoggable(Level.WARNING)) { + if (XlibWrapper.isBuildInternal && "Java2D Disposer".equals(Thread.currentThread().getName()) && log.isLoggable(PlatformLogger.WARNING)) { if (place != null) { - log.log(Level.WARNING, name + " object was not disposed before finalization!", place); + log.warning(name + " object was not disposed before finalization!", place); } else { - log.log(Level.WARNING, name + " object was not disposed before finalization!"); + log.warning(name + " object was not disposed before finalization!"); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java index e022ae90b81..c2a3d3cfbe1 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java @@ -35,15 +35,14 @@ package sun.awt.X11; import java.util.*; import java.awt.*; import sun.awt.XSettings; -import java.util.logging.*; - +import sun.util.logging.PlatformLogger; class XAWTXSettings extends XSettings implements XMSelectionListener { private final XAtom xSettingsPropertyAtom = XAtom.get("_XSETTINGS_SETTINGS"); - private static Logger log = Logger.getLogger("sun.awt.X11.XAWTXSettings"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XAWTXSettings"); /* The maximal length of the property data. */ public static final long MAX_LENGTH = 1000000; @@ -56,7 +55,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { } void initXSettings() { - if (log.isLoggable(Level.FINE)) log.fine("Initializing XAWT XSettings"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Initializing XAWT XSettings"); settings = new XMSelection("_XSETTINGS"); settings.addSelectionListener(this); initPerScreenXSettings(); @@ -67,12 +66,12 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { } public void ownerDeath(int screen, XMSelection sel, long deadOwner) { - if (log.isLoggable(Level.FINE)) log.fine("Owner " + deadOwner + " died for selection " + sel + " screen "+ screen); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Owner " + deadOwner + " died for selection " + sel + " screen "+ screen); } public void ownerChanged(int screen, XMSelection sel, long newOwner, long data, long timestamp) { - if (log.isLoggable(Level.FINE)) log.fine("New Owner "+ newOwner + " for selection = " + sel + " screen " +screen ); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("New Owner "+ newOwner + " for selection = " + sel + " screen " +screen ); } public void selectionChanged(int screen, XMSelection sel, long owner , XPropertyEvent event) { @@ -81,7 +80,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { } void initPerScreenXSettings() { - if (log.isLoggable(Level.FINE)) log.fine("Updating Per XSettings changes"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Updating Per XSettings changes"); /* * As toolkit cannot yet cope with per-screen desktop properties, @@ -115,7 +114,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { } private Map getUpdatedSettings(final long owner) { - if (log.isLoggable(Level.FINE)) log.fine("owner =" + owner); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("owner =" + owner); if (0 == owner) { return null; } @@ -129,13 +128,13 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); if (status != XConstants.Success || getter.getData() == 0) { - if (log.isLoggable(Level.FINE)) log.fine("OH OH : getter failed status = " + status ); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("OH OH : getter failed status = " + status ); settings = null; } long ptr = getter.getData(); - if (log.isLoggable(Level.FINE)) log.fine("noItems = " + getter.getNumberOfItems()); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("noItems = " + getter.getNumberOfItems()); byte array[] = Native.toBytes(ptr,getter.getNumberOfItems()); if (array != null) { settings = update(array); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java index 1655be61ece..f53d68dc7a1 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java @@ -33,7 +33,7 @@ import sun.awt.*; import java.util.ArrayList; import java.util.Vector; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import sun.java2d.SurfaceData; import sun.java2d.SunGraphics2D; @@ -49,7 +49,7 @@ abstract public class XBaseMenuWindow extends XWindow { * ************************************************/ - private static Logger log = Logger.getLogger("sun.awt.X11.XBaseMenuWindow"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XBaseMenuWindow"); /* * Colors are calculated using MotifColorUtilities class @@ -330,7 +330,7 @@ abstract public class XBaseMenuWindow extends XWindow { items.add(mp); } } else { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("WARNING: Attempt to add menu item without a peer"); } } @@ -351,7 +351,7 @@ abstract public class XBaseMenuWindow extends XWindow { if (index < items.size()) { items.remove(index); } else { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("WARNING: Attempt to remove non-existing menu item, index : " + index + ", item count : " + items.size()); } } @@ -386,7 +386,7 @@ abstract public class XBaseMenuWindow extends XWindow { XMenuPeer showingSubmenu = getShowingSubmenu(); int newSelectedIndex = (item != null) ? items.indexOf(item) : -1; if (this.selectedIndex != newSelectedIndex) { - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("Selected index changed, was : " + this.selectedIndex + ", new : " + newSelectedIndex); } this.selectedIndex = newSelectedIndex; @@ -426,7 +426,7 @@ abstract public class XBaseMenuWindow extends XWindow { try { synchronized(getMenuTreeLock()) { if (showingSubmenu != submenuToShow) { - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { log.finest("Changing showing submenu"); } if (showingSubmenu != null) { @@ -1122,7 +1122,7 @@ abstract public class XBaseMenuWindow extends XWindow { * that grabs input focus */ void doHandleJavaKeyEvent(KeyEvent event) { - if (log.isLoggable(Level.FINER)) log.finer(event.toString()); + if (log.isLoggable(PlatformLogger.FINER)) log.finer(event.toString()); if (event.getID() != KeyEvent.KEY_PRESSED) { return; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java index 095f36c5efd..e531583f25e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java @@ -27,15 +27,15 @@ package sun.awt.X11; import java.awt.*; import sun.awt.*; -import java.util.logging.*; import java.util.*; +import sun.util.logging.PlatformLogger; public class XBaseWindow { - private static final Logger log = Logger.getLogger("sun.awt.X11.XBaseWindow"); - private static final Logger insLog = Logger.getLogger("sun.awt.X11.insets.XBaseWindow"); - private static final Logger eventLog = Logger.getLogger("sun.awt.X11.event.XBaseWindow"); - private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XBaseWindow"); - private static final Logger grabLog = Logger.getLogger("sun.awt.X11.grab.XBaseWindow"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XBaseWindow"); + private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XBaseWindow"); + private static final PlatformLogger eventLog = PlatformLogger.getLogger("sun.awt.X11.event.XBaseWindow"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XBaseWindow"); + private static final PlatformLogger grabLog = PlatformLogger.getLogger("sun.awt.X11.grab.XBaseWindow"); public static final String PARENT_WINDOW = "parent window", // parent window, Long @@ -160,7 +160,7 @@ public class XBaseWindow { * with class-specific values and perform post-initialization actions. */ void postInit(XCreateWindowParams params) { - if (log.isLoggable(Level.FINE)) log.fine("WM name is " + getWMName()); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("WM name is " + getWMName()); updateWMName(); // Set WM_CLIENT_LEADER property @@ -198,7 +198,7 @@ public class XBaseWindow { awtUnlock(); throw re; } catch (Throwable t) { - log.log(Level.WARNING, "Exception during peer initialization", t); + log.warning("Exception during peer initialization", t); awtLock(); initialising = InitialiseState.FAILED_INITIALISATION; awtLockNotifyAll(); @@ -360,7 +360,7 @@ public class XBaseWindow { value_mask |= XConstants.CWBitGravity; } - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("Creating window for " + this + " with the following attributes: \n" + params); } window = XlibWrapper.XCreateWindow(XToolkit.getDisplay(), @@ -480,7 +480,7 @@ public class XBaseWindow { } public void setSizeHints(long flags, int x, int y, int width, int height) { - if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags)); + if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags)); XToolkit.awtLock(); try { XSizeHints hints = getHints(); @@ -541,7 +541,7 @@ public class XBaseWindow { flags |= XUtilConstants.PWinGravity; hints.set_flags(flags); hints.set_win_gravity((int)XConstants.NorthWestGravity); - if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) + + if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) + ", values " + hints); XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData); } finally { @@ -593,7 +593,7 @@ public class XBaseWindow { public void xRequestFocus(long time) { XToolkit.awtLock(); try { - if (focusLog.isLoggable(Level.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()) + " with time " + time); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()) + " with time " + time); XlibWrapper.XSetInputFocus2(XToolkit.getDisplay(), getWindow(), time); } finally { XToolkit.awtUnlock(); @@ -602,7 +602,7 @@ public class XBaseWindow { public void xRequestFocus() { XToolkit.awtLock(); try { - if (focusLog.isLoggable(Level.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow())); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow())); XlibWrapper.XSetInputFocus(XToolkit.getDisplay(), getWindow()); } finally { XToolkit.awtUnlock(); @@ -619,7 +619,7 @@ public class XBaseWindow { } public void xSetVisible(boolean visible) { - if (log.isLoggable(Level.FINE)) log.fine("Setting visible on " + this + " to " + visible); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting visible on " + this + " to " + visible); XToolkit.awtLock(); try { this.visible = visible; @@ -824,7 +824,7 @@ public class XBaseWindow { * The active grab overrides activated automatic grab. */ public boolean grabInput() { - grabLog.log(Level.FINE, "Grab input on {0}", new Object[] {this}); + grabLog.fine("Grab input on {0}", this); XToolkit.awtLock(); try { @@ -887,7 +887,7 @@ public class XBaseWindow { XToolkit.awtLock(); try { XBaseWindow grabWindow = XAwtState.getGrabWindow(); - grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {grabWindow}); + grabLog.fine("UnGrab input on {0}", grabWindow); if (grabWindow != null) { grabWindow.ungrabInputImpl(); if (!XToolkit.getSunAwtDisableGrab()) { @@ -929,7 +929,7 @@ public class XBaseWindow { mapped = false; } public void handleReparentNotifyEvent(XEvent xev) { - if (eventLog.isLoggable(Level.FINER)) { + if (eventLog.isLoggable(PlatformLogger.FINER)) { XReparentEvent msg = xev.get_xreparent(); eventLog.finer(msg.toString()); } @@ -939,8 +939,8 @@ public class XBaseWindow { if (XPropertyCache.isCachingSupported()) { XPropertyCache.clearCache(window, XAtom.get(msg.get_atom())); } - if (eventLog.isLoggable(Level.FINER)) { - eventLog.log(Level.FINER, "{0}", new Object[] {msg}); + if (eventLog.isLoggable(PlatformLogger.FINER)) { + eventLog.finer("{0}", msg); } } @@ -969,7 +969,7 @@ public class XBaseWindow { } public void handleClientMessage(XEvent xev) { - if (eventLog.isLoggable(Level.FINER)) { + if (eventLog.isLoggable(PlatformLogger.FINER)) { XClientMessageEvent msg = xev.get_xclient(); eventLog.finer(msg.toString()); } @@ -1021,8 +1021,7 @@ public class XBaseWindow { } public void handleConfigureNotifyEvent(XEvent xev) { XConfigureEvent xe = xev.get_xconfigure(); - insLog.log(Level.FINER, "Configure, {0}", - new Object[] {xe}); + insLog.finer("Configure, {0}", xe); x = xe.get_x(); y = xe.get_y(); width = xe.get_width(); @@ -1073,7 +1072,7 @@ public class XBaseWindow { } public void dispatchEvent(XEvent xev) { - if (eventLog.isLoggable(Level.FINEST)) eventLog.finest(xev.toString()); + if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest(xev.toString()); int type = xev.get_type(); if (isDisposed()) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java index f2e1ef6f04b..b54dfbd9ec5 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java @@ -29,8 +29,6 @@ import java.awt.*; import java.awt.peer.*; import java.awt.event.*; -import java.util.logging.*; - import java.lang.reflect.Field; import sun.awt.SunToolkit; @@ -42,8 +40,6 @@ class XCheckboxMenuItemPeer extends XMenuItemPeer implements CheckboxMenuItemPee * ************************************************/ - private static Logger log = Logger.getLogger("sun.awt.X11.XCheckboxMenuItemPeer"); - /* * CheckboxMenuItem's fields */ diff --git a/jdk/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java index 4f57de624b2..f819d45c1da 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java @@ -32,11 +32,11 @@ import java.awt.image.BufferedImage; import javax.swing.plaf.basic.BasicGraphicsUtils; import java.awt.geom.AffineTransform; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; class XCheckboxPeer extends XComponentPeer implements CheckboxPeer { - private static final Logger log = Logger.getLogger("sun.awt.X11.XCheckboxPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XCheckboxPeer"); private static final Insets focusInsets = new Insets(0,0,0,0); private static final Insets borderInsets = new Insets(2,2,2,2); @@ -172,7 +172,7 @@ class XCheckboxPeer extends XComponentPeer implements CheckboxPeer { Checkbox cb = (Checkbox) e.getSource(); if (cb.contains(e.getX(), e.getY())) { - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { log.finer("mousePressed() on " + target.getName() + " : armed = " + armed + ", pressed = " + pressed + ", selected = " + selected + ", enabled = " + isEnabled()); } @@ -190,7 +190,7 @@ class XCheckboxPeer extends XComponentPeer implements CheckboxPeer { } public void mouseReleased(MouseEvent e) { - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { log.finer("mouseReleased() on " + target.getName() + ": armed = " + armed + ", pressed = " + pressed + ", selected = " + selected + ", enabled = " + isEnabled()); } @@ -215,7 +215,7 @@ class XCheckboxPeer extends XComponentPeer implements CheckboxPeer { } public void mouseEntered(MouseEvent e) { - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { log.finer("mouseEntered() on " + target.getName() + ": armed = " + armed + ", pressed = " + pressed + ", selected = " + selected + ", enabled = " + isEnabled()); } @@ -226,7 +226,7 @@ class XCheckboxPeer extends XComponentPeer implements CheckboxPeer { } public void mouseExited(MouseEvent e) { - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { log.finer("mouseExited() on " + target.getName() + ": armed = " + armed + ", pressed = " + pressed + ", selected = " + selected + ", enabled = " + isEnabled()); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java index 510d75e8673..4e84d39bba9 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java @@ -28,7 +28,7 @@ package sun.awt.X11; import java.awt.*; import java.awt.peer.*; import java.awt.event.*; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; // FIXME: tab traversal should be disabled when mouse is captured (4816336) @@ -43,7 +43,7 @@ import java.util.logging.*; // TODO: make painting more efficient (i.e. when down arrow is pressed, only two items should need to be repainted. public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelStateListener { - private static final Logger log = Logger.getLogger("sun.awt.X11.XChoicePeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XChoicePeer"); private static final int MAX_UNFURLED_ITEMS = 10; // Maximum number of // items to be displayed @@ -892,7 +892,7 @@ public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelS if (transX > 0 && transX < width && transY > 0 && transY < height) { int newIdx = helper.y2index(transY); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("transX=" + transX + ", transY=" + transY + ",width=" + width + ", height=" + height + ", newIdx=" + newIdx + " on " + target); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java index cb842d4d64a..a0ca6efb43d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java @@ -66,7 +66,8 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.Vector; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; + import sun.awt.*; import sun.awt.event.IgnorePaintEvent; import sun.awt.image.SunVolatileImage; @@ -77,12 +78,12 @@ import sun.java2d.pipe.Region; public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer, BackBufferCapsProvider { - private static final Logger log = Logger.getLogger("sun.awt.X11.XComponentPeer"); - private static final Logger buffersLog = Logger.getLogger("sun.awt.X11.XComponentPeer.multibuffer"); - private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XComponentPeer"); - private static final Logger fontLog = Logger.getLogger("sun.awt.X11.font.XComponentPeer"); - private static final Logger enableLog = Logger.getLogger("sun.awt.X11.enable.XComponentPeer"); - private static final Logger shapeLog = Logger.getLogger("sun.awt.X11.shape.XComponentPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XComponentPeer"); + private static final PlatformLogger buffersLog = PlatformLogger.getLogger("sun.awt.X11.XComponentPeer.multibuffer"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XComponentPeer"); + private static final PlatformLogger fontLog = PlatformLogger.getLogger("sun.awt.X11.font.XComponentPeer"); + private static final PlatformLogger enableLog = PlatformLogger.getLogger("sun.awt.X11.enable.XComponentPeer"); + private static final PlatformLogger shapeLog = PlatformLogger.getLogger("sun.awt.X11.shape.XComponentPeer"); boolean paintPending = false; boolean isLayouting = false; @@ -159,7 +160,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget break; } } - enableLog.log(Level.FINE, "Initial enable state: {0}", new Object[] {Boolean.valueOf(enabled)}); + enableLog.fine("Initial enable state: {0}", Boolean.valueOf(enabled)); if (target.isVisible()) { setVisible(true); @@ -253,7 +254,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * Called when component receives focus */ public void focusGained(FocusEvent e) { - focusLog.log(Level.FINE, "{0}", new Object[] {e}); + focusLog.fine("{0}", e); bHasFocus = true; } @@ -261,7 +262,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * Called when component loses focus */ public void focusLost(FocusEvent e) { - focusLog.log(Level.FINE, "{0}", new Object[] {e}); + focusLog.fine("{0}", e); bHasFocus = false; } @@ -333,7 +334,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED: // Currently we just generate focus events like we deal with lightweight instead of calling // XSetInputFocus on native window - if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Proceeding with request to " + + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Proceeding with request to " + lightweightChild + " in " + target); /** * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight @@ -358,7 +359,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget */ boolean res = wpeer.requestWindowFocus(null); - if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Requested window focus: " + res); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Requested window focus: " + res); // If parent window can be made focused and has been made focused(synchronously) // then we can proceed with children, otherwise we retreat. if (!(res && parentWindow.isFocused())) { @@ -378,13 +379,13 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } private boolean rejectFocusRequestHelper(String logMsg) { - if (focusLog.isLoggable(Level.FINER)) focusLog.finer(logMsg); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(logMsg); XKeyboardFocusManagerPeer.removeLastFocusRequest(target); return false; } void handleJavaFocusEvent(AWTEvent e) { - if (focusLog.isLoggable(Level.FINER)) focusLog.finer(e.toString()); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(e.toString()); if (e.getID() == FocusEvent.FOCUS_GAINED) { focusGained((FocusEvent)e); } else { @@ -414,7 +415,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * @see java.awt.peer.ComponentPeer */ public void setEnabled(boolean value) { - enableLog.log(Level.FINE, "{0}ing {1}", new Object[] {(value?"Enabl":"Disabl"), this}); + enableLog.fine("{0}ing {1}", (value?"Enabl":"Disabl"), this); boolean repaintNeeded = (enabled != value); enabled = value; if (target instanceof Container) { @@ -690,7 +691,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } public void setBackground(Color c) { - if (log.isLoggable(Level.FINE)) log.fine("Set background to " + c); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set background to " + c); synchronized (getStateLock()) { background = c; } @@ -699,7 +700,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } public void setForeground(Color c) { - if (log.isLoggable(Level.FINE)) log.fine("Set foreground to " + c); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set foreground to " + c); synchronized (getStateLock()) { foreground = c; } @@ -718,7 +719,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * @since JDK1.0 */ public FontMetrics getFontMetrics(Font font) { - if (fontLog.isLoggable(Level.FINE)) fontLog.fine("Getting font metrics for " + font); + if (fontLog.isLoggable(PlatformLogger.FINE)) fontLog.fine("Getting font metrics for " + font); return sun.font.FontDesignMetrics.getMetrics(font); } @@ -1188,7 +1189,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget public void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException { - if (buffersLog.isLoggable(Level.FINE)) { + if (buffersLog.isLoggable(PlatformLogger.FINE)) { buffersLog.fine("createBuffers(" + numBuffers + ", " + caps + ")"); } // set the caps first, they're used when creating the bb @@ -1206,7 +1207,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) { - if (buffersLog.isLoggable(Level.FINE)) { + if (buffersLog.isLoggable(PlatformLogger.FINE)) { buffersLog.fine("flip(" + flipAction + ")"); } if (backBuffer == 0) { @@ -1217,7 +1218,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } public Image getBackBuffer() { - if (buffersLog.isLoggable(Level.FINE)) { + if (buffersLog.isLoggable(PlatformLogger.FINE)) { buffersLog.fine("getBackBuffer()"); } if (backBuffer == 0) { @@ -1227,7 +1228,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } public void destroyBuffers() { - if (buffersLog.isLoggable(Level.FINE)) { + if (buffersLog.isLoggable(PlatformLogger.FINE)) { buffersLog.fine("destroyBuffers()"); } graphicsConfig.destroyBackBuffer(backBuffer); @@ -1262,7 +1263,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify */ protected boolean isEventDisabled(XEvent e) { - enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}", new Object[] {e, (isEnabled()?"enabled":"disable")}); + enableLog.finest("Component is {1}, checking for disabled event {0}", e, (isEnabled()?"enabled":"disable")); if (!isEnabled()) { switch (e.get_type()) { case XConstants.ButtonPress: @@ -1272,7 +1273,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget case XConstants.EnterNotify: case XConstants.LeaveNotify: case XConstants.MotionNotify: - enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {e}); + enableLog.finer("Event {0} is disable", e); return true; } } @@ -1393,7 +1394,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget */ public void applyShape(Region shape) { if (XlibUtil.isShapingSupported()) { - if (shapeLog.isLoggable(Level.FINER)) { + if (shapeLog.isLoggable(PlatformLogger.FINER)) { shapeLog.finer( "*** INFO: Setting shape: PEER: " + this + "; WINDOW: " + getWindow() @@ -1423,7 +1424,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget XToolkit.awtUnlock(); } } else { - if (shapeLog.isLoggable(Level.FINER)) { + if (shapeLog.isLoggable(PlatformLogger.FINER)) { shapeLog.finer("*** WARNING: Shaping is NOT supported!"); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java index 6a32fe9bdc3..0c4cf626e0f 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java @@ -30,8 +30,7 @@ import java.awt.Insets; import java.awt.event.ComponentEvent; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.awt.ComponentAccessor; @@ -44,7 +43,7 @@ import sun.awt.ComponentAccessor; * decorated window. So coordinates in it would be the same as java coordinates. */ public final class XContentWindow extends XWindow { - private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XContentWindow"); + private static PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XContentWindow"); static XContentWindow createContent(XDecoratedPeer parentFrame) { final WindowDimensions dims = parentFrame.getDimensions(); @@ -116,8 +115,8 @@ public final class XContentWindow extends XWindow { if (in != null) { newBounds.setLocation(-in.left, -in.top); } - if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}", - new Object[] {newBounds, getBounds()}); + if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting content bounds {0}, old bounds {1}", + newBounds, getBounds()); // Fix for 5023533: // Change in the size of the content window means, well, change of the size // Change in the location of the content window means change in insets diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java index 417cd3b0062..a855ade0464 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java @@ -30,17 +30,16 @@ import java.awt.event.ComponentEvent; import java.awt.event.InvocationEvent; import java.awt.event.WindowEvent; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.awt.ComponentAccessor; import sun.awt.SunToolkit; abstract class XDecoratedPeer extends XWindowPeer { - private static final Logger log = Logger.getLogger("sun.awt.X11.XDecoratedPeer"); - private static final Logger insLog = Logger.getLogger("sun.awt.X11.insets.XDecoratedPeer"); - private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XDecoratedPeer"); - private static final Logger iconLog = Logger.getLogger("sun.awt.X11.icon.XDecoratedPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XDecoratedPeer"); + private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XDecoratedPeer"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XDecoratedPeer"); + private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XDecoratedPeer"); // Set to true when we get the first ConfigureNotify after being // reparented - indicates that WM has adopted the top-level. @@ -79,7 +78,7 @@ abstract class XDecoratedPeer extends XWindowPeer { Rectangle bounds = (Rectangle)params.get(BOUNDS); dimensions = new WindowDimensions(bounds, getRealInsets(), false); params.put(BOUNDS, dimensions.getClientRect()); - insLog.log(Level.FINE, "Initial dimensions {0}", new Object[] { dimensions }); + insLog.fine("Initial dimensions {0}", dimensions); // Deny default processing of these events on the shell - proxy will take care of // them instead @@ -175,7 +174,7 @@ abstract class XDecoratedPeer extends XWindowPeer { } public void setTitle(String title) { - if (log.isLoggable(Level.FINE)) log.fine("Title is " + title); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Title is " + title); winAttr.title = title; updateWMName(); } @@ -265,7 +264,7 @@ abstract class XDecoratedPeer extends XWindowPeer { wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom); } - insLog.log(Level.FINER, "FRAME_EXTENTS: {0}", new Object[]{wm_set_insets}); + insLog.finer("FRAME_EXTENTS: {0}", wm_set_insets); if (wm_set_insets != null) { wm_set_insets = copy(wm_set_insets); @@ -292,7 +291,7 @@ abstract class XDecoratedPeer extends XWindowPeer { public void handleReparentNotifyEvent(XEvent xev) { XReparentEvent xe = xev.get_xreparent(); - if (insLog.isLoggable(Level.FINE)) insLog.fine(xe.toString()); + if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine(xe.toString()); reparent_serial = xe.get_serial(); XToolkit.awtLock(); try { @@ -331,7 +330,7 @@ abstract class XDecoratedPeer extends XWindowPeer { // Check if we have insets provided by the WM Insets correctWM = getWMSetInsets(null); if (correctWM != null) { - insLog.log(Level.FINER, "wm-provided insets {0}", new Object[]{correctWM}); + insLog.finer("wm-provided insets {0}", correctWM); // If these insets are equal to our current insets - no actions are necessary Insets dimInsets = dimensions.getInsets(); if (correctWM.equals(dimInsets)) { @@ -345,9 +344,9 @@ abstract class XDecoratedPeer extends XWindowPeer { correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent()); if (correctWM != null) { - insLog.log(Level.FINER, "correctWM {0}", new Object[] {correctWM}); + insLog.finer("correctWM {0}", correctWM); } else { - insLog.log(Level.FINER, "correctWM insets are not available, waiting for configureNotify"); + insLog.finer("correctWM insets are not available, waiting for configureNotify"); } } @@ -368,7 +367,7 @@ abstract class XDecoratedPeer extends XWindowPeer { * initial insets were wrong (most likely they were). */ Insets correction = difference(correctWM, currentInsets); - insLog.log(Level.FINEST, "Corrention {0}", new Object[] {correction}); + insLog.finest("Corrention {0}", correction); if (!isNull(correction)) { currentInsets = copy(correctWM); applyGuessedInsets(); @@ -378,7 +377,7 @@ abstract class XDecoratedPeer extends XWindowPeer { //update minimum size hints updateMinSizeHints(); } - if (insLog.isLoggable(Level.FINER)) insLog.finer("Dimensions before reparent: " + dimensions); + if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Dimensions before reparent: " + dimensions); dimensions.setInsets(getRealInsets()); insets_corrected = true; @@ -452,8 +451,8 @@ abstract class XDecoratedPeer extends XWindowPeer { public Insets getInsets() { Insets in = copy(getRealInsets()); in.top += getMenuBarHeight(); - if (insLog.isLoggable(Level.FINEST)) { - insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {in}); + if (insLog.isLoggable(PlatformLogger.FINEST)) { + insLog.finest("Get insets returns {0}", in); } return in; } @@ -482,7 +481,7 @@ abstract class XDecoratedPeer extends XWindowPeer { public void reshape(WindowDimensions newDimensions, int op, boolean userReshape) { - if (insLog.isLoggable(Level.FINE)) { + if (insLog.isLoggable(PlatformLogger.FINE)) { insLog.fine("Reshaping " + this + " to " + newDimensions + " op " + op + " user reshape " + userReshape); } if (userReshape) { @@ -503,8 +502,8 @@ abstract class XDecoratedPeer extends XWindowPeer { XToolkit.awtLock(); try { if (!isReparented() || !isVisible()) { - insLog.log(Level.FINE, "- not reparented({0}) or not visible({1}), default reshape", - new Object[] {Boolean.valueOf(isReparented()), Boolean.valueOf(visible)}); + insLog.fine("- not reparented({0}) or not visible({1}), default reshape", + Boolean.valueOf(isReparented()), Boolean.valueOf(visible)); // Fix for 6323293. // This actually is needed to preserve compatibility with previous releases - @@ -609,8 +608,9 @@ abstract class XDecoratedPeer extends XWindowPeer { dims.setSize(width, height); break; } - if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}", - new Object[] {operationToString(operation), dims}); + if (insLog.isLoggable(PlatformLogger.FINE)) + insLog.fine("For the operation {0} new dimensions are {1}", + operationToString(operation), dims); reshape(dims, operation, userReshape); } @@ -640,7 +640,7 @@ abstract class XDecoratedPeer extends XWindowPeer { public void handleConfigureNotifyEvent(XEvent xev) { assert (SunToolkit.isAWTLockHeldByCurrentThread()); XConfigureEvent xe = xev.get_xconfigure(); - insLog.log(Level.FINE, "Configure notify {0}", new Object[] {xe}); + insLog.fine("Configure notify {0}", xe); // XXX: should really only consider synthetic events, but if (isReparented()) { @@ -677,9 +677,9 @@ abstract class XDecoratedPeer extends XWindowPeer { * it!!!! or we wind up in a bogus location. */ int runningWM = XWM.getWMID(); - if (insLog.isLoggable(Level.FINE)) { - insLog.log(Level.FINE, "reparented={0}, visible={1}, WM={2}, decorations={3}", - new Object[] {isReparented(), isVisible(), runningWM, getDecorations()}); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine("reparented={0}, visible={1}, WM={2}, decorations={3}", + isReparented(), isVisible(), runningWM, getDecorations()); } if (!isReparented() && isVisible() && runningWM != XWM.NO_WM && !XWM.isNonReparentingWM() @@ -691,7 +691,7 @@ abstract class XDecoratedPeer extends XWindowPeer { if (!insets_corrected && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) { long parent = XlibUtil.getParentWindow(window); Insets correctWM = (parent != -1) ? XWM.getWM().getInsets(this, window, parent) : null; - if (insLog.isLoggable(Level.FINER)) { + if (insLog.isLoggable(PlatformLogger.FINER)) { if (correctWM != null) { insLog.finer("Configure notify - insets : " + correctWM); } else { @@ -732,7 +732,7 @@ abstract class XDecoratedPeer extends XWindowPeer { case XWM.SAWFISH_WM: { Point xlocation = queryXLocation(); - if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "New X location: {0}", new Object[]{xlocation}); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("New X location: {0}", xlocation); if (xlocation != null) { newLocation = xlocation; } @@ -749,8 +749,8 @@ abstract class XDecoratedPeer extends XWindowPeer { copy(currentInsets), true); - insLog.log(Level.FINER, "Insets are {0}, new dimensions {1}", - new Object[] {currentInsets, newDimensions}); + insLog.finer("Insets are {0}, new dimensions {1}", + currentInsets, newDimensions); checkIfOnNewScreen(newDimensions.getBounds()); @@ -789,8 +789,8 @@ abstract class XDecoratedPeer extends XWindowPeer { } public void setShellBounds(Rectangle rec) { - if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting shell bounds on " + - this + " to " + rec); + if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell bounds on " + + this + " to " + rec); XToolkit.awtLock(); try { updateSizeHints(rec.x, rec.y, rec.width, rec.height); @@ -802,8 +802,8 @@ abstract class XDecoratedPeer extends XWindowPeer { } } public void setShellSize(Rectangle rec) { - if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting shell size on " + - this + " to " + rec); + if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell size on " + + this + " to " + rec); XToolkit.awtLock(); try { updateSizeHints(rec.x, rec.y, rec.width, rec.height); @@ -814,8 +814,8 @@ abstract class XDecoratedPeer extends XWindowPeer { } } public void setShellPosition(Rectangle rec) { - if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting shell position on " + - this + " to " + rec); + if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell position on " + + this + " to " + rec); XToolkit.awtLock(); try { updateSizeHints(rec.x, rec.y, rec.width, rec.height); @@ -915,9 +915,9 @@ abstract class XDecoratedPeer extends XWindowPeer { return toGlobal(0,0); } else { Point location = target.getLocation(); - if (insLog.isLoggable(Level.FINE)) - insLog.log(Level.FINE, "getLocationOnScreen {0} not reparented: {1} ", - new Object[] {this, location}); + if (insLog.isLoggable(PlatformLogger.FINE)) + insLog.fine("getLocationOnScreen {0} not reparented: {1} ", + this, location); return location; } } finally { @@ -954,7 +954,7 @@ abstract class XDecoratedPeer extends XWindowPeer { } public void setVisible(boolean vis) { - log.log(Level.FINER, "Setting {0} to visible {1}", new Object[] {this, Boolean.valueOf(vis)}); + log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(vis)); if (vis && !isVisible()) { XWM.setShellDecor(this); super.setVisible(vis); @@ -1005,7 +1005,7 @@ abstract class XDecoratedPeer extends XWindowPeer { } private void handleWmTakeFocus(XClientMessageEvent cl) { - focusLog.log(Level.FINE, "WM_TAKE_FOCUS on {0}", new Object[]{this}); + focusLog.fine("WM_TAKE_FOCUS on {0}", this); requestWindowFocus(cl.get_data(1), true); } @@ -1018,9 +1018,9 @@ abstract class XDecoratedPeer extends XWindowPeer { // by "proxy" - invisible mapped window. When we want to set X input focus to // toplevel set it on proxy instead. if (focusProxy == null) { - if (focusLog.isLoggable(Level.FINE)) focusLog.warning("Focus proxy is null for " + this); + if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.warning("Focus proxy is null for " + this); } else { - if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Requesting focus to proxy: " + focusProxy); + if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Requesting focus to proxy: " + focusProxy); if (timeProvided) { focusProxy.xRequestFocus(time); } else { @@ -1111,9 +1111,9 @@ abstract class XDecoratedPeer extends XWindowPeer { Window focusedWindow = XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow(); Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow); - focusLog.log(Level.FINER, "Current window is: active={0}, focused={1}", - new Object[]{ Boolean.valueOf(target == activeWindow), - Boolean.valueOf(target == focusedWindow)}); + focusLog.finer("Current window is: active={0}, focused={1}", + Boolean.valueOf(target == activeWindow), + Boolean.valueOf(target == focusedWindow)); XWindowPeer toFocus = this; while (toFocus.nextTransientFor != null) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java index d88f95b7539..f81e118b51b 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java @@ -32,7 +32,7 @@ import java.awt.dnd.InvalidDnDOperationException; import java.util.Map; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import sun.misc.Unsafe; @@ -42,8 +42,8 @@ import sun.misc.Unsafe; * @since 1.5 */ class XDnDDragSourceProtocol extends XDragSourceProtocol { - private static final Logger logger = - Logger.getLogger("sun.awt.X11.xembed.xdnd.XDnDDragSourceProtocol"); + private static final PlatformLogger logger = + PlatformLogger.getLogger("sun.awt.X11.xembed.xdnd.XDnDDragSourceProtocol"); private static final Unsafe unsafe = XlibWrapper.unsafe; @@ -395,7 +395,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { return false; } - if (logger.isLoggable(Level.FINEST)) { + if (logger.isLoggable(PlatformLogger.FINEST)) { logger.finest(" sourceWindow=" + sourceWindow + " get_window=" + xclient.get_window() + " xclient=" + xclient); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java index f2ba2dc28e3..2a082d44195 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java @@ -33,7 +33,7 @@ import java.awt.event.MouseEvent; import java.io.IOException; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import sun.misc.Unsafe; @@ -43,8 +43,8 @@ import sun.misc.Unsafe; * @since 1.5 */ class XDnDDropTargetProtocol extends XDropTargetProtocol { - private static final Logger logger = - Logger.getLogger("sun.awt.X11.xembed.xdnd.XDnDDropTargetProtocol"); + private static final PlatformLogger logger = + PlatformLogger.getLogger("sun.awt.X11.xembed.xdnd.XDnDDropTargetProtocol"); private static final Unsafe unsafe = XlibWrapper.unsafe; @@ -999,7 +999,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { if (sourceFormats != null && sourceFormats.length > 3) { data1 |= XDnDConstants.XDND_DATA_TYPES_BIT; } - if (logger.isLoggable(Level.FINEST)) { + if (logger.isLoggable(PlatformLogger.FINEST)) { logger.finest(" " + " entryVersion=" + version + " sourceProtocolVersion=" + @@ -1058,7 +1058,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { public boolean forwardEventToEmbedded(long embedded, long ctxt, int eventID) { - if (logger.isLoggable(Level.FINEST)) { + if (logger.isLoggable(PlatformLogger.FINEST)) { logger.finest(" ctxt=" + ctxt + " type=" + (ctxt != 0 ? getMessageType(new @@ -1086,7 +1086,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { long data3 = Native.getLong(ctxt + size + 2 * Native.getLongSize()); long data4 = Native.getLong(ctxt + size + 3 * Native.getLongSize()); - if (logger.isLoggable(Level.FINEST)) { + if (logger.isLoggable(PlatformLogger.FINEST)) { logger.finest(" 1 " + " embedded=" + embedded + " source=" + xclient.get_data(0) @@ -1120,7 +1120,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { if (XToolkit.saved_error != null && XToolkit.saved_error.get_error_code() != XConstants.Success) { - if (logger.isLoggable(Level.WARNING)) { + if (logger.isLoggable(PlatformLogger.WARNING)) { logger.warning("Cannot set XdndTypeList on the proxy window"); } } @@ -1128,7 +1128,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { XToolkit.awtUnlock(); } } else { - if (logger.isLoggable(Level.WARNING)) { + if (logger.isLoggable(PlatformLogger.WARNING)) { logger.warning("Cannot read XdndTypeList from the source window"); } } @@ -1143,7 +1143,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { overXEmbedClient = true; } - if (logger.isLoggable(Level.FINEST)) { + if (logger.isLoggable(PlatformLogger.FINEST)) { logger.finest(" 2 " + " embedded=" + embedded + " xclient=" + xclient); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java index 4186628c404..5188fe7169b 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java @@ -37,7 +37,8 @@ import java.awt.dnd.InvalidDnDOperationException; import java.util.*; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; + import sun.awt.ComponentAccessor; import sun.awt.dnd.SunDragSourceContextPeer; @@ -52,8 +53,8 @@ import sun.awt.SunToolkit; */ public final class XDragSourceContextPeer extends SunDragSourceContextPeer implements XDragSourceProtocolListener { - private static final Logger logger = - Logger.getLogger("sun.awt.X11.xembed.xdnd.XDragSourceContextPeer"); + private static final PlatformLogger logger = + PlatformLogger.getLogger("sun.awt.X11.xembed.xdnd.XDragSourceContextPeer"); /* The events selected on the root window when the drag begins. */ private static final int ROOT_EVENT_MASK = (int)XConstants.ButtonMotionMask | @@ -542,7 +543,7 @@ public final class XDragSourceContextPeer return false; } - if (logger.isLoggable(Level.FINEST)) { + if (logger.isLoggable(PlatformLogger.FINEST)) { logger.finest(" proxyModeSourceWindow=" + getProxyModeSourceWindow() + " ev=" + ev); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java index efce539bc66..4ffa9e45e59 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java @@ -31,7 +31,8 @@ import java.awt.peer.ComponentPeer; import java.io.IOException; import java.util.Iterator; -import java.util.logging.*; + +import sun.util.logging.PlatformLogger; import sun.awt.AppContext; import sun.awt.SunToolkit; @@ -48,8 +49,8 @@ import sun.misc.Unsafe; * @since 1.5 */ final class XDropTargetContextPeer extends SunDropTargetContextPeer { - private static final Logger logger = - Logger.getLogger("sun.awt.X11.xembed.xdnd.XDropTargetContextPeer"); + private static final PlatformLogger logger = + PlatformLogger.getLogger("sun.awt.X11.xembed.xdnd.XDropTargetContextPeer"); private static final Unsafe unsafe = XlibWrapper.unsafe; @@ -198,7 +199,7 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer { structure. */ long ctxt = getNativeDragContext(); - if (logger.isLoggable(Level.FINER)) { + if (logger.isLoggable(PlatformLogger.FINER)) { logger.finer(" processing " + event + " ctxt=" + ctxt + " consumed=" + event.isConsumed()); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java index 7a7c7c10ee2..2b238730060 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java @@ -29,7 +29,7 @@ import java.io.IOException; import java.util.HashMap; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; /** * An abstract class for drop protocols on X11 systems. @@ -38,8 +38,8 @@ import java.util.logging.*; * @since 1.5 */ abstract class XDropTargetProtocol { - private static final Logger logger = - Logger.getLogger("sun.awt.X11.xembed.xdnd.XDropTargetProtocol"); + private static final PlatformLogger logger = + PlatformLogger.getLogger("sun.awt.X11.xembed.xdnd.XDropTargetProtocol"); private final XDropTargetProtocolListener listener; @@ -116,16 +116,16 @@ abstract class XDropTargetProtocol { XClientMessageEvent xclient) { EmbedderRegistryEntry entry = getEmbedderRegistryEntry(toplevel); - if (logger.isLoggable(Level.FINEST)) { - logger.log(Level.FINEST, " entry={0}", new Object[] {entry}); + if (logger.isLoggable(PlatformLogger.FINEST)) { + logger.finest(" entry={0}", entry); } // Window not registered as an embedder for this protocol. if (entry == null) { return false; } - if (logger.isLoggable(Level.FINEST)) { - logger.log(Level.FINEST, " entry.isOverriden()={0}", new Object[] {entry.isOverriden()}); + if (logger.isLoggable(PlatformLogger.FINEST)) { + logger.finest(" entry.isOverriden()={0}", entry.isOverriden()); } // Window didn't have an associated drop site, so there is no need // to forward the message. @@ -137,8 +137,8 @@ abstract class XDropTargetProtocol { long proxy = entry.getProxy(); - if (logger.isLoggable(Level.FINEST)) { - logger.log(Level.FINEST, " proxy={0} toplevel={1}", new Object[] {proxy, toplevel}); + if (logger.isLoggable(PlatformLogger.FINEST)) { + logger.finest(" proxy={0} toplevel={1}", proxy, toplevel); } if (proxy == 0) { proxy = toplevel; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java index 1678d92a6bd..509a5e32745 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java @@ -31,7 +31,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import java.awt.Point; @@ -42,8 +42,8 @@ import java.awt.Point; * @since 1.5 */ final class XDropTargetRegistry { - private static final Logger logger = - Logger.getLogger("sun.awt.X11.xembed.xdnd.XDropTargetRegistry"); + private static final PlatformLogger logger = + PlatformLogger.getLogger("sun.awt.X11.xembed.xdnd.XDropTargetRegistry"); private static final long DELAYED_REGISTRATION_PERIOD = 200; @@ -614,7 +614,7 @@ final class XDropTargetRegistry { if (info != null && info.getProtocolVersion() >= XDnDConstants.XDND_MIN_PROTOCOL_VERSION) { - if (logger.isLoggable(Level.FINE)) { + if (logger.isLoggable(PlatformLogger.FINE)) { logger.fine(" XEmbed drop site will be registered for " + Long.toHexString(clientWindow)); } registerEmbeddedDropSite(canvasWindow, clientWindow); @@ -628,14 +628,14 @@ final class XDropTargetRegistry { dropTargetProtocol.registerEmbeddedDropSite(clientWindow); } - if (logger.isLoggable(Level.FINE)) { + if (logger.isLoggable(PlatformLogger.FINE)) { logger.fine(" XEmbed drop site has been registered for " + Long.toHexString(clientWindow)); } } } public void unregisterXEmbedClient(long canvasWindow, long clientWindow) { - if (logger.isLoggable(Level.FINE)) { + if (logger.isLoggable(PlatformLogger.FINE)) { logger.fine(" XEmbed drop site will be unregistered for " + Long.toHexString(clientWindow)); } Iterator dropTargetProtocols = @@ -649,7 +649,7 @@ final class XDropTargetRegistry { unregisterEmbeddedDropSite(canvasWindow, clientWindow); - if (logger.isLoggable(Level.FINE)) { + if (logger.isLoggable(PlatformLogger.FINE)) { logger.fine(" XEmbed drop site has beed unregistered for " + Long.toHexString(clientWindow)); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java index 94d130beb21..53dace5aff6 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java @@ -37,7 +37,7 @@ import java.awt.peer.*; import sun.awt.*; import sun.awt.motif.X11FontMetrics; import java.lang.reflect.*; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import java.util.*; import static sun.awt.X11.XEmbedHelper.*; @@ -45,7 +45,7 @@ import java.security.AccessController; import sun.security.action.GetBooleanAction; public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener, KeyEventPostProcessor, ModalityListener, WindowIDProvider { - private static final Logger xembedLog = Logger.getLogger("sun.awt.X11.xembed.XEmbedCanvasPeer"); + private static final PlatformLogger xembedLog = PlatformLogger.getLogger("sun.awt.X11.xembed.XEmbedCanvasPeer"); boolean applicationActive; // Whether the application is active(has focus) XEmbedServer xembed = new XEmbedServer(); // Helper object, contains XEmbed intrinsics @@ -129,7 +129,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } void initDispatching() { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Init embedding for " + Long.toHexString(xembed.handle)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Init embedding for " + Long.toHexString(xembed.handle)); XToolkit.awtLock(); try { XToolkit.addEventDispatcher(xembed.handle, xembed); @@ -196,10 +196,10 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener switch (ev.get_type()) { case XConstants.CreateNotify: XCreateWindowEvent cr = ev.get_xcreatewindow(); - if (xembedLog.isLoggable(Level.FINEST)) { + if (xembedLog.isLoggable(PlatformLogger.FINEST)) { xembedLog.finest("Message on embedder: " + cr); } - if (xembedLog.isLoggable(Level.FINER)) { + if (xembedLog.isLoggable(PlatformLogger.FINER)) { xembedLog.finer("Create notify for parent " + Long.toHexString(cr.get_parent()) + ", window " + Long.toHexString(cr.get_window())); } @@ -207,20 +207,20 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener break; case XConstants.DestroyNotify: XDestroyWindowEvent dn = ev.get_xdestroywindow(); - if (xembedLog.isLoggable(Level.FINEST)) { + if (xembedLog.isLoggable(PlatformLogger.FINEST)) { xembedLog.finest("Message on embedder: " + dn); } - if (xembedLog.isLoggable(Level.FINER)) { + if (xembedLog.isLoggable(PlatformLogger.FINER)) { xembedLog.finer("Destroy notify for parent: " + dn); } childDestroyed(); break; case XConstants.ReparentNotify: XReparentEvent rep = ev.get_xreparent(); - if (xembedLog.isLoggable(Level.FINEST)) { + if (xembedLog.isLoggable(PlatformLogger.FINEST)) { xembedLog.finest("Message on embedder: " + rep); } - if (xembedLog.isLoggable(Level.FINER)) { + if (xembedLog.isLoggable(PlatformLogger.FINER)) { xembedLog.finer("Reparent notify for parent " + Long.toHexString(rep.get_parent()) + ", window " + Long.toHexString(rep.get_window()) + ", event " + Long.toHexString(rep.get_event())); @@ -323,7 +323,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } void childResized() { - if (xembedLog.isLoggable(Level.FINER)) { + if (xembedLog.isLoggable(PlatformLogger.FINER)) { Rectangle bounds = getClientBounds(); xembedLog.finer("Child resized: " + bounds); // It is not required to update embedder's size when client size changes @@ -388,7 +388,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } void detachChild() { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Detaching child " + Long.toHexString(xembed.handle)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Detaching child " + Long.toHexString(xembed.handle)); /** * XEmbed specification: * "The embedder can unmap the client and reparent the client window to the root window. If the @@ -477,7 +477,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener try { XKeyEvent ke = new XKeyEvent(data); ke.set_window(xembed.handle); - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Forwarding native key event: " + ke); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Forwarding native key event: " + ke); XToolkit.awtLock(); try { XlibWrapper.XSendEvent(XToolkit.getDisplay(), xembed.handle, false, XConstants.NoEventMask, data); @@ -508,7 +508,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener postEvent(new InvocationEvent(target, new Runnable() { public void run() { GrabbedKey grab = new GrabbedKey(keysym, modifiers); - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Grabbing key: " + grab); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Grabbing key: " + grab); synchronized(GRAB_LOCK) { grabbed_keys.add(grab); } @@ -520,7 +520,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener postEvent(new InvocationEvent(target, new Runnable() { public void run() { GrabbedKey grab = new GrabbedKey(keysym, modifiers); - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("UnGrabbing key: " + grab); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("UnGrabbing key: " + grab); synchronized(GRAB_LOCK) { grabbed_keys.remove(grab); } @@ -533,7 +533,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener public void run() { AWTKeyStroke stroke = xembed.getKeyStrokeForKeySym(keysym, modifiers); if (stroke != null) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Registering accelerator " + accel_id + " for " + stroke); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Registering accelerator " + accel_id + " for " + stroke); synchronized(ACCEL_LOCK) { accelerators.put(accel_id, stroke); accel_lookup.put(stroke, accel_id); @@ -551,7 +551,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener synchronized(ACCEL_LOCK) { stroke = accelerators.get(accel_id); if (stroke != null) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Unregistering accelerator: " + accel_id); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Unregistering accelerator: " + accel_id); accelerators.remove(accel_id); accel_lookup.remove(stroke); // FIXME: How about several accelerators with the same stroke? } @@ -597,7 +597,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener boolean result = false; - if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Post-processing event " + e); + if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Post-processing event " + e); // Process ACCELERATORS AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e); @@ -610,7 +610,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } } if (exists) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Activating accelerator " + accel_id); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Activating accelerator " + accel_id); xembed.sendMessage(xembed.handle, XEMBED_ACTIVATE_ACCELERATOR, accel_id, 0, 0); // FIXME: How about overloaded? result = true; } @@ -622,7 +622,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener exists = grabbed_keys.contains(key); } if (exists) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Forwarding grabbed key " + e); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Forwarding grabbed key " + e); forwardKeyEvent(e); result = true; } @@ -641,9 +641,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener public void handleClientMessage(XEvent xev) { super.handleClientMessage(xev); XClientMessageEvent msg = xev.get_xclient(); - if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Client message to embedder: " + msg); + if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Client message to embedder: " + msg); if (msg.get_message_type() == xembed.XEmbed.getAtom()) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine(xembed.XEmbedMessageToString(msg)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine(xembed.XEmbedMessageToString(msg)); } if (isXEmbedActive()) { switch ((int)msg.get_data(1)) { @@ -709,7 +709,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } public boolean processXEmbedDnDEvent(long ctxt, int eventID) { - if (xembedLog.isLoggable(Level.FINEST)) { + if (xembedLog.isLoggable(PlatformLogger.FINEST)) { xembedLog.finest(" Drop target=" + target.getDropTarget()); } if (target.getDropTarget() instanceof XEmbedDropTarget) { @@ -744,7 +744,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener boolean new_mapped = (flags & XEMBED_MAPPED) != 0; boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XConstants.IsUnmapped; if (new_mapped != currently_mapped) { - if (xembedLog.isLoggable(Level.FINER)) + if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.fine("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped); if (new_mapped) { XToolkit.awtLock(); @@ -773,7 +773,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener public void handlePropertyNotify(XEvent xev) { if (isXEmbedActive()) { XPropertyEvent ev = xev.get_xproperty(); - if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Property change on client: " + ev); + if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Property change on client: " + ev); if (ev.get_atom() == XAtom.XA_WM_NORMAL_HINTS) { childResized(); } else if (ev.get_atom() == XEmbedInfo.getAtom()) { @@ -794,7 +794,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener void handleConfigureNotify(XEvent xev) { if (isXEmbedActive()) { XConfigureEvent ev = xev.get_xconfigure(); - if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Bounds change on client: " + ev); + if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Bounds change on client: " + ev); if (xev.get_xany().get_window() == handle) { childResized(); } @@ -845,7 +845,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener // We recognize only these masks modifiers = ke.get_state() & (XConstants.ShiftMask | XConstants.ControlMask | XConstants.LockMask); - if (xembedLog.isLoggable(Level.FINEST)) xembedLog.finest("Mapped " + e + " to " + this); + if (xembedLog.isLoggable(PlatformLogger.FINEST)) xembedLog.finest("Mapped " + e + " to " + this); } finally { XlibWrapper.unsafe.freeMemory(data); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java index 8be2390754c..f79de9cf927 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java @@ -26,10 +26,10 @@ package sun.awt.X11; import java.awt.AWTKeyStroke; -import java.util.logging.*; import sun.awt.SunToolkit; import java.awt.Component; import java.awt.Container; +import sun.util.logging.PlatformLogger; import sun.awt.X11GraphicsConfig; import sun.awt.X11GraphicsDevice; @@ -40,7 +40,7 @@ import sun.awt.X11GraphicsDevice; * call install and forward all XClientMessageEvents to it. */ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher { - private static final Logger xembedLog = Logger.getLogger("sun.awt.X11.xembed.XEmbedClientHelper"); + private static final PlatformLogger xembedLog = PlatformLogger.getLogger("sun.awt.X11.xembed.XEmbedClientHelper"); private XEmbeddedFramePeer embedded; // XEmbed client private long server; // XEmbed server @@ -53,7 +53,7 @@ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher } void setClient(XEmbeddedFramePeer client) { - if (xembedLog.isLoggable(Level.FINE)) { + if (xembedLog.isLoggable(PlatformLogger.FINE)) { xembedLog.fine("XEmbed client: " + client); } if (embedded != null) { @@ -67,7 +67,7 @@ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher } void install() { - if (xembedLog.isLoggable(Level.FINE)) { + if (xembedLog.isLoggable(PlatformLogger.FINE)) { xembedLog.fine("Installing xembedder on " + embedded); } long[] info = new long[] { XEMBED_VERSION, XEMBED_MAPPED }; @@ -95,9 +95,9 @@ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher void handleClientMessage(XEvent xev) { XClientMessageEvent msg = xev.get_xclient(); - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine(msg.toString()); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine(msg.toString()); if (msg.get_message_type() == XEmbed.getAtom()) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Embedded message: " + msgidToString((int)msg.get_data(1))); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Embedded message: " + msgidToString((int)msg.get_data(1))); switch ((int)msg.get_data(1)) { case XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start active = true; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java index 4b3c7d9fd88..57267039bd1 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java @@ -27,7 +27,8 @@ package sun.awt.X11; import sun.misc.Unsafe; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; + import java.awt.AWTKeyStroke; import java.awt.event.InputEvent; @@ -36,7 +37,7 @@ import java.awt.event.InputEvent; * Contains constant definitions and helper routines. */ public class XEmbedHelper { - private static final Logger xembedLog = Logger.getLogger("sun.awt.X11.xembed"); + private static final PlatformLogger xembedLog = PlatformLogger.getLogger("sun.awt.X11.xembed"); final static Unsafe unsafe = Unsafe.getUnsafe(); final static int XEMBED_VERSION = 0, @@ -81,11 +82,11 @@ public class XEmbedHelper { XEmbedHelper() { if (XEmbed == null) { XEmbed = XAtom.get("_XEMBED"); - if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Created atom " + XEmbed.toString()); + if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Created atom " + XEmbed.toString()); } if (XEmbedInfo == null) { XEmbedInfo = XAtom.get("_XEMBED_INFO"); - if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Created atom " + XEmbedInfo.toString()); + if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Created atom " + XEmbedInfo.toString()); } } @@ -105,7 +106,7 @@ public class XEmbedHelper { msg.set_data(4, data2); XToolkit.awtLock(); try { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Sending " + XEmbedMessageToString(msg)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Sending " + XEmbedMessageToString(msg)); XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData); } finally { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java index 932f8bd31d6..bc4759f2257 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java @@ -28,7 +28,7 @@ package sun.awt.X11; //import static sun.awt.X11.XEmbed.*; import java.awt.*; import java.awt.event.*; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import static sun.awt.X11.XConstants.*; import java.util.LinkedList; @@ -37,7 +37,7 @@ import java.util.LinkedList; * specification and references. */ public class XEmbedServerTester implements XEventDispatcher { - private static final Logger xembedLog = Logger.getLogger("sun.awt.X11.xembed.XEmbedServerTester"); + private static final PlatformLogger xembedLog = PlatformLogger.getLogger("sun.awt.X11.xembed.XEmbedServerTester"); private final Object EVENT_LOCK = new Object(); static final int SYSTEM_EVENT_MASK = 0x8000; int my_version, server_version; @@ -544,7 +544,7 @@ public class XEmbedServerTester implements XEventDispatcher { try { EVENT_LOCK.wait(3000); } catch (InterruptedException ie) { - xembedLog.log(Level.WARNING, "Event wait interrupted", ie); + xembedLog.warning("Event wait interrupted", ie); } eventWaited = -1; if (checkEventList(position, event) == -1) { @@ -634,7 +634,7 @@ public class XEmbedServerTester implements XEventDispatcher { if (ev.get_type() == ClientMessage) { XClientMessageEvent msg = ev.get_xclient(); if (msg.get_message_type() == xembed.XEmbed.getAtom()) { - if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1))); + if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1))); switch ((int)msg.get_data(1)) { case XEmbedHelper.XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start xembedActive = true; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java index 4b9bcc91def..a2d0df16870 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java @@ -30,15 +30,14 @@ import java.awt.*; import java.util.LinkedList; import java.util.Iterator; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.awt.EmbeddedFrame; import sun.awt.SunToolkit; public class XEmbeddedFramePeer extends XFramePeer { - private static final Logger xembedLog = Logger.getLogger("sun.awt.X11.xembed.XEmbeddedFramePeer"); + private static final PlatformLogger xembedLog = PlatformLogger.getLogger("sun.awt.X11.xembed.XEmbeddedFramePeer"); LinkedList strokes; @@ -138,7 +137,7 @@ public class XEmbeddedFramePeer extends XFramePeer { { assert (SunToolkit.isAWTLockHeldByCurrentThread()); XConfigureEvent xe = xev.get_xconfigure(); - if (xembedLog.isLoggable(Level.FINE)) { + if (xembedLog.isLoggable(PlatformLogger.FINE)) { xembedLog.fine(xe.toString()); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XErrorHandler.java b/jdk/src/solaris/classes/sun/awt/X11/XErrorHandler.java index 218bb303270..d28ec9e1b3f 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XErrorHandler.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XErrorHandler.java @@ -71,8 +71,8 @@ public abstract class XErrorHandler { return super.handleError(display, err); } // Shared instance - private static IgnoreBadWindowHandler theInstance = new IgnoreBadWindowHandler(); - public static IgnoreBadWindowHandler getInstance() { + private static VerifyChangePropertyHandler theInstance = new VerifyChangePropertyHandler(); + public static VerifyChangePropertyHandler getInstance() { return theInstance; } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java index 0b8085e759d..a50437a1ee8 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java @@ -34,12 +34,12 @@ import java.util.Locale; import java.util.Arrays; import com.sun.java.swing.plaf.motif.*; import javax.swing.plaf.ComponentUI; -import java.util.logging.*; import java.security.AccessController; import java.security.PrivilegedAction; +import sun.util.logging.PlatformLogger; class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListener, ItemListener, KeyEventDispatcher, XChoicePeerListener { - private static final Logger log = Logger.getLogger("sun.awt.X11.XFileDialogPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer"); FileDialog target; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java index 361ef87eeb6..d5295ebc86c 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java @@ -26,7 +26,6 @@ package sun.awt.X11; import java.awt.*; -import java.util.logging.*; /** * This class represent focus holder window implementation. When toplevel requests or receives focus @@ -34,7 +33,6 @@ import java.util.logging.*; * and therefore X doesn't control focus after we have set it to proxy. */ public class XFocusProxyWindow extends XBaseWindow { - private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XFocusProxyWindow"); XWindowPeer owner; public XFocusProxyWindow(XWindowPeer owner) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java index 22cb163ebbb..b2f298dab59 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java @@ -34,14 +34,13 @@ import java.awt.Insets; import java.awt.MenuBar; import java.awt.Rectangle; import java.awt.peer.FramePeer; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.awt.AWTAccessor; class XFramePeer extends XDecoratedPeer implements FramePeer { - private static Logger log = Logger.getLogger("sun.awt.X11.XFramePeer"); - private static Logger stateLog = Logger.getLogger("sun.awt.X11.states"); - private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XFramePeer"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XFramePeer"); + private static PlatformLogger stateLog = PlatformLogger.getLogger("sun.awt.X11.states"); + private static PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XFramePeer"); XMenuBarPeer menubarPeer; MenuBar menubar; @@ -76,10 +75,10 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { winAttr.isResizable = true; // target.isResizable(); winAttr.title = target.getTitle(); winAttr.initialResizability = target.isResizable(); - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}", - new Object[] {Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability), - Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState)}); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}", + Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability), + Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState)); } } @@ -208,7 +207,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { } public void setMaximizedBounds(Rectangle b) { - if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting maximized bounds to " + b); + if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting maximized bounds to " + b); if (b == null) return; maxBounds = new Rectangle(b); XToolkit.awtLock(); @@ -225,7 +224,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { } else { hints.set_max_height((int)XlibWrapper.DisplayHeight(XToolkit.getDisplay(), XlibWrapper.DefaultScreen(XToolkit.getDisplay()))); } - if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags())); + if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags())); XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), window, hints.pData); } finally { XToolkit.awtUnlock(); @@ -253,14 +252,14 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { int changed = state ^ newState; int changeIconic = changed & Frame.ICONIFIED; boolean iconic = (newState & Frame.ICONIFIED) != 0; - stateLog.log(Level.FINER, "Changing state, old state {0}, new state {1}(iconic {2})", - new Object[] {Integer.valueOf(state), Integer.valueOf(newState), Boolean.valueOf(iconic)}); + stateLog.finer("Changing state, old state {0}, new state {1}(iconic {2})", + Integer.valueOf(state), Integer.valueOf(newState), Boolean.valueOf(iconic)); if (changeIconic != 0 && iconic) { - if (stateLog.isLoggable(Level.FINER)) stateLog.finer("Iconifying shell " + getShell() + ", this " + this + ", screen " + getScreenNumber()); + if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("Iconifying shell " + getShell() + ", this " + this + ", screen " + getScreenNumber()); XToolkit.awtLock(); try { int res = XlibWrapper.XIconifyWindow(XToolkit.getDisplay(), getShell(), getScreenNumber()); - if (stateLog.isLoggable(Level.FINER)) stateLog.finer("XIconifyWindow returned " + res); + if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("XIconifyWindow returned " + res); } finally { XToolkit.awtUnlock(); @@ -270,7 +269,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { setExtendedState(newState); } if (changeIconic != 0 && !iconic) { - if (stateLog.isLoggable(Level.FINER)) stateLog.finer("DeIconifying " + this); + if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("DeIconifying " + this); xSetVisible(true); } } @@ -283,7 +282,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { super.handlePropertyNotify(xev); XPropertyEvent ev = xev.get_xproperty(); - log.log(Level.FINER, "Property change {0}", new Object[] {ev}); + log.finer("Property change {0}", ev); /* * Let's see if this is a window state protocol message, and * if it is - decode a new state in terms of java constants. @@ -348,7 +347,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { XWMHints hints = getWMHints(); hints.set_flags((int)XUtilConstants.StateHint | hints.get_flags()); hints.set_initial_state(wm_state); - if (stateLog.isLoggable(Level.FINE)) stateLog.fine("Setting initial WM state on " + this + " to " + wm_state); + if (stateLog.isLoggable(PlatformLogger.FINE)) stateLog.fine("Setting initial WM state on " + this + " to " + wm_state); XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData); } finally { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java index a6211a0e0b6..918ecdf0622 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java @@ -30,10 +30,10 @@ import sun.awt.X11GraphicsConfig; import sun.awt.image.ToolkitImage; import sun.awt.image.ImageRepresentation; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; public class XIconWindow extends XBaseWindow { - private final static Logger log = Logger.getLogger("sun.awt.X11.XIconWindow"); + private final static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XIconWindow"); XDecoratedPeer parent; Dimension size; long iconPixmap = 0; @@ -61,7 +61,7 @@ public class XIconWindow extends XBaseWindow { final long screen = adata.get_awt_visInfo().get_screen(); final long display = XToolkit.getDisplay(); - if (log.isLoggable(Level.FINEST)) log.finest(adata.toString()); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest(adata.toString()); long status = XlibWrapper.XGetIconSizes(display, XToolkit.getDefaultRootWindow(), @@ -71,11 +71,11 @@ public class XIconWindow extends XBaseWindow { } int count = Native.getInt(XlibWrapper.iarg1); long sizes_ptr = Native.getLong(XlibWrapper.larg1); // XIconSize* - log.log(Level.FINEST, "count = {1}, sizes_ptr = {0}", new Object[] {Long.valueOf(sizes_ptr), Integer.valueOf(count)}); + log.finest("count = {1}, sizes_ptr = {0}", Long.valueOf(sizes_ptr), Integer.valueOf(count)); XIconSize[] res = new XIconSize[count]; for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) { res[i] = new XIconSize(sizes_ptr); - log.log(Level.FINEST, "sizes_ptr[{1}] = {0}", new Object[] {res[i], Integer.valueOf(i)}); + log.finest("sizes_ptr[{1}] = {0}", res[i], Integer.valueOf(i)); } return res; } finally { @@ -87,12 +87,12 @@ public class XIconWindow extends XBaseWindow { if (XWM.getWMID() == XWM.ICE_WM) { // ICE_WM has a bug - it only displays icons of the size // 16x16, while reporting 32x32 in its size list - log.log(Level.FINEST, "Returning ICE_WM icon size: 16x16"); + log.finest("Returning ICE_WM icon size: 16x16"); return new Dimension(16, 16); } XIconSize[] sizeList = getIconSizes(); - log.log(Level.FINEST, "Icon sizes: {0}", new Object[] {sizeList}); + log.finest("Icon sizes: {0}", sizeList); if (sizeList == null) { // No icon sizes so we simply fall back to 16x16 return new Dimension(16, 16); @@ -139,11 +139,11 @@ public class XIconWindow extends XBaseWindow { } } } - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("found=" + found); } if (!found) { - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("widthHint=" + widthHint + ", heightHint=" + heightHint + ", saveWidth=" + saveWidth + ", saveHeight=" + saveHeight + ", max_width=" + sizeList[0].get_max_width() @@ -159,7 +159,7 @@ public class XIconWindow extends XBaseWindow { /* determine which way to scale */ int wdiff = widthHint - sizeList[0].get_max_width(); int hdiff = heightHint - sizeList[0].get_max_height(); - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("wdiff=" + wdiff + ", hdiff=" + hdiff); } if (wdiff >= hdiff) { /* need to scale width more */ @@ -191,7 +191,7 @@ public class XIconWindow extends XBaseWindow { XToolkit.awtUnlock(); } - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("return " + saveWidth + "x" + saveHeight); } return new Dimension(saveWidth, saveHeight); @@ -418,7 +418,7 @@ public class XIconWindow extends XBaseWindow { } } if (min != null) { - log.log(Level.FINER, "Icon: {0}x{1}", new Object[] { min.getWidth(null), min.getHeight(null)}); + log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); setIconImage(min); } } @@ -444,7 +444,7 @@ public class XIconWindow extends XBaseWindow { } Dimension iconSize = getIconSize(width, height); if (iconSize != null) { - log.log(Level.FINEST, "Icon size: {0}", iconSize); + log.finest("Icon size: {0}", iconSize); iconWidth = iconSize.width; iconHeight = iconSize.height; } else { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java b/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java index 86df2073d6d..709654b9953 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java @@ -33,7 +33,7 @@ import java.awt.im.spi.InputMethodContext; import java.awt.peer.ComponentPeer; import sun.awt.X11InputMethod; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; /** * Input Method Adapter for XIM (without Motif) @@ -41,7 +41,7 @@ import java.util.logging.*; * @author JavaSoft International */ public class XInputMethod extends X11InputMethod { - private static final Logger log = Logger.getLogger("sun.awt.X11.XInputMethod"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XInputMethod"); public XInputMethod() throws AWTException { super(); @@ -102,13 +102,13 @@ public class XInputMethod extends X11InputMethod { protected ComponentPeer getPeer(Component client) { XComponentPeer peer; - if (log.isLoggable(Level.FINE)) log.fine("Client is " + client); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Client is " + client); peer = (XComponentPeer)XToolkit.targetToPeer(client); while (client != null && peer == null) { client = getParent(client); peer = (XComponentPeer)XToolkit.targetToPeer(client); } - log.log(Level.FINE, "Peer is {0}, client is {1}", new Object[] {peer, client}); + log.fine("Peer is {0}, client is {1}", peer, client); if (peer != null) return peer; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java index 19c213441a0..6e11c1aac1f 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java @@ -36,15 +36,14 @@ import java.awt.peer.ComponentPeer; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.awt.CausedFocusEvent; import sun.awt.SunToolkit; import sun.awt.KeyboardFocusManagerPeerImpl; public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl { - private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XKeyboardFocusManagerPeer"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XKeyboardFocusManagerPeer"); private static Object lock = new Object() {}; private static Component currentFocusOwner; @@ -82,7 +81,7 @@ public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl { } public static void setCurrentNativeFocusedWindow(Window win) { - if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Setting current native focused window " + win); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Setting current native focused window " + win); XWindowPeer from = null, to = null; synchronized(lock) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java b/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java index ea39aeacc94..abf3c65c547 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java @@ -29,8 +29,7 @@ package sun.awt.X11; import java.util.Hashtable; import sun.misc.Unsafe; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; public class XKeysym { @@ -70,7 +69,7 @@ public class XKeysym { static Hashtable javaKeycode2KeysymHash = new Hashtable(); static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize()); static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize()); - private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XKeysym"); + private static PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.kye.XKeysym"); public static char convertKeysym( long ks, int state ) { /* First check for Latin-1 characters (1:1 mapping) */ @@ -354,6 +353,7 @@ public class XKeysym { keysym2UCSHash.put( (long)0xFFB7, (char)0x0037); // XK_KP_7 --> DIGIT SEVEN keysym2UCSHash.put( (long)0xFFB8, (char)0x0038); // XK_KP_8 --> DIGIT EIGHT keysym2UCSHash.put( (long)0xFFB9, (char)0x0039); // XK_KP_9 --> DIGIT NINE + keysym2UCSHash.put( (long)0xFE20, (char)0x0009); // XK_ISO_Left_Tab --> keysym2UCSHash.put( (long)0x1a1, (char)0x0104); // XK_Aogonek --> LATIN CAPITAL LETTER A WITH OGONEK keysym2UCSHash.put( (long)0x1a2, (char)0x02d8); // XK_breve --> BREVE keysym2UCSHash.put( (long)0x1a3, (char)0x0141); // XK_Lstroke --> LATIN CAPITAL LETTER L WITH STROKE diff --git a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java index 56c4ef9d2aa..f0b3fc117ff 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java @@ -34,13 +34,13 @@ import java.awt.peer.*; import java.util.Vector; import java.awt.geom.*; import java.awt.image.*; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; // TODO: some input actions should do nothing if Shift or Control are down class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { - private static final Logger log = Logger.getLogger("sun.awt.X11.XListPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XListPeer"); public final static int MARGIN = 2; public final static int SPACE = 1; @@ -578,10 +578,10 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } void mousePressed(MouseEvent mouseEvent) { - if (log.isLoggable(Level.FINER)) log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis); + if (log.isLoggable(PlatformLogger.FINER)) log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis); if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) { if (inWindow(mouseEvent.getX(), mouseEvent.getY())) { - if (log.isLoggable(Level.FINE)) log.fine("Mouse press in items area"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in items area"); active = WINDOW; int i = y2index(mouseEvent.getY()); if (i >= 0) { @@ -618,14 +618,14 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { currentIndex = -1; } } else if (inVerticalScrollbar(mouseEvent.getX(), mouseEvent.getY())) { - if (log.isLoggable(Level.FINE)) log.fine("Mouse press in vertical scrollbar"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in vertical scrollbar"); active = VERSCROLLBAR; vsb.handleMouseEvent(mouseEvent.getID(), mouseEvent.getModifiers(), mouseEvent.getX() - (width - SCROLLBAR_WIDTH), mouseEvent.getY()); } else if (inHorizontalScrollbar(mouseEvent.getX(), mouseEvent.getY())) { - if (log.isLoggable(Level.FINE)) log.fine("Mouse press in horizontal scrollbar"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in horizontal scrollbar"); active = HORSCROLLBAR; hsb.handleMouseEvent(mouseEvent.getID(), mouseEvent.getModifiers(), @@ -808,7 +808,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); - if (log.isLoggable(Level.FINE)) log.fine(e.toString()); + if (log.isLoggable(PlatformLogger.FINE)) log.fine(e.toString()); switch(keyCode) { case KeyEvent.VK_UP: case KeyEvent.VK_KP_UP: // TODO: I assume we also want this, too @@ -993,7 +993,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { */ public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) { - if (log.isLoggable(Level.FINE)) log.fine("Notify value changed on " + obj + " to " + v); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Notify value changed on " + obj + " to " + v); int value = obj.getValue(); if (obj == vsb) { scrollVertical(v - value); @@ -1076,7 +1076,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } } } - if (log.isLoggable(Level.FINER)) log.finer("Adding item '" + item + "' to " + addedIndex); + if (log.isLoggable(PlatformLogger.FINER)) log.finer("Adding item '" + item + "' to " + addedIndex); // Update maxLength boolean repaintItems = !isItemHidden(addedIndex); @@ -1094,7 +1094,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { | ((vsb.needsRepaint())?(PAINT_VSCROLL):0); } - if (log.isLoggable(Level.FINEST)) log.finest("Last visible: " + getLastVisibleItem() + + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last visible: " + getLastVisibleItem() + ", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems); repaint(addedIndex, getLastVisibleItem(), options); } @@ -1110,9 +1110,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { boolean vsbWasVisible = vsbVis; int oldLastDisplayed = lastItemDisplayed(); - if (log.isLoggable(Level.FINE)) log.fine("Deleting from " + s + " to " + e); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Deleting from " + s + " to " + e); - if (log.isLoggable(Level.FINEST)) log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() + + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() + ", size " + items.size()); if (items.size() == 0) { @@ -1180,7 +1180,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { options |= PAINT_FOCUS; } - if (log.isLoggable(Level.FINEST)) log.finest("Multiple selections: " + multipleSelections); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Multiple selections: " + multipleSelections); // update vsb.val if (vsb.getValue() >= s) { @@ -1433,7 +1433,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { * y is the number of items to scroll */ void scrollVertical(int y) { - if (log.isLoggable(Level.FINE)) log.fine("Scrolling vertically by " + y); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Scrolling vertically by " + y); int itemsInWin = itemsInWindow(); int h = getItemHeight(); int pixelsToScroll = y * h; @@ -1473,7 +1473,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { * x is the number of pixels to scroll */ void scrollHorizontal(int x) { - if (log.isLoggable(Level.FINE)) log.fine("Scrolling horizontally by " + y); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Scrolling horizontally by " + y); int w = getListWidth(); w -= ((2 * SPACE) + (2 * MARGIN)); int h = height - (SCROLLBAR_AREA + (2 * MARGIN)); @@ -1706,7 +1706,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } if (localBuffer == null) { - if (log.isLoggable(Level.FINE)) log.fine("Creating buffer " + width + "x" + height); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Creating buffer " + width + "x" + height); // use GraphicsConfig.cCVI() instead of Component.cVI(), // because the latter may cause a deadlock with the tree lock localBuffer = @@ -1743,7 +1743,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { private void paint(Graphics listG, int firstItem, int lastItem, int options, Rectangle source, Point distance) { - if (log.isLoggable(Level.FINER)) log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options); + if (log.isLoggable(PlatformLogger.FINER)) log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options); if (firstItem > lastItem) { int t = lastItem; lastItem = firstItem; @@ -1832,7 +1832,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } private void paintItems(Graphics g, int firstItem, int lastItem, int options) { - if (log.isLoggable(Level.FINER)) log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem()); + if (log.isLoggable(PlatformLogger.FINER)) log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem()); firstItem = Math.max(getFirstVisibleItem(), firstItem); if (firstItem > lastItem) { @@ -1843,7 +1843,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { firstItem = Math.max(getFirstVisibleItem(), firstItem); lastItem = Math.min(lastItem, items.size()-1); - if (log.isLoggable(Level.FINER)) log.finer("Actually painting items from " + firstItem + " to " + lastItem + + if (log.isLoggable(PlatformLogger.FINER)) log.finer("Actually painting items from " + firstItem + " to " + lastItem + ", items in window " + itemsInWindow()); for (int i = firstItem; i <= lastItem; i++) { paintItem(g, i); @@ -1851,7 +1851,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } private void paintItem(Graphics g, int index) { - if (log.isLoggable(Level.FINEST)) log.finest("Painting item " + index); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting item " + index); // 4895367 - only paint items which are visible if (!isItemHidden(index)) { Shape clip = g.getClip(); @@ -1859,18 +1859,18 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { int h = getItemHeight(); int y = getItemY(index); int x = getItemX(); - if (log.isLoggable(Level.FINEST)) log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2))); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2))); g.setClip(x, y, w - (SPACE*2), h-(SPACE*2)); // Always paint the background so that focus is unpainted in // multiselect mode if (isSelected(index)) { - if (log.isLoggable(Level.FINEST)) log.finest("Painted item is selected"); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painted item is selected"); g.setColor(getListForeground()); } else { g.setColor(getListBackground()); } - if (log.isLoggable(Level.FINEST)) log.finest("Filling " + new Rectangle(x, y, w, h)); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Filling " + new Rectangle(x, y, w, h)); g.fillRect(x, y, w, h); if (index <= getLastVisibleItem() && index < items.size()) { @@ -1894,7 +1894,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } void paintScrollBar(XScrollbar scr, Graphics g, int x, int y, int width, int height, boolean paintAll) { - if (log.isLoggable(Level.FINEST)) log.finest("Painting scrollbar " + scr + " width " + + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting scrollbar " + scr + " width " + width + " height " + height + ", paintAll " + paintAll); g.translate(x, y); scr.paint(g, getSystemColors(), paintAll); @@ -1932,22 +1932,22 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { if (paintFocus && !hasFocus()) { paintFocus = false; } - if (log.isLoggable(Level.FINE)) log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " + + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " + (isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus); Shape clip = g.getClip(); g.setClip(0, 0, listWidth, listHeight); - if (log.isLoggable(Level.FINEST)) log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight)); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight)); Rectangle rect = getFocusRect(); if (prevFocusRect != null) { // Erase focus rect - if (log.isLoggable(Level.FINEST)) log.finest("Erasing previous focus rect " + prevFocusRect); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Erasing previous focus rect " + prevFocusRect); g.setColor(getListBackground()); g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height); prevFocusRect = null; } if (paintFocus) { // Paint new - if (log.isLoggable(Level.FINEST)) log.finest("Painting focus rect " + rect); + if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting focus rect " + rect); g.setColor(getListForeground()); // Focus color is always black on Linux g.drawRect(rect.x, rect.y, rect.width, rect.height); prevFocusRect = rect; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java b/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java index 8fb4f4bf3c0..16de13fe9ec 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java @@ -32,8 +32,7 @@ package sun.awt.X11; import java.util.*; -import java.util.logging.*; - +import sun.util.logging.PlatformLogger; public class XMSelection { @@ -56,7 +55,7 @@ public class XMSelection { */ - private static Logger log = Logger.getLogger("sun.awt.X11.XMSelection"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XMSelection"); /* Name of the selection */ String selectionName; @@ -129,7 +128,7 @@ public class XMSelection { long display = XToolkit.getDisplay(); synchronized(this) { setOwner(owner, screen); - if (log.isLoggable(Level.FINE)) log.fine("New Selection Owner for screen " + screen + " = " + owner ); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("New Selection Owner for screen " + screen + " = " + owner ); XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | eventMask); XToolkit.addEventDispatcher(owner, new XEventDispatcher() { @@ -149,19 +148,19 @@ public class XMSelection { try { try { long display = XToolkit.getDisplay(); - if (log.isLoggable(Level.FINE)) log.fine("Grabbing XServer"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Grabbing XServer"); XlibWrapper.XGrabServer(display); synchronized(this) { String selection_name = getName()+"_S"+screen; - if (log.isLoggable(Level.FINE)) log.fine("Screen = " + screen + " selection name = " + selection_name); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Screen = " + screen + " selection name = " + selection_name); XAtom atom = XAtom.get(selection_name); selectionMap.put(Long.valueOf(atom.getAtom()),this); // add mapping from atom to the instance of XMSelection setAtom(atom,screen); long owner = XlibWrapper.XGetSelectionOwner(display, atom.getAtom()); if (owner != 0) { setOwner(owner, screen); - if (log.isLoggable(Level.FINE)) log.fine("Selection Owner for screen " + screen + " = " + owner ); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Selection Owner for screen " + screen + " = " + owner ); XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | extra_mask); XToolkit.addEventDispatcher(owner, new XEventDispatcher() { @@ -176,7 +175,7 @@ public class XMSelection { e.printStackTrace(); } finally { - if (log.isLoggable(Level.FINE)) log.fine("UnGrabbing XServer"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("UnGrabbing XServer"); XlibWrapper.XUngrabServer(XToolkit.getDisplay()); } } finally { @@ -188,7 +187,7 @@ public class XMSelection { static boolean processClientMessage(XEvent xev, int screen) { XClientMessageEvent xce = xev.get_xclient(); if (xce.get_message_type() == XA_MANAGER.getAtom()) { - if (log.isLoggable(Level.FINE)) log.fine("client messags = " + xce); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("client messags = " + xce); long timestamp = xce.get_data(0); long atom = xce.get_data(1); long owner = xce.get_data(2); @@ -295,7 +294,7 @@ public class XMSelection { synchronized void dispatchSelectionChanged( XPropertyEvent ev, int screen) { - if (log.isLoggable(Level.FINE)) log.fine("Selection Changed : Screen = " + screen + "Event =" + ev); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Selection Changed : Screen = " + screen + "Event =" + ev); if (listeners != null) { Iterator iter = listeners.iterator(); while (iter.hasNext()) { @@ -306,7 +305,7 @@ public class XMSelection { } synchronized void dispatchOwnerDeath(XDestroyWindowEvent de, int screen) { - if (log.isLoggable(Level.FINE)) log.fine("Owner dead : Screen = " + screen + "Event =" + de); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Owner dead : Screen = " + screen + "Event =" + de); if (listeners != null) { Iterator iter = listeners.iterator(); while (iter.hasNext()) { @@ -318,7 +317,7 @@ public class XMSelection { } void dispatchSelectionEvent(XEvent xev, int screen) { - if (log.isLoggable(Level.FINE)) log.fine("Event =" + xev); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Event =" + xev); if (xev.get_type() == XConstants.DestroyNotify) { XDestroyWindowEvent de = xev.get_xdestroywindow(); dispatchOwnerDeath( de, screen); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java index 1d4b8be3c6d..30fa7061840 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java @@ -30,7 +30,7 @@ import java.awt.event.*; import java.lang.reflect.Field; import java.util.Vector; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import sun.awt.SunToolkit; public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { @@ -41,7 +41,7 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { * ************************************************/ - private static Logger log = Logger.getLogger("sun.awt.X11.XMenuBarPeer"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XMenuBarPeer"); /* * Primary members @@ -533,7 +533,7 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { */ public void handleKeyPress(XEvent xev) { XKeyEvent xkey = xev.get_xkey(); - if (log.isLoggable(Level.FINE)) log.fine(xkey.toString()); + if (log.isLoggable(PlatformLogger.FINE)) log.fine(xkey.toString()); if (isEventDisabled(xev)) { return; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java index ec80cebcec1..032426a6160 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java @@ -28,8 +28,6 @@ import java.awt.*; import java.awt.peer.*; import java.awt.event.*; -import java.util.logging.*; - import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; @@ -43,8 +41,6 @@ public class XMenuItemPeer implements MenuItemPeer { * ************************************************/ - private static Logger log = Logger.getLogger("sun.awt.X11.XMenuItemPeer"); - /* * Primary members */ diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java index d5e217fe86d..9aed53ec844 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java @@ -29,7 +29,7 @@ import java.awt.peer.*; import java.lang.reflect.Field; import java.util.Vector; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import sun.awt.SunToolkit; public class XMenuPeer extends XMenuItemPeer implements MenuPeer { @@ -39,7 +39,7 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer { * Data members * ************************************************/ - private static Logger log = Logger.getLogger("sun.awt.X11.XMenuPeer"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XMenuPeer"); /** * Window that correspond to this menu @@ -122,7 +122,7 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer { * for adding separators */ public void addSeparator() { - if (log.isLoggable(Level.FINER)) log.finer("addSeparator is not implemented"); + if (log.isLoggable(PlatformLogger.FINER)) log.finer("addSeparator is not implemented"); } public void addItem(MenuItem item) { @@ -130,7 +130,7 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer { if (menuWindow != null) { menuWindow.addItem(item); } else { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("Attempt to use XMenuWindowPeer without window"); } } @@ -141,7 +141,7 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer { if (menuWindow != null) { menuWindow.delItem(index); } else { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("Attempt to use XMenuWindowPeer without window"); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java index 8a722b13355..1fdb71104d0 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java @@ -32,7 +32,7 @@ import java.awt.image.BufferedImage; import java.awt.geom.Point2D; import java.util.Vector; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; public class XMenuWindow extends XBaseMenuWindow { @@ -42,7 +42,7 @@ public class XMenuWindow extends XBaseMenuWindow { * ************************************************/ - private static Logger log = Logger.getLogger("sun.awt.X11.XMenuWindow"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XMenuWindow"); /* * Primary members @@ -399,7 +399,7 @@ public class XMenuWindow extends XBaseMenuWindow { if (!isCreated()) { return; } - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { log.finer("showing menu window + " + getWindow() + " at " + bounds); } XToolkit.awtLock(); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java index 1bc8829d9bc..86252721be5 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java @@ -27,14 +27,13 @@ package sun.awt.X11; import java.awt.Frame; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { - private final static Logger log = Logger.getLogger("sun.awt.X11.XNETProtocol"); - private final static Logger iconLog = Logger.getLogger("sun.awt.X11.icon.XNETProtocol"); - private static Logger stateLog = Logger.getLogger("sun.awt.X11.states.XNETProtocol"); + private final static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XNETProtocol"); + private final static PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XNETProtocol"); + private static PlatformLogger stateLog = PlatformLogger.getLogger("sun.awt.X11.states.XNETProtocol"); /** * XStateProtocol @@ -44,7 +43,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt } public void setState(XWindowPeer window, int state) { - if (log.isLoggable(Level.FINE)) log.fine("Setting state of " + window + " to " + state); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting state of " + window + " to " + state); if (window.isShowing()) { requestState(window, state); } else { @@ -54,7 +53,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt private void setInitialState(XWindowPeer window, int state) { XAtomList old_state = window.getNETWMState(); - log.log(Level.FINE, "Current state of the window {0} is {1}", new Object[] {window, old_state}); + log.fine("Current state of the window {0} is {1}", window, old_state); if ((state & Frame.MAXIMIZED_VERT) != 0) { old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT); } else { @@ -65,7 +64,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt } else { old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ); } - log.log(Level.FINE, "Setting initial state of the window {0} to {1}", new Object[] {window, old_state}); + log.fine("Setting initial state of the window {0} to {1}", window, old_state); window.setNETWMState(old_state); } @@ -98,7 +97,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt default: return; } - if (log.isLoggable(Level.FINE)) log.fine("Requesting state on " + window + " for " + state); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Requesting state on " + window + " for " + state); req.set_type((int)XConstants.ClientMessage); req.set_window(window.getWindow()); req.set_message_type(XA_NET_WM_STATE.getAtom()); @@ -180,7 +179,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt req.set_data(1, state.getAtom()); // Fix for 6735584: req.data[2] must be set to 0 when only one property is changed req.set_data(2, 0); - log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}", new Object[] {state, window, Boolean.valueOf(isAdd)}); + log.fine("Setting _NET_STATE atom {0} on {1} for {2}", state, window, Boolean.valueOf(isAdd)); XToolkit.awtLock(); try { XlibWrapper.XSendEvent(XToolkit.getDisplay(), @@ -205,20 +204,20 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt * @param reset Indicates operation, 'set' if false, 'reset' if true */ private void setStateHelper(XWindowPeer window, XAtom state, boolean set) { - log.log(Level.FINER, "Window visibility is: withdrawn={0}, visible={1}, mapped={2} showing={3}", - new Object[] {Boolean.valueOf(window.isWithdrawn()), Boolean.valueOf(window.isVisible()), - Boolean.valueOf(window.isMapped()), Boolean.valueOf(window.isShowing())}); + log.finer("Window visibility is: withdrawn={0}, visible={1}, mapped={2} showing={3}", + Boolean.valueOf(window.isWithdrawn()), Boolean.valueOf(window.isVisible()), + Boolean.valueOf(window.isMapped()), Boolean.valueOf(window.isShowing())); if (window.isShowing()) { requestState(window, state, set); } else { XAtomList net_wm_state = window.getNETWMState(); - log.log(Level.FINE, "Current state on {0} is {1}", new Object[] {window, net_wm_state}); + log.finer("Current state on {0} is {1}", window, net_wm_state); if (!set) { net_wm_state.remove(state); } else { net_wm_state.add(state); } - log.log(Level.FINE, "Setting states on {0} to {1}", new Object[] {window, net_wm_state}); + log.fine("Setting states on {0} to {1}", window, net_wm_state); window.setNETWMState(net_wm_state); } XToolkit.XSync(); @@ -272,7 +271,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt } NetWindow = checkAnchor(XA_NET_SUPPORTING_WM_CHECK, XAtom.XA_WINDOW); supportChecked = true; - if (log.isLoggable(Level.FINE)) log.fine("### " + this + " is active: " + (NetWindow != 0)); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " is active: " + (NetWindow != 0)); } boolean active() { @@ -309,7 +308,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt if (net_wm_name_string == null) { return false; } - if (log.isLoggable(Level.FINE)) log.fine("### WM_NAME = " + net_wm_name_string); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### WM_NAME = " + net_wm_name_string); return net_wm_name_string.startsWith(name); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java index 55fcfb5743f..7eba1b8ef63 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java @@ -33,7 +33,7 @@ import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; import java.util.Vector; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import sun.awt.SunToolkit; @@ -44,7 +44,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer { * Data members * ************************************************/ - private static Logger log = Logger.getLogger("sun.awt.X11.XBaseMenuWindow"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XBaseMenuWindow"); /* * Primary members @@ -146,7 +146,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer { * for adding separators */ public void addSeparator() { - if (log.isLoggable(Level.FINER)) log.finer("addSeparator is not implemented"); + if (log.isLoggable(PlatformLogger.FINER)) log.finer("addSeparator is not implemented"); } /* @@ -382,7 +382,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer { */ public void handleKeyPress(XEvent xev) { XKeyEvent xkey = xev.get_xkey(); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine(xkey.toString()); } if (isEventDisabled(xev)) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java index 328f1a88775..44e10f84a21 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java @@ -25,12 +25,12 @@ package sun.awt.X11; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import java.util.*; class XProtocol { - private final static Logger log = Logger.getLogger("sun.awt.X11.XProtocol"); + private final static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XProtocol"); private Map atomToList = new HashMap(); private Map atomToAnchor = new HashMap(); @@ -54,7 +54,7 @@ class XProtocol { } finally { if (firstCheck) { firstCheck = false; - log.log(Level.FINE, "{0}:{1} supports {2}", new Object[] {this, listName, protocols}); + log.fine("{0}:{1} supports {2}", this, listName, protocols); } } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java b/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java index eaace18e9ff..c352cbb5eab 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java @@ -28,11 +28,9 @@ package sun.awt.X11; import sun.misc.Unsafe; -import java.util.logging.*; public class XQueryTree { private static Unsafe unsafe = XlibWrapper.unsafe; - private static final Logger log = Logger.getLogger("sun.awt.X11.XQueryTree"); private boolean __executed = false; long _w; long root_ptr = unsafe.allocateMemory(Native.getLongSize()); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java b/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java index 6e4bd8cd2f9..6c26c47785e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java @@ -30,14 +30,14 @@ import java.awt.event.*; import java.awt.image.BufferedImage; import sun.awt.SunToolkit; import sun.awt.X11GraphicsConfig; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; /** * A simple vertical scroll bar. */ abstract class XScrollbar { - private static Logger log = Logger.getLogger("sun.awt.X11.XScrollbar"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XScrollbar"); /** * The thread that asynchronously tells the scrollbar to scroll. * @see #startScrolling @@ -118,7 +118,7 @@ abstract class XScrollbar { abstract protected void rebuildArrows(); public void setSize(int width, int height) { - if (log.isLoggable(Level.FINER)) log.finer("Setting scroll bar " + this + " size to " + width + "x" + height); + if (log.isLoggable(PlatformLogger.FINER)) log.finer("Setting scroll bar " + this + " size to " + width + "x" + height); this.width = width; this.height = height; } @@ -164,7 +164,7 @@ abstract class XScrollbar { * @param paintAll paint the whole scrollbar if true, just the thumb is false */ void paint(Graphics g, Color colors[], boolean paintAll) { - if (log.isLoggable(Level.FINER)) log.finer("Painting scrollbar " + this); + if (log.isLoggable(PlatformLogger.FINER)) log.finer("Painting scrollbar " + this); boolean useBufferedImage = false; Graphics2D g2 = null; @@ -454,7 +454,7 @@ abstract class XScrollbar { return; } - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { String type; switch (id) { case MouseEvent.MOUSE_PRESSED: diff --git a/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java index f90bde0cd23..a5e6d3e5f86 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java @@ -28,10 +28,10 @@ package sun.awt.X11; import java.awt.*; import java.awt.event.*; import java.awt.peer.*; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbarClient { - private final static Logger log = Logger.getLogger("sun.awt.X11.XScrollbarPeer"); + private final static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XScrollbarPeer"); private static final int DEFAULT_LENGTH = 50; private static final int DEFAULT_WIDTH_SOLARIS = 19; @@ -162,7 +162,7 @@ class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbar public void handleJavaKeyEvent(KeyEvent event) { super.handleJavaKeyEvent(event); - if (log.isLoggable(Level.FINEST)) log.finer("KeyEvent on scrollbar: " + event); + if (log.isLoggable(PlatformLogger.FINEST)) log.finer("KeyEvent on scrollbar: " + event); if (!(event.isConsumed()) && event.getID() == KeyEvent.KEY_RELEASED) { switch(event.getKeyCode()) { case KeyEvent.VK_UP: diff --git a/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java index 83ba45ccbe8..1fa4e436192 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java @@ -27,14 +27,14 @@ package sun.awt.X11; import java.awt.*; import java.awt.peer.SystemTrayPeer; -import java.util.logging.Logger; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; import sun.awt.SunToolkit; import sun.awt.AppContext; +import sun.util.logging.PlatformLogger; public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener { - private static final Logger log = Logger.getLogger("sun.awt.X11.XSystemTrayPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XSystemTrayPeer"); SystemTray target; static XSystemTrayPeer peerInstance; // there is only one SystemTray peer per application diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java index 8d0d79e8a27..981478fd789 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java @@ -52,12 +52,13 @@ import javax.swing.border.Border; import com.sun.java.swing.plaf.motif.*; import java.awt.im.InputMethodRequests; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; + import sun.awt.CausedFocusEvent; import sun.awt.ComponentAccessor; public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { - private static final Logger log = Logger.getLogger("sun.awt.X11.XTextField"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XTextField"); String text; XAWTTextField xtext; @@ -256,7 +257,7 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { } public void setBackground(Color c) { - if (log.isLoggable(Level.FINE)) log.fine("target="+ target + ", old=" + background + ", new=" + c); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("target="+ target + ", old=" + background + ", new=" + c); background = c; if (xtext != null) { xtext.setBackground(c); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java index 14839c7b671..1103ee6cdb9 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java @@ -46,22 +46,22 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.*; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.LookAndFeel; import javax.swing.UIDefaults; import sun.awt.*; +import sun.font.FontConfigManager; import sun.font.FontManager; import sun.misc.PerformanceLogger; import sun.print.PrintJob2D; import sun.security.action.GetBooleanAction; +import sun.util.logging.PlatformLogger; public final class XToolkit extends UNIXToolkit implements Runnable { - private static Logger log = Logger.getLogger("sun.awt.X11.XToolkit"); - private static Logger eventLog = Logger.getLogger("sun.awt.X11.event.XToolkit"); - private static final Logger timeoutTaskLog = Logger.getLogger("sun.awt.X11.timeoutTask.XToolkit"); - private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XToolkit"); - private static final Logger backingStoreLog = Logger.getLogger("sun.awt.X11.backingStore.XToolkit"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XToolkit"); + private static final PlatformLogger eventLog = PlatformLogger.getLogger("sun.awt.X11.event.XToolkit"); + private static final PlatformLogger timeoutTaskLog = PlatformLogger.getLogger("sun.awt.X11.timeoutTask.XToolkit"); + private static final PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.kye.XToolkit"); + private static final PlatformLogger backingStoreLog = PlatformLogger.getLogger("sun.awt.X11.backingStore.XToolkit"); //There is 400 ms is set by default on Windows and 500 by default on KDE and GNOME. //We use the same hardcoded constant. @@ -95,6 +95,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable { */ private XSettings xs; + private FontConfigManager fcManager = new FontConfigManager(); + static int arrowCursor; static TreeMap winMap = new TreeMap(); static HashMap specialPeerMap = new HashMap(); @@ -166,6 +168,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } public static void RESTORE_XERROR_HANDLER() { + // wait until all requests are processed by the X server + // and only then uninstall the error handler + XSync(); current_error_handler = null; } @@ -175,13 +180,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable { // Default XErrorHandler may just terminate the process. Don't call it. // return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData); } - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "Unhandled XErrorEvent: " + - "id=" + error.get_resourceid() + ", " + - "serial=" + error.get_serial() + ", " + - "ec=" + error.get_error_code() + ", " + - "rc=" + error.get_request_code() + ", " + - "mc=" + error.get_minor_code()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Unhandled XErrorEvent: " + + "id=" + error.get_resourceid() + ", " + + "serial=" + error.get_serial() + ", " + + "ec=" + error.get_error_code() + ", " + + "rc=" + error.get_request_code() + ", " + + "mc=" + error.get_minor_code()); } return 0; } @@ -200,7 +205,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { return SAVED_ERROR_HANDLER(display, event); } } catch (Throwable z) { - log.log(Level.FINE, "Error in GlobalErrorHandler", z); + log.fine("Error in GlobalErrorHandler", z); } return 0; } @@ -318,16 +323,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ((XAWTXSettings)xs).dispose(); } freeXKB(); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { dumpPeers(); } - - awtLock(); - try { - XlibWrapper.XSetErrorHandler(saved_error_handler); - } finally { - awtUnlock(); - } } }); } @@ -561,8 +559,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } static void processException(Throwable thr) { - if (log.isLoggable(Level.WARNING)) { - log.log(Level.WARNING, "Exception on Toolkit thread", thr); + if (log.isLoggable(PlatformLogger.WARNING)) { + log.warning("Exception on Toolkit thread", thr); } } @@ -623,8 +621,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable { continue; } - if (eventLog.isLoggable(Level.FINER)) { - eventLog.log(Level.FINER, "{0}", ev); + if (eventLog.isLoggable(PlatformLogger.FINER)) { + eventLog.finer("{0}", ev); } // Check if input method consumes the event @@ -639,13 +637,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } } } - if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) { + if( keyEventLog.isLoggable(PlatformLogger.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) { keyEventLog.fine("before XFilterEvent:"+ev); } if (XlibWrapper.XFilterEvent(ev.getPData(), w)) { continue; } - if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) { + if( keyEventLog.isLoggable(PlatformLogger.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) { keyEventLog.fine("after XFilterEvent:"+ev); // IS THIS CORRECT? } @@ -1332,7 +1330,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } static void dumpPeers() { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("Mapped windows:"); Iterator iter = winMap.entrySet().iterator(); while (iter.hasNext()) { @@ -1428,7 +1426,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } } catch (InterruptedException ie) { // Note: the returned timeStamp can be incorrect in this case. - if (log.isLoggable(Level.FINE)) log.fine("Catched exception, timeStamp may not be correct (ie = " + ie + ")"); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Catched exception, timeStamp may not be correct (ie = " + ie + ")"); } } finally { awtUnlock(); @@ -1527,7 +1525,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { */ if (desktopProperties.get(SunToolkit.DESKTOPFONTHINTS) == null) { if (XWM.isKDE2()) { - Object hint = FontManager.getFontConfigAAHint(); + Object hint = fcManager.getFontConfigAAHint(); if (hint != null) { /* set the fontconfig/KDE property so that * getDesktopHints() below will see it @@ -1761,7 +1759,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } finally { awtUnlock(); } - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("metaMask = " + metaMask); log.fine("altMask = " + altMask); log.fine("numLockMask = " + numLockMask); @@ -1783,11 +1781,11 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } awtLock(); try { - if (timeoutTaskLog.isLoggable(Level.FINER)) { + if (timeoutTaskLog.isLoggable(PlatformLogger.FINER)) { timeoutTaskLog.finer("Removing task " + task); } if (timeoutTasks == null) { - if (timeoutTaskLog.isLoggable(Level.FINER)) { + if (timeoutTaskLog.isLoggable(PlatformLogger.FINER)) { timeoutTaskLog.finer("Task is not scheduled"); } return; @@ -1834,11 +1832,11 @@ public final class XToolkit extends UNIXToolkit implements Runnable { awtLock(); try { - if (timeoutTaskLog.isLoggable(Level.FINER)) { - timeoutTaskLog.log(Level.FINER, "XToolkit.schedule(): current time={0}" + - "; interval={1}" + - "; task being added={2}" + "; tasks before addition={3}", new Object[] { - Long.valueOf(System.currentTimeMillis()), Long.valueOf(interval), task, timeoutTasks}); + if (timeoutTaskLog.isLoggable(PlatformLogger.FINER)) { + timeoutTaskLog.finer("XToolkit.schedule(): current time={0}" + + "; interval={1}" + + "; task being added={2}" + "; tasks before addition={3}", + Long.valueOf(System.currentTimeMillis()), Long.valueOf(interval), task, timeoutTasks); } if (timeoutTasks == null) { @@ -1881,9 +1879,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable { * Called from run() under awtLock. */ private static void callTimeoutTasks() { - if (timeoutTaskLog.isLoggable(Level.FINER)) { - timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" + - "; tasks={1}", new Object[] {Long.valueOf(System.currentTimeMillis()), timeoutTasks}); + if (timeoutTaskLog.isLoggable(PlatformLogger.FINER)) { + timeoutTaskLog.finer("XToolkit.callTimeoutTasks(): current time={0}" + + "; tasks={1}", Long.valueOf(System.currentTimeMillis()), timeoutTasks); } if (timeoutTasks == null || timeoutTasks.isEmpty()) { @@ -1899,9 +1897,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable { for (Iterator iter = tasks.iterator(); iter.hasNext();) { Runnable task = (Runnable)iter.next(); - if (timeoutTaskLog.isLoggable(Level.FINER)) { - timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" + - "; about to run task={1}", new Object[] {Long.valueOf(currentTime), task}); + if (timeoutTaskLog.isLoggable(PlatformLogger.FINER)) { + timeoutTaskLog.finer("XToolkit.callTimeoutTasks(): current time={0}" + + "; about to run task={1}", Long.valueOf(currentTime), task); } try { @@ -1974,7 +1972,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { */ long current_time_utc = System.currentTimeMillis(); - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { log.finer("reset_time=" + reset_time_utc + ", current_time=" + current_time_utc + ", server_offset=" + server_offset + ", wrap_time=" + WRAP_TIME_MILLIS); } @@ -1983,7 +1981,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { reset_time_utc = System.currentTimeMillis() - getCurrentServerTime(); } - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { log.finer("result = " + (reset_time_utc + server_offset)); } return reset_time_utc + server_offset; @@ -2068,14 +2066,14 @@ public final class XToolkit extends UNIXToolkit implements Runnable { if (prop == null) { backingStoreType = XConstants.NotUseful; - if (backingStoreLog.isLoggable(Level.CONFIG)) { + if (backingStoreLog.isLoggable(PlatformLogger.CONFIG)) { backingStoreLog.config("The system property sun.awt.backingStore is not set" + ", by default backingStore=NotUseful"); } return; } - if (backingStoreLog.isLoggable(Level.CONFIG)) { + if (backingStoreLog.isLoggable(PlatformLogger.CONFIG)) { backingStoreLog.config("The system property sun.awt.backingStore is " + prop); } prop = prop.toLowerCase(); @@ -2087,7 +2085,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { backingStoreType = XConstants.NotUseful; } - if (backingStoreLog.isLoggable(Level.CONFIG)) { + if (backingStoreLog.isLoggable(PlatformLogger.CONFIG)) { backingStoreLog.config("backingStore(as provided by the system property)=" + ( backingStoreType == XConstants.NotUseful ? "NotUseful" : backingStoreType == XConstants.WhenMapped ? @@ -2097,7 +2095,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { if (sun.java2d.x11.X11SurfaceData.isDgaAvailable()) { backingStoreType = XConstants.NotUseful; - if (backingStoreLog.isLoggable(Level.CONFIG)) { + if (backingStoreLog.isLoggable(PlatformLogger.CONFIG)) { backingStoreLog.config("DGA is available, backingStore=NotUseful"); } @@ -2112,7 +2110,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { == XConstants.NotUseful) { backingStoreType = XConstants.NotUseful; - if (backingStoreLog.isLoggable(Level.CONFIG)) { + if (backingStoreLog.isLoggable(PlatformLogger.CONFIG)) { backingStoreLog.config("Backing store is not available on the screen " + i + ", backingStore=NotUseful"); } @@ -2358,7 +2356,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { // Wait for selection notify for oops on win long event_number = getEventNumber(); XAtom atom = XAtom.get("WM_S0"); - eventLog.log(Level.FINER, "WM_S0 selection owner {0}", new Object[] {XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())}); + eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())); XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(), XAtom.get("VERSION").getAtom(), oops.getAtom(), win.getWindow(), XConstants.CurrentTime); @@ -2384,7 +2382,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { // If selection update failed we can simply wait some time // hoping some events will arrive awtUnlock(); - eventLog.log(Level.FINEST, "Emergency sleep"); + eventLog.finest("Emergency sleep"); try { Thread.sleep(WORKAROUND_SLEEP); } catch (InterruptedException ie) { @@ -2396,7 +2394,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { return getEventNumber() - event_number > 2; } finally { removeEventDispatcher(win.getWindow(), oops_waiter); - eventLog.log(Level.FINER, "Exiting syncNativeQueue"); + eventLog.finer("Exiting syncNativeQueue"); awtUnlock(); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java index b1243abacf7..da4a6b0d43d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java @@ -31,18 +31,17 @@ import java.awt.peer.TrayIconPeer; import sun.awt.*; import java.awt.image.*; import java.text.BreakIterator; -import java.util.logging.Logger; -import java.util.logging.Level; import java.util.concurrent.ArrayBlockingQueue; import java.security.AccessController; import java.security.PrivilegedAction; import java.lang.reflect.InvocationTargetException; +import sun.util.logging.PlatformLogger; public class XTrayIconPeer implements TrayIconPeer, InfoWindow.Balloon.LiveArguments, InfoWindow.Tooltip.LiveArguments { - private static final Logger ctrLog = Logger.getLogger("sun.awt.X11.XTrayIconPeer.centering"); + private static final PlatformLogger ctrLog = PlatformLogger.getLogger("sun.awt.X11.XTrayIconPeer.centering"); TrayIcon target; TrayIconEventProxy eventProxy; @@ -107,9 +106,9 @@ public class XTrayIconPeer implements TrayIconPeer, XConfigureEvent ce = ev.get_xconfigure(); - ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})", - new Object[] { XTrayIconPeer.this, ce.get_width(), ce.get_height(), - ce.get_x(), ce.get_y(), old_x, old_y }); + ctrLog.fine("ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})", + XTrayIconPeer.this, ce.get_width(), ce.get_height(), + ce.get_x(), ce.get_y(), old_x, old_y); // A workaround for Gnome/Metacity (it doesn't affect the behaviour on KDE). // On Metacity the EmbeddedFrame's parent window bounds are larger @@ -129,14 +128,14 @@ public class XTrayIconPeer implements TrayIconPeer, // If both the height and the width differ from the fixed size then WM // must level at least one side to the fixed size. For some reason it may take // a few hops (even after reparenting) and we have to skip the intermediate ones. - ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Skipping as intermediate resizing.", - XTrayIconPeer.this); + ctrLog.fine("ConfigureNotify on parent of {0}. Skipping as intermediate resizing.", + XTrayIconPeer.this); return; } else if (ce.get_height() > TRAY_ICON_HEIGHT) { - ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"Y\".", - XTrayIconPeer.this); + ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"Y\".", + XTrayIconPeer.this); XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, ce.get_x(), @@ -148,8 +147,8 @@ public class XTrayIconPeer implements TrayIconPeer, } else if (ce.get_width() > TRAY_ICON_WIDTH) { - ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"X\".", - XTrayIconPeer.this); + ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"X\".", + XTrayIconPeer.this); XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2, @@ -166,8 +165,8 @@ public class XTrayIconPeer implements TrayIconPeer, if (ex_height != 0) { - ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".", - XTrayIconPeer.this); + ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".", + XTrayIconPeer.this); XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, ce.get_x(), @@ -175,15 +174,15 @@ public class XTrayIconPeer implements TrayIconPeer, } else if (ex_width != 0) { - ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".", - XTrayIconPeer.this); + ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".", + XTrayIconPeer.this); XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2, ce.get_y()); } else { - ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Skipping.", - XTrayIconPeer.this); + ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Skipping.", + XTrayIconPeer.this); } } old_x = ce.get_x(); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java index 83b676a1a60..fae0ec11ac5 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java @@ -27,11 +27,10 @@ package sun.awt.X11; import java.awt.*; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { - final static Logger log = Logger.getLogger("sun.awt.X11.XWINProtocol"); + final static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWINProtocol"); /* Gnome WM spec */ XAtom XA_WIN_SUPPORTING_WM_CHECK = XAtom.get("_WIN_SUPPORTING_WM_CHECK"); @@ -64,7 +63,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { req.set_format(32); req.set_data(0, (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT)); req.set_data(1, win_state); - if (log.isLoggable(Level.FINE)) log.fine("Sending WIN_STATE to root to change the state to " + win_state); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Sending WIN_STATE to root to change the state to " + win_state); try { XToolkit.awtLock(); XlibWrapper.XSendEvent(XToolkit.getDisplay(), @@ -112,7 +111,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { win_state &= ~WIN_STATE_MAXIMIZED_HORIZ; } if ((old_win_state ^ win_state) != 0) { - if (log.isLoggable(Level.FINE)) log.fine("Setting WIN_STATE on " + window + " to change the state to " + win_state); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting WIN_STATE on " + window + " to change the state to " + win_state); XA_WIN_STATE.setCard32Property(window, win_state); } } @@ -157,7 +156,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { req.set_data(0, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP); req.set_data(1, 0); req.set_data(2, 0); - if (log.isLoggable(Level.FINE)) log.fine("Setting layer " + layer + " by root message : " + req); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting layer " + layer + " by root message : " + req); XToolkit.awtLock(); try { XlibWrapper.XSendEvent(XToolkit.getDisplay(), @@ -172,7 +171,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { } req.dispose(); } else { - if (log.isLoggable(Level.FINE)) log.fine("Setting layer property to " + layer); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting layer property to " + layer); XA_WIN_LAYER.setCard32Property(window, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP); } } @@ -198,7 +197,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { } WinWindow = checkAnchor(XA_WIN_SUPPORTING_WM_CHECK, XAtom.XA_CARDINAL); supportChecked = true; - if (log.isLoggable(Level.FINE)) log.fine("### " + this + " is active: " + (WinWindow != 0)); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " is active: " + (WinWindow != 0)); } boolean active() { @@ -207,13 +206,13 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { } boolean doStateProtocol() { boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_STATE); - if (log.isLoggable(Level.FINE)) log.fine("### " + this + " supports state: " + res); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " supports state: " + res); return res; } boolean doLayerProtocol() { boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_LAYER); - if (log.isLoggable(Level.FINE)) log.fine("### " + this + " supports layer: " + res); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " supports layer: " + res); return res; } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWM.java b/jdk/src/solaris/classes/sun/awt/X11/XWM.java index 4d49dee60e0..d37d24a7f9f 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java @@ -37,10 +37,10 @@ import java.awt.Rectangle; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; +import sun.util.logging.PlatformLogger; + /** * Class incapsulating knowledge about window managers in general @@ -49,9 +49,9 @@ import java.util.regex.Pattern; final class XWM { - private final static Logger log = Logger.getLogger("sun.awt.X11.XWM"); - private final static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XWM"); - private final static Logger stateLog = Logger.getLogger("sun.awt.X11.states.XWM"); + private final static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWM"); + private final static PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XWM"); + private final static PlatformLogger stateLog = PlatformLogger.getLogger("sun.awt.X11.states.XWM"); static final XAtom XA_MWM_HINTS = new XAtom(); @@ -142,7 +142,7 @@ final class XWM XWM(int WMID) { this.WMID = WMID; initializeProtocols(); - if (log.isLoggable(Level.FINE)) log.fine("Window manager: " + toString()); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Window manager: " + toString()); } int getID() { return WMID; @@ -246,7 +246,7 @@ final class XWM * having a window manager running. I.e. it does not reparent * top level shells. */ - if (insLog.isLoggable(Level.FINE)) { + if (insLog.isLoggable(PlatformLogger.FINE)) { insLog.finer("eXcursion means NO_WM"); } return true; @@ -264,7 +264,7 @@ final class XWM long selection_owner = XlibWrapper.XGetSelectionOwner(XToolkit.getDisplay(), XAtom.get(selection_name).getAtom()); - if (insLog.isLoggable(Level.FINE)) { + if (insLog.isLoggable(PlatformLogger.FINE)) { insLog.finer("selection owner of " + selection_name + " is " + selection_owner); } @@ -293,7 +293,7 @@ final class XWM XToolkit.getDefaultRootWindow(), XConstants.CWEventMask, substruct.pData); - if (insLog.isLoggable(Level.FINE)) { + if (insLog.isLoggable(PlatformLogger.FINE)) { insLog.finer("It looks like there is no WM thus NO_WM"); } } @@ -355,7 +355,7 @@ final class XWM return 0; } } catch (Exception e) { - if (log.isLoggable(Level.FINER)) { + if (log.isLoggable(PlatformLogger.FINER)) { e.printStackTrace(); } return 0; @@ -401,7 +401,7 @@ final class XWM static boolean isCDE() { if (!XA_DT_SM_WINDOW_INFO.isInterned()) { - log.log(Level.FINER, "{0} is not interned", new Object[] {XA_DT_SM_WINDOW_INFO}); + log.finer("{0} is not interned", XA_DT_SM_WINDOW_INFO); return false; } @@ -432,7 +432,7 @@ final class XWM /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */ if (!XA_DT_SM_STATE_INFO.isInterned()) { - log.log(Level.FINER, "{0} is not interned", new Object[] {XA_DT_SM_STATE_INFO}); + log.finer("{0} is not interned", XA_DT_SM_STATE_INFO); return false; } WindowPropertyGetter getter2 = @@ -596,7 +596,7 @@ final class XWM */ if (!XA_ICEWM_WINOPTHINT.isInterned()) { - log.log(Level.FINER, "{0} is not interned", new Object[] {XA_ICEWM_WINOPTHINT}); + log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT); return false; } @@ -629,7 +629,7 @@ final class XWM */ static boolean isIceWM() { if (!XA_ICEWM_WINOPTHINT.isInterned()) { - log.log(Level.FINER, "{0} is not interned", new Object[] {XA_ICEWM_WINOPTHINT}); + log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT); return false; } @@ -694,7 +694,7 @@ final class XWM return wm; } static int getWMID() { - if (insLog.isLoggable(Level.FINEST)) { + if (insLog.isLoggable(PlatformLogger.FINEST)) { insLog.finest("awt_wmgr = " + awt_wmgr); } /* @@ -718,7 +718,7 @@ final class XWM // Later, WM will initialize its own version of protocol XNETProtocol l_net_protocol = g_net_protocol = new XNETProtocol(); l_net_protocol.detect(); - if (log.isLoggable(Level.FINE) && l_net_protocol.active()) { + if (log.isLoggable(PlatformLogger.FINE) && l_net_protocol.active()) { log.fine("_NET_WM_NAME is " + l_net_protocol.getWMName()); } XWINProtocol win = g_win_protocol = new XWINProtocol(); @@ -798,7 +798,7 @@ final class XWM } hints.set_flags(hints.get_flags() & ~mask); - if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags())); + if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags())); XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), window.getWindow(), hints.pData); @@ -855,7 +855,7 @@ final class XWM XAtomList decorDel = new XAtomList(); decorations = normalizeMotifDecor(decorations); - if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations)); + if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations)); if ((decorations & MWMConstants.MWM_DECOR_TITLE) == 0) { decorDel.add(XA_OL_DECOR_HEADER); } @@ -872,7 +872,7 @@ final class XWM insLog.finer("Deleting OL_DECOR"); XA_OL_DECOR_DEL.DeleteProperty(window); } else { - if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting OL_DECOR to " + decorDel); + if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting OL_DECOR to " + decorDel); XA_OL_DECOR_DEL.setAtomListProperty(window, decorDel); } } @@ -900,7 +900,7 @@ final class XWM hints.set_functions(functions); hints.set_decorations(decorations); - if (stateLog.isLoggable(Level.FINER)) stateLog.finer("Setting MWM_HINTS to " + hints); + if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("Setting MWM_HINTS to " + hints); window.setMWMHints(hints); } @@ -962,7 +962,7 @@ final class XWM * Make specified shell resizable. */ static void setShellResizable(XDecoratedPeer window) { - if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting shell resizable " + window); + if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell resizable " + window); XToolkit.awtLock(); try { Rectangle shellBounds = window.getShellBounds(); @@ -992,7 +992,7 @@ final class XWM static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds, boolean justChangeSize) { - if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions + + if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions + ", shellBounds " + shellBounds +", just change size: " + justChangeSize); XToolkit.awtLock(); try { @@ -1285,7 +1285,7 @@ final class XWM res = defaultInsets; } } - if (insLog.isLoggable(Level.FINEST)) insLog.finest("WM guessed insets: " + res); + if (insLog.isLoggable(PlatformLogger.FINEST)) insLog.finest("WM guessed insets: " + res); return res; } /* @@ -1354,7 +1354,7 @@ final class XWM XNETProtocol net_protocol = getWM().getNETProtocol(); if (net_protocol != null && net_protocol.active()) { Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS); - insLog.log(Level.FINE, "_NET_FRAME_EXTENTS: {0}", insets); + insLog.fine("_NET_FRAME_EXTENTS: {0}", insets); if (insets != null) { return insets; @@ -1495,7 +1495,7 @@ final class XWM * [mwm, e!, kwin, fvwm2 ... ] */ Insets correctWM = XWM.getInsetsFromExtents(window); - insLog.log(Level.FINER, "Got insets from property: {0}", correctWM); + insLog.finer("Got insets from property: {0}", correctWM); if (correctWM == null) { correctWM = new Insets(0,0,0,0); @@ -1556,7 +1556,7 @@ final class XWM } case XWM.OTHER_WM: default: { /* this is very similar to the E! case above */ - insLog.log(Level.FINEST, "Getting correct insets for OTHER_WM/default, parent: {0}", parent); + insLog.finest("Getting correct insets for OTHER_WM/default, parent: {0}", parent); syncTopLevelPos(parent, lwinAttr); int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), window, lwinAttr.pData); @@ -1583,8 +1583,8 @@ final class XWM && lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width() && lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height()) { - insLog.log(Level.FINEST, "Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}", - new Object[] {lwinAttr, pattr, parent, window}); + insLog.finest("Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}", + lwinAttr, pattr, parent, window); lwinAttr.set_x(pattr.get_x()); lwinAttr.set_y(pattr.get_y()); lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width()); @@ -1611,8 +1611,8 @@ final class XWM * widths and inner/outer distinction, so for the time * being, just ignore it. */ - insLog.log(Level.FINEST, "Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", - new Object[] {lwinAttr, pattr, parent, window}); + insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", + lwinAttr, pattr, parent, window); correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(), lwinAttr.get_x() + lwinAttr.get_border_width(), pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()), diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java index f1c3c675b6c..8c44c328082 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java @@ -35,8 +35,7 @@ import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.awt.*; @@ -46,11 +45,11 @@ import sun.java2d.SunGraphics2D; import sun.java2d.SurfaceData; public class XWindow extends XBaseWindow implements X11ComponentPeer { - private static Logger log = Logger.getLogger("sun.awt.X11.XWindow"); - private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XWindow"); - private static Logger eventLog = Logger.getLogger("sun.awt.X11.event.XWindow"); - private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XWindow"); - private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XWindow"); + private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWindow"); + private static PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XWindow"); + private static PlatformLogger eventLog = PlatformLogger.getLogger("sun.awt.X11.event.XWindow"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XWindow"); + private static PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.kye.XWindow"); /* If a motion comes in while a multi-click is pending, * allow a smudge factor so that moving the mouse by a small * amount does not wipe out the multi-click state variables. @@ -414,7 +413,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ((Component)e.getSource()).dispatchEvent(e); } }, PeerEvent.ULTIMATE_PRIORITY_EVENT); - if (focusLog.isLoggable(Level.FINER) && (e instanceof FocusEvent)) focusLog.finer("Sending " + e); + if (focusLog.isLoggable(PlatformLogger.FINER) && (e instanceof FocusEvent)) focusLog.finer("Sending " + e); XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), pe); } @@ -670,7 +669,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { if (isEventDisabled(xev)) { return; } - if (eventLog.isLoggable(Level.FINE)) eventLog.fine(xbe.toString()); + if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(xbe.toString()); long when; int modifiers; boolean popupTrigger = false; @@ -704,7 +703,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { /* multiclick checking */ - if (eventLog.isLoggable(Level.FINEST)) eventLog.finest("lastWindow = " + lastWindow + ", lastButton " + if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest("lastWindow = " + lastWindow + ", lastButton " + lastButton + ", lastTime " + lastTime + ", multiClickTime " + XToolkit.getMultiClickTime()); if (lastWindow == this && lastButton == lbutton && (when - lastTime) < XToolkit.getMultiClickTime()) { @@ -895,7 +894,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { super.handleXCrossingEvent(xev); XCrossingEvent xce = xev.get_xcrossing(); - if (eventLog.isLoggable(Level.FINEST)) eventLog.finest(xce.toString()); + if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest(xce.toString()); if (xce.get_type() == XConstants.EnterNotify) { enterNotify(xce.get_window()); @@ -997,8 +996,8 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { Rectangle oldBounds = getBounds(); super.handleConfigureNotifyEvent(xev); - insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}", - new Object[] {xev.get_xconfigure(), isEventDisabled(xev)}); + insLog.finer("Configure, {0}, event disabled: {1}", + xev.get_xconfigure(), isEventDisabled(xev)); if (isEventDisabled(xev)) { return; } @@ -1017,7 +1016,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { public void handleMapNotifyEvent(XEvent xev) { super.handleMapNotifyEvent(xev); - log.log(Level.FINE, "Mapped {0}", new Object[] {this}); + log.fine("Mapped {0}", this); if (isEventDisabled(xev)) { return; } @@ -1074,7 +1073,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { public void handleKeyPress(XEvent xev) { super.handleKeyPress(xev); XKeyEvent ev = xev.get_xkey(); - if (eventLog.isLoggable(Level.FINE)) eventLog.fine(ev.toString()); + if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(ev.toString()); if (isEventDisabled(xev)) { return; } @@ -1087,14 +1086,14 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { int unicodeKey = 0; keysym[0] = XConstants.NoSymbol; - if (keyEventLog.isLoggable(Level.FINE)) { + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { logIncomingKeyEvent( ev ); } if ( //TODO check if there's an active input method instance // without calling a native method. Is it necessary though? haveCurrentX11InputMethodInstance()) { if (x11inputMethodLookupString(ev.pData, keysym)) { - if (keyEventLog.isLoggable(Level.FINE)) { + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { keyEventLog.fine("--XWindow.java XIM did process event; return; dec keysym processed:"+(keysym[0])+ "; hex keysym processed:"+Long.toHexString(keysym[0]) ); @@ -1102,7 +1101,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { return; }else { unicodeKey = keysymToUnicode( keysym[0], ev.get_state() ); - if (keyEventLog.isLoggable(Level.FINE)) { + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { keyEventLog.fine("--XWindow.java XIM did NOT process event, hex keysym:"+Long.toHexString(keysym[0])+"\n"+ " unicode key:"+Integer.toHexString((int)unicodeKey)); } @@ -1112,7 +1111,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { // Produce do-it-yourself keysym and perhaps unicode character. keysym[0] = xkeycodeToKeysym(ev); unicodeKey = keysymToUnicode( keysym[0], ev.get_state() ); - if (keyEventLog.isLoggable(Level.FINE)) { + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { keyEventLog.fine("--XWindow.java XIM is absent; hex keysym:"+Long.toHexString(keysym[0])+"\n"+ " unicode key:"+Integer.toHexString((int)unicodeKey)); } @@ -1135,7 +1134,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { // is undefined, we still have a guess of what has been engraved on a keytop. int unicodeFromPrimaryKeysym = keysymToUnicode( xkeycodeToPrimaryKeysym(ev) ,0); - if (keyEventLog.isLoggable(Level.FINE)) { + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { keyEventLog.fine(">>>Fire Event:"+ (ev.get_type() == XConstants.KeyPress ? "KEY_PRESSED; " : "KEY_RELEASED; ")+ "jkeycode:decimal="+jkc.getJavaKeycode()+ @@ -1178,7 +1177,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { public void handleKeyRelease(XEvent xev) { super.handleKeyRelease(xev); XKeyEvent ev = xev.get_xkey(); - if (eventLog.isLoggable(Level.FINE)) eventLog.fine(ev.toString()); + if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(ev.toString()); if (isEventDisabled(xev)) { return; } @@ -1190,7 +1189,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { int unicodeKey = 0; keysym[0] = XConstants.NoSymbol; - if (keyEventLog.isLoggable(Level.FINE)) { + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { logIncomingKeyEvent( ev ); } // Keysym should be converted to Unicode, if possible and necessary, @@ -1201,7 +1200,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { if( jkc == null ) { jkc = new XKeysym.Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_UNDEFINED, java.awt.event.KeyEvent.KEY_LOCATION_UNKNOWN); } - if (keyEventLog.isLoggable(Level.FINE)) { + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { keyEventLog.fine(">>>Fire Event:"+ (ev.get_type() == XConstants.KeyPress ? "KEY_PRESSED; " : "KEY_RELEASED; ")+ "jkeycode:decimal="+jkc.getJavaKeycode()+ @@ -1333,10 +1332,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { void updateSizeHints(int x, int y, int width, int height) { long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition)); if (!isResizable()) { - log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this}); + log.finer("Window {0} is not resizable", this); flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize; } else { - log.log(Level.FINER, "Window {0} is resizable", new Object[] {this}); + log.finer("Window {0} is resizable", this); } setSizeHints(flags, x, y, width, height); } @@ -1344,10 +1343,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { void updateSizeHints(int x, int y) { long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition); if (!isResizable()) { - log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this}); + log.finer("Window {0} is not resizable", this); flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize; } else { - log.log(Level.FINER, "Window {0} is resizable", new Object[] {this}); + log.finer("Window {0} is resizable", this); } setSizeHints(flags, x, y, width, height); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java index b1646413b79..f87ec27c565 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java @@ -41,8 +41,7 @@ import java.util.Iterator; import java.util.Set; import java.util.Vector; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.awt.AWTAccessor; import sun.awt.ComponentAccessor; @@ -58,11 +57,11 @@ import sun.java2d.pipe.Region; class XWindowPeer extends XPanelPeer implements WindowPeer, DisplayChangedListener { - private static final Logger log = Logger.getLogger("sun.awt.X11.XWindowPeer"); - private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XWindowPeer"); - private static final Logger insLog = Logger.getLogger("sun.awt.X11.insets.XWindowPeer"); - private static final Logger grabLog = Logger.getLogger("sun.awt.X11.grab.XWindowPeer"); - private static final Logger iconLog = Logger.getLogger("sun.awt.X11.icon.XWindowPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWindowPeer"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XWindowPeer"); + private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XWindowPeer"); + private static final PlatformLogger grabLog = PlatformLogger.getLogger("sun.awt.X11.grab.XWindowPeer"); + private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XWindowPeer"); // should be synchronized on awtLock private static Set windows = new HashSet(); @@ -201,7 +200,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, Window owner = t_window.getOwner(); if (owner != null) { ownerPeer = (XWindowPeer)owner.getPeer(); - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.fine("Owner is " + owner); focusLog.fine("Owner peer is " + ownerPeer); focusLog.fine("Owner X window " + Long.toHexString(ownerPeer.getWindow())); @@ -214,7 +213,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, XToolkit.awtLock(); try { // Set WM_TRANSIENT_FOR - if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Setting transient on " + Long.toHexString(getWindow()) + if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Setting transient on " + Long.toHexString(getWindow()) + " for " + Long.toHexString(ownerWindow)); setToplevelTransientFor(this, ownerPeer, false, true); @@ -259,7 +258,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, for (Iterator i = iconImages.iterator(); i.hasNext(); ) { Image image = i.next(); if (image == null) { - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("XWindowPeer.updateIconImages: Skipping the image passed into Java because it's null."); } continue; @@ -268,7 +267,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, try { iconInfo = new XIconInfo(image); } catch (Exception e){ - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("XWindowPeer.updateIconImages: Perhaps the image passed into Java is broken. Skipping this icon."); } continue; @@ -339,9 +338,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, } } - if (iconLog.isLoggable(Level.FINEST)) { - iconLog.log(Level.FINEST, ">>> Length_ of buffer of icons data: " + totalLength + - ", maximum length: " + MAXIMUM_BUFFER_LENGTH_NET_WM_ICON); + if (iconLog.isLoggable(PlatformLogger.FINEST)) { + iconLog.finest(">>> Length_ of buffer of icons data: " + totalLength + + ", maximum length: " + MAXIMUM_BUFFER_LENGTH_NET_WM_ICON); } return result; @@ -351,10 +350,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, * Dumps each icon from the list */ static void dumpIcons(java.util.List icons) { - if (iconLog.isLoggable(Level.FINEST)) { - iconLog.log(Level.FINEST, ">>> Sizes of icon images:"); + if (iconLog.isLoggable(PlatformLogger.FINEST)) { + iconLog.finest(">>> Sizes of icon images:"); for (Iterator i = icons.iterator(); i.hasNext(); ) { - iconLog.log(Level.FINEST, " {0}", i.next()); + iconLog.finest(" {0}", i.next()); } } } @@ -631,7 +630,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, return; } - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("XWindowPeer: Check if we've been moved to a new screen since we're running in Xinerama mode"); } @@ -668,7 +667,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, } } if (newScreenNum != curScreenNum) { - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("XWindowPeer: Moved to a new screen"); } executeDisplayChangedOnEDT(newGC); @@ -743,7 +742,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // override_redirect all we can do is check whether our parent // is active. If it is - we can freely synthesize focus transfer. // Luckily, this logic is already implemented in requestWindowFocus. - if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Requesting window focus"); + if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Requesting window focus"); requestWindowFocus(time, timeProvided); } @@ -769,7 +768,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, public void handleFocusEvent(XEvent xev) { XFocusChangeEvent xfe = xev.get_xfocus(); FocusEvent fe; - focusLog.log(Level.FINE, "{0}", new Object[] {xfe}); + focusLog.fine("{0}", xfe); if (isEventDisabled(xev)) { return; } @@ -952,7 +951,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, } private void updateAlwaysOnTop() { - log.log(Level.FINE, "Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop)); + log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop)); XWM.getWM().setLayer(this, alwaysOnTop ? XLayerProtocol.LAYER_ALWAYS_ON_TOP : @@ -1388,7 +1387,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, synchronized(getStateLock()) { XDialogPeer blockerPeer = (XDialogPeer) ComponentAccessor.getPeer(d); if (blocked) { - log.log(Level.FINE, "{0} is blocked by {1}", new Object[] { this, blockerPeer}); + log.fine("{0} is blocked by {1}", this, blockerPeer); modalBlocker = d; if (isReparented() || XWM.isNonReparentingWM()) { @@ -1741,7 +1740,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, } public void xSetVisible(boolean visible) { - if (log.isLoggable(Level.FINE)) log.fine("Setting visible on " + this + " to " + visible); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting visible on " + this + " to " + visible); XToolkit.awtLock(); try { this.visible = visible; @@ -1864,9 +1863,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, public void handleXCrossingEvent(XEvent xev) { XCrossingEvent xce = xev.get_xcrossing(); - if (grabLog.isLoggable(Level.FINE)) { - grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2}", - new Object[] {xce, isGrabbed(), containsGlobal(xce.get_x_root(), xce.get_y_root())}); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.fine("{0}, when grabbed {1}, contains {2}", + xce, isGrabbed(), containsGlobal(xce.get_x_root(), xce.get_y_root())); } if (isGrabbed()) { // When window is grabbed, all events are dispatched to @@ -1877,7 +1876,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog. // (fix for 6390326) XBaseWindow target = XToolkit.windowToXWindow(xce.get_window()); - grabLog.log(Level.FINER, " - Grab event target {0}", new Object[] {target}); + grabLog.finer(" - Grab event target {0}", target); if (target != null && target != this) { target.dispatchEvent(xev); return; @@ -1888,9 +1887,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, public void handleMotionNotify(XEvent xev) { XMotionEvent xme = xev.get_xmotion(); - if (grabLog.isLoggable(Level.FINE)) { - grabLog.log(Level.FINER, "{0}, when grabbed {1}, contains {2}", - new Object[] {xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())}); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.finer("{0}, when grabbed {1}, contains {2}", + xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())); } if (isGrabbed()) { boolean dragging = false; @@ -1919,7 +1918,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, xme.set_x(localCoord.x); xme.set_y(localCoord.y); } - grabLog.log(Level.FINER, " - Grab event target {0}", new Object[] {target}); + grabLog.finer(" - Grab event target {0}", target); if (target != null) { if (target != getContentXWindow() && target != this) { target.dispatchEvent(xev); @@ -1951,9 +1950,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) { return; } - if (grabLog.isLoggable(Level.FINE)) { - grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})", - new Object[] {xbe, isGrabbed(), containsGlobal(xbe.get_x_root(), xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()}); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.fine("{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})", + xbe, isGrabbed(), containsGlobal(xbe.get_x_root(), xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()); } if (isGrabbed()) { // When window is grabbed, all events are dispatched to @@ -1962,7 +1961,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // translation) XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window()); try { - grabLog.log(Level.FINER, " - Grab event target {0} (press target {1})", new Object[] {target, pressTarget}); + grabLog.finer(" - Grab event target {0} (press target {1})", target, pressTarget); if (xbe.get_type() == XConstants.ButtonPress && xbe.get_button() == XConstants.buttons[0]) { @@ -1995,7 +1994,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // Outside this toplevel hierarchy // According to the specification of UngrabEvent, post it // when press occurs outside of the window and not on its owned windows - grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because not inside of shell", this); + grabLog.fine("Generating UngrabEvent on {0} because not inside of shell", this); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); return; } @@ -2013,18 +2012,18 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // toplevel == null - outside of // hierarchy, toplevel is Dialog - should // send ungrab (but shouldn't for Window) - grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because hierarchy ended", this); + grabLog.fine("Generating UngrabEvent on {0} because hierarchy ended", this); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); } } else { // toplevel is null - outside of hierarchy - grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because toplevel is null", this); + grabLog.fine("Generating UngrabEvent on {0} because toplevel is null", this); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); return; } } else { // target doesn't map to XAWT window - outside of hierarchy - grabLog.log(Level.FINE, "Generating UngrabEvent on because target is null {0}", this); + grabLog.fine("Generating UngrabEvent on because target is null {0}", this); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); return; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWrapperBase.java b/jdk/src/solaris/classes/sun/awt/X11/XWrapperBase.java index 4a5e852915a..50efd11c70a 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWrapperBase.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWrapperBase.java @@ -26,10 +26,10 @@ package sun.awt.X11; // This class serves as the base class for all the wrappers. -import java.util.logging.*; +import sun.util.logging.PlatformLogger; abstract class XWrapperBase { - static final Logger log = Logger.getLogger("sun.awt.X11.wrappers"); + static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.wrappers"); public String toString() { String ret = ""; diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java b/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java index 3ad8662bf70..ac369326cc5 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java +++ b/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java @@ -27,7 +27,8 @@ import java.util.*; import java.io.*; import java.nio.charset.*; import java.text.MessageFormat; -import java.util.logging.*; +import java.util.logging.Level; +import java.util.logging.Logger; public class WrapperGenerator { /* XLibParser converts Xlib.h to a Java Object that encapsulates the @@ -835,7 +836,7 @@ public class WrapperGenerator { pw.println("package "+package_name+";\n"); pw.println("import sun.misc.*;\n"); - pw.println("import java.util.logging.*;"); + pw.println("import sun.util.logging.PlatformLogger;"); String baseClass = stp.getBaseClass(); if (baseClass == null) { baseClass = defaultBaseClass; diff --git a/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h b/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h index e03e2a79c04..32ecd66c987 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h +++ b/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h @@ -67,8 +67,7 @@ tojava package sun.awt.X11; tojava import java.util.Hashtable; tojava import sun.misc.Unsafe; tojava -tojava import java.util.logging.Level; -tojava import java.util.logging.Logger; +tojava import sun.util.logging.PlatformLogger; tojava tojava public class XKeysym { tojava @@ -108,7 +107,7 @@ tojava // Another use for reverse lookup: query keyboard state, for some key tojava static Hashtable javaKeycode2KeysymHash = new Hashtable(); tojava static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize()); tojava static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize()); -tojava private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XKeysym"); +tojava private static PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.kye.XKeysym"); tojava public static char convertKeysym( long ks, int state ) { tojava tojava /* First check for Latin-1 characters (1:1 mapping) */ @@ -649,7 +648,7 @@ SOFTWARE. 0x0000 #define XK_ISO_Last_Group 0xFE0E 0x0000 #define XK_ISO_Last_Group_Lock 0xFE0F -0x0000 #define XK_ISO_Left_Tab 0xFE20 +0x0009 #define XK_ISO_Left_Tab 0xFE20 0x0000 #define XK_ISO_Move_Line_Up 0xFE21 0x0000 #define XK_ISO_Move_Line_Down 0xFE22 0x0000 #define XK_ISO_Partial_Line_Up 0xFE23 diff --git a/jdk/src/solaris/classes/sun/awt/X11FontManager.java b/jdk/src/solaris/classes/sun/awt/X11FontManager.java new file mode 100644 index 00000000000..fea46ff56c3 --- /dev/null +++ b/jdk/src/solaris/classes/sun/awt/X11FontManager.java @@ -0,0 +1,850 @@ +package sun.awt; + +import java.awt.GraphicsEnvironment; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.StreamTokenizer; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Locale; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.swing.plaf.FontUIResource; +import sun.awt.motif.MFontConfiguration; +import sun.font.CompositeFont; +import sun.font.FontManager; +import sun.font.SunFontManager; +import sun.font.FontConfigManager; +import sun.font.FcFontConfiguration; +import sun.font.FontAccess; +import sun.font.FontUtilities; +import sun.font.NativeFont; +import sun.util.logging.PlatformLogger; + +/** + * The X11 implementation of {@link FontManager}. + */ +public class X11FontManager extends SunFontManager { + + // constants identifying XLFD and font ID fields + private static final int FOUNDRY_FIELD = 1; + private static final int FAMILY_NAME_FIELD = 2; + private static final int WEIGHT_NAME_FIELD = 3; + private static final int SLANT_FIELD = 4; + private static final int SETWIDTH_NAME_FIELD = 5; + private static final int ADD_STYLE_NAME_FIELD = 6; + private static final int PIXEL_SIZE_FIELD = 7; + private static final int POINT_SIZE_FIELD = 8; + private static final int RESOLUTION_X_FIELD = 9; + private static final int RESOLUTION_Y_FIELD = 10; + private static final int SPACING_FIELD = 11; + private static final int AVERAGE_WIDTH_FIELD = 12; + private static final int CHARSET_REGISTRY_FIELD = 13; + private static final int CHARSET_ENCODING_FIELD = 14; + + /* + * fontNameMap is a map from a fontID (which is a substring of an XLFD like + * "-monotype-arial-bold-r-normal-iso8859-7") + * to font file path like + * /usr/openwin/lib/locale/iso_8859_7/X11/fonts/TrueType/ArialBoldItalic.ttf + * It's used in a couple of methods like + * getFileNameFomPlatformName(..) to help locate the font file. + * We use this substring of a full XLFD because the font configuration files + * define the XLFDs in a way that's easier to make into a request. + * E.g., the -0-0-0-0-p-0- reported by X is -*-%d-*-*-p-*- in the font + * configuration files. We need to remove that part for comparisons. + */ + private static Map fontNameMap = new HashMap(); + + /* + * xlfdMap is a map from a platform path like + * /usr/openwin/lib/locale/ja/X11/fonts/TT/HG-GothicB.ttf to an XLFD like + * "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0" + * Because there may be multiple native names, because the font is used + * to support multiple X encodings for example, the value of an entry in + * this map is always a vector where we store all the native names. + * For fonts which we don't understand the key isn't a pathname, its + * the full XLFD string like :- + * "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0" + */ + private static Map xlfdMap = new HashMap(); + + /* xFontDirsMap is also a map from a font ID to a font filepath. + * The difference from fontNameMap is just that it does not have + * resolved symbolic links. Normally this is not interesting except + * that we need to know the directory in which a font was found to + * add it to the X font server path, since although the files may + * be linked, the fonts.dir is different and specific to the encoding + * handled by that directory. This map is nulled out after use to free + * heap space. If the optimal path is taken, such that all fonts in + * font configuration files are referenced by filename, then the font + * dir can be directly derived as its parent directory. + * If a font is used by two XLFDs, each corresponding to a different + * X11 font directory, then precautions must be taken to include both + * directories. + */ + private static Map xFontDirsMap; + + /* + * This is the set of font directories needed to be on the X font path + * to enable AWT heavyweights to find all of the font configuration fonts. + * It is populated by : + * - awtfontpath entries in the fontconfig.properties + * - parent directories of "core" fonts used in the fontconfig.properties + * - looking up font dirs in the xFontDirsMap where the key is a fontID + * (cut down version of the XLFD read from the font configuration file). + * This set is nulled out after use to free heap space. + */ + private static HashSet fontConfigDirs = null; + + /* These maps are used on Linux where we reference the Lucida oblique + * fonts in fontconfig files even though they aren't in the standard + * font directory. This explicitly remaps the XLFDs for these to the + * correct base font. This is needed to prevent composite fonts from + * defaulting to the Lucida Sans which is a bad substitute for the + * monospaced Lucida Sans Typewriter. Also these maps prevent the + * JRE from doing wasted work at start up. + */ + HashMap oblmap = null; + + + /* + * Used to eliminate redundant work. When a font directory is + * registered it added to this list. Subsequent registrations for the + * same directory can then be skipped by checking this Map. + * Access to this map is not synchronised here since creation + * of the singleton GE instance is already synchronised and that is + * the only code path that accesses this map. + */ + private static HashMap registeredDirs = new HashMap(); + + /* Array of directories to be added to the X11 font path. + * Used by static method called from Toolkits which use X11 fonts. + * Specifically this means MToolkit + */ + private static String[] fontdirs = null; + + private static String[] defaultPlatformFont = null; + + private FontConfigManager fcManager = null; + + public static X11FontManager getInstance() { + return (X11FontManager) SunFontManager.getInstance(); + } + + /** + * Takes family name property in the following format: + * "-linotype-helvetica-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1" + * and returns the name of the corresponding physical font. + * This code is used to resolve font configuration fonts, and expects + * only to get called for these fonts. + */ + @Override + public String getFileNameFromPlatformName(String platName) { + + /* If the FontConfig file doesn't use xlfds, or its + * FcFontConfiguration, this may be already a file name. + */ + if (platName.startsWith("/")) { + return platName; + } + + String fileName = null; + String fontID = specificFontIDForName(platName); + + /* If the font filename has been explicitly assigned in the + * font configuration file, use it. This avoids accessing + * the wrong fonts on Linux, where different fonts (some + * of which may not be usable by 2D) may share the same + * specific font ID. It may also speed up the lookup. + */ + fileName = super.getFileNameFromPlatformName(platName); + if (fileName != null) { + if (isHeadless() && fileName.startsWith("-")) { + /* if it's headless, no xlfd should be used */ + return null; + } + if (fileName.startsWith("/")) { + /* If a path is assigned in the font configuration file, + * it is required that the config file also specify using the + * new awtfontpath key the X11 font directories + * which must be added to the X11 font path to support + * AWT access to that font. For that reason we no longer + * have code here to add the parent directory to the list + * of font config dirs, since the parent directory may not + * be sufficient if fonts are symbolically linked to a + * different directory. + * + * Add this XLFD (platform name) to the list of known + * ones for this file. + */ + Vector xVal = (Vector) xlfdMap.get(fileName); + if (xVal == null) { + /* Try to be robust on Linux distros which move fonts + * around by verifying that the fileName represents a + * file that exists. If it doesn't, set it to null + * to trigger a search. + */ + if (getFontConfiguration().needToSearchForFile(fileName)) { + fileName = null; + } + if (fileName != null) { + xVal = new Vector(); + xVal.add(platName); + xlfdMap.put(fileName, xVal); + } + } else { + if (!xVal.contains(platName)) { + xVal.add(platName); + } + } + } + if (fileName != null) { + fontNameMap.put(fontID, fileName); + return fileName; + } + } + + if (fontID != null) { + fileName = (String)fontNameMap.get(fontID); + /* On Linux check for the Lucida Oblique fonts */ + if (fileName == null && FontUtilities.isLinux && !isOpenJDK()) { + if (oblmap == null) { + initObliqueLucidaFontMap(); + } + String oblkey = getObliqueLucidaFontID(fontID); + if (oblkey != null) { + fileName = oblmap.get(oblkey); + } + } + if (fontPath == null && + (fileName == null || !fileName.startsWith("/"))) { + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .warning("** Registering all font paths because " + + "can't find file for " + platName); + } + fontPath = getPlatformFontPath(noType1Font); + registerFontDirs(fontPath); + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .warning("** Finished registering all font paths"); + } + fileName = (String)fontNameMap.get(fontID); + } + if (fileName == null && !isHeadless()) { + /* Query X11 directly to see if this font is available + * as a native font. + */ + fileName = getX11FontName(platName); + } + if (fileName == null) { + fontID = switchFontIDForName(platName); + fileName = (String)fontNameMap.get(fontID); + } + if (fileName != null) { + fontNameMap.put(fontID, fileName); + } + } + return fileName; + } + + @Override + protected String[] getNativeNames(String fontFileName, + String platformName) { + Vector nativeNames; + if ((nativeNames=(Vector)xlfdMap.get(fontFileName))==null) { + if (platformName == null) { + return null; + } else { + /* back-stop so that at least the name used in the + * font configuration file is known as a native name + */ + String []natNames = new String[1]; + natNames[0] = platformName; + return natNames; + } + } else { + int len = nativeNames.size(); + return (String[])nativeNames.toArray(new String[len]); + } + } + + /* NOTE: this method needs to be executed in a privileged context. + * The superclass constructor which is the primary caller of + * this method executes entirely in such a context. Additionally + * the loadFonts() method does too. So all should be well. + + */ + @Override + protected void registerFontDir(String path) { + /* fonts.dir file format looks like :- + * 47 + * Arial.ttf -monotype-arial-regular-r-normal--0-0-0-0-p-0-iso8859-1 + * Arial-Bold.ttf -monotype-arial-bold-r-normal--0-0-0-0-p-0-iso8859-1 + * ... + */ + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger().info("ParseFontDir " + path); + } + File fontsDotDir = new File(path + File.separator + "fonts.dir"); + FileReader fr = null; + try { + if (fontsDotDir.canRead()) { + fr = new FileReader(fontsDotDir); + BufferedReader br = new BufferedReader(fr, 8192); + StreamTokenizer st = new StreamTokenizer(br); + st.eolIsSignificant(true); + int ttype = st.nextToken(); + if (ttype == StreamTokenizer.TT_NUMBER) { + int numEntries = (int)st.nval; + ttype = st.nextToken(); + if (ttype == StreamTokenizer.TT_EOL) { + st.resetSyntax(); + st.wordChars(32, 127); + st.wordChars(128 + 32, 255); + st.whitespaceChars(0, 31); + + for (int i=0; i < numEntries; i++) { + ttype = st.nextToken(); + if (ttype == StreamTokenizer.TT_EOF) { + break; + } + if (ttype != StreamTokenizer.TT_WORD) { + break; + } + int breakPos = st.sval.indexOf(' '); + if (breakPos <= 0) { + /* On TurboLinux 8.0 a fonts.dir file had + * a line with integer value "24" which + * appeared to be the number of remaining + * entries in the file. This didn't add to + * the value on the first line of the file. + * Seemed like XFree86 didn't like this line + * much either. It failed to parse the file. + * Ignore lines like this completely, and + * don't let them count as an entry. + */ + numEntries++; + ttype = st.nextToken(); + if (ttype != StreamTokenizer.TT_EOL) { + break; + } + + continue; + } + if (st.sval.charAt(0) == '!') { + /* TurboLinux 8.0 comment line: ignore. + * can't use st.commentChar('!') to just + * skip because this line mustn't count + * against numEntries. + */ + numEntries++; + ttype = st.nextToken(); + if (ttype != StreamTokenizer.TT_EOL) { + break; + } + continue; + } + String fileName = st.sval.substring(0, breakPos); + /* TurboLinux 8.0 uses some additional syntax to + * indicate algorithmic styling values. + * Ignore ':' separated files at the beginning + * of the fileName + */ + int lastColon = fileName.lastIndexOf(':'); + if (lastColon > 0) { + if (lastColon+1 >= fileName.length()) { + continue; + } + fileName = fileName.substring(lastColon+1); + } + String fontPart = st.sval.substring(breakPos+1); + String fontID = specificFontIDForName(fontPart); + String sVal = (String) fontNameMap.get(fontID); + + if (FontUtilities.debugFonts()) { + PlatformLogger logger = FontUtilities.getLogger(); + logger.info("file=" + fileName + + " xlfd=" + fontPart); + logger.info("fontID=" + fontID + + " sVal=" + sVal); + } + String fullPath = null; + try { + File file = new File(path,fileName); + /* we may have a resolved symbolic link + * this becomes important for an xlfd we + * still need to know the location it was + * found to update the X server font path + * for use by AWT heavyweights - and when 2D + * wants to use the native rasteriser. + */ + if (xFontDirsMap == null) { + xFontDirsMap = new HashMap(); + } + xFontDirsMap.put(fontID, path); + fullPath = file.getCanonicalPath(); + } catch (IOException e) { + fullPath = path + File.separator + fileName; + } + Vector xVal = (Vector) xlfdMap.get(fullPath); + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .info("fullPath=" + fullPath + + " xVal=" + xVal); + } + if ((xVal == null || !xVal.contains(fontPart)) && + (sVal == null) || !sVal.startsWith("/")) { + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .info("Map fontID:"+fontID + + "to file:" + fullPath); + } + fontNameMap.put(fontID, fullPath); + if (xVal == null) { + xVal = new Vector(); + xlfdMap.put (fullPath, xVal); + } + xVal.add(fontPart); + } + + ttype = st.nextToken(); + if (ttype != StreamTokenizer.TT_EOL) { + break; + } + } + } + } + fr.close(); + } + } catch (IOException ioe1) { + } finally { + if (fr != null) { + try { + fr.close(); + } catch (IOException ioe2) { + } + } + } + } + + @Override + public void loadFonts() { + super.loadFonts(); + /* These maps are greatly expanded during a loadFonts but + * can be reset to their initial state afterwards. + * Since preferLocaleFonts() and preferProportionalFonts() will + * trigger a partial repopulating from the FontConfiguration + * it has to be the inital (empty) state for the latter two, not + * simply nulling out. + * xFontDirsMap is a special case in that the implementation + * will typically not ever need to initialise it so it can be null. + */ + xFontDirsMap = null; + xlfdMap = new HashMap(1); + fontNameMap = new HashMap(1); + } + + private String getObliqueLucidaFontID(String fontID) { + if (fontID.startsWith("-lucidasans-medium-i-normal") || + fontID.startsWith("-lucidasans-bold-i-normal") || + fontID.startsWith("-lucidatypewriter-medium-i-normal") || + fontID.startsWith("-lucidatypewriter-bold-i-normal")) { + return fontID.substring(0, fontID.indexOf("-i-")); + } else { + return null; + } + } + + private static String getX11FontName(String platName) { + String xlfd = platName.replaceAll("%d", "*"); + if (NativeFont.fontExists(xlfd)) { + return xlfd; + } else { + return null; + } + } + + private void initObliqueLucidaFontMap() { + oblmap = new HashMap(); + oblmap.put("-lucidasans-medium", + jreLibDirName+"/fonts/LucidaSansRegular.ttf"); + oblmap.put("-lucidasans-bold", + jreLibDirName+"/fonts/LucidaSansDemiBold.ttf"); + oblmap.put("-lucidatypewriter-medium", + jreLibDirName+"/fonts/LucidaTypewriterRegular.ttf"); + oblmap.put("-lucidatypewriter-bold", + jreLibDirName+"/fonts/LucidaTypewriterBold.ttf"); + } + + private boolean isHeadless() { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + return GraphicsEnvironment.isHeadless(); + } + + private String specificFontIDForName(String name) { + + int[] hPos = new int[14]; + int hyphenCnt = 1; + int pos = 1; + + while (pos != -1 && hyphenCnt < 14) { + pos = name.indexOf('-', pos); + if (pos != -1) { + hPos[hyphenCnt++] = pos; + pos++; + } + } + + if (hyphenCnt != 14) { + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .severe("Font Configuration Font ID is malformed:" + name); + } + return name; // what else can we do? + } + + StringBuffer sb = + new StringBuffer(name.substring(hPos[FAMILY_NAME_FIELD-1], + hPos[SETWIDTH_NAME_FIELD])); + sb.append(name.substring(hPos[CHARSET_REGISTRY_FIELD-1])); + String retval = sb.toString().toLowerCase (Locale.ENGLISH); + return retval; + } + + private String switchFontIDForName(String name) { + + int[] hPos = new int[14]; + int hyphenCnt = 1; + int pos = 1; + + while (pos != -1 && hyphenCnt < 14) { + pos = name.indexOf('-', pos); + if (pos != -1) { + hPos[hyphenCnt++] = pos; + pos++; + } + } + + if (hyphenCnt != 14) { + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .severe("Font Configuration Font ID is malformed:" + name); + } + return name; // what else can we do? + } + + String slant = name.substring(hPos[SLANT_FIELD-1]+1, + hPos[SLANT_FIELD]); + String family = name.substring(hPos[FAMILY_NAME_FIELD-1]+1, + hPos[FAMILY_NAME_FIELD]); + String registry = name.substring(hPos[CHARSET_REGISTRY_FIELD-1]+1, + hPos[CHARSET_REGISTRY_FIELD]); + String encoding = name.substring(hPos[CHARSET_ENCODING_FIELD-1]+1); + + if (slant.equals("i")) { + slant = "o"; + } else if (slant.equals("o")) { + slant = "i"; + } + // workaround for #4471000 + if (family.equals("itc zapfdingbats") + && registry.equals("sun") + && encoding.equals("fontspecific")){ + registry = "adobe"; + } + StringBuffer sb = + new StringBuffer(name.substring(hPos[FAMILY_NAME_FIELD-1], + hPos[SLANT_FIELD-1]+1)); + sb.append(slant); + sb.append(name.substring(hPos[SLANT_FIELD], + hPos[SETWIDTH_NAME_FIELD]+1)); + sb.append(registry); + sb.append(name.substring(hPos[CHARSET_ENCODING_FIELD-1])); + String retval = sb.toString().toLowerCase (Locale.ENGLISH); + return retval; + } + + /** + * Returns the face name for the given XLFD. + */ + public String getFileNameFromXLFD(String name) { + String fileName = null; + String fontID = specificFontIDForName(name); + if (fontID != null) { + fileName = (String)fontNameMap.get(fontID); + if (fileName == null) { + fontID = switchFontIDForName(name); + fileName = (String)fontNameMap.get(fontID); + } + if (fileName == null) { + fileName = getDefaultFontFile(); + } + } + return fileName; + } + + /* Register just the paths, (it doesn't register the fonts). + * If a font configuration file has specified a baseFontPath + * fontPath is just those directories, unless on usage we + * find it doesn't contain what we need for the logical fonts. + * Otherwise, we register all the paths on Solaris, because + * the fontPath we have here is the complete one from + * parsing /var/sadm/install/contents, not just + * what's on the X font path (may be this should be + * changed). + * But for now what it means is that if we didn't do + * this then if the font weren't listed anywhere on the + * less complete font path we'd trigger loadFonts which + * actually registers the fonts. This may actually be + * the right thing tho' since that would also set up + * the X font path without which we wouldn't be able to + * display some "native" fonts. + * So something to revisit is that probably fontPath + * here ought to be only the X font path + jre font dir. + * loadFonts should have a separate native call to + * get the rest of the platform font path. + * + * Registering the directories can now be avoided in the + * font configuration initialisation when filename entries + * exist in the font configuration file for all fonts. + * (Perhaps a little confusingly a filename entry is + * actually keyed using the XLFD used in the font entries, + * and it maps *to* a real filename). + * In the event any are missing, registration of all + * directories will be invoked to find the real files. + * + * But registering the directory performed other + * functions such as filling in the map of all native names + * for the font. So when this method isn't invoked, they still + * must be found. This is mitigated by getNativeNames now + * being able to return at least the platform name, but mostly + * by ensuring that when a filename key is found, that + * xlfd key is stored as one of the set of platform names + * for the font. Its a set because typical font configuration + * files reference the same CJK font files using multiple + * X11 encodings. For the code that adds this to the map + * see X11GE.getFileNameFromPlatformName(..) + * If you don't get all of these then some code points may + * not use the Xserver, and will not get the PCF bitmaps + * that are available for some point sizes. + * So, in the event that there is such a problem, + * unconditionally making this call may be necessary, at + * some cost to JRE start-up + */ + @Override + protected void registerFontDirs(String pathName) { + + StringTokenizer parser = new StringTokenizer(pathName, + File.pathSeparator); + try { + while (parser.hasMoreTokens()) { + String dirPath = parser.nextToken(); + if (dirPath != null && !registeredDirs.containsKey(dirPath)) { + registeredDirs.put(dirPath, null); + registerFontDir(dirPath); + } + } + } catch (NoSuchElementException e) { + } + } + + // An X font spec (xlfd) includes an encoding. The same TrueType font file + // may be referenced from different X font directories in font.dir files + // to support use in multiple encodings by X apps. + // So for the purposes of font configuration logical fonts where AWT + // heavyweights need to access the font via X APIs we need to ensure that + // the directory for precisely the encodings needed by this are added to + // the x font path. This requires that we note the platform names + // specified in font configuration files and use that to identify the + // X font directory that contains a font.dir file for that platform name + // and add it to the X font path (if display is local) + // Here we make use of an already built map of xlfds to font locations + // to add the font location to the set of those required to build the + // x font path needed by AWT. + // These are added to the x font path later. + // All this is necessary because on Solaris the font.dir directories + // may contain not real font files, but symbolic links to the actual + // location but that location is not suitable for the x font path, since + // it probably doesn't have a font.dir at all and certainly not one + // with the required encodings + // If the fontconfiguration file is properly set up so that all fonts + // are mapped to files then we will never trigger initialising + // xFontDirsMap (it will be null). In this case the awtfontpath entries + // must specify all the X11 directories needed by AWT. + @Override + protected void addFontToPlatformFontPath(String platformName) { + // Lazily initialize fontConfigDirs. + getPlatformFontPathFromFontConfig(); + if (xFontDirsMap != null) { + String fontID = specificFontIDForName(platformName); + String dirName = (String)xFontDirsMap.get(fontID); + if (dirName != null) { + fontConfigDirs.add(dirName); + } + } + return; + } + + private void getPlatformFontPathFromFontConfig() { + if (fontConfigDirs == null) { + fontConfigDirs = getFontConfiguration().getAWTFontPathSet(); + if (FontUtilities.debugFonts() && fontConfigDirs != null) { + String[] names = fontConfigDirs.toArray(new String[0]); + for (int i=0;i 0 && + fontConfigFonts[0].firstFont.fontFile != null) { + info[0] = fontConfigFonts[0].firstFont.familyName; + info[1] = fontConfigFonts[0].firstFont.fontFile; + } else { + info[0] = "Dialog"; + info[1] = "/dialog.ttf"; + } + } + defaultPlatformFont = info; + return defaultPlatformFont; + } + + public synchronized FontConfigManager getFontConfigManager() { + + if (fcManager == null) { + fcManager = new FontConfigManager(); + } + + return fcManager; + } + + @Override + protected FontUIResource getFontConfigFUIR(String family, int style, int size) { + + CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style); + + if (font2D == null) { // Not expected, just a precaution. + return new FontUIResource(family, style, size); + } + + /* The name of the font will be that of the physical font in slot, + * but by setting the handle to that of the CompositeFont it + * renders as that CompositeFont. + * It also needs to be marked as a created font which is the + * current mechanism to signal that deriveFont etc must copy + * the handle from the original font. + */ + FontUIResource fuir = + new FontUIResource(font2D.getFamilyName(null), style, size); + FontAccess.getFontAccess().setFont2D(fuir, font2D.handle); + FontAccess.getFontAccess().setCreatedFont(fuir); + return fuir; + } +} diff --git a/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java b/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java index 47ca64f1daa..6ea0756dd5e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java +++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java @@ -41,7 +41,6 @@ import java.net.SocketException; import java.net.UnknownHostException; import java.util.*; -import java.util.logging.*; import sun.awt.motif.MFontConfiguration; import sun.font.FcFontConfiguration; @@ -51,6 +50,7 @@ import sun.font.NativeFont; import sun.java2d.SunGraphicsEnvironment; import sun.java2d.SurfaceManagerFactory; import sun.java2d.UnixSurfaceManagerFactory; +import sun.util.logging.PlatformLogger; /** * This is an implementation of a GraphicsEnvironment object for the @@ -63,82 +63,11 @@ import sun.java2d.UnixSurfaceManagerFactory; public class X11GraphicsEnvironment extends SunGraphicsEnvironment { - private static final Logger log = Logger.getLogger("sun.awt.X11GraphicsEnvironment"); - private static final Logger screenLog = Logger.getLogger("sun.awt.screen.X11GraphicsEnvironment"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11GraphicsEnvironment"); + private static final PlatformLogger screenLog = PlatformLogger.getLogger("sun.awt.screen.X11GraphicsEnvironment"); private static Boolean xinerState; - /* - * This is the set of font directories needed to be on the X font path - * to enable AWT heavyweights to find all of the font configuration fonts. - * It is populated by : - * - awtfontpath entries in the fontconfig.properties - * - parent directories of "core" fonts used in the fontconfig.properties - * - looking up font dirs in the xFontDirsMap where the key is a fontID - * (cut down version of the XLFD read from the font configuration file). - * This set is nulled out after use to free heap space. - */ - private static HashSet fontConfigDirs = null; - - /* - * fontNameMap is a map from a fontID (which is a substring of an XLFD like - * "-monotype-arial-bold-r-normal-iso8859-7") - * to font file path like - * /usr/openwin/lib/locale/iso_8859_7/X11/fonts/TrueType/ArialBoldItalic.ttf - * It's used in a couple of methods like - * getFileNameFomPlatformName(..) to help locate the font file. - * We use this substring of a full XLFD because the font configuration files - * define the XLFDs in a way that's easier to make into a request. - * E.g., the -0-0-0-0-p-0- reported by X is -*-%d-*-*-p-*- in the font - * configuration files. We need to remove that part for comparisons. - */ - private static Map fontNameMap = new HashMap(); - - /* xFontDirsMap is also a map from a font ID to a font filepath. - * The difference from fontNameMap is just that it does not have - * resolved symbolic links. Normally this is not interesting except - * that we need to know the directory in which a font was found to - * add it to the X font server path, since although the files may - * be linked, the fonts.dir is different and specific to the encoding - * handled by that directory. This map is nulled out after use to free - * heap space. If the optimal path is taken, such that all fonts in - * font configuration files are referenced by filename, then the font - * dir can be directly derived as its parent directory. - * If a font is used by two XLFDs, each corresponding to a different - * X11 font directory, then precautions must be taken to include both - * directories. - */ - private static Map xFontDirsMap; - - /* - * xlfdMap is a map from a platform path like - * /usr/openwin/lib/locale/ja/X11/fonts/TT/HG-GothicB.ttf to an XLFD like - * "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0" - * Because there may be multiple native names, because the font is used - * to support multiple X encodings for example, the value of an entry in - * this map is always a vector where we store all the native names. - * For fonts which we don't understand the key isn't a pathname, its - * the full XLFD string like :- - * "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0" - */ - private static Map xlfdMap = new HashMap(); - - /* - * Used to eliminate redundant work. When a font directory is - * registered it added to this list. Subsequent registrations for the - * same directory can then be skipped by checking this Map. - * Access to this map is not synchronised here since creation - * of the singleton GE instance is already synchronised and that is - * the only code path that accesses this map. - */ - private static HashMap registeredDirs = new HashMap(); - - /* Array of directories to be added to the X11 font path. - * Used by static method called from Toolkits which use X11 fonts. - * Specifically this means MToolkit - */ - private static String[] fontdirs = null; - static { java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { @@ -234,7 +163,6 @@ public class X11GraphicsEnvironment return getScreenDevices()[getDefaultScreenNum()]; } - @Override public boolean isDisplayLocal() { if (isDisplayLocal == null) { SunToolkit.awtLock(); @@ -311,657 +239,7 @@ public class X11GraphicsEnvironment return result.booleanValue(); } - /* These maps are used on Linux where we reference the Lucida oblique - * fonts in fontconfig files even though they aren't in the standard - * font directory. This explicitly remaps the XLFDs for these to the - * correct base font. This is needed to prevent composite fonts from - * defaulting to the Lucida Sans which is a bad substitute for the - * monospaced Lucida Sans Typewriter. Also these maps prevent the - * JRE from doing wasted work at start up. - */ - HashMap oblmap = null; - private String getObliqueLucidaFontID(String fontID) { - if (fontID.startsWith("-lucidasans-medium-i-normal") || - fontID.startsWith("-lucidasans-bold-i-normal") || - fontID.startsWith("-lucidatypewriter-medium-i-normal") || - fontID.startsWith("-lucidatypewriter-bold-i-normal")) { - return fontID.substring(0, fontID.indexOf("-i-")); - } else { - return null; - } - } - - private void initObliqueLucidaFontMap() { - oblmap = new HashMap(); - oblmap.put("-lucidasans-medium", - jreLibDirName+"/fonts/LucidaSansRegular.ttf"); - oblmap.put("-lucidasans-bold", - jreLibDirName+"/fonts/LucidaSansDemiBold.ttf"); - oblmap.put("-lucidatypewriter-medium", - jreLibDirName+"/fonts/LucidaTypewriterRegular.ttf"); - oblmap.put("-lucidatypewriter-bold", - jreLibDirName+"/fonts/LucidaTypewriterBold.ttf"); - } - - /** - * Takes family name property in the following format: - * "-linotype-helvetica-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1" - * and returns the name of the corresponding physical font. - * This code is used to resolve font configuration fonts, and expects - * only to get called for these fonts. - */ - public String getFileNameFromPlatformName(String platName) { - - /* If the FontConfig file doesn't use xlfds, or its - * FcFontConfiguration, this may be already a file name. - */ - if (platName.startsWith("/")) { - return platName; - } - - String fileName = null; - String fontID = specificFontIDForName(platName); - - /* If the font filename has been explicitly assigned in the - * font configuration file, use it. This avoids accessing - * the wrong fonts on Linux, where different fonts (some - * of which may not be usable by 2D) may share the same - * specific font ID. It may also speed up the lookup. - */ - fileName = super.getFileNameFromPlatformName(platName); - if (fileName != null) { - if (isHeadless() && fileName.startsWith("-")) { - /* if it's headless, no xlfd should be used */ - return null; - } - if (fileName.startsWith("/")) { - /* If a path is assigned in the font configuration file, - * it is required that the config file also specify using the - * new awtfontpath key the X11 font directories - * which must be added to the X11 font path to support - * AWT access to that font. For that reason we no longer - * have code here to add the parent directory to the list - * of font config dirs, since the parent directory may not - * be sufficient if fonts are symbolically linked to a - * different directory. - * - * Add this XLFD (platform name) to the list of known - * ones for this file. - */ - Vector xVal = (Vector) xlfdMap.get(fileName); - if (xVal == null) { - /* Try to be robust on Linux distros which move fonts - * around by verifying that the fileName represents a - * file that exists. If it doesn't, set it to null - * to trigger a search. - */ - if (getFontConfiguration().needToSearchForFile(fileName)) { - fileName = null; - } - if (fileName != null) { - xVal = new Vector(); - xVal.add(platName); - xlfdMap.put(fileName, xVal); - } - } else { - if (!xVal.contains(platName)) { - xVal.add(platName); - } - } - } - if (fileName != null) { - fontNameMap.put(fontID, fileName); - return fileName; - } - } - - if (fontID != null) { - fileName = (String)fontNameMap.get(fontID); - /* On Linux check for the Lucida Oblique fonts */ - if (fileName == null && isLinux && !isOpenJDK()) { - if (oblmap == null) { - initObliqueLucidaFontMap(); - } - String oblkey = getObliqueLucidaFontID(fontID); - if (oblkey != null) { - fileName = oblmap.get(oblkey); - } - } - if (fontPath == null && - (fileName == null || !fileName.startsWith("/"))) { - if (debugFonts) { - logger.warning("** Registering all font paths because " + - "can't find file for " + platName); - } - fontPath = getPlatformFontPath(noType1Font); - registerFontDirs(fontPath); - if (debugFonts) { - logger.warning("** Finished registering all font paths"); - } - fileName = (String)fontNameMap.get(fontID); - } - if (fileName == null && !isHeadless()) { - /* Query X11 directly to see if this font is available - * as a native font. - */ - fileName = getX11FontName(platName); - } - if (fileName == null) { - fontID = switchFontIDForName(platName); - fileName = (String)fontNameMap.get(fontID); - } - if (fileName != null) { - fontNameMap.put(fontID, fileName); - } - } - return fileName; - } - - private static String getX11FontName(String platName) { - String xlfd = platName.replaceAll("%d", "*"); - if (NativeFont.fontExists(xlfd)) { - return xlfd; - } else { - return null; - } - } - - /** - * Returns the face name for the given XLFD. - */ - public String getFileNameFromXLFD(String name) { - String fileName = null; - String fontID = specificFontIDForName(name); - if (fontID != null) { - fileName = (String)fontNameMap.get(fontID); - if (fileName == null) { - fontID = switchFontIDForName(name); - fileName = (String)fontNameMap.get(fontID); - } - if (fileName == null) { - fileName = getDefaultFontFile(); - } - } - return fileName; - } - - // constants identifying XLFD and font ID fields - private static final int FOUNDRY_FIELD = 1; - private static final int FAMILY_NAME_FIELD = 2; - private static final int WEIGHT_NAME_FIELD = 3; - private static final int SLANT_FIELD = 4; - private static final int SETWIDTH_NAME_FIELD = 5; - private static final int ADD_STYLE_NAME_FIELD = 6; - private static final int PIXEL_SIZE_FIELD = 7; - private static final int POINT_SIZE_FIELD = 8; - private static final int RESOLUTION_X_FIELD = 9; - private static final int RESOLUTION_Y_FIELD = 10; - private static final int SPACING_FIELD = 11; - private static final int AVERAGE_WIDTH_FIELD = 12; - private static final int CHARSET_REGISTRY_FIELD = 13; - private static final int CHARSET_ENCODING_FIELD = 14; - - private String switchFontIDForName(String name) { - - int[] hPos = new int[14]; - int hyphenCnt = 1; - int pos = 1; - - while (pos != -1 && hyphenCnt < 14) { - pos = name.indexOf('-', pos); - if (pos != -1) { - hPos[hyphenCnt++] = pos; - pos++; - } - } - - if (hyphenCnt != 14) { - if (debugFonts) { - logger.severe("Font Configuration Font ID is malformed:" + name); - } - return name; // what else can we do? - } - - String slant = name.substring(hPos[SLANT_FIELD-1]+1, - hPos[SLANT_FIELD]); - String family = name.substring(hPos[FAMILY_NAME_FIELD-1]+1, - hPos[FAMILY_NAME_FIELD]); - String registry = name.substring(hPos[CHARSET_REGISTRY_FIELD-1]+1, - hPos[CHARSET_REGISTRY_FIELD]); - String encoding = name.substring(hPos[CHARSET_ENCODING_FIELD-1]+1); - - if (slant.equals("i")) { - slant = "o"; - } else if (slant.equals("o")) { - slant = "i"; - } - // workaround for #4471000 - if (family.equals("itc zapfdingbats") - && registry.equals("sun") - && encoding.equals("fontspecific")){ - registry = "adobe"; - } - StringBuffer sb = - new StringBuffer(name.substring(hPos[FAMILY_NAME_FIELD-1], - hPos[SLANT_FIELD-1]+1)); - sb.append(slant); - sb.append(name.substring(hPos[SLANT_FIELD], - hPos[SETWIDTH_NAME_FIELD]+1)); - sb.append(registry); - sb.append(name.substring(hPos[CHARSET_ENCODING_FIELD-1])); - String retval = sb.toString().toLowerCase (Locale.ENGLISH); - return retval; - } - - - private String specificFontIDForName(String name) { - - int[] hPos = new int[14]; - int hyphenCnt = 1; - int pos = 1; - - while (pos != -1 && hyphenCnt < 14) { - pos = name.indexOf('-', pos); - if (pos != -1) { - hPos[hyphenCnt++] = pos; - pos++; - } - } - - if (hyphenCnt != 14) { - if (debugFonts) { - logger.severe("Font Configuration Font ID is malformed:" + name); - } - return name; // what else can we do? - } - - StringBuffer sb = - new StringBuffer(name.substring(hPos[FAMILY_NAME_FIELD-1], - hPos[SETWIDTH_NAME_FIELD])); - sb.append(name.substring(hPos[CHARSET_REGISTRY_FIELD-1])); - String retval = sb.toString().toLowerCase (Locale.ENGLISH); - return retval; - } - - protected String[] getNativeNames(String fontFileName, - String platformName) { - Vector nativeNames; - if ((nativeNames=(Vector)xlfdMap.get(fontFileName))==null) { - if (platformName == null) { - return null; - } else { - /* back-stop so that at least the name used in the - * font configuration file is known as a native name - */ - String []natNames = new String[1]; - natNames[0] = platformName; - return natNames; - } - } else { - int len = nativeNames.size(); - return (String[])nativeNames.toArray(new String[len]); - } - } - - - // An X font spec (xlfd) includes an encoding. The same TrueType font file - // may be referenced from different X font directories in font.dir files - // to support use in multiple encodings by X apps. - // So for the purposes of font configuration logical fonts where AWT - // heavyweights need to access the font via X APIs we need to ensure that - // the directory for precisely the encodings needed by this are added to - // the x font path. This requires that we note the platform names - // specified in font configuration files and use that to identify the - // X font directory that contains a font.dir file for that platform name - // and add it to the X font path (if display is local) - // Here we make use of an already built map of xlfds to font locations - // to add the font location to the set of those required to build the - // x font path needed by AWT. - // These are added to the x font path later. - // All this is necessary because on Solaris the font.dir directories - // may contain not real font files, but symbolic links to the actual - // location but that location is not suitable for the x font path, since - // it probably doesn't have a font.dir at all and certainly not one - // with the required encodings - // If the fontconfiguration file is properly set up so that all fonts - // are mapped to files then we will never trigger initialising - // xFontDirsMap (it will be null). In this case the awtfontpath entries - // must specify all the X11 directories needed by AWT. - protected void addFontToPlatformFontPath(String platformName) { - if (xFontDirsMap != null) { - String fontID = specificFontIDForName(platformName); - String dirName = (String)xFontDirsMap.get(fontID); - if (dirName != null) { - fontConfigDirs.add(dirName); - } - } - return; - } - - protected void getPlatformFontPathFromFontConfig() { - if (fontConfigDirs == null) { - fontConfigDirs = getFontConfiguration().getAWTFontPathSet(); - if (debugFonts && fontConfigDirs != null) { - String[] names = fontConfigDirs.toArray(new String[0]); - for (int i=0;i 0) { - if (lastColon+1 >= fileName.length()) { - continue; - } - fileName = fileName.substring(lastColon+1); - } - String fontPart = st.sval.substring(breakPos+1); - String fontID = specificFontIDForName(fontPart); - String sVal = (String) fontNameMap.get(fontID); - - if (debugFonts) { - logger.info("file=" + fileName + - " xlfd=" + fontPart); - logger.info("fontID=" + fontID + - " sVal=" + sVal); - } - String fullPath = null; - try { - File file = new File(path,fileName); - /* we may have a resolved symbolic link - * this becomes important for an xlfd we - * still need to know the location it was - * found to update the X server font path - * for use by AWT heavyweights - and when 2D - * wants to use the native rasteriser. - */ - if (xFontDirsMap == null) { - xFontDirsMap = new HashMap(); - } - xFontDirsMap.put(fontID, path); - fullPath = file.getCanonicalPath(); - } catch (IOException e) { - fullPath = path + File.separator + fileName; - } - Vector xVal = (Vector) xlfdMap.get(fullPath); - if (debugFonts) { - logger.info("fullPath=" + fullPath + - " xVal=" + xVal); - } - if ((xVal == null || !xVal.contains(fontPart)) && - (sVal == null) || !sVal.startsWith("/")) { - if (debugFonts) { - logger.info("Map fontID:"+fontID + - "to file:" + fullPath); - } - fontNameMap.put(fontID, fullPath); - if (xVal == null) { - xVal = new Vector(); - xlfdMap.put (fullPath, xVal); - } - xVal.add(fontPart); - } - - ttype = st.nextToken(); - if (ttype != StreamTokenizer.TT_EOL) { - break; - } - } - } - } - fr.close(); - } - } catch (IOException ioe1) { - } finally { - if (fr != null) { - try { - fr.close(); - } catch (IOException ioe2) { - } - } - } - } - - @Override - public void loadFonts() { - super.loadFonts(); - /* These maps are greatly expanded during a loadFonts but - * can be reset to their initial state afterwards. - * Since preferLocaleFonts() and preferProportionalFonts() will - * trigger a partial repopulating from the FontConfiguration - * it has to be the inital (empty) state for the latter two, not - * simply nulling out. - * xFontDirsMap is a special case in that the implementation - * will typically not ever need to initialise it so it can be null. - */ - xFontDirsMap = null; - xlfdMap = new HashMap(1); - fontNameMap = new HashMap(1); - } - - // Implements SunGraphicsEnvironment.createFontConfiguration. - protected FontConfiguration createFontConfiguration() { - - /* The logic here decides whether to use a preconfigured - * fontconfig.properties file, or synthesise one using platform APIs. - * On Solaris (as opposed to OpenSolaris) we try to use the - * pre-configured ones, but if the files it specifies are missing - * we fail-safe to synthesising one. This might happen if Solaris - * changes its fonts. - * For OpenSolaris I don't expect us to ever create fontconfig files, - * so it will always synthesise. Note that if we misidentify - * OpenSolaris as Solaris, then the test for the presence of - * Solaris-only font files will correct this. - * For Linux we require an exact match of distro and version to - * use the preconfigured file, and also that it points to - * existent fonts. - * If synthesising fails, we fall back to any preconfigured file - * and do the best we can. For the commercial JDK this will be - * fine as it includes the Lucida fonts. OpenJDK should not hit - * this as the synthesis should always work on its platforms. - */ - FontConfiguration mFontConfig = new MFontConfiguration(this); - if (isOpenSolaris || - (isLinux && - (!mFontConfig.foundOsSpecificFile() || - !mFontConfig.fontFilesArePresent()) || - (isSolaris && !mFontConfig.fontFilesArePresent()))) { - FcFontConfiguration fcFontConfig = - new FcFontConfiguration(this); - if (fcFontConfig.init()) { - return fcFontConfig; - } - } - mFontConfig.init(); - return mFontConfig; - } - public FontConfiguration - createFontConfiguration(boolean preferLocaleFonts, - boolean preferPropFonts) { - - FontConfiguration config = getFontConfiguration(); - if (config instanceof FcFontConfiguration) { - // Doesn't need to implement the alternate support. - return config; - } - - return new MFontConfiguration(this, - preferLocaleFonts, preferPropFonts); - } /** * Returns face name for default font, or null if @@ -1006,8 +284,8 @@ public class X11GraphicsEnvironment // pRunningXinerama() simply returns a global boolean variable, // so there is no need to synchronize here xinerState = Boolean.valueOf(pRunningXinerama()); - if (screenLog.isLoggable(Level.FINER)) { - screenLog.log(Level.FINER, "Running Xinerama: " + xinerState); + if (screenLog.isLoggable(PlatformLogger.FINER)) { + screenLog.finer("Running Xinerama: " + xinerState); } } return xinerState.booleanValue(); @@ -1090,24 +368,24 @@ public class X11GraphicsEnvironment (unionRect.width / 2) + unionRect.x < center.x + 1 && (unionRect.height / 2) + unionRect.y < center.y + 1) { - if (screenLog.isLoggable(Level.FINER)) { - screenLog.log(Level.FINER, "Video Wall: center point is at center of all displays."); + if (screenLog.isLoggable(PlatformLogger.FINER)) { + screenLog.finer("Video Wall: center point is at center of all displays."); } return unionRect; } // next, check if at center of one monitor if (centerMonitorRect != null) { - if (screenLog.isLoggable(Level.FINER)) { - screenLog.log(Level.FINER, "Center point at center of a particular " + - "monitor, but not of the entire virtual display."); + if (screenLog.isLoggable(PlatformLogger.FINER)) { + screenLog.finer("Center point at center of a particular " + + "monitor, but not of the entire virtual display."); } return centerMonitorRect; } // otherwise, the center is at some weird spot: return unionRect - if (screenLog.isLoggable(Level.FINER)) { - screenLog.log(Level.FINER, "Center point is somewhere strange - return union of all bounds."); + if (screenLog.isLoggable(PlatformLogger.FINER)) { + screenLog.finer("Center point is somewhere strange - return union of all bounds."); } return unionRect; } diff --git a/jdk/src/solaris/classes/sun/awt/X11InputMethod.java b/jdk/src/solaris/classes/sun/awt/X11InputMethod.java index 2ff014095e3..ca7a324e724 100644 --- a/jdk/src/solaris/classes/sun/awt/X11InputMethod.java +++ b/jdk/src/solaris/classes/sun/awt/X11InputMethod.java @@ -57,7 +57,7 @@ import java.io.File; import java.io.FileReader; import java.io.BufferedReader; import java.io.IOException; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import java.util.StringTokenizer; import java.util.regex.Pattern; @@ -68,7 +68,7 @@ import java.util.regex.Pattern; * @author JavaSoft International */ public abstract class X11InputMethod extends InputMethodAdapter { - private static final Logger log = Logger.getLogger("sun.awt.X11InputMethod"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11InputMethod"); /* * The following XIM* values must be the same as those defined in * Xlib.h @@ -324,8 +324,8 @@ public abstract class X11InputMethod extends InputMethodAdapter { return; if (lastXICFocussedComponent != null){ - if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "XICFocused {0}, AWTFocused {1}", new Object[] { - lastXICFocussedComponent, awtFocussedComponent}); + if (log.isLoggable(PlatformLogger.FINE)) log.fine("XICFocused {0}, AWTFocused {1}", + lastXICFocussedComponent, awtFocussedComponent); } if (pData == 0) { diff --git a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java index 67a7b09bb02..ab532d454e9 100644 --- a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java +++ b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java @@ -30,37 +30,42 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; +import java.nio.charset.Charset; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; -import java.util.logging.Logger; import java.util.Properties; import java.util.Scanner; import sun.awt.FontConfiguration; +import sun.awt.X11FontManager; import sun.awt.X11GraphicsEnvironment; +import sun.font.FontManager; +import sun.font.SunFontManager; +import sun.font.FontManagerFactory; +import sun.font.FontUtilities; import sun.java2d.SunGraphicsEnvironment; -import java.nio.charset.Charset; +import sun.util.logging.PlatformLogger; public class MFontConfiguration extends FontConfiguration { private static FontConfiguration fontConfig = null; - private static Logger logger; + private static PlatformLogger logger; - public MFontConfiguration(SunGraphicsEnvironment environment) { - super(environment); - if (SunGraphicsEnvironment.debugFonts) { - logger = Logger.getLogger("sun.awt.FontConfiguration"); + public MFontConfiguration(SunFontManager fm) { + super(fm); + if (FontUtilities.debugFonts()) { + logger = PlatformLogger.getLogger("sun.awt.FontConfiguration"); } initTables(); } - public MFontConfiguration(SunGraphicsEnvironment environment, + public MFontConfiguration(SunFontManager fm, boolean preferLocaleFonts, boolean preferPropFonts) { - super(environment, preferLocaleFonts, preferPropFonts); - if (SunGraphicsEnvironment.debugFonts) { - logger = Logger.getLogger("sun.awt.FontConfiguration"); + super(fm, preferLocaleFonts, preferPropFonts); + if (FontUtilities.debugFonts()) { + logger = PlatformLogger.getLogger("sun.awt.FontConfiguration"); } initTables(); } @@ -90,7 +95,7 @@ public class MFontConfiguration extends FontConfiguration { reorderMap.put("UTF-8.th", "thai"); reorderMap.put("UTF-8.zh.TW", "chinese-big5"); reorderMap.put("UTF-8.zh.HK", split("chinese-big5,chinese-hkscs")); - if (sun.font.FontManager.isSolaris8) { + if (FontUtilities.isSolaris8) { reorderMap.put("UTF-8.zh.CN", split("chinese-gb2312,chinese-big5")); } else { reorderMap.put("UTF-8.zh.CN", @@ -100,7 +105,7 @@ public class MFontConfiguration extends FontConfiguration { split("chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1")); reorderMap.put("Big5", "chinese-big5"); reorderMap.put("Big5-HKSCS", split("chinese-big5,chinese-hkscs")); - if (! sun.font.FontManager.isSolaris8 && ! sun.font.FontManager.isSolaris9) { + if (! FontUtilities.isSolaris8 && ! FontUtilities.isSolaris9) { reorderMap.put("GB2312", split("chinese-gbk,chinese-gb2312")); } else { reorderMap.put("GB2312","chinese-gb2312"); @@ -209,7 +214,7 @@ public class MFontConfiguration extends FontConfiguration { protected String mapFileName(String fileName) { if (fileName != null && fileName.startsWith(fontsDirPrefix)) { - return SunGraphicsEnvironment.jreFontDirName + return SunFontManager.jreFontDirName + fileName.substring(fontsDirPrefix.length()); } return fileName; @@ -310,7 +315,7 @@ public class MFontConfiguration extends FontConfiguration { !needToSearchForFile(fileName)) { return fileName; } - return ((X11GraphicsEnvironment) environment).getFileNameFromXLFD(componentFontName); + return ((X11FontManager) fontManager).getFileNameFromXLFD(componentFontName); } /** diff --git a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java index 8f9f6115f30..318897a4466 100644 --- a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java +++ b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java @@ -43,7 +43,6 @@ import java.security.PrivilegedExceptionAction; import java.util.Properties; import java.util.Map; import java.util.Iterator; -import java.util.logging.*; import sun.awt.AppContext; import sun.awt.AWTAutoShutdown; @@ -61,6 +60,7 @@ import java.awt.dnd.InvalidDnDOperationException; import java.awt.dnd.peer.DragSourceContextPeer; //import sun.awt.motif.MInputMethod; +import sun.awt.X11FontManager; import sun.awt.X11GraphicsConfig; import sun.awt.X11GraphicsEnvironment; import sun.awt.XSettings; @@ -73,10 +73,11 @@ import sun.misc.PerformanceLogger; import sun.misc.Unsafe; import sun.security.action.GetBooleanAction; +import sun.util.logging.PlatformLogger; public class MToolkit extends UNIXToolkit implements Runnable { - private static final Logger log = Logger.getLogger("sun.awt.motif.MToolkit"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.motif.MToolkit"); // the system clipboard - CLIPBOARD selection //X11Clipboard clipboard; @@ -124,7 +125,7 @@ public class MToolkit extends UNIXToolkit implements Runnable { * and when we know that MToolkit is the one that will be used, * since XToolkit doesn't need the X11 font path set */ - X11GraphicsEnvironment.setNativeFontPath(); + X11FontManager.getInstance().setNativeFontPath(); motifdnd = ((Boolean)java.security.AccessController.doPrivileged( new GetBooleanAction("awt.dnd.motifdnd"))).booleanValue(); @@ -616,8 +617,8 @@ public class MToolkit extends UNIXToolkit implements Runnable { protected Boolean lazilyLoadDynamicLayoutSupportedProperty(String name) { boolean nativeDynamic = isDynamicLayoutSupportedNative(); - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "nativeDynamic == " + nativeDynamic); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("nativeDynamic == " + nativeDynamic); } return Boolean.valueOf(nativeDynamic); diff --git a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java index a34fed02e15..7699a943e5b 100644 --- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java +++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java @@ -35,18 +35,19 @@ import java.net.UnknownHostException; import java.nio.charset.Charset; import java.util.HashMap; import java.util.HashSet; -import java.util.logging.Logger; import java.util.Properties; import java.util.Scanner; import sun.awt.FontConfiguration; import sun.awt.FontDescriptor; import sun.awt.SunToolkit; +import sun.awt.X11FontManager; import sun.font.CompositeFontDescriptor; import sun.font.FontManager; -import sun.font.FontManager.FontConfigInfo; -import sun.font.FontManager.FcCompFont; -import sun.font.FontManager.FontConfigFont; +import sun.font.FontConfigManager.FontConfigInfo; +import sun.font.FontConfigManager.FcCompFont; +import sun.font.FontConfigManager.FontConfigFont; import sun.java2d.SunGraphicsEnvironment; +import sun.util.logging.PlatformLogger; public class FcFontConfiguration extends FontConfiguration { @@ -68,16 +69,16 @@ public class FcFontConfiguration extends FontConfiguration { private FcCompFont[] fcCompFonts = null; - public FcFontConfiguration(SunGraphicsEnvironment environment) { - super(environment); + public FcFontConfiguration(SunFontManager fm) { + super(fm); init(); } /* This isn't called but is needed to satisfy super-class contract. */ - public FcFontConfiguration(SunGraphicsEnvironment environment, + public FcFontConfiguration(SunFontManager fm, boolean preferLocaleFonts, boolean preferPropFonts) { - super(environment, preferLocaleFonts, preferPropFonts); + super(fm, preferLocaleFonts, preferPropFonts); init(); } @@ -89,24 +90,23 @@ public class FcFontConfiguration extends FontConfiguration { setFontConfiguration(); readFcInfo(); + X11FontManager fm = (X11FontManager) fontManager; + FontConfigManager fcm = fm.getFontConfigManager(); if (fcCompFonts == null) { - fcCompFonts = FontManager.loadFontConfig(); + fcCompFonts = fcm.loadFontConfig(); if (fcCompFonts != null) { try { writeFcInfo(); } catch (Exception e) { - if (SunGraphicsEnvironment.debugFonts) { - Logger logger = - Logger.getLogger("sun.awt.FontConfiguration"); - logger.warning("Exception writing fcInfo " + e); + if (FontUtilities.debugFonts()) { + warning("Exception writing fcInfo " + e); } } - } else if (SunGraphicsEnvironment.debugFonts) { - Logger logger = Logger.getLogger("sun.awt.FontConfiguration"); - logger.warning("Failed to get info from libfontconfig"); + } else if (FontUtilities.debugFonts()) { + warning("Failed to get info from libfontconfig"); } } else { - FontManager.populateFontConfig(fcCompFonts); + fcm.populateFontConfig(fcCompFonts); } if (fcCompFonts == null) { @@ -184,7 +184,9 @@ public class FcFontConfiguration extends FontConfiguration { @Override public String[] getPlatformFontNames() { HashSet nameSet = new HashSet(); - FcCompFont[] fcCompFonts = FontManager.loadFontConfig(); + X11FontManager fm = (X11FontManager) fontManager; + FontConfigManager fcm = fm.getFontConfigManager(); + FcCompFont[] fcCompFonts = fcm.loadFontConfig(); for (int i=0; i type) { // support DosFileAttributeView and UserDefinedAttributeView if extended // attributes enabled - if (name.equals("dos") || name.equals("user")) { + if (type == DosFileAttributeView.class || + type == UserDefinedFileAttributeView.class) + { // lookup fstypes.properties FeatureStatus status = checkIfFeaturePresent("user_xattr"); if (status == FeatureStatus.PRESENT) @@ -142,7 +145,15 @@ class LinuxFileStore } return xattrEnabled; } + return super.supportsFileAttributeView(type); + } + @Override + public boolean supportsFileAttributeView(String name) { + if (name.equals("dos")) + return supportsFileAttributeView(DosFileAttributeView.class); + if (name.equals("user")) + return supportsFileAttributeView(UserDefinedFileAttributeView.class); return super.supportsFileAttributeView(name); } diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileStore.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileStore.java index aaa737137d3..8cf2bbe0818 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileStore.java +++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileStore.java @@ -25,6 +25,7 @@ package sun.nio.fs; +import java.nio.file.attribute.*; import java.io.IOException; import static sun.nio.fs.UnixNativeDispatcher.*; @@ -72,27 +73,39 @@ class SolarisFileStore } @Override - public boolean supportsFileAttributeView(String name) { - if (name.equals("acl")) { + public boolean supportsFileAttributeView(Class type) { + if (type == AclFileAttributeView.class) { // lookup fstypes.properties FeatureStatus status = checkIfFeaturePresent("nfsv4acl"); - if (status == FeatureStatus.PRESENT) - return true; - if (status == FeatureStatus.NOT_PRESENT) - return false; - // AclFileAttributeView available on ZFS - return (type().equals("zfs")); + switch (status) { + case PRESENT : return true; + case NOT_PRESENT : return false; + default : + // AclFileAttributeView available on ZFS + return (type().equals("zfs")); + } } - if (name.equals("user")) { + if (type == UserDefinedFileAttributeView.class) { // lookup fstypes.properties FeatureStatus status = checkIfFeaturePresent("xattr"); - if (status == FeatureStatus.PRESENT) - return true; - if (status == FeatureStatus.NOT_PRESENT) - return false; - return xattrEnabled; + switch (status) { + case PRESENT : return true; + case NOT_PRESENT : return false; + default : + // UserDefinedFileAttributeView available if extended + // attributes supported + return xattrEnabled; + } } + return super.supportsFileAttributeView(type); + } + @Override + public boolean supportsFileAttributeView(String name) { + if (name.equals("acl")) + return supportsFileAttributeView(AclFileAttributeView.class); + if (name.equals("user")) + return supportsFileAttributeView(UserDefinedFileAttributeView.class); return super.supportsFileAttributeView(name); } diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java b/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java index 02397648eae..f19b2f90fe8 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java +++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java @@ -145,9 +145,8 @@ abstract class UnixFileStore { // lookup fstypes.properties FeatureStatus status = checkIfFeaturePresent("posix"); - if (status == FeatureStatus.NOT_PRESENT) - return false; - return true; + // assume supported if UNKNOWN + return (status != FeatureStatus.NOT_PRESENT); } return false; } diff --git a/jdk/src/solaris/classes/sun/print/IPPPrintService.java b/jdk/src/solaris/classes/sun/print/IPPPrintService.java index ec5344ae379..0b52e174289 100644 --- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java +++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java @@ -661,9 +661,10 @@ public class IPPPrintService implements PrintService, SunPrinterJobService { } } } else if (category == OrientationRequested.class) { - if (flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) || - flavor.equals(DocFlavor.URL.POSTSCRIPT) || - flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT)) { + if ((flavor != null) && + (flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) || + flavor.equals(DocFlavor.URL.POSTSCRIPT) || + flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) { return null; } diff --git a/jdk/src/solaris/native/java/util/TimeZone_md.c b/jdk/src/solaris/native/java/util/TimeZone_md.c index a3b9fc74c1e..4ec6ef4122a 100644 --- a/jdk/src/solaris/native/java/util/TimeZone_md.c +++ b/jdk/src/solaris/native/java/util/TimeZone_md.c @@ -51,9 +51,9 @@ #ifdef __linux__ -static const char *sysconfig_clock_file = "/etc/sysconfig/clock"; -static const char *zoneinfo_dir = "/usr/share/zoneinfo"; -static const char *defailt_zoneinfo_file = "/etc/localtime"; +static const char *ETC_TIMEZONE_FILE = "/etc/timezone"; +static const char *ZONEINFO_DIR = "/usr/share/zoneinfo"; +static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime"; /* * Returns a point to the zone ID portion of the given zoneinfo file @@ -201,53 +201,22 @@ getPlatformTimeZoneID() size_t size; /* - * First, try the ZONE entry in /etc/sysconfig/clock. However, the - * ZONE entry is not set up after initial Red Hat Linux - * installation. In case that /etc/localtime is set up without - * using timeconfig, there might be inconsistency between - * /etc/localtime and the ZONE entry. The inconsistency between - * timeconfig and linuxconf is reported as a bug in the Red Hat - * web page as of May 1, 2000. + * Try reading the /etc/timezone file for Debian distros. There's + * no spec of the file format available. This parsing assumes that + * there's one line of an Olson tzid followed by a '\n', no + * leading or trailing spaces, no comments. */ - if ((fp = fopen(sysconfig_clock_file, "r")) != NULL) { + if ((fp = fopen(ETC_TIMEZONE_FILE, "r")) != NULL) { char line[256]; - while (fgets(line, sizeof(line), fp) != NULL) { - char *p = line; - char *s; - - SKIP_SPACE(p); - if (*p != 'Z') { - continue; + if (fgets(line, sizeof(line), fp) != NULL) { + char *p = strchr(line, '\n'); + if (p != NULL) { + *p = '\0'; } - if (strncmp(p, "ZONE=\"", 6) == 0) { - p += 6; - } else { - /* - * In case we need to parse it token by token. - */ - if (strncmp(p, "ZONE", 4) != 0) { - continue; - } - p += 4; - SKIP_SPACE(p); - if (*p++ != '=') { - break; - } - SKIP_SPACE(p); - if (*p++ != '"') { - break; - } + if (strlen(line) > 0) { + tz = strdup(line); } - for (s = p; *s && *s != '"'; s++) - ; - if (*s != '"') { - /* this ZONE entry is broken. */ - break; - } - *s = '\0'; - tz = strdup(p); - break; } (void) fclose(fp); if (tz != NULL) { @@ -258,7 +227,7 @@ getPlatformTimeZoneID() /* * Next, try /etc/localtime to find the zone ID. */ - if (lstat(defailt_zoneinfo_file, &statbuf) == -1) { + if (lstat(DEFAULT_ZONEINFO_FILE, &statbuf) == -1) { return NULL; } @@ -273,9 +242,9 @@ getPlatformTimeZoneID() char linkbuf[PATH_MAX+1]; int len; - if ((len = readlink(defailt_zoneinfo_file, linkbuf, sizeof(linkbuf)-1)) == -1) { + if ((len = readlink(DEFAULT_ZONEINFO_FILE, linkbuf, sizeof(linkbuf)-1)) == -1) { jio_fprintf(stderr, (const char *) "can't get a symlink of %s\n", - defailt_zoneinfo_file); + DEFAULT_ZONEINFO_FILE); return NULL; } linkbuf[len] = '\0'; @@ -295,7 +264,7 @@ getPlatformTimeZoneID() if (buf == NULL) { return NULL; } - if ((fd = open(defailt_zoneinfo_file, O_RDONLY)) == -1) { + if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) { free((void *) buf); return NULL; } @@ -307,7 +276,7 @@ getPlatformTimeZoneID() } (void) close(fd); - tz = findZoneinfoFile(buf, size, zoneinfo_dir); + tz = findZoneinfoFile(buf, size, ZONEINFO_DIR); free((void *) buf); return tz; } diff --git a/jdk/src/solaris/native/sun/awt/fontpath.c b/jdk/src/solaris/native/sun/awt/fontpath.c index b944ff93360..c6b1fc71fe7 100644 --- a/jdk/src/solaris/native/sun/awt/fontpath.c +++ b/jdk/src/solaris/native/sun/awt/fontpath.c @@ -150,15 +150,26 @@ jboolean isDisplayLocal(JNIEnv *env) { static jboolean isLocalSet = False; jboolean ret; - if (isLocalSet) { - return isLocal; + if (! isLocalSet) { + jclass geCls = (*env)->FindClass(env, "java/awt/GraphicsEnvironment"); + jmethodID getLocalGE = (*env)->GetStaticMethodID(env, geCls, + "getLocalGraphicsEnvironment", + "()Ljava/awt/GraphicsEnvironment;"); + jobject ge = (*env)->CallStaticObjectMethod(env, geCls, getLocalGE); + + jclass sgeCls = (*env)->FindClass(env, + "sun/java2d/SunGraphicsEnvironment"); + if ((*env)->IsInstanceOf(env, ge, sgeCls)) { + jmethodID isDisplayLocal = (*env)->GetMethodID(env, sgeCls, + "isDisplayLocal", + "()Z"); + isLocal = (*env)->CallBooleanMethod(env, ge, isDisplayLocal); + } else { + isLocal = True; + } + isLocalSet = True; } - isLocal = JNU_CallStaticMethodByName(env, NULL, - "sun/awt/X11GraphicsEnvironment", - "_isDisplayLocal", - "()Z").z; - isLocalSet = True; return isLocal; } @@ -516,8 +527,8 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) { return path; } -JNIEXPORT jstring JNICALL Java_sun_font_FontManager_getFontPath -(JNIEnv *env, jclass obj, jboolean noType1) { +JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath +(JNIEnv *env, jobject thiz, jboolean noType1) { jstring ret; static char *ptr = NULL; /* retain result across calls */ @@ -564,7 +575,7 @@ static int shouldSetXFontPath(JNIEnv *env) { } #endif /* !HEADLESS */ -JNIEXPORT void JNICALL Java_sun_font_FontManager_setNativeFontPath +JNIEXPORT void JNICALL Java_sun_font_X11FontManager_setNativeFontPath (JNIEnv *env, jclass obj, jstring theString) { #ifdef HEADLESS return; @@ -592,21 +603,6 @@ JNIEXPORT void JNICALL Java_sun_font_FontManager_setNativeFontPath #endif } -/* This isn't yet used on unix, the implementation is added since shared - * code calls this method in preparation for future use. - */ -/* Obtain all the fontname -> filename mappings. - * This is called once and the results returned to Java code which can - * use it for lookups to reduce or avoid the need to search font files. - */ -JNIEXPORT void JNICALL -Java_sun_font_FontManager_populateFontFileNameMap -(JNIEnv *env, jclass obj, jobject fontToFileMap, - jobject fontToFamilyMap, jobject familyToFontListMap, jobject locale) -{ - return; -} - #include #ifndef __linux__ /* i.e. is solaris */ #include @@ -865,7 +861,7 @@ static char **getFontConfigLocations() { #define TEXT_AA_LCD_VBGR 7 JNIEXPORT jint JNICALL -Java_sun_font_FontManager_getFontConfigAASettings +Java_sun_font_FontConfigManager_getFontConfigAASettings (JNIEnv *env, jclass obj, jstring localeStr, jstring fcNameStr) { FcNameParseFuncType FcNameParse; @@ -975,7 +971,7 @@ Java_sun_font_FontManager_getFontConfigAASettings } JNIEXPORT jint JNICALL -Java_sun_font_FontManager_getFontConfigVersion +Java_sun_font_FontConfigManager_getFontConfigVersion (JNIEnv *env, jclass obj) { void* libfontconfig; @@ -1000,7 +996,7 @@ Java_sun_font_FontManager_getFontConfigVersion JNIEXPORT void JNICALL -Java_sun_font_FontManager_getFontConfig +Java_sun_font_FontConfigManager_getFontConfig (JNIEnv *env, jclass obj, jstring localeStr, jobject fcInfoObj, jobjectArray fcCompFontArray, jboolean includeFallbacks) { @@ -1034,11 +1030,11 @@ Java_sun_font_FontManager_getFontConfig char* debugMinGlyphsStr = getenv("J2D_DEBUG_MIN_GLYPHS"); jclass fcInfoClass = - (*env)->FindClass(env, "sun/font/FontManager$FontConfigInfo"); + (*env)->FindClass(env, "sun/font/FontConfigManager$FontConfigInfo"); jclass fcCompFontClass = - (*env)->FindClass(env, "sun/font/FontManager$FcCompFont"); + (*env)->FindClass(env, "sun/font/FontConfigManager$FcCompFont"); jclass fcFontClass = - (*env)->FindClass(env, "sun/font/FontManager$FontConfigFont"); + (*env)->FindClass(env, "sun/font/FontConfigManager$FontConfigFont"); if (fcInfoObj == NULL || fcCompFontArray == NULL || fcInfoClass == NULL || fcCompFontClass == NULL || fcFontClass == NULL) { @@ -1054,11 +1050,11 @@ Java_sun_font_FontManager_getFontConfig "fcName", "Ljava/lang/String;"); fcFirstFontID = (*env)->GetFieldID(env, fcCompFontClass, "firstFont", - "Lsun/font/FontManager$FontConfigFont;"); + "Lsun/font/FontConfigManager$FontConfigFont;"); fcAllFontsID = (*env)->GetFieldID(env, fcCompFontClass, "allFonts", - "[Lsun/font/FontManager$FontConfigFont;"); + "[Lsun/font/FontConfigManager$FontConfigFont;"); fcFontCons = (*env)->GetMethodID(env, fcFontClass, "", "()V"); @@ -1207,11 +1203,7 @@ Java_sun_font_FontManager_getFontConfig * Inspect the returned fonts and the ones we like (adds enough glyphs) * are added to the arrays and we increment 'fontCount'. */ - if (includeFallbacks) { - nfonts = fontset->nfont; - } else { - nfonts = 1; - } + nfonts = fontset->nfont; family = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); styleStr = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); fullname = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); @@ -1253,7 +1245,7 @@ Java_sun_font_FontManager_getFontConfig * adversely affects load time for minimal value-add. * This is still likely far more than we've had in the past. */ - if (nfonts==10) { + if (j==10) { minGlyphs = 50; } if (unionCharset == NULL) { @@ -1272,6 +1264,9 @@ Java_sun_font_FontManager_getFontConfig (*FcPatternGetString)(fontPattern, FC_FAMILY, 0, &family[j]); (*FcPatternGetString)(fontPattern, FC_STYLE, 0, &styleStr[j]); (*FcPatternGetString)(fontPattern, FC_FULLNAME, 0, &fullname[j]); + if (!includeFallbacks) { + break; + } } /* Once we get here 'fontCount' is the number of returned fonts @@ -1313,6 +1308,8 @@ Java_sun_font_FontManager_getFontConfig } if (includeFallbacks) { (*env)->SetObjectArrayElement(env, fcFontArr, fn++,fcFont); + } else { + break; } } } diff --git a/jdk/src/windows/bin/java_md.c b/jdk/src/windows/bin/java_md.c index df5e6988c5e..a4fa4ccd63a 100644 --- a/jdk/src/windows/bin/java_md.c +++ b/jdk/src/windows/bin/java_md.c @@ -1093,12 +1093,6 @@ void SetJavaLauncherPlatformProps() {} */ static FindClassFromBootLoader_t *findBootClass = NULL; -#ifdef _M_AMD64 -#define JVM_BCLOADER "JVM_FindClassFromClassLoader" -#else -#define JVM_BCLOADER "_JVM_FindClassFromClassLoader@20" -#endif /* _M_AMD64 */ - jclass FindBootStrapClass(JNIEnv *env, const char *classname) { HMODULE hJvm; @@ -1108,13 +1102,13 @@ jclass FindBootStrapClass(JNIEnv *env, const char *classname) if (hJvm == NULL) return NULL; /* need to use the demangled entry point */ findBootClass = (FindClassFromBootLoader_t *)GetProcAddress(hJvm, - JVM_BCLOADER); + "JVM_FindClassFromBootLoader"); if (findBootClass == NULL) { - JLI_ReportErrorMessage(DLL_ERROR4, JVM_BCLOADER); + JLI_ReportErrorMessage(DLL_ERROR4, "JVM_FindClassFromBootLoader"); return NULL; } } - return findBootClass(env, classname, JNI_FALSE, (jobject)NULL, JNI_FALSE); + return findBootClass(env, classname); } void diff --git a/jdk/src/windows/classes/java/util/prefs/WindowsPreferences.java b/jdk/src/windows/classes/java/util/prefs/WindowsPreferences.java index b9ee8f49b28..c9034277360 100644 --- a/jdk/src/windows/classes/java/util/prefs/WindowsPreferences.java +++ b/jdk/src/windows/classes/java/util/prefs/WindowsPreferences.java @@ -29,7 +29,7 @@ import java.util.Map; import java.util.TreeMap; import java.util.StringTokenizer; import java.io.ByteArrayOutputStream; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; /** * Windows registry based implementation of Preferences. @@ -48,7 +48,7 @@ class WindowsPreferences extends AbstractPreferences{ /** * Logger for error messages */ - private static Logger logger; + private static PlatformLogger logger; /** * Windows registry path to Preferences's root nodes. @@ -1102,9 +1102,9 @@ class WindowsPreferences extends AbstractPreferences{ // assert false; } - private static synchronized Logger logger() { + private static synchronized PlatformLogger logger() { if (logger == null) { - logger = Logger.getLogger("java.util.prefs"); + logger = PlatformLogger.getLogger("java.util.prefs"); } return logger; } diff --git a/jdk/src/windows/classes/sun/awt/Win32FontManager.java b/jdk/src/windows/classes/sun/awt/Win32FontManager.java new file mode 100644 index 00000000000..a982432992b --- /dev/null +++ b/jdk/src/windows/classes/sun/awt/Win32FontManager.java @@ -0,0 +1,280 @@ +/* + * Copyright 2008 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + + +package sun.awt; + +import java.awt.FontFormatException; +import java.awt.GraphicsEnvironment; +import java.io.File; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Locale; +import java.util.NoSuchElementException; +import java.util.StringTokenizer; + +import sun.awt.Win32GraphicsEnvironment; +import sun.awt.windows.WFontConfiguration; +import sun.font.FontManager; +import sun.font.SunFontManager; +import sun.font.TrueTypeFont; +import sun.java2d.HeadlessGraphicsEnvironment; +import sun.java2d.SunGraphicsEnvironment; + +/** + * The X11 implementation of {@link FontManager}. + */ +public class Win32FontManager extends SunFontManager { + + private static String[] defaultPlatformFont = null; + + private static TrueTypeFont eudcFont; + + static { + + AccessController.doPrivileged(new PrivilegedAction() { + + public Object run() { + String eudcFile = getEUDCFontFile(); + if (eudcFile != null) { + try { + eudcFont = new TrueTypeFont(eudcFile, null, 0, + true); + } catch (FontFormatException e) { + } + } + return null; + } + + }); + } + + /* Used on Windows to obtain from the windows registry the name + * of a file containing the system EUFC font. If running in one of + * the locales for which this applies, and one is defined, the font + * defined by this file is appended to all composite fonts as a + * fallback component. + */ + private static native String getEUDCFontFile(); + + public Win32FontManager() { + super(); + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + + /* Register the JRE fonts so that the native platform can + * access them. This is used only on Windows so that when + * printing the printer driver can access the fonts. + */ + registerJREFontsWithPlatform(jreFontDirName); + return null; + } + }); + } + + /* Unlike the shared code version, this expects a base file name - + * not a full path name. + * The font configuration file has base file names and the FontConfiguration + * class reports these back to the GraphicsEnvironment, so these + * are the componentFileNames of CompositeFonts. + */ + protected void registerFontFile(String fontFileName, String[] nativeNames, + int fontRank, boolean defer) { + + // REMIND: case compare depends on platform + if (registeredFontFiles.contains(fontFileName)) { + return; + } + registeredFontFiles.add(fontFileName); + + int fontFormat; + if (getTrueTypeFilter().accept(null, fontFileName)) { + fontFormat = SunFontManager.FONTFORMAT_TRUETYPE; + } else if (getType1Filter().accept(null, fontFileName)) { + fontFormat = SunFontManager.FONTFORMAT_TYPE1; + } else { + /* on windows we don't use/register native fonts */ + return; + } + + if (fontPath == null) { + fontPath = getPlatformFontPath(noType1Font); + } + + /* Look in the JRE font directory first. + * This is playing it safe as we would want to find fonts in the + * JRE font directory ahead of those in the system directory + */ + String tmpFontPath = jreFontDirName+File.pathSeparator+fontPath; + StringTokenizer parser = new StringTokenizer(tmpFontPath, + File.pathSeparator); + + boolean found = false; + try { + while (!found && parser.hasMoreTokens()) { + String newPath = parser.nextToken(); + File theFile = new File(newPath, fontFileName); + if (theFile.canRead()) { + found = true; + String path = theFile.getAbsolutePath(); + if (defer) { + registerDeferredFont(fontFileName, path, + nativeNames, + fontFormat, true, + fontRank); + } else { + registerFontFile(path, nativeNames, + fontFormat, true, + fontRank); + } + break; + } + } + } catch (NoSuchElementException e) { + System.err.println(e); + } + if (!found) { + addToMissingFontFileList(fontFileName); + } + } + + @Override + protected FontConfiguration createFontConfiguration() { + + FontConfiguration fc = new WFontConfiguration(this); + fc.init(); + return fc; + } + + @Override + public FontConfiguration createFontConfiguration(boolean preferLocaleFonts, + boolean preferPropFonts) { + + return new WFontConfiguration(this, + preferLocaleFonts,preferPropFonts); + } + + protected void + populateFontFileNameMap(HashMap fontToFileMap, + HashMap fontToFamilyNameMap, + HashMap> + familyToFontListMap, + Locale locale) { + + populateFontFileNameMap0(fontToFileMap, fontToFamilyNameMap, + familyToFontListMap, locale); + + } + + private static native void + populateFontFileNameMap0(HashMap fontToFileMap, + HashMap fontToFamilyNameMap, + HashMap> + familyToFontListMap, + Locale locale); + + public synchronized native String getFontPath(boolean noType1Fonts); + + public String[] getDefaultPlatformFont() { + + if (defaultPlatformFont != null) { + return defaultPlatformFont; + } + + String[] info = new String[2]; + info[0] = "Arial"; + info[1] = "c:\\windows\\fonts"; + final String[] dirs = getPlatformFontDirs(true); + if (dirs.length > 1) { + String dir = (String) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + for (int i=0; i() { - public Boolean run() { - return OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) >= 0; - } - }); - static Win32ShellFolder2 getDesktop() { if (desktop == null) { try { @@ -206,9 +225,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { * folders, such as Desktop, Documents, History, Network, Home, etc. * This is used in the shortcut panel of the filechooser on Windows 2000 * and Windows Me. - * "fileChooserIcon nn": - * Returns an Image - icon nn from resource 216 in shell32.dll, - * or if not found there from resource 124 in comctl32.dll (Windows only). + * "fileChooserIcon ": + * Returns an Image - icon can be ListView, DetailsView, UpFolder, NewFolder or + * ViewMenu (Windows only). * "optionPaneIcon iconName": * Returns an Image - icon from the system icon list * @@ -303,26 +322,23 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { } return folders.toArray(new File[folders.size()]); } else if (key.startsWith("fileChooserIcon ")) { - int i = -1; - String name = key.substring(key.indexOf(" ")+1); - try { - i = Integer.parseInt(name); - } catch (NumberFormatException ex) { - if (name.equals("ListView")) { - i = (USE_SHELL32_ICONS) ? 21 : 2; - } else if (name.equals("DetailsView")) { - i = (USE_SHELL32_ICONS) ? 23 : 3; - } else if (name.equals("UpFolder")) { - i = (USE_SHELL32_ICONS) ? 28 : 8; - } else if (name.equals("NewFolder")) { - i = (USE_SHELL32_ICONS) ? 31 : 11; - } else if (name.equals("ViewMenu")) { - i = (USE_SHELL32_ICONS) ? 21 : 2; - } - } - if (i >= 0) { - return Win32ShellFolder2.getFileChooserIcon(i); + String name = key.substring(key.indexOf(" ") + 1); + + int iconIndex; + + if (name.equals("ListView") || name.equals("ViewMenu")) { + iconIndex = VIEW_LIST; + } else if (name.equals("DetailsView")) { + iconIndex = VIEW_DETAILS; + } else if (name.equals("UpFolder")) { + iconIndex = VIEW_PARENTFOLDER; + } else if (name.equals("NewFolder")) { + iconIndex = VIEW_NEWFOLDER; + } else { + return null; } + + return getStandardViewButton(iconIndex); } else if (key.startsWith("optionPaneIcon ")) { Win32ShellFolder2.SystemIcon iconType; if (key == "optionPaneIcon Error") { diff --git a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java index 04b3e99c26b..4b73c2e4fe7 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java @@ -59,8 +59,7 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.peer.DropTargetPeer; import sun.awt.ComponentAccessor; -import java.util.logging.*; - +import sun.util.logging.PlatformLogger; public abstract class WComponentPeer extends WObjectPeer implements ComponentPeer, DropTargetPeer @@ -70,9 +69,9 @@ public abstract class WComponentPeer extends WObjectPeer */ protected volatile long hwnd; - private static final Logger log = Logger.getLogger("sun.awt.windows.WComponentPeer"); - private static final Logger shapeLog = Logger.getLogger("sun.awt.windows.shape.WComponentPeer"); - private static final Logger focusLog = Logger.getLogger("sun.awt.windows.focus.WComponentPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WComponentPeer"); + private static final PlatformLogger shapeLog = PlatformLogger.getLogger("sun.awt.windows.shape.WComponentPeer"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.windows.focus.WComponentPeer"); // ComponentPeer implementation SurfaceData surfaceData; @@ -178,10 +177,10 @@ public abstract class WComponentPeer extends WObjectPeer void dynamicallyLayoutContainer() { // If we got the WM_SIZING, this must be a Container, right? // In fact, it must be the top-level Container. - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { Container parent = WToolkit.getNativeContainer((Component)target); if (parent != null) { - log.log(Level.FINE, "Assertion (parent == null) failed"); + log.fine("Assertion (parent == null) failed"); } } final Container cont = (Container)target; @@ -283,14 +282,14 @@ public abstract class WComponentPeer extends WObjectPeer paintArea.add(r, e.getID()); } - if (log.isLoggable(Level.FINEST)) { + if (log.isLoggable(PlatformLogger.FINEST)) { switch(e.getID()) { case PaintEvent.UPDATE: - log.log(Level.FINEST, "coalescePaintEvent: UPDATE: add: x = " + + log.finest("coalescePaintEvent: UPDATE: add: x = " + r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height); return; case PaintEvent.PAINT: - log.log(Level.FINEST, "coalescePaintEvent: PAINT: add: x = " + + log.finest("coalescePaintEvent: PAINT: add: x = " + r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height); return; } @@ -360,7 +359,7 @@ public abstract class WComponentPeer extends WObjectPeer } void handleJavaFocusEvent(FocusEvent fe) { - if (focusLog.isLoggable(Level.FINER)) focusLog.finer(fe.toString()); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(fe.toString()); setFocus(fe.getID() == FocusEvent.FOCUS_GAINED); } @@ -641,7 +640,7 @@ public abstract class WComponentPeer extends WObjectPeer case WKeyboardFocusManagerPeer.SNFH_FAILURE: return false; case WKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED: - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Proceeding with request to " + lightweightChild + " in " + target); } Window parentWindow = SunToolkit.getContainingWindow((Component)target); @@ -654,7 +653,7 @@ public abstract class WComponentPeer extends WObjectPeer } boolean res = wpeer.requestWindowFocus(cause); - if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Requested window focus: " + res); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Requested window focus: " + res); // If parent window can be made focused and has been made focused(synchronously) // then we can proceed with children, otherwise we retreat. if (!(res && parentWindow.isFocused())) { @@ -674,7 +673,7 @@ public abstract class WComponentPeer extends WObjectPeer } private boolean rejectFocusRequestHelper(String logMsg) { - if (focusLog.isLoggable(Level.FINER)) focusLog.finer(logMsg); + if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(logMsg); WKeyboardFocusManagerPeer.removeLastFocusRequest((Component)target); return false; } @@ -1017,7 +1016,7 @@ public abstract class WComponentPeer extends WObjectPeer * @since 1.7 */ public void applyShape(Region shape) { - if (shapeLog.isLoggable(Level.FINER)) { + if (shapeLog.isLoggable(PlatformLogger.FINER)) { shapeLog.finer( "*** INFO: Setting shape: PEER: " + this + "; TARGET: " + target diff --git a/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java b/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java index 3ef61190e6c..3310fcb4b11 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java +++ b/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java @@ -34,8 +34,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import java.util.logging.Logger; -import java.util.logging.Level; +import sun.util.logging.PlatformLogger; import sun.awt.SunToolkit; @@ -54,7 +53,7 @@ import sun.awt.SunToolkit; * itself when running on a Windows platform. */ class WDesktopProperties { - private static final Logger log = Logger.getLogger("sun.awt.windows.WDesktopProperties"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WDesktopProperties"); private static final String PREFIX = "win."; private static final String FILE_PREFIX = "awt.file."; private static final String PROP_NAMES = "win.propNames"; @@ -111,7 +110,7 @@ class WDesktopProperties { */ private synchronized void setBooleanProperty(String key, boolean value) { assert( key != null ); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine(key + "=" + String.valueOf(value)); } map.put(key, Boolean.valueOf(value)); @@ -122,7 +121,7 @@ class WDesktopProperties { */ private synchronized void setIntegerProperty(String key, int value) { assert( key != null ); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine(key + "=" + String.valueOf(value)); } map.put(key, Integer.valueOf(value)); @@ -133,7 +132,7 @@ class WDesktopProperties { */ private synchronized void setStringProperty(String key, String value) { assert( key != null ); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine(key + "=" + value); } map.put(key, value); @@ -145,7 +144,7 @@ class WDesktopProperties { private synchronized void setColorProperty(String key, int r, int g, int b) { assert( key != null && r <= 255 && g <=255 && b <= 255 ); Color color = new Color(r, g, b); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine(key + "=" + color); } map.put(key, color); @@ -173,14 +172,14 @@ class WDesktopProperties { name = mappedName; } Font font = new Font(name, style, size); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine(key + "=" + font); } map.put(key, font); String sizeKey = key + ".height"; Integer iSize = Integer.valueOf(size); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine(sizeKey + "=" + iSize); } map.put(sizeKey, iSize); @@ -193,7 +192,7 @@ class WDesktopProperties { assert( key != null && winEventName != null ); Runnable soundRunnable = new WinPlaySound(winEventName); - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine(key + "=" + soundRunnable); } map.put(key, soundRunnable); diff --git a/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java b/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java index 2c7b00124a7..8a9fbbb3bfe 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java +++ b/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java @@ -29,6 +29,8 @@ import java.util.HashMap; import java.util.Hashtable; import sun.awt.FontDescriptor; import sun.awt.FontConfiguration; +import sun.font.FontManager; +import sun.font.SunFontManager; import sun.java2d.SunGraphicsEnvironment; import java.nio.charset.*; @@ -37,16 +39,16 @@ public class WFontConfiguration extends FontConfiguration { // whether compatibility fallbacks for TimesRoman and Co. are used private boolean useCompatibilityFallbacks; - public WFontConfiguration(SunGraphicsEnvironment environment) { - super(environment); + public WFontConfiguration(SunFontManager fm) { + super(fm); useCompatibilityFallbacks = "windows-1252".equals(encoding); initTables(encoding); } - public WFontConfiguration(SunGraphicsEnvironment environment, + public WFontConfiguration(SunFontManager fm, boolean preferLocaleFonts, boolean preferPropFonts) { - super(environment, preferLocaleFonts, preferPropFonts); + super(fm, preferLocaleFonts, preferPropFonts); useCompatibilityFallbacks = "windows-1252".equals(encoding); } diff --git a/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java b/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java index e1523268861..671df5354ff 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java @@ -31,11 +31,10 @@ import java.awt.peer.*; import java.awt.event.ActionEvent; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.logging.Logger; -import java.util.logging.Level; +import sun.util.logging.PlatformLogger; class WMenuItemPeer extends WObjectPeer implements MenuItemPeer { - private static final Logger log = Logger.getLogger("sun.awt.WMenuItemPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.WMenuItemPeer"); static { initIDs(); @@ -166,8 +165,8 @@ class WMenuItemPeer extends WObjectPeer implements MenuItemPeer { ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization"); return Font.decode(rb.getString("menuFont")); } catch (MissingResourceException e) { - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "WMenuItemPeer: " + e.getMessage()+". Using default MenuItem font.", e); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("WMenuItemPeer: " + e.getMessage()+". Using default MenuItem font.", e); } return new Font("SanSerif", Font.PLAIN, 11); } diff --git a/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java b/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java index 3b4af6dd1f6..95ea1d73fd2 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java @@ -30,11 +30,9 @@ import java.awt.peer.*; import java.util.Vector; import sun.awt.SunGraphicsCallback; -import java.util.logging.*; class WPanelPeer extends WCanvasPeer implements PanelPeer { - private static final Logger log = Logger.getLogger("sun.awt.windows.WPanelPeer"); // ComponentPeer overrides public void paint(Graphics g) { diff --git a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java index ffcead19e08..2b482389618 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java +++ b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java @@ -64,7 +64,7 @@ import java.util.Arrays; import sun.font.CharToGlyphMapper; import sun.font.CompositeFont; import sun.font.Font2D; -import sun.font.FontManager; +import sun.font.FontUtilities; import sun.font.PhysicalFont; import sun.font.TrueTypeFont; @@ -119,6 +119,7 @@ class WPathGraphics extends PathGraphics { * this graphics context. * @since JDK1.0 */ + @Override public Graphics create() { return new WPathGraphics((Graphics2D) getDelegate().create(), @@ -143,6 +144,7 @@ class WPathGraphics extends PathGraphics { * @see #setClip * @see #setComposite */ + @Override public void draw(Shape s) { Stroke stroke = getStroke(); @@ -250,10 +252,12 @@ class WPathGraphics extends PathGraphics { * @see java.awt.Graphics#drawChars * @since JDK1.0 */ + @Override public void drawString(String str, int x, int y) { drawString(str, (float) x, (float) y); } + @Override public void drawString(String str, float x, float y) { drawString(str, x, y, getFont(), getFontRenderContext(), 0f); } @@ -270,6 +274,7 @@ class WPathGraphics extends PathGraphics { * the default render context (as canDrawStringToWidth() will return * false. That is why it ignores the frc and width arguments. */ + @Override protected int platformFontCount(Font font, String str) { AffineTransform deviceTransform = getTransform(); @@ -294,7 +299,7 @@ class WPathGraphics extends PathGraphics { * fail that case. Just do a quick check whether its a TrueTypeFont * - ie not a Type1 font etc, and let drawString() resolve the rest. */ - Font2D font2D = FontManager.getFont2D(font); + Font2D font2D = FontUtilities.getFont2D(font); if (font2D instanceof CompositeFont || font2D instanceof TrueTypeFont) { return 1; @@ -320,14 +325,14 @@ class WPathGraphics extends PathGraphics { */ private boolean strNeedsTextLayout(String str, Font font) { char[] chars = str.toCharArray(); - boolean isComplex = FontManager.isComplexText(chars, 0, chars.length); + boolean isComplex = FontUtilities.isComplexText(chars, 0, chars.length); if (!isComplex) { return false; } else if (!useGDITextLayout) { return true; } else { if (preferGDITextLayout || - (isXP() && FontManager.textLayoutIsCompatible(font))) { + (isXP() && FontUtilities.textLayoutIsCompatible(font))) { return false; } else { return true; @@ -388,6 +393,7 @@ class WPathGraphics extends PathGraphics { * @see #setComposite * @see #setClip */ + @Override public void drawString(String str, float x, float y, Font font, FontRenderContext frc, float targetW) { if (str.length() == 0) { @@ -498,7 +504,7 @@ class WPathGraphics extends PathGraphics { float awScale = getAwScale(scaleFactorX, scaleFactorY); int iangle = getAngle(ptx); - Font2D font2D = FontManager.getFont2D(font); + Font2D font2D = FontUtilities.getFont2D(font); if (font2D instanceof TrueTypeFont) { textOut(str, font, (TrueTypeFont)font2D, frc, scaledFontSizeY, iangle, awScale, @@ -549,6 +555,7 @@ class WPathGraphics extends PathGraphics { /** return true if the Graphics instance can directly print * this glyphvector */ + @Override protected boolean printGlyphVector(GlyphVector gv, float x, float y) { /* We don't want to try to handle per-glyph transforms. GDI can't * handle per-glyph rotations, etc. There's no way to express it @@ -693,7 +700,7 @@ class WPathGraphics extends PathGraphics { glyphAdvPos, 0, //destination glyphPos.length/2); //num points - Font2D font2D = FontManager.getFont2D(font); + Font2D font2D = FontUtilities.getFont2D(font); if (font2D instanceof TrueTypeFont) { String family = font2D.getFamilyName(null); int style = font.getStyle() | font2D.getStyle(); @@ -792,7 +799,7 @@ class WPathGraphics extends PathGraphics { char[] chars = str.toCharArray(); int len = chars.length; GlyphVector gv = null; - if (!FontManager.isComplexText(chars, 0, len)) { + if (!FontUtilities.isComplexText(chars, 0, len)) { gv = font.createGlyphVector(frc, str); } if (gv == null) { diff --git a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java index 128f10f6beb..674716c3d80 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java @@ -98,6 +98,8 @@ import javax.print.attribute.standard.PageRanges; import javax.print.attribute.Size2DSyntax; import javax.print.StreamPrintService; +import sun.awt.Win32FontManager; + import sun.print.RasterPrinterJob; import sun.print.SunAlternateMedia; import sun.print.SunPageSelection; @@ -359,7 +361,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget { initIDs(); - Win32GraphicsEnvironment.registerJREFontsForPrinting(); + Win32FontManager.registerJREFontsForPrinting(); } /* Constructors */ diff --git a/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java b/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java index 2e8c5e60bd5..189d3443bab 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java @@ -29,11 +29,11 @@ import java.awt.event.AdjustmentEvent; import java.awt.peer.ScrollPanePeer; import sun.awt.PeerEvent; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer { - private static final Logger log = Logger.getLogger("sun.awt.windows.WScrollPanePeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WScrollPanePeer"); int scrollbarWidth; int scrollbarHeight; @@ -159,8 +159,8 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer { } public PeerEvent coalesceEvents(PeerEvent newEvent) { - if (log.isLoggable(Level.FINEST)) { - log.log(Level.FINEST, "ScrollEvent coalesced: " + newEvent); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("ScrollEvent coalesced: " + newEvent); } if (newEvent instanceof ScrollEvent) { return newEvent; @@ -204,8 +204,8 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer { } else if (orient == Adjustable.HORIZONTAL) { adj = (ScrollPaneAdjustable)sp.getHAdjustable(); } else { - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "Assertion failed: unknown orient"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Assertion failed: unknown orient"); } } @@ -231,8 +231,8 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer { newpos = this.pos; break; default: - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "Assertion failed: unknown type"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Assertion failed: unknown type"); } return; } @@ -258,10 +258,10 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer { { hwAncestor = hwAncestor.getParent(); } - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (hwAncestor == null) { - log.log(Level.FINE, "Assertion (hwAncestor != null) failed, " + - "couldn't find heavyweight ancestor of scroll pane child"); + log.fine("Assertion (hwAncestor != null) failed, " + + "couldn't find heavyweight ancestor of scroll pane child"); } } WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer(); diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java index 9fcf3d67a8b..465c8ef3ab9 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java +++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java @@ -58,13 +58,15 @@ import java.util.Locale; import java.util.Map; import java.util.Properties; -import java.util.logging.*; - +import sun.font.FontManager; +import sun.font.FontManagerFactory; +import sun.font.SunFontManager; import sun.misc.PerformanceLogger; +import sun.util.logging.PlatformLogger; public class WToolkit extends SunToolkit implements Runnable { - private static final Logger log = Logger.getLogger("sun.awt.windows.WToolkit"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit"); static GraphicsConfiguration config; @@ -107,8 +109,8 @@ public class WToolkit extends SunToolkit implements Runnable { initIDs(); // Print out which version of Windows is running - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "Win version: " + getWindowsVersion()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Win version: " + getWindowsVersion()); } java.security.AccessController.doPrivileged( @@ -572,8 +574,11 @@ public class WToolkit extends SunToolkit implements Runnable { public FontMetrics getFontMetrics(Font font) { - // REMIND: platform font flag should be removed post-merlin. - if (sun.font.FontManager.usePlatformFontMetrics()) { + // This is an unsupported hack, but left in for a customer. + // Do not remove. + FontManager fm = FontManagerFactory.getInstance(); + if (fm instanceof SunFontManager + && ((SunFontManager) fm).usePlatformFontMetrics()) { return WFontMetrics.getFontMetrics(font); } return super.getFontMetrics(font); @@ -824,10 +829,10 @@ public class WToolkit extends SunToolkit implements Runnable { lazilyInitWProps(); Boolean prop = (Boolean) desktopProperties.get("awt.dynamicLayoutSupported"); - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "In WTK.isDynamicLayoutSupported()" + - " nativeDynamic == " + nativeDynamic + - " wprops.dynamic == " + prop); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("In WTK.isDynamicLayoutSupported()" + + " nativeDynamic == " + nativeDynamic + + " wprops.dynamic == " + prop); } if ((prop == null) || (nativeDynamic != prop.booleanValue())) { @@ -862,8 +867,8 @@ public class WToolkit extends SunToolkit implements Runnable { Map props = wprops.getProperties(); for (String propName : props.keySet()) { Object val = props.get(propName); - if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, "changed " + propName + " to " + val); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("changed " + propName + " to " + val); } setDesktopProperty(propName, val); } diff --git a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java index fbb7442ba7d..009593ac3cf 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java @@ -35,7 +35,7 @@ import java.lang.reflect.*; import java.util.*; import java.util.List; -import java.util.logging.*; +import sun.util.logging.PlatformLogger; import sun.awt.*; @@ -45,8 +45,8 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, DisplayChangedListener { - private static final Logger log = Logger.getLogger("sun.awt.windows.WWindowPeer"); - private static final Logger screenLog = Logger.getLogger("sun.awt.windows.screen.WWindowPeer"); + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WWindowPeer"); + private static final PlatformLogger screenLog = PlatformLogger.getLogger("sun.awt.windows.screen.WWindowPeer"); // we can't use WDialogPeer as blocker may be an instance of WPrintDialogPeer that // extends WWindowPeer, not WDialogPeer @@ -440,8 +440,8 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, public void updateGC() { int scrn = getScreenImOn(); - if (screenLog.isLoggable(Level.FINER)) { - log.log(Level.FINER, "Screen number: " + scrn); + if (screenLog.isLoggable(PlatformLogger.FINER)) { + log.finer("Screen number: " + scrn); } // get current GD @@ -465,9 +465,9 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, // is now mostly on. winGraphicsConfig = (Win32GraphicsConfig)newDev .getDefaultConfiguration(); - if (screenLog.isLoggable(Level.FINE)) { + if (screenLog.isLoggable(PlatformLogger.FINE)) { if (winGraphicsConfig == null) { - screenLog.log(Level.FINE, "Assertion (winGraphicsConfig != null) failed"); + screenLog.fine("Assertion (winGraphicsConfig != null) failed"); } } @@ -700,9 +700,8 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, TranslucentWindowPainter currentPainter = painter; if (currentPainter != null) { currentPainter.updateWindow(repaint); - } else if (log.isLoggable(Level.FINER)) { - log.log(Level.FINER, - "Translucent window painter is null in updateWindow"); + } else if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Translucent window painter is null in updateWindow"); } } } @@ -736,8 +735,8 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, public void propertyChange(PropertyChangeEvent e) { boolean isDisposed = (Boolean)e.getNewValue(); if (isDisposed != true) { - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, " Assertion (newValue != true) failed for AppContext.GUI_DISPOSED "); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine(" Assertion (newValue != true) failed for AppContext.GUI_DISPOSED "); } } AppContext appContext = AppContext.getAppContext(); diff --git a/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties b/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties index a4e8e83ff79..b3aef483fd4 100644 --- a/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties +++ b/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties @@ -1,6 +1,6 @@ # # -# Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2003-2009 Sun Microsystems, Inc. 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 @@ -31,8 +31,11 @@ version=1 # Component Font Mappings allfonts.chinese-ms936=SimSun +allfonts.chinese-ms936-extb=SimSun-ExtB allfonts.chinese-gb18030=SimSun-18030 +allfonts.chinese-gb18030-extb=SimSun-ExtB allfonts.chinese-hkscs=MingLiU_HKSCS +allfonts.chinese-ms950-extb=MingLiU-ExtB allfonts.devanagari=Mangal allfonts.dingbats=Wingdings allfonts.lucida=Lucida Sans Regular @@ -41,120 +44,140 @@ allfonts.thai=Lucida Sans Regular serif.plain.alphabetic=Times New Roman serif.plain.chinese-ms950=MingLiU +serif.plain.chinese-ms950-extb=MingLiU-ExtB serif.plain.hebrew=David serif.plain.japanese=MS Mincho serif.plain.korean=Batang serif.bold.alphabetic=Times New Roman Bold serif.bold.chinese-ms950=PMingLiU +serif.bold.chinese-ms950-extb=PMingLiU-ExtB serif.bold.hebrew=David Bold serif.bold.japanese=MS Mincho serif.bold.korean=Batang serif.italic.alphabetic=Times New Roman Italic serif.italic.chinese-ms950=PMingLiU +serif.italic.chinese-ms950-extb=PMingLiU-ExtB serif.italic.hebrew=David serif.italic.japanese=MS Mincho serif.italic.korean=Batang serif.bolditalic.alphabetic=Times New Roman Bold Italic serif.bolditalic.chinese-ms950=PMingLiU +serif.bolditalic.chinese-ms950-extb=PMingLiU-ExtB serif.bolditalic.hebrew=David Bold serif.bolditalic.japanese=MS Mincho serif.bolditalic.korean=Batang sansserif.plain.alphabetic=Arial sansserif.plain.chinese-ms950=MingLiU +sansserif.plain.chinese-ms950-extb=MingLiU-ExtB sansserif.plain.hebrew=David sansserif.plain.japanese=MS Gothic sansserif.plain.korean=Gulim sansserif.bold.alphabetic=Arial Bold sansserif.bold.chinese-ms950=PMingLiU +sansserif.bold.chinese-ms950-extb=PMingLiU-ExtB sansserif.bold.hebrew=David Bold sansserif.bold.japanese=MS Gothic sansserif.bold.korean=Gulim sansserif.italic.alphabetic=Arial Italic sansserif.italic.chinese-ms950=PMingLiU +sansserif.italic.chinese-ms950-extb=PMingLiU-ExtB sansserif.italic.hebrew=David sansserif.italic.japanese=MS Gothic sansserif.italic.korean=Gulim sansserif.bolditalic.alphabetic=Arial Bold Italic sansserif.bolditalic.chinese-ms950=PMingLiU +sansserif.bolditalic.chinese-ms950-extb=PMingLiU-ExtB sansserif.bolditalic.hebrew=David Bold sansserif.bolditalic.japanese=MS Gothic sansserif.bolditalic.korean=Gulim monospaced.plain.alphabetic=Courier New monospaced.plain.chinese-ms950=MingLiU +monospaced.plain.chinese-ms950-extb=MingLiU-ExtB monospaced.plain.hebrew=David monospaced.plain.japanese=MS Gothic monospaced.plain.korean=GulimChe monospaced.bold.alphabetic=Courier New Bold monospaced.bold.chinese-ms950=PMingLiU +monospaced.bold.chinese-ms950-extb=PMingLiU-ExtB monospaced.bold.hebrew=David Bold monospaced.bold.japanese=MS Gothic monospaced.bold.korean=GulimChe monospaced.italic.alphabetic=Courier New Italic monospaced.italic.chinese-ms950=PMingLiU +monospaced.italic.chinese-ms950-extb=PMingLiU-ExtB monospaced.italic.hebrew=David monospaced.italic.japanese=MS Gothic monospaced.italic.korean=GulimChe monospaced.bolditalic.alphabetic=Courier New Bold Italic monospaced.bolditalic.chinese-ms950=PMingLiU +monospaced.bolditalic.chinese-ms950-extb=PMingLiU-ExtB monospaced.bolditalic.hebrew=David Bold monospaced.bolditalic.japanese=MS Gothic monospaced.bolditalic.korean=GulimChe dialog.plain.alphabetic=Arial dialog.plain.chinese-ms950=MingLiU +dialog.plain.chinese-ms950-extb=MingLiU-ExtB dialog.plain.hebrew=David dialog.plain.japanese=MS Gothic dialog.plain.korean=Gulim dialog.bold.alphabetic=Arial Bold dialog.bold.chinese-ms950=PMingLiU +dialog.bold.chinese-ms950-extb=PMingLiU-ExtB dialog.bold.hebrew=David Bold dialog.bold.japanese=MS Gothic dialog.bold.korean=Gulim dialog.italic.alphabetic=Arial Italic dialog.italic.chinese-ms950=PMingLiU +dialog.italic.chinese-ms950-extb=PMingLiU-ExtB dialog.italic.hebrew=David dialog.italic.japanese=MS Gothic dialog.italic.korean=Gulim dialog.bolditalic.alphabetic=Arial Bold Italic dialog.bolditalic.chinese-ms950=PMingLiU +dialog.bolditalic.chinese-ms950-extb=PMingLiU-ExtB dialog.bolditalic.hebrew=David Bold dialog.bolditalic.japanese=MS Gothic dialog.bolditalic.korean=Gulim dialoginput.plain.alphabetic=Courier New dialoginput.plain.chinese-ms950=MingLiU +dialoginput.plain.chinese-ms950-extb=MingLiU-ExtB dialoginput.plain.hebrew=David dialoginput.plain.japanese=MS Gothic dialoginput.plain.korean=Gulim dialoginput.bold.alphabetic=Courier New Bold dialoginput.bold.chinese-ms950=PMingLiU +dialoginput.bold.chinese-ms950-extb=PMingLiU-ExtB dialoginput.bold.hebrew=David Bold dialoginput.bold.japanese=MS Gothic dialoginput.bold.korean=Gulim dialoginput.italic.alphabetic=Courier New Italic dialoginput.italic.chinese-ms950=PMingLiU +dialoginput.italic.chinese-ms950-extb=PMingLiU-ExtB dialoginput.italic.hebrew=David dialoginput.italic.japanese=MS Gothic dialoginput.italic.korean=Gulim dialoginput.bolditalic.alphabetic=Courier New Bold Italic dialoginput.bolditalic.chinese-ms950=PMingLiU +dialoginput.bolditalic.chinese-ms950-extb=PMingLiU-ExtB dialoginput.bolditalic.hebrew=David Bold dialoginput.bolditalic.japanese=MS Gothic dialoginput.bolditalic.korean=Gulim @@ -163,31 +186,32 @@ dialoginput.bolditalic.korean=Gulim sequence.allfonts=alphabetic/default,dingbats,symbol -sequence.serif.GBK=alphabetic,chinese-ms936,dingbats,symbol -sequence.sansserif.GBK=alphabetic,chinese-ms936,dingbats,symbol -sequence.monospaced.GBK=chinese-ms936,alphabetic,dingbats,symbol -sequence.dialog.GBK=alphabetic,chinese-ms936,dingbats,symbol -sequence.dialoginput.GBK=alphabetic,chinese-ms936,dingbats,symbol +sequence.serif.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb +sequence.sansserif.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb +sequence.monospaced.GBK=chinese-ms936,alphabetic,dingbats,symbol,chinese-ms936-extb +sequence.dialog.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb +sequence.dialoginput.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb -sequence.serif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol -sequence.sansserif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol -sequence.monospaced.GB18030=chinese-gb18030,alphabetic,dingbats,symbol -sequence.dialog.GB18030=alphabetic,chinese-gb18030,dingbats,symbol -sequence.dialoginput.GB18030=alphabetic,chinese-gb18030,dingbats,symbol +sequence.serif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb +sequence.sansserif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb +sequence.monospaced.GB18030=chinese-gb18030,alphabetic,dingbats,symbol,chinese-gb18030-extb +sequence.dialog.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb +sequence.dialoginput.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb -sequence.serif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol -sequence.sansserif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol -sequence.monospaced.x-windows-950=chinese-ms950,alphabetic,dingbats,symbol -sequence.dialog.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol -sequence.dialoginput.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol +sequence.serif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb +sequence.sansserif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb +sequence.monospaced.x-windows-950=chinese-ms950,alphabetic,dingbats,symbol,chinese-ms950-extb +sequence.dialog.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb +sequence.dialoginput.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb -sequence.serif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol -sequence.sansserif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol -sequence.monospaced.x-MS950-HKSCS=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol -sequence.dialog.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol -sequence.dialoginput.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol +sequence.serif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb +sequence.sansserif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb +sequence.monospaced.x-MS950-HKSCS=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol,chinese-ms950-extb +sequence.dialog.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb +sequence.dialoginput.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari,dingbats,symbol +sequence.allfonts.UTF-8.ja=alphabetic,japanese,devanagari,dingbats,symbol sequence.allfonts.windows-1255=hebrew,alphabetic/1252,dingbats,symbol @@ -207,7 +231,7 @@ sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol sequence.fallback=lucida,\ chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\ - japanese,korean + japanese,korean,chinese-ms950-extb,chinese-ms936-extb # Exclusion Ranges @@ -220,6 +244,7 @@ exclusion.hebrew=0041-005a,0060-007a,007f-00ff,20ac-20ac proportional.MS_Gothic=MS PGothic proportional.MS_Mincho=MS PMincho proportional.MingLiU=PMingLiU +proportional.MingLiU-ExtB=PMingLiU-ExtB # Font File Names @@ -240,9 +265,12 @@ filename.Times_New_Roman_Bold_Italic=TIMESBI.TTF filename.SimSun=SIMSUN.TTC filename.SimSun-18030=SIMSUN18030.TTC +filename.SimSun-ExtB=SIMSUNB.TTF filename.MingLiU=MINGLIU.TTC +filename.MingLiU-ExtB=MINGLIUB.TTC filename.PMingLiU=MINGLIU.TTC +filename.PMingLiU-ExtB=MINGLIUB.TTC filename.MingLiU_HKSCS=hkscsm3u.ttf filename.David=DAVID.TTF diff --git a/jdk/src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java b/jdk/src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java index a4334b42f12..788a4d0ff21 100644 --- a/jdk/src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java +++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java @@ -67,6 +67,9 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice { if (d3dAvailable) { // we don't use pixel formats for the d3d pipeline pfDisabled = true; + sun.misc.PerfCounter.getD3DAvailable().set(1); + } else { + sun.misc.PerfCounter.getD3DAvailable().set(0); } } diff --git a/jdk/src/windows/classes/sun/net/www/protocol/http/NTLMAuthentication.java b/jdk/src/windows/classes/sun/net/www/protocol/http/NTLMAuthentication.java index 12ffdf402ff..d3be6820161 100644 --- a/jdk/src/windows/classes/sun/net/www/protocol/http/NTLMAuthentication.java +++ b/jdk/src/windows/classes/sun/net/www/protocol/http/NTLMAuthentication.java @@ -25,18 +25,13 @@ package sun.net.www.protocol.http; -import java.util.Arrays; -import java.util.StringTokenizer; -import java.util.Random; - +import java.io.IOException; +import java.net.InetAddress; +import java.net.PasswordAuthentication; +import java.net.UnknownHostException; +import java.net.URL; import sun.net.www.HeaderParser; -import java.io.*; -import javax.crypto.*; -import javax.crypto.spec.*; -import java.security.*; -import java.net.*; - /** * NTLMAuthentication: * @@ -47,7 +42,6 @@ class NTLMAuthentication extends AuthenticationInfo { private static final long serialVersionUID = 100L; - static final char NTLM_AUTH = 'N'; private String hostname; private static String defaultDomain; /* Domain to use if not specified by user */ @@ -88,7 +82,10 @@ class NTLMAuthentication extends AuthenticationInfo { * from a system property: "http.auth.ntlm.domain". */ public NTLMAuthentication(boolean isProxy, URL url, PasswordAuthentication pw) { - super(isProxy?PROXY_AUTHENTICATION:SERVER_AUTHENTICATION, NTLM_AUTH, url, ""); + super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION, + AuthScheme.NTLM, + url, + ""); init (pw); } @@ -119,7 +116,11 @@ class NTLMAuthentication extends AuthenticationInfo { */ public NTLMAuthentication(boolean isProxy, String host, int port, PasswordAuthentication pw) { - super(isProxy?PROXY_AUTHENTICATION:SERVER_AUTHENTICATION, NTLM_AUTH,host, port, ""); + super(isProxy?PROXY_AUTHENTICATION:SERVER_AUTHENTICATION, + AuthScheme.NTLM, + host, + port, + ""); init (pw); } @@ -191,9 +192,4 @@ class NTLMAuthentication extends AuthenticationInfo { } } - /* This is a no-op for NTLM, because there is no authentication information - * provided by the server to the client - */ - public void checkResponse (String header, String method, URL url) throws IOException { - } } diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java b/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java index a906b54e0de..5af14f1673f 100644 --- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java +++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java @@ -153,7 +153,7 @@ class WindowsFileStore public boolean supportsFileAttributeView(Class type) { if (type == null) throw new NullPointerException(); - if (type == BasicFileAttributeView.class) + if (type == BasicFileAttributeView.class || type == DosFileAttributeView.class) return true; if (type == AclFileAttributeView.class || type == FileOwnerAttributeView.class) return ((volInfo.flags() & FILE_PERSISTENT_ACLS) != 0); diff --git a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java index cb4ded6e668..44dee2c86c5 100644 --- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java +++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java @@ -1,5 +1,5 @@ /* - * Portions Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. + * Portions Copyright 2000-2009 Sun Microsystems, Inc. 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 @@ -252,15 +252,15 @@ public class Kinit { } KRBError error = ke.getError(); int etype = error.getEType(); - byte[] salt = error.getSalt(); + String salt = error.getSalt(); byte[] s2kparams = error.getParams(); if (useKeytab) { - as_req = new KrbAsReq(skeys, true, etype, salt, s2kparams, - opt, principal, sname, + as_req = new KrbAsReq(skeys, true, etype, salt, + s2kparams, opt, principal, sname, null, null, null, null, addresses, null); } else { - as_req = new KrbAsReq(psswd, true, etype, salt, s2kparams, - opt, principal, sname, + as_req = new KrbAsReq(psswd, true, etype, salt, + s2kparams, opt, principal, sname, null, null, null, null, addresses, null); } as_rep = sendASRequest(as_req, useKeytab, realm, psswd, skeys); diff --git a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java index 5cb919b9d52..40f2942e3a9 100644 --- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java +++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java @@ -30,17 +30,12 @@ package sun.security.krb5.internal.tools; +import java.net.InetAddress; import sun.security.krb5.*; import sun.security.krb5.internal.*; import sun.security.krb5.internal.ccache.*; import sun.security.krb5.internal.ktab.*; import sun.security.krb5.internal.crypto.EType; -import sun.security.krb5.KrbCryptoException; -import java.lang.RuntimeException; -import java.io.IOException; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.File; /** * This class can execute as a command-line tool to list entries in @@ -51,9 +46,9 @@ import java.io.File; */ public class Klist { Object target; - // for credentials cache, options are 'f' and 'e'; + // for credentials cache, options are 'f', 'e', 'a' and 'n'; // for keytab, optionsare 't' and 'K' and 'e' - char[] options = new char[3]; + char[] options = new char[4]; String name; // the name of credentials cache and keytable. char action; // actions would be 'c' for credentials cache // and 'k' for keytable. @@ -62,7 +57,7 @@ public class Klist { /** * The main program that can be invoked at command line. *
    Usage: klist - * [[-c] [-f] [-e]] [-k [-t] [-K]] [name] + * [[-c] [-f] [-e] [-a [-n]]] [-k [-t] [-K]] [name] * -c specifes that credential cache is to be listed * -k specifies that key tab is to be listed * name name of the credentials cache or keytab @@ -70,6 +65,8 @@ public class Klist { *
      *
    • -f shows credentials flags *
    • -e shows the encryption type + *
    • -a shows addresses + *
    • -n do not reverse-resolve addresses *
    * available options for keytabs: *
  • -t shows keytab entry timestamps @@ -141,6 +138,12 @@ public class Klist { case 'k': action = 'k'; break; + case 'a': + options[2] = 'a'; + break; + case 'n': + options[3] = 'n'; + break; case 'f': options[1] = 'f'; break; @@ -202,7 +205,7 @@ public class Klist { } if (options[2] == 't') { System.out.println("\t Time stamp: " + - reformat(entries[i].getTimeStamp().toDate().toString())); + reformat(entries[i].getTimeStamp().toDate().toString())); } } } @@ -249,12 +252,33 @@ public class Klist { System.out.println(" Expires: " + endtime); if (options[0] == 'e') { etype = EType.toString(creds[i].getEType()); - System.out.println("\t Encryption type: " + etype); + System.out.println(" Encryption type: " + etype); } if (options[1] == 'f') { - System.out.println("\t Flags: " + + System.out.println(" Flags: " + creds[i].getTicketFlags().toString()); } + if (options[2] == 'a') { + boolean first = true; + InetAddress[] caddr + = creds[i].setKrbCreds().getClientAddresses(); + if (caddr != null) { + for (InetAddress ia: caddr) { + String out; + if (options[3] == 'n') { + out = ia.getHostAddress(); + } else { + out = ia.getCanonicalHostName(); + } + System.out.println(" " + + (first?"Addresses:":" ") + + " " + out); + first = false; + } + } else { + System.out.println(" [No host addresses info]"); + } + } } catch (RealmException e) { System.out.println("Error reading principal from "+ "the entry."); @@ -295,7 +319,7 @@ public class Klist { */ void printHelp() { System.out.println("\nUsage: klist " + - "[[-c] [-f] [-e]] [-k [-t] [-K]] [name]"); + "[[-c] [-f] [-e] [-a [-n]]] [-k [-t] [-K]] [name]"); System.out.println(" name\t name of credentials cache or " + " keytab with the prefix. File-based cache or " + "keytab's prefix is FILE:."); @@ -305,6 +329,8 @@ public class Klist { System.out.println(" options for credentials caches:"); System.out.println("\t-f \t shows credentials flags"); System.out.println("\t-e \t shows the encryption type"); + System.out.println("\t-a \t shows addresses"); + System.out.println("\t -n \t do not reverse-resolve addresses"); System.out.println(" options for keytabs:"); System.out.println("\t-t \t shows keytab entry timestamps"); System.out.println("\t-K \t shows keytab entry key value"); diff --git a/jdk/src/windows/lib/tzmappings b/jdk/src/windows/lib/tzmappings index a45200b7596..ec2732f64fb 100644 --- a/jdk/src/windows/lib/tzmappings +++ b/jdk/src/windows/lib/tzmappings @@ -82,8 +82,8 @@ GMT:0,1::Europe/London: GMT Standard Time:0,1::Europe/London: Ekaterinburg:10,11::Asia/Yekaterinburg: Ekaterinburg Standard Time:10,11::Asia/Yekaterinburg: -West Asia:10,11::Asia/Karachi: -West Asia Standard Time:10,11::Asia/Karachi: +West Asia:10,11:UZ:Asia/Tashkent: +West Asia Standard Time:10,11:UZ:Asia/Tashkent: Central Asia:12,13::Asia/Dhaka: Central Asia Standard Time:12,13::Asia/Dhaka: N. Central Asia Standard Time:12,13::Asia/Novosibirsk: @@ -146,8 +146,8 @@ South Africa:4,69::Africa/Harare: South Africa Standard Time:4,69::Africa/Harare: Atlantic:40,41::America/Halifax: Atlantic Standard Time:40,41::America/Halifax: -SA Eastern:42,43::America/Buenos_Aires: -SA Eastern Standard Time:42,43::America/Buenos_Aires: +SA Eastern:42,43:GF:America/Cayenne: +SA Eastern Standard Time:42,43:GF:America/Cayenne: Mid-Atlantic:44,45::Atlantic/South_Georgia: Mid-Atlantic Standard Time:44,45::Atlantic/South_Georgia: Azores:46,47::Atlantic/Azores: @@ -160,21 +160,28 @@ New Zealand Standard Time:78,79::Pacific/Auckland: Tonga Standard Time:78,79::Pacific/Tongatapu: Arabian:8,9::Asia/Muscat: Arabian Standard Time:8,9::Asia/Muscat: -Caucasus:8,9::GMT+0400: -Caucasus Standard Time:8,9::GMT+0400: +Caucasus:8,9:AM:Asia/Yerevan: +Caucasus Standard Time:8,9:AM:Asia/Yerevan: GMT Standard Time:88,89::GMT: Greenwich:88,89::GMT: Greenwich Standard Time:88,89::GMT: -Central Brazilian Standard Time:900,900:BR:America/Manaus: -Central Standard Time (Mexico):901,901::America/Mexico_City: -Georgian Standard Time:902,902:GE:Asia/Tbilisi: -Mountain Standard Time (Mexico):903,903:MX:America/Chihuahua: -Namibia Standard Time:904,904:NA:Africa/Windhoek: -Pacific Standard Time (Mexico):905,905:MX:America/Tijuana: -Western Brazilian Standard Time:906,906:BR:America/Rio_Branco: -Azerbaijan Standard Time:907,907:AZ:Asia/Baku: -Jordan Standard Time:908,908:JO:Asia/Amman: -Middle East Standard Time:909,909:LB:Asia/Beirut: -Armenian Standard Time:910,910:AM:Asia/Yerevan: -Montevideo Standard Time:911,911:UY:America/Montevideo: -Venezuela Standard Time:912,912::America/Caracas: +Argentina Standard Time:900,900::America/Buenos_Aires: +Azerbaijan Standard Time:901,901:AZ:Asia/Baku: +Central Brazilian Standard Time:902,902:BR:America/Manaus: +Central Standard Time (Mexico):903,903::America/Mexico_City: +Georgian Standard Time:904,904:GE:Asia/Tbilisi: +Jordan Standard Time:905,905:JO:Asia/Amman: +Mauritius Standard Time:906,906:MU:Indian/Mauritius: +Middle East Standard Time:907,907:LB:Asia/Beirut: +Montevideo Standard Time:908,908:UY:America/Montevideo: +Morocco Standard Time:909,909:MA:Africa/Casablanca: +Mountain Standard Time (Mexico):910,910:MX:America/Chihuahua: +Namibia Standard Time:911,911:NA:Africa/Windhoek: +Pacific Standard Time (Mexico):912,912:MX:America/Tijuana: +Pakistan Standard Time:913,913::Asia/Karachi: +UTC:914,914::UTC: +Venezuela Standard Time:915,915::America/Caracas: +Kamchatka Standard Time:916,916:RU:Asia/Kamchatka: +Paraguay Standard Time:917,917:PY:America/Asuncion: +Western Brazilian Standard Time:918,918:BR:America/Rio_Branco: +Armenian Standard Time:919,919:AM:Asia/Yerevan: diff --git a/jdk/src/windows/native/sun/font/fontpath.c b/jdk/src/windows/native/sun/font/fontpath.c index 2fd3c3af9be..2ed94b95113 100644 --- a/jdk/src/windows/native/sun/font/fontpath.c +++ b/jdk/src/windows/native/sun/font/fontpath.c @@ -28,12 +28,12 @@ #include #include -#include +#include #define BSIZE (max(512, MAX_PATH+1)) -JNIEXPORT jstring JNICALL Java_sun_font_FontManager_getFontPath(JNIEnv *env, jclass obj, jboolean noType1) +JNIEXPORT jstring JNICALL Java_sun_awt_Win32FontManager_getFontPath(JNIEnv *env, jobject thiz, jboolean noType1) { char windir[BSIZE]; char sysdir[BSIZE]; @@ -68,15 +68,6 @@ JNIEXPORT jstring JNICALL Java_sun_font_FontManager_getFontPath(JNIEnv *env, jcl return JNU_NewStringPlatform(env, fontpath); } -/* This isn't used on windows, the implementation is added in case shared - * code accidentally calls this method to prevent an UnsatisfiedLinkError - */ -JNIEXPORT void JNICALL Java_sun_font_FontManager_setNativeFontPath -(JNIEnv *env, jclass obj, jstring theString) -{ - return; -} - /* The code below is used to obtain information from the windows font APIS * and registry on which fonts are available and what font files hold those * fonts. The results are used to speed font lookup. @@ -546,7 +537,7 @@ static void registerFontW(GdiFontMapInfo *fmi, jobject fontToFileMap, * use it for lookups to reduce or avoid the need to search font files. */ JNIEXPORT void JNICALL -Java_sun_font_FontManager_populateFontFileNameMap +Java_sun_awt_Win32FontManager_populateFontFileNameMap0 (JNIEnv *env, jclass obj, jobject fontToFileMap, jobject fontToFamilyMap, jobject familyToFontListMap, jobject locale) { diff --git a/jdk/src/windows/native/sun/windows/ShellFolder2.cpp b/jdk/src/windows/native/sun/windows/ShellFolder2.cpp index 64eea69bced..353e47cffb3 100644 --- a/jdk/src/windows/native/sun/windows/ShellFolder2.cpp +++ b/jdk/src/windows/native/sun/windows/ShellFolder2.cpp @@ -256,7 +256,6 @@ JNIEXPORT void JNICALL Java_sun_awt_shell_Win32ShellFolderManager2_uninitializeC static IShellIcon* getIShellIcon(IShellFolder* pIShellFolder) { // http://msdn.microsoft.com/library/en-us/shellcc/platform/Shell/programmersguide/shell_int/shell_int_programming/std_ifaces.asp HRESULT hres; - HICON hIcon = NULL; IShellIcon* pIShellIcon; if (pIShellFolder != NULL) { hres = pIShellFolder->QueryInterface(IID_IShellIcon, (void**)&pIShellIcon); @@ -965,89 +964,40 @@ JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconBits /* * Class: sun_awt_shell_Win32ShellFolder2 - * Method: getFileChooserBitmapBits - * Signature: ()[I + * Method: getStandardViewButton0 + * Signature: (I)[I */ -JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getFileChooserBitmapBits - (JNIEnv* env, jclass cls) +JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getStandardViewButton0 + (JNIEnv* env, jclass cls, jint iconIndex) { - HBITMAP hBitmap = NULL; - BITMAP bm; - HINSTANCE libComCtl32; - HINSTANCE libShell32; + jintArray result = NULL; - libShell32 = LoadLibrary(TEXT("shell32.dll")); - if (libShell32 != NULL) { - hBitmap = (HBITMAP)LoadImage(libShell32, - IS_WINVISTA ? TEXT("IDB_TB_SH_DEF_16") : MAKEINTRESOURCE(216), - IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); + // Create a toolbar + HWND hWndToolbar = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL, + 0, 0, 0, 0, 0, + NULL, NULL, NULL, NULL); - if (hBitmap == NULL) { - // version of shell32.dll doesn't match OS version. - // So we either are in a Vista Compatibility Mode - // or shell32.dll was copied from OS of another version - hBitmap = (HBITMAP)LoadImage(libShell32, - IS_WINVISTA ? MAKEINTRESOURCE(216) : TEXT("IDB_TB_SH_DEF_16"), - IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); + if (hWndToolbar != NULL) { + SendMessage(hWndToolbar, TB_LOADIMAGES, (WPARAM)IDB_VIEW_SMALL_COLOR, (LPARAM)HINST_COMMCTRL); + + HIMAGELIST hImageList = (HIMAGELIST) SendMessage(hWndToolbar, TB_GETIMAGELIST, 0, 0); + + if (hImageList != NULL) { + HICON hIcon = ImageList_GetIcon(hImageList, iconIndex, ILD_TRANSPARENT); + + if (hIcon != NULL) { + result = Java_sun_awt_shell_Win32ShellFolder2_getIconBits(env, cls, ptr_to_jlong(hIcon), 16); + + DestroyIcon(hIcon); + } + + ImageList_Destroy(hImageList); } - } - if (hBitmap == NULL) { - libComCtl32 = LoadLibrary(TEXT("comctl32.dll")); - if (libComCtl32 != NULL) { - hBitmap = (HBITMAP)LoadImage(libComCtl32, MAKEINTRESOURCE(124), - IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); - } - } - if (hBitmap == NULL) { - return NULL; + + DestroyWindow(hWndToolbar); } - GetObject(hBitmap, sizeof(bm), (LPSTR)&bm); - - // Get the screen DC - HDC dc = GetDC(NULL); - if (dc == NULL) { - return NULL; - } - - // Set up BITMAPINFO - BITMAPINFO bmi; - memset(&bmi, 0, sizeof(BITMAPINFO)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = bm.bmWidth; - bmi.bmiHeader.biHeight = -bm.bmHeight; - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 32; - bmi.bmiHeader.biCompression = BI_RGB; - // Extract the color bitmap - int numPixels = bm.bmWidth * bm.bmHeight; - //long colorBits[192 * 16]; - long *colorBits = (long*)safe_Malloc(numPixels * sizeof(long)); - if (GetDIBits(dc, hBitmap, 0, bm.bmHeight, colorBits, &bmi, DIB_RGB_COLORS) == 0) { - return NULL; - } - - // Release DC - ReleaseDC(NULL, dc); - - // The color of the first pixel defines the transparency, according - // to the documentation for LR_LOADTRANSPARENT at - // http://msdn.microsoft.com/library/psdk/winui/resource_9fhi.htm - long transparent = colorBits[0]; - for (int i=0; i < numPixels; i++) { - if (colorBits[i] != transparent) { - colorBits[i] |= 0xff000000; - } - } - - // Create java array - jintArray bits = env->NewIntArray(numPixels); - // Copy values to java array - env->SetIntArrayRegion(bits, 0, numPixels, colorBits); - // Fix 4745575 GDI Resource Leak - ::DeleteObject(hBitmap); - ::FreeLibrary(libComCtl32); - return bits; + return result; } /* diff --git a/jdk/src/windows/native/sun/windows/awt_Dialog.cpp b/jdk/src/windows/native/sun/windows/awt_Dialog.cpp index 147bcf711eb..c0637237da4 100644 --- a/jdk/src/windows/native/sun/windows/awt_Dialog.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Dialog.cpp @@ -364,6 +364,7 @@ void AwtDialog::Show() if (locationByPlatform) { moveToDefaultLocation(); } + EnableTranslucency(TRUE); if (IsFocusableWindow() && (IsAutoRequestFocus() || IsFocusedWindowModalBlocker())) { ::ShowWindow(GetHWnd(), SW_SHOW); } else { diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.cpp b/jdk/src/windows/native/sun/windows/awt_Frame.cpp index 6e2ec9c0ff7..7d48921bab8 100644 --- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp @@ -690,6 +690,8 @@ AwtFrame::Show() if (locationByPlatform) { moveToDefaultLocation(); } + EnableTranslucency(TRUE); + BOOL autoRequestFocus = IsAutoRequestFocus(); if (m_iconic) { diff --git a/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp b/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp index 150ff8f075c..1842ce6c51b 100644 --- a/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp @@ -25,6 +25,7 @@ #include #include +#include #include "awt_Canvas.h" #include "awt_Win32GraphicsDevice.h" #include "Devices.h" @@ -173,14 +174,14 @@ Java_sun_awt_Win32GraphicsEnvironment_getDefaultScreen(JNIEnv *env, } /* - * Class: sun_awt_Win32GraphicsEnvironment + * Class: sun_awt_Win32FontManager * Method: registerFontWithPlatform * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL -Java_sun_awt_Win32GraphicsEnvironment_registerFontWithPlatform(JNIEnv *env, - jclass cl, - jstring fontName) +Java_sun_awt_Win32FontManager_registerFontWithPlatform(JNIEnv *env, + jclass cl, + jstring fontName) { LPTSTR file = (LPTSTR)JNU_GetStringPlatformChars(env, fontName, JNI_FALSE); if (file) { @@ -191,16 +192,16 @@ Java_sun_awt_Win32GraphicsEnvironment_registerFontWithPlatform(JNIEnv *env, /* - * Class: sun_awt_Win32GraphicsEnvironment + * Class: sun_awt_Win32FontManagerEnvironment * Method: deRegisterFontWithPlatform * Signature: (Ljava/lang/String;)V * * This method intended for future use. */ JNIEXPORT void JNICALL -Java_sun_awt_Win32GraphicsEnvironment_deRegisterFontWithPlatform(JNIEnv *env, - jclass cl, - jstring fontName) +Java_sun_awt_Win32FontManager_deRegisterFontWithPlatform(JNIEnv *env, + jclass cl, + jstring fontName) { LPTSTR file = (LPTSTR)JNU_GetStringPlatformChars(env, fontName, JNI_FALSE); if (file) { @@ -223,7 +224,7 @@ Java_sun_awt_Win32GraphicsEnvironment_deRegisterFontWithPlatform(JNIEnv *env, JNIEXPORT jstring JNICALL -Java_sun_awt_Win32GraphicsEnvironment_getEUDCFontFile(JNIEnv *env, jclass cl) { +Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) { int rc; HKEY key; DWORD type; diff --git a/jdk/src/windows/native/sun/windows/awt_Window.cpp b/jdk/src/windows/native/sun/windows/awt_Window.cpp index f10c9055d15..4c902c3fb47 100644 --- a/jdk/src/windows/native/sun/windows/awt_Window.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp @@ -218,12 +218,7 @@ AwtWindow::~AwtWindow() if (warningString != NULL) { delete [] warningString; } - ::EnterCriticalSection(&contentBitmapCS); - if (hContentBitmap != NULL) { - ::DeleteObject(hContentBitmap); - hContentBitmap = NULL; - } - ::LeaveCriticalSection(&contentBitmapCS); + DeleteContentBitmap(); ::DeleteCriticalSection(&contentBitmapCS); } @@ -372,6 +367,10 @@ MsgRouting AwtWindow::WmWindowPosChanged(LPARAM windowPos) { } } + if (wp->flags & SWP_HIDEWINDOW) { + EnableTranslucency(FALSE); + } + return mrDoDefault; } @@ -1130,6 +1129,8 @@ void AwtWindow::Show() moveToDefaultLocation(); } + EnableTranslucency(TRUE); + // The following block exists to support Menu/Tooltip animation for // Swing programs in a way which avoids introducing any new public api into // AWT or Swing. @@ -2494,27 +2495,73 @@ void AwtWindow::RedrawWindow() } } -void AwtWindow::SetTranslucency(BYTE opacity, BOOL opaque) +// Deletes the hContentBitmap if it is non-null +void AwtWindow::DeleteContentBitmap() { - BYTE old_opacity = getOpacity(); - BOOL old_opaque = isOpaque(); + ::EnterCriticalSection(&contentBitmapCS); + if (hContentBitmap != NULL) { + ::DeleteObject(hContentBitmap); + hContentBitmap = NULL; + } + ::LeaveCriticalSection(&contentBitmapCS); +} + +// The effects are enabled only upon showing the window. +// See 6780496 for details. +void AwtWindow::EnableTranslucency(BOOL enable) +{ + if (enable) { + SetTranslucency(getOpacity(), isOpaque(), FALSE, TRUE); + } else { + SetTranslucency(0xFF, TRUE, FALSE); + } +} + +/** + * Sets the translucency effects. + * + * This method is used to: + * + * 1. Apply the translucency effects upon showing the window + * (setValues == FALSE, useDefaultForOldValues == TRUE); + * 2. Turn off the effects upon hiding the window + * (setValues == FALSE, useDefaultForOldValues == FALSE); + * 3. Set the effects per user's request + * (setValues == TRUE, useDefaultForOldValues == FALSE); + * + * In case #3 the effects may or may not be applied immediately depending on + * the current visibility status of the window. + * + * The setValues argument indicates if we need to preserve the passed values + * in local fields for further use. + * The useDefaultForOldValues argument indicates whether we should consider + * the window as if it has not any effects applied at the moment. + */ +void AwtWindow::SetTranslucency(BYTE opacity, BOOL opaque, BOOL setValues, + BOOL useDefaultForOldValues) +{ + BYTE old_opacity = useDefaultForOldValues ? 0xFF : getOpacity(); + BOOL old_opaque = useDefaultForOldValues ? TRUE : isOpaque(); if (opacity == old_opacity && opaque == old_opaque) { return; } - setOpacity(opacity); - setOpaque(opaque); + if (setValues) { + m_opacity = opacity; + m_opaque = opaque; + } + + // If we're invisible and are storing the values, return + // Otherwise, apply the effects immediately + if (!IsVisible() && setValues) { + return; + } HWND hwnd = GetHWnd(); if (opaque != old_opaque) { - ::EnterCriticalSection(&contentBitmapCS); - if (hContentBitmap != NULL) { - ::DeleteObject(hContentBitmap); - hContentBitmap = NULL; - } - ::LeaveCriticalSection(&contentBitmapCS); + DeleteContentBitmap(); } if (opaque && opacity == 0xff) { @@ -2634,9 +2681,7 @@ void AwtWindow::UpdateWindow(JNIEnv* env, jintArray data, int width, int height, } ::EnterCriticalSection(&contentBitmapCS); - if (hContentBitmap != NULL) { - ::DeleteObject(hContentBitmap); - } + DeleteContentBitmap(); hContentBitmap = hBitmap; contentWidth = width; contentHeight = height; diff --git a/jdk/src/windows/native/sun/windows/awt_Window.h b/jdk/src/windows/native/sun/windows/awt_Window.h index 3edd39ed030..1d238b44dac 100644 --- a/jdk/src/windows/native/sun/windows/awt_Window.h +++ b/jdk/src/windows/native/sun/windows/awt_Window.h @@ -262,32 +262,29 @@ private: // from its hierarchy when shown. Currently applied to instances of // javax/swing/Popup$HeavyWeightWindow class. + // SetTranslucency() is the setter for the following two fields BYTE m_opacity; // The opacity level. == 0xff by default (when opacity mode is disabled) BOOL m_opaque; // Whether the window uses the perpixel translucency (false), or not (true). inline BYTE getOpacity() { return m_opacity; } - inline void setOpacity(BYTE opacity) { - m_opacity = opacity; - } inline BOOL isOpaque() { return m_opaque; } - inline void setOpaque(BOOL opaque) { - m_opaque = opaque; - } CRITICAL_SECTION contentBitmapCS; HBITMAP hContentBitmap; UINT contentWidth; UINT contentHeight; - void SetTranslucency(BYTE opacity, BOOL opaque); + void SetTranslucency(BYTE opacity, BOOL opaque, BOOL setValues = TRUE, + BOOL useDefaultForOldValues = FALSE); void UpdateWindow(int width, int height, HBITMAP hBitmap); void UpdateWindowImpl(int width, int height, HBITMAP hBitmap); void RedrawWindow(); + void DeleteContentBitmap(); static UINT untrustedWindowsCounter; @@ -352,6 +349,8 @@ protected: UINT currentWmSizeState; + void EnableTranslucency(BOOL enable); + private: int m_screenNum; diff --git a/jdk/test/com/sun/java/swing/plaf/windows/Test6824600.java b/jdk/test/com/sun/java/swing/plaf/windows/Test6824600.java new file mode 100644 index 00000000000..183bec947e9 --- /dev/null +++ b/jdk/test/com/sun/java/swing/plaf/windows/Test6824600.java @@ -0,0 +1,70 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + @bug 6824600 + @summary OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style) + @author Pavel Porvatov + @run main Test6824600 +*/ + +import com.sun.java.swing.plaf.windows.DesktopProperty; + +import java.awt.*; + +public class Test6824600 { + public static void main(String[] args) throws Exception { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + + HackedDesktopProperty desktopProperty = new HackedDesktopProperty("Button.background", null); + + // Register listener in toolkit + desktopProperty.getValueFromDesktop(); + + int length = toolkit.getPropertyChangeListeners().length; + + // Make several invocations + desktopProperty.getValueFromDesktop(); + desktopProperty.getValueFromDesktop(); + + desktopProperty.invalidate(); + + desktopProperty.getValueFromDesktop(); + desktopProperty.getValueFromDesktop(); + + if (length != toolkit.getPropertyChangeListeners().length) { + throw new RuntimeException("New listeners were added into Toolkit"); + } + } + + public static class HackedDesktopProperty extends DesktopProperty { + public HackedDesktopProperty(String key, Object fallback) { + super(key, fallback); + } + + // Publish the method + public Object getValueFromDesktop() { + return super.getValueFromDesktop(); + } + } +} diff --git a/jdk/test/com/sun/jdi/BadHandshakeTest.java b/jdk/test/com/sun/jdi/BadHandshakeTest.java index a0fba898f0b..d5ecd0a73b8 100644 --- a/jdk/test/com/sun/jdi/BadHandshakeTest.java +++ b/jdk/test/com/sun/jdi/BadHandshakeTest.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 6306165 + * @bug 6306165 6432567 * @summary Check that a bad handshake doesn't cause a debuggee to abort * * @build VMConnection BadHandshakeTest Exit0 diff --git a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh new file mode 100644 index 00000000000..74106760c79 --- /dev/null +++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh @@ -0,0 +1,128 @@ +#!/bin/sh + +# +# Copyright 2009 Sun Microsystems, Inc. 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# @test +# @bug 6862295 +# @summary Verify breakpoints still work after a full GC. +# @author dcubed (based on the test program posted to the following +# Eclipse thread https://bugs.eclipse.org/bugs/show_bug.cgi?id=279137) +# +# @run shell BreakpointWithFullGC.sh + +compileOptions=-g +# Hijacking the mode parameter to make sure we use a small amount +# of memory and can see what GC is doing. +mode="-Xmx32m -verbose:gc" +# Force use of a GC framework collector to see the original failure. +#mode="$mode -XX:+UseSerialGC" + +# Uncomment this to see the JDI trace +#jdbOptions=-dbgtrace + +createJavaFile() +{ + cat < $1.java.1 + +import java.util.ArrayList; +import java.util.List; + +public class $1 { + public static List objList = new ArrayList(); + + private static void init(int numObjs) { + for (int i = 0; i < numObjs; i++) { + objList.add(new Object()); + } + } + + public static void main(String[] args) { + for (int i = 0; i < 10; i++) { + System.out.println("top of loop"); // @1 breakpoint + init(1000000); + objList.clear(); + System.out.println("bottom of loop"); // @1 breakpoint + } + System.out.println("end of test"); // @1 breakpoint + } +} + +EOF +} + +# This is called to feed cmds to jdb. +dojdbCmds() +{ + setBkpts @1 + + # get to the first loop breakpoint + runToBkpt + # 19 "cont" commands gets us through all the loop breakpoints. + # Use for-loop instead of while-loop to avoid creating processes + # for '[' and 'expr'. + for ii in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; do + contToBkpt + done + # get to the last breakpoint + contToBkpt +} + + +mysetup() +{ + if [ -z "$TESTSRC" ] ; then + TESTSRC=. + fi + + for ii in . $TESTSRC $TESTSRC/.. ; do + if [ -r "$ii/ShellScaffold.sh" ] ; then + . $ii/ShellScaffold.sh + break + fi + done +} + +# You could replace this next line with the contents +# of ShellScaffold.sh and this script will run just the same. +mysetup + +runit + +# make sure we hit the first breakpoint at least once +jdbFailIfNotPresent 'System\..*top of loop' + +# make sure we hit the second breakpoint at least once +jdbFailIfNotPresent 'System\..*bottom of loop' + +# make sure we hit the last breakpoint +jdbFailIfNotPresent 'System\..*end of test' + +# make sure we had at least one full GC +debuggeeFailIfNotPresent 'Full GC' + +# check for error message due to thread ID change +debuggeeFailIfPresent \ + 'Exception in thread "event-handler" java.lang.NullPointerException' + +pass diff --git a/jdk/test/com/sun/jdi/ShellScaffold.sh b/jdk/test/com/sun/jdi/ShellScaffold.sh index a133a8673bb..0ca14814e6c 100644 --- a/jdk/test/com/sun/jdi/ShellScaffold.sh +++ b/jdk/test/com/sun/jdi/ShellScaffold.sh @@ -193,11 +193,17 @@ findPid() { # Return 0 if $1 is the pid of a running process. if [ -z "$isWin98" ] ; then - # Never use plain 'ps', which requires a "controlling terminal" - # and will fail with a "ps: no controlling terminal" error. - # Running under 'rsh' will cause this ps error. - # cygwin ps puts an I in column 1 for some reason. - $psCmd -e | $grep '^I* *'"$1 " > $devnull 2>&1 + if [ "$osname" = SunOS ] ; then + #Solaris and OpenSolaris use pgrep and not ps in psCmd + findPidCmd="$psCmd" + else + # Never use plain 'ps', which requires a "controlling terminal" + # and will fail with a "ps: no controlling terminal" error. + # Running under 'rsh' will cause this ps error. + # cygwin ps puts an I in column 1 for some reason. + findPidCmd="$psCmd -e" + fi + $findPidCmd | $grep '^I* *'"$1 " > $devnull 2>&1 return $? fi @@ -292,7 +298,17 @@ EOF # On linux, core files take a long time, and can leave # zombie processes if [ "$osname" = SunOS ] ; then - psCmd="/usr/ucb/ps -axwww" + #Experiments show Solaris '/usr/ucb/ps -axwww' and + #'/usr/bin/pgrep -f -l' provide the same small amount of the + #argv string (PRARGSZ=80 in /usr/include/sys/procfs.h) + # 1) This seems to have been working OK in ShellScaffold. + # 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep + # instead + #The alternative would be to use /usr/bin/pargs [pid] to get + #all the args for a process, splice them back into one + #long string, then grep. + UU=`/usr/bin/id -un` + psCmd="pgrep -f -l -U $UU" else ulimit -c 0 # See bug 6238593. diff --git a/jdk/test/java/awt/font/TextLayout/TestSinhalaChar.java b/jdk/test/java/awt/font/TextLayout/TestSinhalaChar.java new file mode 100644 index 00000000000..9d0539d775f --- /dev/null +++ b/jdk/test/java/awt/font/TextLayout/TestSinhalaChar.java @@ -0,0 +1,70 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +/* @test @(#)TestSinhalaChar.java + * @summary verify lack of crash on U+0DDD. + * @bug 6795060 + */ + +import javax.swing.*; +import javax.swing.border.LineBorder; +import java.awt.*; +import java.awt.event.ActionEvent; + +public class TestSinhalaChar { + public static void main(String[] args) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + new TestSinhalaChar().run(); + } + }); + } + public static boolean AUTOMATIC_TEST=true; // true; run test automatically, else manually at button push + + private void run() { + JFrame frame = new JFrame("Test Character (no crash = PASS)"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel panel = new JPanel(); + final JLabel label = new JLabel("(empty)"); + label.setSize(400, 100); + label.setBorder(new LineBorder(Color.black)); + label.setFont(new Font("Lucida Bright", Font.PLAIN, 12)); + if(AUTOMATIC_TEST) { /* run the test automatically (else, manually) */ + label.setText(Character.toString('\u0DDD')); + } else { + JButton button = new JButton("Set Char x0DDD"); + button.addActionListener(new AbstractAction() { + public void actionPerformed(ActionEvent actionEvent) { + label.setText(Character.toString('\u0DDD')); + } + }); + panel.add(button); + } + panel.add(label); + + frame.getContentPane().add(panel); + frame.pack(); + frame.setVisible(true); + } +} + diff --git a/jdk/test/java/awt/print/PageFormat/PageFormatFromAttributes.java b/jdk/test/java/awt/print/PageFormat/PageFormatFromAttributes.java new file mode 100644 index 00000000000..e965982b8d3 --- /dev/null +++ b/jdk/test/java/awt/print/PageFormat/PageFormatFromAttributes.java @@ -0,0 +1,96 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 4500750 6848799 + * @summary Tests creating page format from attributes + * @run main PageFormatFromAttributes + */ +import java.awt.print.*; +import javax.print.*; +import javax.print.attribute.*; +import javax.print.attribute.standard.*; + +public class PageFormatFromAttributes { + + public static void main(String args[]) { + PrinterJob job = PrinterJob.getPrinterJob(); + PrintService service = job.getPrintService(); + if (service == null) { + return; // No printers + } + PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); + test(job, MediaSizeName.ISO_A4, OrientationRequested.PORTRAIT); + test(job, MediaSizeName.ISO_A4, OrientationRequested.LANDSCAPE); + test(job, MediaSizeName.ISO_A4, + OrientationRequested.REVERSE_LANDSCAPE); + test(job, MediaSizeName.ISO_A3, OrientationRequested.PORTRAIT); + test(job, MediaSizeName.NA_LETTER, OrientationRequested.PORTRAIT); + test(job, MediaSizeName.NA_LETTER, OrientationRequested.LANDSCAPE); + test(job, MediaSizeName.NA_LEGAL, OrientationRequested.PORTRAIT); + } + + static void test(PrinterJob job, + MediaSizeName media, OrientationRequested orient) { + + PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); + aset.add(media); + aset.add(orient); + + PrintService service = job.getPrintService(); + if (!service.isAttributeValueSupported(media, null, aset) || + !service.isAttributeValueSupported(orient, null, aset)) { + return; // Can't test this case. + } + PageFormat pf = job.getPageFormat(aset); + boolean ok = true; + switch (pf.getOrientation()) { + case PageFormat.PORTRAIT : + ok = orient == OrientationRequested.PORTRAIT; + break; + case PageFormat.LANDSCAPE : + ok = orient == OrientationRequested.LANDSCAPE; + break; + case PageFormat.REVERSE_LANDSCAPE : + ok = orient == OrientationRequested.REVERSE_LANDSCAPE; + break; + } + if (!ok) { + throw new RuntimeException("orientation not as specified"); + } + MediaSize mediaSize = MediaSize.getMediaSizeForName(media); + if (mediaSize == null) { + throw new RuntimeException("expected a media size"); + } + double units = Size2DSyntax.INCH/72.0; + int w = (int)(mediaSize.getX(1)/units); + int h = (int)(mediaSize.getY(1)/units); + Paper paper = pf.getPaper(); + int pw = (int)paper.getWidth(); + int ph = (int)paper.getHeight(); + if (pw != w || ph != h) { + throw new RuntimeException("size not as specified"); + } + } +} diff --git a/jdk/test/java/lang/Compare.java b/jdk/test/java/lang/Compare.java new file mode 100644 index 00000000000..ea2fa580653 --- /dev/null +++ b/jdk/test/java/lang/Compare.java @@ -0,0 +1,142 @@ +/* + * Copyright 2009 Google, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6582946 + * @summary Test the primitive wrappers compare and compareTo methods + */ + +import java.util.Random; + +public class Compare { + + final Random rnd = new Random(); + + boolean toBoolean(long x) { return x > 0; } + + void compareAll(long x, long y) { + check(Double.compare(x, y) == + Double.valueOf(x).compareTo(Double.valueOf(y))); + check(Float.compare(x, y) == + Float.valueOf(x).compareTo(Float.valueOf(y))); + check(Long.compare(x, y) == + Long.valueOf(x).compareTo(Long.valueOf(y))); + check(Integer.compare((int) x, (int) y) == + Integer.valueOf((int) x).compareTo(Integer.valueOf((int) y))); + check(Short.compare((short) x, (short) y) == + Short.valueOf((short) x).compareTo(Short.valueOf((short) y))); + check(Character.compare((char) x, (char) y) == + Character.valueOf((char) x).compareTo(Character.valueOf((char) y))); + check(Byte.compare((byte) x, (byte) y) == + Byte.valueOf((byte) x).compareTo(Byte.valueOf((byte) y))); + check(Boolean.compare(toBoolean(x), toBoolean(y)) == + Boolean.valueOf(toBoolean(x)).compareTo(Boolean.valueOf(toBoolean(y)))); + + check(Double.compare(x, y) == -Double.compare(y, x)); + check(Float.compare(x, y) == -Float.compare(y, x)); + check(Long.compare(x, y) == -Long.compare(y, x)); + check(Integer.compare((int) x, (int) y) == + -Integer.compare((int) y, (int) x)); + check(Short.compare((short) x, (short) y) == + -Short.compare((short) y, (short) x)); + check(Character.compare((char) x, (char) y) == + -Character.compare((char) y, (char) x)); + check(Byte.compare((byte) x, (byte) y) == + -Byte.compare((byte) y, (byte) x)); + + equal(Long.compare(x, y), + x < y ? -1 : x > y ? 1 : 0); + + { + int a = (int) x, b = (int) y; + equal(Integer.compare(a, b), + a < b ? -1 : a > b ? 1 : 0); + } + + { + short a = (short) x, b = (short) y; + equal(Short.compare(a, b), + a - b); + } + + { + char a = (char) x, b = (char) y; + equal(Character.compare(a, b), + a - b); + } + + { + byte a = (byte) x, b = (byte) y; + equal(Byte.compare(a, b), + a - b); + } + + { + boolean a = toBoolean(x), b = toBoolean(y); + equal(Boolean.compare(a, b), + a == b ? 0 : a ? 1 : -1); + } + } + + void test(String args[]) throws Exception { + long[] longs = { + Long.MIN_VALUE, + Integer.MIN_VALUE, + Short.MIN_VALUE, + Character.MIN_VALUE, + Byte.MIN_VALUE, + -1, 0, 1, + Byte.MAX_VALUE, + Character.MAX_VALUE, + Short.MAX_VALUE, + Integer.MAX_VALUE, + Long.MAX_VALUE, + rnd.nextLong(), + rnd.nextInt(), + }; + + for (long x : longs) { + for (long y : longs) { + compareAll(x, y); + } + } + } + + //--------------------- Infrastructure --------------------------- + volatile int passed = 0, failed = 0; + void pass() {passed++;} + void fail() {failed++; Thread.dumpStack();} + void fail(String msg) {System.err.println(msg); fail();} + void unexpected(Throwable t) {failed++; t.printStackTrace();} + void check(boolean cond) {if (cond) pass(); else fail();} + void equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) pass(); + else fail(x + " not equal to " + y);} + public static void main(String[] args) throws Throwable { + new Compare().instanceMain(args);} + public void instanceMain(String[] args) throws Throwable { + try {test(args);} catch (Throwable t) {unexpected(t);} + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new AssertionError("Some tests failed");} +} diff --git a/jdk/test/java/lang/HashCode.java b/jdk/test/java/lang/HashCode.java new file mode 100644 index 00000000000..6d62facea7b --- /dev/null +++ b/jdk/test/java/lang/HashCode.java @@ -0,0 +1,80 @@ +/* + * Copyright 2009 Google, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 4245470 + * @summary Test the primitive wrappers hashCode() + */ + +import java.util.Random; + +public class HashCode { + + final Random rnd = new Random(); + + void test(String args[]) throws Exception { + int[] ints = { + Integer.MIN_VALUE, + Short.MIN_VALUE, + Character.MIN_VALUE, + Byte.MIN_VALUE, + -1, 0, 1, + Byte.MAX_VALUE, + Character.MAX_VALUE, + Short.MAX_VALUE, + Integer.MAX_VALUE, + rnd.nextInt(), + }; + + for (int x : ints) { + check( new Long(x).hashCode() == (int)((long)x ^ (long)x>>>32)); + check(Long.valueOf(x).hashCode() == (int)((long)x ^ (long)x>>>32)); + check( new Integer(x).hashCode() == x); + check(Integer.valueOf(x).hashCode() == x); + check( new Short((short)x).hashCode() == (short) x); + check(Short.valueOf((short)x).hashCode() == (short) x); + check( new Character((char) x).hashCode() == (char) x); + check(Character.valueOf((char) x).hashCode() == (char) x); + check( new Byte((byte) x).hashCode() == (byte) x); + check(Byte.valueOf((byte) x).hashCode() == (byte) x); + } + } + + //--------------------- Infrastructure --------------------------- + volatile int passed = 0, failed = 0; + void pass() {passed++;} + void fail() {failed++; Thread.dumpStack();} + void fail(String msg) {System.err.println(msg); fail();} + void unexpected(Throwable t) {failed++; t.printStackTrace();} + void check(boolean cond) {if (cond) pass(); else fail();} + void equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) pass(); + else fail(x + " not equal to " + y);} + public static void main(String[] args) throws Throwable { + new HashCode().instanceMain(args);} + public void instanceMain(String[] args) throws Throwable { + try {test(args);} catch (Throwable t) {unexpected(t);} + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new AssertionError("Some tests failed");} +} diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java index 745fab468b9..afb8ea8210e 100644 --- a/jdk/test/java/lang/ProcessBuilder/Basic.java +++ b/jdk/test/java/lang/ProcessBuilder/Basic.java @@ -25,7 +25,7 @@ * @test * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689 * 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313 - * 6464154 6523983 6206031 4960438 6631352 6631966 + * 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958 * @summary Basic tests for Process and Environment Variable code * @run main/othervm Basic * @author Martin Buchholz @@ -302,6 +302,14 @@ public class Basic { printUTF8(val == null ? "null" : val); } else if (action.equals("System.getenv()")) { printUTF8(getenvAsString(System.getenv())); + } else if (action.equals("ArrayOOME")) { + Object dummy; + switch(new Random().nextInt(3)) { + case 0: dummy = new Integer[Integer.MAX_VALUE]; break; + case 1: dummy = new double[Integer.MAX_VALUE]; break; + case 2: dummy = new byte[Integer.MAX_VALUE][]; break; + default: throw new InternalError(); + } } else if (action.equals("pwd")) { printUTF8(new File(System.getProperty("user.dir")) .getCanonicalPath()); @@ -1472,6 +1480,22 @@ public class Basic { } } catch (Throwable t) { unexpected(t); } + //---------------------------------------------------------------- + // OOME in child allocating maximally sized array + // Test for hotspot/jvmti bug 6850957 + //---------------------------------------------------------------- + try { + List list = new ArrayList(javaChildArgs); + list.add(1, String.format("-XX:OnOutOfMemoryError=%s -version", + javaExe)); + list.add("ArrayOOME"); + ProcessResults r = run(new ProcessBuilder(list)); + check(r.out().contains("java.lang.OutOfMemoryError:")); + check(r.out().contains(javaExe)); + check(r.err().contains(System.getProperty("java.version"))); + equal(r.exitValue(), 1); + } catch (Throwable t) { unexpected(t); } + //---------------------------------------------------------------- // Windows has tricky semi-case-insensitive semantics //---------------------------------------------------------------- diff --git a/jdk/test/java/lang/reflect/Generics/Probe.java b/jdk/test/java/lang/reflect/Generics/Probe.java index 30d6f21e5a3..4d92aa884ad 100644 --- a/jdk/test/java/lang/reflect/Generics/Probe.java +++ b/jdk/test/java/lang/reflect/Generics/Probe.java @@ -23,11 +23,9 @@ /* * @test - * @bug 5003916 6704655 + * @bug 5003916 6704655 6873951 * @summary Testing parsing of signatures attributes of nested classes * @author Joseph D. Darcy - * @compile -source 1.5 Probe.java - * @run main Probe */ import java.lang.reflect.*; @@ -35,51 +33,35 @@ import java.lang.annotation.*; import java.util.*; import static java.util.Arrays.*; -@Classes(value={ - "java.util.concurrent.FutureTask", - "java.util.concurrent.ConcurrentHashMap$EntryIterator", - "java.util.concurrent.ConcurrentHashMap$KeyIterator", - "java.util.concurrent.ConcurrentHashMap$ValueIterator", - "java.util.AbstractList$ListItr", - "java.util.EnumMap$EntryIterator", - "java.util.EnumMap$KeyIterator", - "java.util.EnumMap$ValueIterator", - "java.util.IdentityHashMap$EntryIterator", - "java.util.IdentityHashMap$KeyIterator", - "java.util.IdentityHashMap$ValueIterator", - "java.util.WeakHashMap$EntryIterator", - "java.util.WeakHashMap$KeyIterator", - "java.util.WeakHashMap$ValueIterator", - "java.util.TreeMap$EntryIterator", - "java.util.TreeMap$KeyIterator", - "java.util.TreeMap$ValueIterator", - "java.util.HashMap$EntryIterator", - "java.util.HashMap$KeyIterator", - "java.util.HashMap$ValueIterator", - "java.util.LinkedHashMap$EntryIterator", - "java.util.LinkedHashMap$KeyIterator", - "java.util.LinkedHashMap$ValueIterator" - }, - sunClasses={ - "javax.crypto.SunJCE_c", - "javax.crypto.SunJCE_e", - "javax.crypto.SunJCE_f", - "javax.crypto.SunJCE_j", - "javax.crypto.SunJCE_k", - "javax.crypto.SunJCE_l" - }) +@Classes({"java.util.concurrent.FutureTask", + "java.util.concurrent.ConcurrentHashMap$EntryIterator", + "java.util.concurrent.ConcurrentHashMap$KeyIterator", + "java.util.concurrent.ConcurrentHashMap$ValueIterator", + "java.util.AbstractList$ListItr", + "java.util.EnumMap$EntryIterator", + "java.util.EnumMap$KeyIterator", + "java.util.EnumMap$ValueIterator", + "java.util.IdentityHashMap$EntryIterator", + "java.util.IdentityHashMap$KeyIterator", + "java.util.IdentityHashMap$ValueIterator", + "java.util.WeakHashMap$EntryIterator", + "java.util.WeakHashMap$KeyIterator", + "java.util.WeakHashMap$ValueIterator", + "java.util.TreeMap$EntryIterator", + "java.util.TreeMap$KeyIterator", + "java.util.TreeMap$ValueIterator", + "java.util.HashMap$EntryIterator", + "java.util.HashMap$KeyIterator", + "java.util.HashMap$ValueIterator", + "java.util.LinkedHashMap$EntryIterator", + "java.util.LinkedHashMap$KeyIterator", + "java.util.LinkedHashMap$ValueIterator"}) public class Probe { - public static void main (String[] args) throws Throwable { + public static void main (String... args) throws Throwable { Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class); List names = new ArrayList(asList(classesAnnotation.value())); - if (System.getProperty("java.runtime.name").startsWith("Java(TM)")) { - // Sun production JDK; test crypto classes too - for(String name: classesAnnotation.sunClasses()) - names.add(name); - } - int errs = 0; for(String name: names) { System.out.println("\nCLASS " + name); @@ -152,5 +134,4 @@ public class Probe { @Retention(RetentionPolicy.RUNTIME) @interface Classes { String [] value(); // list of classes to probe - String [] sunClasses(); // list of Sun-production JDK specific classes to probe } diff --git a/jdk/test/java/math/BigDecimal/DivideTests.java b/jdk/test/java/math/BigDecimal/DivideTests.java index 89692255edc..7d04a60ca4b 100644 --- a/jdk/test/java/math/BigDecimal/DivideTests.java +++ b/jdk/test/java/math/BigDecimal/DivideTests.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4851776 4907265 6177836 + * @bug 4851776 4907265 6177836 6876282 * @summary Some tests for the divide methods. * @author Joseph D. Darcy * @compile -source 1.5 DivideTests.java @@ -328,6 +328,35 @@ public class DivideTests { } } + // 6876282 + BigDecimal[][] testCases2 = { + // { dividend, divisor, expected quotient } + { new BigDecimal(3090), new BigDecimal(7), new BigDecimal(441) }, + { new BigDecimal("309000000000000000000000"), new BigDecimal("700000000000000000000"), + new BigDecimal(441) }, + { new BigDecimal("962.430000000000"), new BigDecimal("8346463.460000000000"), + new BigDecimal("0.000115309916") }, + { new BigDecimal("18446744073709551631"), new BigDecimal("4611686018427387909"), + new BigDecimal(4) }, + { new BigDecimal("18446744073709551630"), new BigDecimal("4611686018427387909"), + new BigDecimal(4) }, + { new BigDecimal("23058430092136939523"), new BigDecimal("4611686018427387905"), + new BigDecimal(5) }, + { new BigDecimal("-18446744073709551661"), new BigDecimal("-4611686018427387919"), + new BigDecimal(4) }, + { new BigDecimal("-18446744073709551660"), new BigDecimal("-4611686018427387919"), + new BigDecimal(4) }, + }; + + for (BigDecimal test[] : testCases2) { + BigDecimal quo = test[0].divide(test[1], RoundingMode.HALF_UP); + if (!quo.equals(test[2])) { + failures++; + System.err.println("Unexpected quotient from " + test[0] + " / " + test[1] + + " rounding mode HALF_UP" + + "; expected " + test[2] + " got " + quo); + } + } return failures; } diff --git a/jdk/test/java/net/Authenticator/B4933582.java b/jdk/test/java/net/Authenticator/B4933582.java index 1ea04ae08d3..aa41ce045ee 100644 --- a/jdk/test/java/net/Authenticator/B4933582.java +++ b/jdk/test/java/net/Authenticator/B4933582.java @@ -125,9 +125,16 @@ public class B4933582 implements HttpCallback { firstTime = args[0].equals ("first"); MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); - AuthCacheValue.setAuthCache (new CacheImpl()); + CacheImpl cache; try { - server = new HttpServer (new B4933582(), 1, 10, 5009); + if (firstTime) { + server = new HttpServer (new B4933582(), 1, 10, 0); + cache = new CacheImpl (server.getLocalPort()); + } else { + cache = new CacheImpl (); + server = new HttpServer(new B4933582(), 1, 10, cache.getPort()); + } + AuthCacheValue.setAuthCache (cache); System.out.println ("Server: listening on port: " + server.getLocalPort()); client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html"); } catch (Exception e) { @@ -172,8 +179,15 @@ public class B4933582 implements HttpCallback { static class CacheImpl extends AuthCacheImpl { HashMap map; + int port; // need to store the port number the server is using + CacheImpl () throws IOException { + this (-1); + } + + CacheImpl (int port) throws IOException { super(); + this.port = port; File src = new File ("cache.ser"); if (src.exists()) { ObjectInputStream is = new ObjectInputStream ( @@ -181,6 +195,8 @@ public class B4933582 implements HttpCallback { ); try { map = (HashMap)is.readObject (); + this.port = (Integer)is.readObject (); + System.out.println ("read port from file " + port); } catch (ClassNotFoundException e) { assert false; } @@ -192,6 +208,10 @@ public class B4933582 implements HttpCallback { setMap (map); } + int getPort () { + return port; + } + private void writeMap () { try { File dst = new File ("cache.ser"); @@ -203,6 +223,8 @@ public class B4933582 implements HttpCallback { new FileOutputStream (dst) ); os.writeObject(map); + os.writeObject(port); + System.out.println ("wrote port " + port); os.close(); } catch (IOException e) {} } diff --git a/jdk/test/java/net/Authenticator/B6870935.java b/jdk/test/java/net/Authenticator/B6870935.java new file mode 100644 index 00000000000..5afaed9d73b --- /dev/null +++ b/jdk/test/java/net/Authenticator/B6870935.java @@ -0,0 +1,262 @@ +/* + * Copyright 2001-2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/** + * @test + * @bug 6870935 + * @run main/othervm -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935 + */ + +import java.io.*; +import java.util.*; +import java.net.*; +import java.security.*; +import sun.net.www.*; + +/* This is one simple test of the RFC2617 digest authentication behavior + * It specifically tests that the client correctly checks the returned + * Authentication-Info header field from the server and throws an exception + * if the password is wrong + */ + +public class B6870935 { + + static char[] passwd = "password".toCharArray(); + static String username = "user"; + static String nonce = "abcdefghijklmnopqrstuvwxyz"; + static String realm = "wallyworld"; + static String uri = "http://www.ibm.com"; + static volatile boolean error = false; + + static class DigestServer extends Thread { + + ServerSocket s; + InputStream is; + OutputStream os; + int port; + + String reply1 = "HTTP/1.1 407 Proxy Authentication Required\r\n"+ + "Proxy-Authenticate: Digest realm=\""+realm+"\" domain=/ "+ + "nonce=\""+nonce+"\" qop=\"auth\"\r\n\r\n"; + + String reply2 = "HTTP/1.1 200 OK\r\n" + + "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" + + "Server: Apache/1.3.14 (Unix)\r\n" + + "Content-Type: text/html; charset=iso-8859-1\r\n" + + "Transfer-encoding: chunked\r\n\r\n"+ + "B\r\nHelloWorld1\r\n"+ + "B\r\nHelloWorld2\r\n"+ + "B\r\nHelloWorld3\r\n"+ + "B\r\nHelloWorld4\r\n"+ + "B\r\nHelloWorld5\r\n"+ + "0\r\n"+ + "Proxy-Authentication-Info: "; + + DigestServer (ServerSocket y) { + s = y; + port = s.getLocalPort(); + } + + public void run () { + try { + Socket s1 = s.accept (); + is = s1.getInputStream (); + os = s1.getOutputStream (); + is.read (); + os.write (reply1.getBytes()); + Thread.sleep (2000); + s1.close (); + + s1 = s.accept (); + is = s1.getInputStream (); + os = s1.getOutputStream (); + is.read (); + // need to get the cnonce out of the response + MessageHeader header = new MessageHeader (is); + String raw = header.findValue ("Proxy-Authorization"); + HeaderParser parser = new HeaderParser (raw); + String cnonce = parser.findValue ("cnonce"); + String cnstring = parser.findValue ("nc"); + String clientrsp = parser.findValue ("response"); + String expected = computeDigest( + true, username,passwd,realm, + "GET", uri, nonce, cnonce, cnstring + ); + if (!expected.equals(clientrsp)) { + s1.close (); + s.close (); + error = true; + return; + } + + String reply = reply2 + getAuthorization ( + realm, false, uri, "GET", cnonce, + cnstring, passwd, username + ) +"\r\n"; + os.write (reply.getBytes()); + Thread.sleep (2000); + s1.close (); + } + catch (Exception e) { + System.out.println (e); + e.printStackTrace(); + } + } + + private String getAuthorization (String realm, boolean isRequest, String uri, String method, String cnonce, String cnstring, char[] password, String username) { + String response; + + try { + response = computeDigest(isRequest, username,passwd,realm, + method, uri, nonce, cnonce, cnstring); + } catch (NoSuchAlgorithmException ex) { + return null; + } + + String value = "Digest" + + " qop=\"auth" + + "\", cnonce=\"" + cnonce + + "\", rspauth=\"" + response + + "\", nc=\"" + cnstring + "\""; + return (value+ "\r\n"); + } + + private String computeDigest( + boolean isRequest, String userName, char[] password, + String realm, String connMethod, + String requestURI, String nonceString, + String cnonce, String ncValue + ) throws NoSuchAlgorithmException + { + + String A1, HashA1; + + MessageDigest md = MessageDigest.getInstance("MD5"); + + { + A1 = userName + ":" + realm + ":"; + HashA1 = encode(A1, password, md); + } + + String A2; + if (isRequest) { + A2 = connMethod + ":" + requestURI; + } else { + A2 = ":" + requestURI; + } + String HashA2 = encode(A2, null, md); + String combo, finalHash; + + { /* RRC2617 when qop=auth */ + combo = HashA1+ ":" + nonceString + ":" + ncValue + ":" + + cnonce + ":auth:" +HashA2; + + } + finalHash = encode(combo, null, md); + return finalHash; + } + + private final static char charArray[] = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' + }; + + private String encode(String src, char[] passwd, MessageDigest md) { + md.update(src.getBytes()); + if (passwd != null) { + byte[] passwdBytes = new byte[passwd.length]; + for (int i=0; i>> 4) & 0xf); + res.append(charArray[hashchar]); + hashchar = (digest[i] & 0xf); + res.append(charArray[hashchar]); + } + return res.toString(); + } + } + + + static class MyAuthenticator extends Authenticator { + public MyAuthenticator () { + super (); + } + + public PasswordAuthentication getPasswordAuthentication () + { + return (new PasswordAuthentication (username, passwd)); + } + } + + + public static void main(String[] args) throws Exception { + int nLoops = 1; + int nSize = 10; + int port, n =0; + byte b[] = new byte[nSize]; + DigestServer server; + ServerSocket sock; + + try { + sock = new ServerSocket (0); + port = sock.getLocalPort (); + } + catch (Exception e) { + System.out.println ("Exception: " + e); + return; + } + + server = new DigestServer(sock); + server.start (); + + try { + + Authenticator.setDefault (new MyAuthenticator ()); + SocketAddress addr = new InetSocketAddress ("127.0.0.1", port); + Proxy proxy = new Proxy (Proxy.Type.HTTP, addr); + String s = "http://www.ibm.com"; + URL url = new URL(s); + java.net.URLConnection conURL = url.openConnection(proxy); + + InputStream in = conURL.getInputStream(); + int c; + while ((c = in.read ()) != -1) { + } + in.close (); + } + catch(IOException e) { + e.printStackTrace(); + error = true; + } + if (error) { + throw new RuntimeException ("Error in test"); + } + } +} diff --git a/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java b/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java index d24b03c79f3..7aa546a5cf3 100644 --- a/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java +++ b/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java @@ -27,7 +27,6 @@ * @summary Re-test IPv6 (and specifically MulticastSocket) with latest Linux & USAGI code */ import java.net.*; -import java.util.concurrent.*; import java.util.*; @@ -68,37 +67,61 @@ public class SetOutgoingIf { // We need 2 or more network interfaces to run the test // - List nics = new ArrayList(); + List netIfs = new ArrayList(); + int index = 1; for (NetworkInterface nic : Collections.list(NetworkInterface.getNetworkInterfaces())) { - if (!nic.isLoopback()) - nics.add(nic); + // we should use only network interfaces with multicast support which are in "up" state + if (!nic.isLoopback() && nic.supportsMulticast() && nic.isUp()) { + NetIf netIf = NetIf.create(nic); + + // now determine what (if any) type of addresses are assigned to this interface + for (InetAddress addr : Collections.list(nic.getInetAddresses())) { + if (addr instanceof Inet4Address) { + netIf.ipv4Address(true); + } else if (addr instanceof Inet6Address) { + netIf.ipv6Address(true); + } + } + if (netIf.ipv4Address() || netIf.ipv6Address()) { + netIf.index(index++); + netIfs.add(netIf); + debug("Using: " + nic); + } + } } - if (nics.size() <= 1) { + if (netIfs.size() <= 1) { System.out.println("Need 2 or more network interfaces to run. Bye."); return; } - // We will send packets to one ipv4, one ipv4-mapped, and one ipv6 + // We will send packets to one ipv4, and one ipv6 // multicast group using each network interface :- // 224.1.1.1 --| - // ::ffff:224.1.1.2 -----> using network interface #1 - // ff02::1:1 --| + // ff02::1:1 --|--> using network interface #1 // 224.1.2.1 --| - // ::ffff:224.1.2.2 -----> using network interface #2 - // ff02::1:2 --| + // ff02::1:2 --|--> using network interface #2 // and so on. // - List groups = new ArrayList(); - for (int i = 0; i < nics.size(); i++) { - InetAddress groupv4 = InetAddress.getByName("224.1." + (i+1) + ".1"); - InetAddress groupv4mapped = InetAddress.getByName("::ffff:224.1." + (i+1) + ".2"); - InetAddress groupv6 = InetAddress.getByName("ff02::1:" + (i+1)); - groups.add(groupv4); - groups.add(groupv4mapped); - groups.add(groupv6); + for (NetIf netIf : netIfs) { + int NetIfIndex = netIf.index(); + List groups = new ArrayList(); - // use a separated thread to send to those 3 groups - Thread sender = new Thread(new Sender(nics.get(i), groupv4, groupv4mapped, groupv6, PORT)); + if (netIf.ipv4Address()) { + InetAddress groupv4 = InetAddress.getByName("224.1." + NetIfIndex + ".1"); + groups.add(groupv4); + } + if (netIf.ipv6Address()) { + InetAddress groupv6 = InetAddress.getByName("ff02::1:" + NetIfIndex); + groups.add(groupv6); + } + + debug("Adding " + groups + " groups for " + netIf.nic().getName()); + netIf.groups(groups); + + // use a separated thread to send to those 2 groups + Thread sender = new Thread(new Sender(netIf, + groups, + PORT)); sender.setDaemon(true); // we want sender to stop when main thread exits sender.start(); } @@ -107,75 +130,135 @@ public class SetOutgoingIf { // from the expected network interface // byte[] buf = new byte[1024]; - for (InetAddress group : groups) { - MulticastSocket mcastsock = new MulticastSocket(PORT); - mcastsock.setSoTimeout(5000); // 5 second - DatagramPacket packet = new DatagramPacket(buf, 0, buf.length); + for (NetIf netIf : netIfs) { + NetworkInterface nic = netIf.nic(); + for (InetAddress group : netIf.groups()) { + MulticastSocket mcastsock = new MulticastSocket(PORT); + mcastsock.setSoTimeout(5000); // 5 second + DatagramPacket packet = new DatagramPacket(buf, 0, buf.length); - mcastsock.joinGroup(new InetSocketAddress(group, PORT), nics.get(groups.indexOf(group) / 3)); + // the interface supports the IP multicast group + debug("Joining " + group + " on " + nic.getName()); + mcastsock.joinGroup(new InetSocketAddress(group, PORT), nic); - try { - mcastsock.receive(packet); - } catch (Exception e) { - // test failed if any exception - throw new RuntimeException(e); + try { + mcastsock.receive(packet); + debug("received packet on " + packet.getAddress()); + } catch (Exception e) { + // test failed if any exception + throw new RuntimeException(e); + } + + // now check which network interface this packet comes from + NetworkInterface from = NetworkInterface.getByInetAddress(packet.getAddress()); + NetworkInterface shouldbe = nic; + if (!from.equals(shouldbe)) { + System.out.println("Packets on group " + + group + " should come from " + + shouldbe.getName() + ", but came from " + + from.getName()); + //throw new RuntimeException("Test failed."); + } + + mcastsock.leaveGroup(new InetSocketAddress(group, PORT), nic); } - - // now check which network interface this packet comes from - NetworkInterface from = NetworkInterface.getByInetAddress(packet.getAddress()); - NetworkInterface shouldbe = nics.get(groups.indexOf(group) / 3); - if (!from.equals(shouldbe)) { - System.out.println("Packets on group " - + group + " should come from " - + shouldbe.getName() + ", but came from " - + from.getName()); - //throw new RuntimeException("Test failed."); - } - - mcastsock.leaveGroup(new InetSocketAddress(group, PORT), nics.get(groups.indexOf(group) / 3)); } } + + private static boolean debug = true; + + static void debug(String message) { + if (debug) + System.out.println(message); + } } class Sender implements Runnable { - private NetworkInterface nic; - private InetAddress group1; - private InetAddress group2; - private InetAddress group3; + private NetIf netIf; + private List groups; private int port; - public Sender(NetworkInterface nic, - InetAddress groupv4, InetAddress groupv4mapped, InetAddress groupv6, - int port) { - this.nic = nic; - group1 = groupv4; - group2 = groupv4mapped; - group3 = groupv6; + public Sender(NetIf netIf, + List groups, + int port) { + this.netIf = netIf; + this.groups = groups; this.port = port; } public void run() { try { MulticastSocket mcastsock = new MulticastSocket(); - mcastsock.setNetworkInterface(nic); + mcastsock.setNetworkInterface(netIf.nic()); + List packets = new LinkedList(); byte[] buf = "hello world".getBytes(); - DatagramPacket packet1 = new DatagramPacket(buf, buf.length, - new InetSocketAddress(group1, port)); - DatagramPacket packet2 = new DatagramPacket(buf, buf.length, - new InetSocketAddress(group2, port)); - DatagramPacket packet3 = new DatagramPacket(buf, buf.length, - new InetSocketAddress(group3, port)); + for (InetAddress group : groups) { + packets.add(new DatagramPacket(buf, buf.length, new InetSocketAddress(group, port))); + } for (;;) { - mcastsock.send(packet1); - mcastsock.send(packet2); - mcastsock.send(packet3); + for (DatagramPacket packet : packets) + mcastsock.send(packet); - Thread.currentThread().sleep(1000); // sleep 1 second + Thread.sleep(1000); // sleep 1 second } } catch (Exception e) { throw new RuntimeException(e); } } } + +@SuppressWarnings("unchecked") +class NetIf { + private boolean ipv4Address; //false + private boolean ipv6Address; //false + private int index; + List groups = Collections.EMPTY_LIST; + private final NetworkInterface nic; + + private NetIf(NetworkInterface nic) { + this.nic = nic; + } + + static NetIf create(NetworkInterface nic) { + return new NetIf(nic); + } + + NetworkInterface nic() { + return nic; + } + + boolean ipv4Address() { + return ipv4Address; + } + + void ipv4Address(boolean ipv4Address) { + this.ipv4Address = ipv4Address; + } + + boolean ipv6Address() { + return ipv6Address; + } + + void ipv6Address(boolean ipv6Address) { + this.ipv6Address = ipv6Address; + } + + int index() { + return index; + } + + void index(int index) { + this.index = index; + } + + List groups() { + return groups; + } + + void groups(List groups) { + this.groups = groups; + } +} + diff --git a/jdk/test/java/net/ProxySelector/B6737819.java b/jdk/test/java/net/ProxySelector/B6737819.java new file mode 100644 index 00000000000..360f1ae4aef --- /dev/null +++ b/jdk/test/java/net/ProxySelector/B6737819.java @@ -0,0 +1,63 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +/* + * @test + * @bug 6737819 + * @summary sun.misc.net.DefaultProxySelector doesn't use proxy setting to localhost + */ + +import java.net.ProxySelector; +import java.net.Proxy; +import java.net.URI; + +public class B6737819 { + private static String[] uris = { + "http://localhost/index.html", + "http://127.0.0.1/index.html", + "http://127.2/index.html", + "http://[::1]/index.html" + }; + public static void main(String[] args) throws Exception { + System.setProperty("http.proxyHost", "myproxy"); + System.setProperty("http.proxyPort", "8080"); + ProxySelector sel = ProxySelector.getDefault(); + java.util.List l; + // Default value for http.nonProxyHots should exclude all this uris + // from going through the HTTP proxy + for (String s : uris) { + l = sel.select(new URI(s)); + if (l.size() == 1 && l.get(0).type() != Proxy.Type.DIRECT) { + throw new RuntimeException("ProxySelector returned the wrong proxy for " + s); + } + } + // Let's override the default nonProxyHosts and make sure we now get a + // HTTP proxy + System.setProperty("http.nonProxyHosts", ""); + for (String s : uris) { + l = sel.select(new URI(s)); + if (l.size() == 1 && l.get(0).type() != Proxy.Type.HTTP) { + throw new RuntimeException("ProxySelector returned the wrong proxy for " + s); + } + } + } +} diff --git a/jdk/test/java/nio/channels/Channels/Basic.java b/jdk/test/java/nio/channels/Channels/Basic.java index 3a931a3f4c5..bfa9f0d404e 100644 --- a/jdk/test/java/nio/channels/Channels/Basic.java +++ b/jdk/test/java/nio/channels/Channels/Basic.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 4417152 4481572 6248930 6725399 + * @bug 4417152 4481572 6248930 6725399 6884800 * @summary Test Channels basic functionality */ @@ -225,8 +225,7 @@ public class Basic { private static void testNewInputStream(File blah) throws Exception { FileInputStream fis = new FileInputStream(blah); FileChannel fc = fis.getChannel(); - ReadableByteChannel rbc = (ReadableByteChannel)fc; - InputStream is = Channels.newInputStream(rbc); + InputStream is = Channels.newInputStream(fc); int messageSize = message.length() * ITERATIONS * 3 + 1; byte bb[] = new byte[messageSize]; @@ -234,8 +233,13 @@ public class Basic { int totalRead = 0; while (bytesRead != -1) { totalRead += bytesRead; + long rem = Math.min(fc.size() - totalRead, (long)Integer.MAX_VALUE); + if (is.available() != (int)rem) + throw new RuntimeException("available not useful or not maximally useful"); bytesRead = is.read(bb, totalRead, messageSize - totalRead); } + if (is.available() != 0) + throw new RuntimeException("available() should return 0 at EOF"); String result = new String(bb, 0, totalRead, encoding); int len = message.length(); diff --git a/jdk/test/java/nio/file/FileStore/Basic.java b/jdk/test/java/nio/file/FileStore/Basic.java index 604795db435..85e6b992a57 100644 --- a/jdk/test/java/nio/file/FileStore/Basic.java +++ b/jdk/test/java/nio/file/FileStore/Basic.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 4313887 + * @bug 4313887 6873621 * @summary Unit test for java.nio.file.FileStore * @library .. */ @@ -67,6 +67,15 @@ public class Basic { * Test: File and FileStore attributes */ assertTrue(store1.supportsFileAttributeView("basic")); + assertTrue(store1.supportsFileAttributeView(BasicFileAttributeView.class)); + assertTrue(store1.supportsFileAttributeView("posix") == + store1.supportsFileAttributeView(PosixFileAttributeView.class)); + assertTrue(store1.supportsFileAttributeView("dos") == + store1.supportsFileAttributeView(DosFileAttributeView.class)); + assertTrue(store1.supportsFileAttributeView("acl") == + store1.supportsFileAttributeView(AclFileAttributeView.class)); + assertTrue(store1.supportsFileAttributeView("user") == + store1.supportsFileAttributeView(UserDefinedFileAttributeView.class)); /** * Test: Enumerate all FileStores diff --git a/jdk/test/java/nio/file/Files/WalkWithSecurity.java b/jdk/test/java/nio/file/Files/WalkWithSecurity.java new file mode 100644 index 00000000000..5b2ab564474 --- /dev/null +++ b/jdk/test/java/nio/file/Files/WalkWithSecurity.java @@ -0,0 +1,132 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6876541 + * @summary Test Files.walkFileTree in the presence of a security manager + * @build WalkWithSecurity + * @run main/othervm WalkWithSecurity grantAll.policy pass + * @run main/othervm WalkWithSecurity denyAll.policy fail + * @run main/othervm WalkWithSecurity grantTopOnly.policy top_only + */ + +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.io.IOException; + +public class WalkWithSecurity { + + public static void main(String[] args) throws IOException { + String policyFile = args[0]; + ExpectedResult expectedResult = ExpectedResult.valueOf(args[1].toUpperCase()); + + String here = System.getProperty("user.dir"); + String testSrc = System.getProperty("test.src"); + if (testSrc == null) + throw new RuntimeException("This test must be run by jtreg"); + Path dir = Paths.get(testSrc); + + // Sanity check the environment + if (Paths.get(here).isSameFile(dir)) + throw new RuntimeException("Working directory cannot be " + dir); + DirectoryStream stream = dir.newDirectoryStream(); + try { + if (!stream.iterator().hasNext()) + throw new RuntimeException(testSrc + " is empty"); + } finally { + stream.close(); + } + + // Install security manager with the given policy file + System.setProperty("java.security.policy", + dir.resolve(policyFile).toString()); + System.setSecurityManager(new SecurityManager()); + + // Walk the source tree + CountingVisitor visitor = new CountingVisitor(); + SecurityException exception = null; + try { + Files.walkFileTree(dir, visitor); + } catch (SecurityException se) { + exception = se; + } + + // Check result + switch (expectedResult) { + case PASS: + if (exception != null) { + exception.printStackTrace(); + throw new RuntimeException("SecurityException not expected"); + } + if (visitor.count() == 0) + throw new RuntimeException("No files visited"); + break; + case FAIL: + if (exception == null) + throw new RuntimeException("SecurityException expected"); + if (visitor.count() > 0) + throw new RuntimeException("Files were visited"); + break; + case TOP_ONLY: + if (exception != null) { + exception.printStackTrace(); + throw new RuntimeException("SecurityException not expected"); + } + if (visitor.count() == 0) + throw new RuntimeException("Starting file not visited"); + if (visitor.count() > 1) + throw new RuntimeException("More than starting file visited"); + break; + default: + throw new RuntimeException("Should not get here"); + } + } + + static enum ExpectedResult { + PASS, + FAIL, + TOP_ONLY; + } + + static class CountingVisitor extends SimpleFileVisitor { + private int count; + + int count() { + return count; + } + + @Override + public FileVisitResult preVisitDirectory(Path dir) { + System.out.println(dir); + count++; + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { + System.out.println(file); + count++; + return FileVisitResult.CONTINUE; + } + } +} diff --git a/jdk/test/java/nio/file/Files/denyAll.policy b/jdk/test/java/nio/file/Files/denyAll.policy new file mode 100644 index 00000000000..32500947791 --- /dev/null +++ b/jdk/test/java/nio/file/Files/denyAll.policy @@ -0,0 +1,3 @@ +// policy file that does not grant any permissions +grant { +}; diff --git a/jdk/test/java/nio/file/Files/grantAll.policy b/jdk/test/java/nio/file/Files/grantAll.policy new file mode 100644 index 00000000000..85bc0d0fb51 --- /dev/null +++ b/jdk/test/java/nio/file/Files/grantAll.policy @@ -0,0 +1,5 @@ +// policy file that grants read access to source directory and all descendants +grant { + permission java.io.FilePermission "${test.src}", "read"; + permission java.io.FilePermission "${test.src}${file.separator}-", "read"; +}; diff --git a/jdk/test/java/nio/file/Files/grantTopOnly.policy b/jdk/test/java/nio/file/Files/grantTopOnly.policy new file mode 100644 index 00000000000..fca1539416f --- /dev/null +++ b/jdk/test/java/nio/file/Files/grantTopOnly.policy @@ -0,0 +1,4 @@ +// policy file that grants read access to source directory +grant { + permission java.io.FilePermission "${test.src}", "read"; +}; diff --git a/jdk/test/java/util/Collection/BiggernYours.java b/jdk/test/java/util/Collection/BiggernYours.java index de3a417ecde..a9cb59c007d 100644 --- a/jdk/test/java/util/Collection/BiggernYours.java +++ b/jdk/test/java/util/Collection/BiggernYours.java @@ -178,6 +178,11 @@ public class BiggernYours { new ConcurrentLinkedQueue() { public int size() {return randomize(super.size());}}); +// testCollections( +// new LinkedTransferQueue(), +// new LinkedTransferQueue() { +// public int size() {return randomize(super.size());}}); + testCollections( new LinkedBlockingQueue(), new LinkedBlockingQueue() { diff --git a/jdk/test/java/util/Collection/IteratorAtEnd.java b/jdk/test/java/util/Collection/IteratorAtEnd.java index 985a006d878..ff8ae97c563 100644 --- a/jdk/test/java/util/Collection/IteratorAtEnd.java +++ b/jdk/test/java/util/Collection/IteratorAtEnd.java @@ -49,6 +49,7 @@ public class IteratorAtEnd { testCollection(new LinkedBlockingQueue()); testCollection(new ArrayBlockingQueue(100)); testCollection(new ConcurrentLinkedQueue()); +// testCollection(new LinkedTransferQueue()); testMap(new HashMap()); testMap(new Hashtable()); diff --git a/jdk/test/java/util/Collection/MOAT.java b/jdk/test/java/util/Collection/MOAT.java index d2b6b686903..0b4fc6a3f2c 100644 --- a/jdk/test/java/util/Collection/MOAT.java +++ b/jdk/test/java/util/Collection/MOAT.java @@ -76,6 +76,7 @@ public class MOAT { testCollection(new LinkedBlockingQueue(20)); testCollection(new LinkedBlockingDeque(20)); testCollection(new ConcurrentLinkedQueue()); +// testCollection(new LinkedTransferQueue()); testCollection(new ConcurrentSkipListSet()); testCollection(Arrays.asList(new Integer(42))); testCollection(Arrays.asList(1,2,3)); @@ -161,6 +162,7 @@ public class MOAT { equal(c.toString(),"[]"); equal(c.toArray().length, 0); equal(c.toArray(new Object[0]).length, 0); + check(c.toArray(new Object[]{42})[0] == null); Object[] a = new Object[1]; a[0] = Boolean.TRUE; equal(c.toArray(a), a); diff --git a/jdk/test/java/util/Collections/RacingCollections.java b/jdk/test/java/util/Collections/RacingCollections.java index 22f88675cd6..32e41cf8b14 100644 --- a/jdk/test/java/util/Collections/RacingCollections.java +++ b/jdk/test/java/util/Collections/RacingCollections.java @@ -234,6 +234,7 @@ public class RacingCollections { List> list = new ArrayList>(newConcurrentDeques()); list.add(new LinkedBlockingQueue(10)); +// list.add(new LinkedTransferQueue()); return list; } diff --git a/jdk/test/java/util/PriorityQueue/RemoveContains.java b/jdk/test/java/util/PriorityQueue/RemoveContains.java index e82e28d4b70..85c9d214c7f 100644 --- a/jdk/test/java/util/PriorityQueue/RemoveContains.java +++ b/jdk/test/java/util/PriorityQueue/RemoveContains.java @@ -69,6 +69,7 @@ public class RemoveContains { test(new ArrayBlockingQueue(10)); test(new LinkedBlockingQueue(10)); test(new LinkedBlockingDeque(10)); +// test(new LinkedTransferQueue()); test(new ArrayDeque(10)); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); diff --git a/jdk/make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/CustomUIDefault.java b/jdk/test/java/util/TimeZone/ListTimeZones.java similarity index 67% rename from jdk/make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/CustomUIDefault.java rename to jdk/test/java/util/TimeZone/ListTimeZones.java index 6d4740b8b2b..88e0e866ce2 100644 --- a/jdk/make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/CustomUIDefault.java +++ b/jdk/test/java/util/TimeZone/ListTimeZones.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2009 Sun Microsystems, Inc. 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 @@ -22,22 +22,24 @@ * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ -package org.jdesktop.synthdesigner.synthmodel; /** - * CustomUIDefault - * - * @author Richard Bair - * @author Jasper Potts + * @test + * @bug 6851214 + * @summary Allow 24:00 as a valid end/start DST time stamp + * @run main ListTimeZones */ -public class CustomUIDefault extends UIDefault { - private static int counter = -1; - public CustomUIDefault() { - super("Unnamed" + (++counter == 0 ? "" : counter), null); - } +import java.util.*; - public void setName(String id) { - super.setName(id); +public class ListTimeZones{ + public static void main(String[] args){ + Date date = new Date(); + String TimeZoneIds[] = TimeZone.getAvailableIDs(); + for(int i = 0; i < TimeZoneIds.length; i++){ + TimeZone tz = TimeZone.getTimeZone(TimeZoneIds[i]); + Calendar calendar = new GregorianCalendar(tz); + String calString = calendar.toString(); } + } } diff --git a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java index 42388add7ae..210f43c0d9d 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java @@ -75,10 +75,12 @@ public class CancelledProducerConsumerLoops { } static void oneRun(BlockingQueue q, int npairs, int iters) throws Exception { + if (print) + System.out.printf("%-18s", q.getClass().getSimpleName()); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(npairs * 2 + 1, timer); - Future[] prods = new Future[npairs]; - Future[] cons = new Future[npairs]; + Future[] prods = new Future[npairs]; + Future[] cons = new Future[npairs]; for (int i = 0; i < npairs; ++i) { prods[i] = pool.submit(new Producer(q, barrier, iters)); @@ -119,21 +121,13 @@ public class CancelledProducerConsumerLoops { static void oneTest(int pairs, int iters) throws Exception { - if (print) - System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(CAPACITY), pairs, iters); - - if (print) - System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(CAPACITY), pairs, iters); - - if (print) - System.out.print("SynchronousQueue "); + oneRun(new LinkedBlockingDeque(CAPACITY), pairs, iters); +// oneRun(new LinkedTransferQueue(), pairs, iters); oneRun(new SynchronousQueue(), pairs, iters / 8); /* PriorityBlockingQueue is unbounded - if (print) - System.out.print("PriorityBlockingQueue "); oneRun(new PriorityBlockingQueue(iters / 2 * pairs), pairs, iters / 4); */ } diff --git a/jdk/test/java/util/concurrent/BlockingQueue/Interrupt.java b/jdk/test/java/util/concurrent/BlockingQueue/Interrupt.java index 696b0960fc0..55589bb7391 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/Interrupt.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/Interrupt.java @@ -66,7 +66,8 @@ public class Interrupt { static void testQueue(final BlockingQueue q) { try { final BlockingDeque deq = - q instanceof BlockingDeque ? (BlockingDeque) q : null; + (q instanceof BlockingDeque) ? + (BlockingDeque) q : null; q.clear(); List fs = new ArrayList(); fs.add(new Fun() { void f() throws Throwable @@ -107,7 +108,10 @@ public class Interrupt { { deq.offerLast(1, 7, SECONDS); }}); } checkInterrupted(fs); - } catch (Throwable t) { unexpected(t); } + } catch (Throwable t) { + System.out.printf("Failed: %s%n", q.getClass().getSimpleName()); + unexpected(t); + } } private static void realMain(final String[] args) throws Throwable { diff --git a/jdk/test/java/util/concurrent/LinkedBlockingQueue/LastElement.java b/jdk/test/java/util/concurrent/BlockingQueue/LastElement.java similarity index 67% rename from jdk/test/java/util/concurrent/LinkedBlockingQueue/LastElement.java rename to jdk/test/java/util/concurrent/BlockingQueue/LastElement.java index 58918ee9972..a4c27872f34 100644 --- a/jdk/test/java/util/concurrent/LinkedBlockingQueue/LastElement.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/LastElement.java @@ -32,44 +32,18 @@ import java.util.*; import java.util.concurrent.*; public class LastElement { - static volatile int passed = 0, failed = 0; - - static void fail(String msg) { - failed++; - new Exception(msg).printStackTrace(); - } - - static void pass() { - passed++; - } - - static void unexpected(Throwable t) { - failed++; - t.printStackTrace(); - } - - static void check(boolean condition, String msg) { - if (condition) - passed++; - else - fail(msg); - } - - static void check(boolean condition) { - check(condition, "Assertion failure"); - } - - public static void main(String[] args) throws Throwable { + void test(String[] args) throws Throwable { testQueue(new LinkedBlockingQueue()); - // Uncomment when LinkedBlockingDeque is integrated - //testQueue(new LinkedBlockingDeque()); - testQueue(new ArrayBlockingQueue(10)); + testQueue(new LinkedBlockingDeque()); + testQueue(new ArrayBlockingQueue(10, true)); + testQueue(new ArrayBlockingQueue(10, false)); +// testQueue(new LinkedTransferQueue()); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new Exception("Some tests failed"); } - private static void testQueue(BlockingQueue q) throws Throwable { + void testQueue(BlockingQueue q) throws Throwable { Integer one = 1; Integer two = 2; Integer three = 3; @@ -102,4 +76,21 @@ public class LastElement { catch (Throwable t) {unexpected(t);} check(q.isEmpty() && q.size() == 0); } + + //--------------------- Infrastructure --------------------------- + volatile int passed = 0, failed = 0; + void pass() {passed++;} + void fail() {failed++; Thread.dumpStack();} + void fail(String msg) {System.err.println(msg); fail();} + void unexpected(Throwable t) {failed++; t.printStackTrace();} + void check(boolean cond) {if (cond) pass(); else fail();} + void equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) pass(); + else fail(x + " not equal to " + y);} + public static void main(String[] args) throws Throwable { + new LastElement().instanceMain(args);} + public void instanceMain(String[] args) throws Throwable { + try {test(args);} catch (Throwable t) {unexpected(t);} + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new AssertionError("Some tests failed");} } diff --git a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java index 53fc050d784..0e0fd82430e 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java @@ -77,6 +77,7 @@ public class MultipleProducersSingleConsumerLoops { print = true; for (int i = 1; i <= maxProducers; i += (i+1) >>> 1) { + System.out.println("----------------------------------------"); System.out.println("Producers:" + i); oneTest(i, iters); Thread.sleep(100); @@ -87,29 +88,20 @@ public class MultipleProducersSingleConsumerLoops { } static void oneTest(int producers, int iters) throws Exception { - if (print) - System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(CAPACITY), producers, iters); - - if (print) - System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(CAPACITY), producers, iters); + oneRun(new LinkedBlockingDeque(CAPACITY), producers, iters); +// oneRun(new LinkedTransferQueue(), producers, iters); // Don't run PBQ since can legitimately run out of memory // if (print) // System.out.print("PriorityBlockingQueue "); // oneRun(new PriorityBlockingQueue(), producers, iters); - if (print) - System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(), producers, iters); - if (print) - System.out.print("SynchronousQueue(fair) "); + System.out.println("fair implementations:"); oneRun(new SynchronousQueue(true), producers, iters); - - if (print) - System.out.print("ArrayBlockingQueue(fair)"); oneRun(new ArrayBlockingQueue(CAPACITY, true), producers, iters); } @@ -174,6 +166,8 @@ public class MultipleProducersSingleConsumerLoops { } static void oneRun(BlockingQueue q, int nproducers, int iters) throws Exception { + if (print) + System.out.printf("%-18s", q.getClass().getSimpleName()); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(nproducers + 2, timer); for (int i = 0; i < nproducers; ++i) { diff --git a/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java index eb85f7bb3ab..1721b916dce 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java @@ -34,81 +34,135 @@ /* * @test * @bug 6805775 6815766 + * @run main OfferDrainToLoops 300 * @summary Test concurrent offer vs. drainTo */ import java.util.*; import java.util.concurrent.*; +import java.util.concurrent.atomic.*; -@SuppressWarnings({"unchecked", "rawtypes"}) +@SuppressWarnings({"unchecked", "rawtypes", "deprecation"}) public class OfferDrainToLoops { + final long testDurationMillisDefault = 10L * 1000L; + final long testDurationMillis; + + OfferDrainToLoops(String[] args) { + testDurationMillis = (args.length > 0) ? + Long.valueOf(args[0]) : testDurationMillisDefault; + } + void checkNotContainsNull(Iterable it) { for (Object x : it) check(x != null); } - abstract class CheckedThread extends Thread { - abstract protected void realRun(); - public void run() { - try { realRun(); } catch (Throwable t) { unexpected(t); } - } - { - setDaemon(true); - start(); - } - } - void test(String[] args) throws Throwable { test(new LinkedBlockingQueue()); test(new LinkedBlockingQueue(2000)); test(new LinkedBlockingDeque()); test(new LinkedBlockingDeque(2000)); test(new ArrayBlockingQueue(2000)); +// test(new LinkedTransferQueue()); + } + + Random getRandom() { + return new Random(); + // return ThreadLocalRandom.current(); } void test(final BlockingQueue q) throws Throwable { System.out.println(q.getClass().getSimpleName()); - final long testDurationSeconds = 1L; - final long testDurationMillis = testDurationSeconds * 1000L; - final long quittingTimeNanos - = System.nanoTime() + testDurationSeconds * 1000L * 1000L * 1000L; + final long testDurationNanos = testDurationMillis * 1000L * 1000L; + final long quittingTimeNanos = System.nanoTime() + testDurationNanos; + final long timeoutMillis = 10L * 1000L; - Thread offerer = new CheckedThread() { + /** Poor man's bounded buffer. */ + final AtomicLong approximateCount = new AtomicLong(0L); + + abstract class CheckedThread extends Thread { + CheckedThread(String name) { + super(name); + setDaemon(true); + start(); + } + /** Polls for quitting time. */ + protected boolean quittingTime() { + return System.nanoTime() - quittingTimeNanos > 0; + } + /** Polls occasionally for quitting time. */ + protected boolean quittingTime(long i) { + return (i % 1024) == 0 && quittingTime(); + } + abstract protected void realRun(); + public void run() { + try { realRun(); } catch (Throwable t) { unexpected(t); } + } + } + + Thread offerer = new CheckedThread("offerer") { protected void realRun() { - for (long i = 0; ; i++) { - if ((i % 1024) == 0 && - System.nanoTime() - quittingTimeNanos > 0) - break; - while (! q.offer(i)) + long c = 0; + for (long i = 0; ! quittingTime(i); i++) { + if (q.offer(c)) { + if ((++c % 1024) == 0) { + approximateCount.getAndAdd(1024); + while (approximateCount.get() > 10000) + Thread.yield(); + } + } else { Thread.yield(); - }}}; + }}}}; - Thread drainer = new CheckedThread() { + Thread drainer = new CheckedThread("drainer") { protected void realRun() { - for (long i = 0; ; i++) { - if (System.nanoTime() - quittingTimeNanos > 0) - break; + final Random rnd = getRandom(); + while (! quittingTime()) { List list = new ArrayList(); - int n = q.drainTo(list); + int n = rnd.nextBoolean() ? + q.drainTo(list) : + q.drainTo(list, 100); + approximateCount.getAndAdd(-n); equal(list.size(), n); for (int j = 0; j < n - 1; j++) equal((Long) list.get(j) + 1L, list.get(j + 1)); Thread.yield(); - }}}; + } + q.clear(); + approximateCount.set(0); // Releases waiting offerer thread + }}; - Thread scanner = new CheckedThread() { + Thread scanner = new CheckedThread("scanner") { protected void realRun() { - for (long i = 0; ; i++) { - if (System.nanoTime() - quittingTimeNanos > 0) + final Random rnd = getRandom(); + while (! quittingTime()) { + switch (rnd.nextInt(3)) { + case 0: checkNotContainsNull(q); break; + case 1: q.size(); break; + case 2: + Long[] a = (Long[]) q.toArray(new Long[0]); + int n = a.length; + for (int j = 0; j < n - 1; j++) { + check(a[j] < a[j+1]); + check(a[j] != null); + } break; - checkNotContainsNull(q); + } Thread.yield(); }}}; - offerer.join(10 * testDurationMillis); - drainer.join(10 * testDurationMillis); - check(! offerer.isAlive()); - check(! drainer.isAlive()); + for (Thread thread : new Thread[] { offerer, drainer, scanner }) { + thread.join(timeoutMillis + testDurationMillis); + if (thread.isAlive()) { + System.err.printf("Hung thread: %s%n", thread.getName()); + failed++; + for (StackTraceElement e : thread.getStackTrace()) + System.err.println(e); + // Kludge alert + thread.stop(); + thread.join(timeoutMillis); + } + } } //--------------------- Infrastructure --------------------------- @@ -122,7 +176,7 @@ public class OfferDrainToLoops { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} public static void main(String[] args) throws Throwable { - new OfferDrainToLoops().instanceMain(args);} + new OfferDrainToLoops(args).instanceMain(args);} public void instanceMain(String[] args) throws Throwable { try {test(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); diff --git a/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java b/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java index be507061cda..9e47162c6c2 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java @@ -46,6 +46,7 @@ public class PollMemoryLeak { public static void main(String[] args) throws InterruptedException { final BlockingQueue[] qs = { new LinkedBlockingQueue(10), +// new LinkedTransferQueue(), new ArrayBlockingQueue(10), new SynchronousQueue(), new SynchronousQueue(true), diff --git a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java index 78869149a75..b40c49f3688 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java @@ -77,7 +77,8 @@ public class ProducerConsumerLoops { print = true; for (int i = 1; i <= maxPairs; i += (i+1) >>> 1) { - System.out.println("Pairs:" + i); + System.out.println("----------------------------------------"); + System.out.println("Pairs: " + i); oneTest(i, iters); Thread.sleep(100); } @@ -87,28 +88,17 @@ public class ProducerConsumerLoops { } static void oneTest(int pairs, int iters) throws Exception { - if (print) - System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(CAPACITY), pairs, iters); - - if (print) - System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(CAPACITY), pairs, iters); - - if (print) - System.out.print("PriorityBlockingQueue "); + oneRun(new LinkedBlockingDeque(CAPACITY), pairs, iters); +// oneRun(new LinkedTransferQueue(), pairs, iters); oneRun(new PriorityBlockingQueue(), pairs, iters); - - if (print) - System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(), pairs, iters); if (print) - System.out.print("SynchronousQueue(fair) "); - oneRun(new SynchronousQueue(true), pairs, iters); + System.out.println("fair implementations:"); - if (print) - System.out.print("ArrayBlockingQueue(fair)"); + oneRun(new SynchronousQueue(true), pairs, iters); oneRun(new ArrayBlockingQueue(CAPACITY, true), pairs, iters); } @@ -174,6 +164,8 @@ public class ProducerConsumerLoops { } static void oneRun(BlockingQueue q, int npairs, int iters) throws Exception { + if (print) + System.out.printf("%-18s", q.getClass().getSimpleName()); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(npairs * 2 + 1, timer); for (int i = 0; i < npairs; ++i) { diff --git a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java index b0fffbf5cf8..8c718b97602 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java @@ -63,7 +63,8 @@ public class SingleProducerMultipleConsumerLoops { print = true; for (int i = 1; i <= maxConsumers; i += (i+1) >>> 1) { - System.out.println("Consumers:" + i); + System.out.println("----------------------------------------"); + System.out.println("Consumers: " + i); oneTest(i, iters); Thread.sleep(100); } @@ -73,28 +74,15 @@ public class SingleProducerMultipleConsumerLoops { } static void oneTest(int consumers, int iters) throws Exception { - if (print) - System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(CAPACITY), consumers, iters); - - if (print) - System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(CAPACITY), consumers, iters); - - if (print) - System.out.print("PriorityBlockingQueue "); + oneRun(new LinkedBlockingDeque(CAPACITY), consumers, iters); +// oneRun(new LinkedTransferQueue(), consumers, iters); oneRun(new PriorityBlockingQueue(), consumers, iters); - - if (print) - System.out.print("SynchronousQueue "); oneRun(new SynchronousQueue(), consumers, iters); - if (print) - System.out.print("SynchronousQueue(fair) "); + System.out.println("fair implementations:"); oneRun(new SynchronousQueue(true), consumers, iters); - - if (print) - System.out.print("ArrayBlockingQueue(fair)"); oneRun(new ArrayBlockingQueue(CAPACITY, true), consumers, iters); } @@ -163,6 +151,8 @@ public class SingleProducerMultipleConsumerLoops { } static void oneRun(BlockingQueue q, int nconsumers, int iters) throws Exception { + if (print) + System.out.printf("%-18s", q.getClass().getSimpleName()); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(nconsumers + 2, timer); pool.execute(new Producer(q, barrier, iters * nconsumers)); diff --git a/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java b/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java index 73dfc65c768..9586d3d4a53 100644 --- a/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java @@ -60,20 +60,10 @@ public class ConcurrentQueueLoops { //queues.add(new ArrayBlockingQueue(count, true)); queues.add(new LinkedBlockingQueue()); queues.add(new LinkedBlockingDeque()); - - try { - queues.add((Queue) - Class.forName("java.util.concurrent.LinkedTransferQueue") - .newInstance()); - } catch (IllegalAccessException e) { - } catch (InstantiationException e) { - } catch (ClassNotFoundException e) { - // OK; not yet added to JDK - } +// queues.add(new LinkedTransferQueue()); // Following additional implementations are available from: // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html - // queues.add(new LinkedTransferQueue()); // queues.add(new SynchronizedLinkedListQueue()); // Avoid "first fast, second slow" benchmark effect. diff --git a/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java b/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java index 68e62734359..c2ade907e9e 100644 --- a/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java @@ -41,8 +41,9 @@ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.LinkedBlockingQueue; +// import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.PriorityBlockingQueue; import java.util.LinkedList; import java.util.PriorityQueue; @@ -69,20 +70,10 @@ public class GCRetention { queues.add(new PriorityBlockingQueue()); queues.add(new PriorityQueue()); queues.add(new LinkedList()); - - try { - queues.add((Queue) - Class.forName("java.util.concurrent.LinkedTransferQueue") - .newInstance()); - } catch (IllegalAccessException e) { - } catch (InstantiationException e) { - } catch (ClassNotFoundException e) { - // OK; not yet added to JDK - } +// queues.add(new LinkedTransferQueue()); // Following additional implementations are available from: // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html - // queues.add(new LinkedTransferQueue()); // queues.add(new SynchronizedLinkedListQueue()); // Avoid "first fast, second slow" benchmark effect. diff --git a/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java b/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java index 727f6495651..c767fa422ab 100644 --- a/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java @@ -49,6 +49,7 @@ public class IteratorWeakConsistency { test(new LinkedBlockingDeque()); test(new LinkedBlockingDeque(20)); test(new ConcurrentLinkedQueue()); +// test(new LinkedTransferQueue()); // Other concurrent queues (e.g. ArrayBlockingQueue) do not // currently have weakly consistent iterators. // test(new ArrayBlockingQueue(20)); diff --git a/jdk/test/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java b/jdk/test/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java new file mode 100644 index 00000000000..6051483f6c3 --- /dev/null +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java @@ -0,0 +1,174 @@ +/* + * Copyright 2005-2008 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6316155 6595669 6871697 6868712 + * @summary Test concurrent offer vs. remove + * @run main OfferRemoveLoops 300 + * @author Martin Buchholz + */ + +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; + +@SuppressWarnings({"unchecked", "rawtypes", "deprecation"}) +public class OfferRemoveLoops { + final long testDurationMillisDefault = 10L * 1000L; + final long testDurationMillis; + + OfferRemoveLoops(String[] args) { + testDurationMillis = (args.length > 0) ? + Long.valueOf(args[0]) : testDurationMillisDefault; + } + + void checkNotContainsNull(Iterable it) { + for (Object x : it) + check(x != null); + } + + void test(String[] args) throws Throwable { + testQueue(new LinkedBlockingQueue(10)); + testQueue(new LinkedBlockingQueue()); + testQueue(new LinkedBlockingDeque(10)); + testQueue(new LinkedBlockingDeque()); + testQueue(new ArrayBlockingQueue(10)); + testQueue(new PriorityBlockingQueue(10)); + testQueue(new ConcurrentLinkedQueue()); +// testQueue(new LinkedTransferQueue()); + } + + Random getRandom() { + return new Random(); + // return ThreadLocalRandom.current(); + } + + void testQueue(final Queue q) throws Throwable { + System.out.println(q.getClass().getSimpleName()); + final long testDurationNanos = testDurationMillis * 1000L * 1000L; + final long quittingTimeNanos = System.nanoTime() + testDurationNanos; + final long timeoutMillis = 10L * 1000L; + final int maxChunkSize = 1042; + final int maxQueueSize = 10 * maxChunkSize; + + /** Poor man's bounded buffer. */ + final AtomicLong approximateCount = new AtomicLong(0L); + + abstract class CheckedThread extends Thread { + CheckedThread(String name) { + super(name); + setDaemon(true); + start(); + } + /** Polls for quitting time. */ + protected boolean quittingTime() { + return System.nanoTime() - quittingTimeNanos > 0; + } + /** Polls occasionally for quitting time. */ + protected boolean quittingTime(long i) { + return (i % 1024) == 0 && quittingTime(); + } + abstract protected void realRun(); + public void run() { + try { realRun(); } catch (Throwable t) { unexpected(t); } + } + } + + Thread offerer = new CheckedThread("offerer") { + protected void realRun() { + final long chunkSize = getRandom().nextInt(maxChunkSize) + 2; + long c = 0; + for (long i = 0; ! quittingTime(i); i++) { + if (q.offer(Long.valueOf(c))) { + if ((++c % chunkSize) == 0) { + approximateCount.getAndAdd(chunkSize); + while (approximateCount.get() > maxQueueSize) + Thread.yield(); + } + } else { + Thread.yield(); + }}}}; + + Thread remover = new CheckedThread("remover") { + protected void realRun() { + final long chunkSize = getRandom().nextInt(maxChunkSize) + 2; + long c = 0; + for (long i = 0; ! quittingTime(i); i++) { + if (q.remove(Long.valueOf(c))) { + if ((++c % chunkSize) == 0) { + approximateCount.getAndAdd(-chunkSize); + } + } else { + Thread.yield(); + } + } + q.clear(); + approximateCount.set(0); // Releases waiting offerer thread + }}; + + Thread scanner = new CheckedThread("scanner") { + protected void realRun() { + final Random rnd = getRandom(); + while (! quittingTime()) { + switch (rnd.nextInt(3)) { + case 0: checkNotContainsNull(q); break; + case 1: q.size(); break; + case 2: checkNotContainsNull + (Arrays.asList(q.toArray(new Long[0]))); + break; + } + Thread.yield(); + }}}; + + for (Thread thread : new Thread[] { offerer, remover, scanner }) { + thread.join(timeoutMillis + testDurationMillis); + if (thread.isAlive()) { + System.err.printf("Hung thread: %s%n", thread.getName()); + failed++; + for (StackTraceElement e : thread.getStackTrace()) + System.err.println(e); + // Kludge alert + thread.stop(); + thread.join(timeoutMillis); + } + } + } + + //--------------------- Infrastructure --------------------------- + volatile int passed = 0, failed = 0; + void pass() {passed++;} + void fail() {failed++; Thread.dumpStack();} + void fail(String msg) {System.err.println(msg); fail();} + void unexpected(Throwable t) {failed++; t.printStackTrace();} + void check(boolean cond) {if (cond) pass(); else fail();} + void equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) pass(); + else fail(x + " not equal to " + y);} + public static void main(String[] args) throws Throwable { + new OfferRemoveLoops(args).instanceMain(args);} + public void instanceMain(String[] args) throws Throwable { + try {test(args);} catch (Throwable t) {unexpected(t);} + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new AssertionError("Some tests failed");} +} diff --git a/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java b/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java index f3e4ee9feb8..2019c658b7c 100644 --- a/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java +++ b/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java @@ -45,6 +45,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingQueue; +// import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.atomic.AtomicLong; import java.util.ArrayList; import java.util.Collection; @@ -66,20 +67,10 @@ public class RemovePollRace { queues.add(new ArrayBlockingQueue(count, true)); queues.add(new LinkedBlockingQueue()); queues.add(new LinkedBlockingDeque()); - - try { - queues.add((Queue) - Class.forName("java.util.concurrent.LinkedTransferQueue") - .newInstance()); - } catch (IllegalAccessException e) { - } catch (InstantiationException e) { - } catch (ClassNotFoundException e) { - // OK; not yet added to JDK - } +// queues.add(new LinkedTransferQueue()); // Following additional implementations are available from: // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html - // queues.add(new LinkedTransferQueue()); // queues.add(new SynchronizedLinkedListQueue()); // Avoid "first fast, second slow" benchmark effect. diff --git a/jdk/test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java b/jdk/test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java deleted file mode 100644 index fbd0070a7a7..00000000000 --- a/jdk/test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2005-2008 Sun Microsystems, Inc. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * @test - * @bug 6316155 6595669 - * @summary Test concurrent offer vs. remove - * @author Martin Buchholz - */ - -import java.util.*; -import java.util.concurrent.*; - -public class OfferRemoveLoops { - void test(String[] args) throws Throwable { - testQueue(new LinkedBlockingQueue(10)); - testQueue(new LinkedBlockingQueue()); - testQueue(new LinkedBlockingDeque(10)); - testQueue(new LinkedBlockingDeque()); - testQueue(new ArrayBlockingQueue(10)); - testQueue(new PriorityBlockingQueue(10)); - testQueue(new ConcurrentLinkedQueue()); - } - - abstract class CheckedThread extends Thread { - abstract protected void realRun(); - public void run() { - try { realRun(); } catch (Throwable t) { unexpected(t); } - } - } - - void testQueue(final Queue q) throws Throwable { - System.out.println(q.getClass().getSimpleName()); - final int count = 1000 * 1000; - final long testDurationSeconds = 1L; - final long testDurationMillis = testDurationSeconds * 1000L; - final long quittingTimeNanos - = System.nanoTime() + testDurationSeconds * 1000L * 1000L * 1000L; - Thread t1 = new CheckedThread() { - protected void realRun() { - for (int i = 0; i < count; i++) { - if ((i % 1024) == 0 && - System.nanoTime() - quittingTimeNanos > 0) - return; - while (! q.remove(String.valueOf(i))) - Thread.yield(); - }}}; - Thread t2 = new CheckedThread() { - protected void realRun() { - for (int i = 0; i < count; i++) { - if ((i % 1024) == 0 && - System.nanoTime() - quittingTimeNanos > 0) - return; - while (! q.offer(String.valueOf(i))) - Thread.yield(); - }}}; - t1.setDaemon(true); t2.setDaemon(true); - t1.start(); t2.start(); - t1.join(10 * testDurationMillis); - t2.join(10 * testDurationMillis); - check(! t1.isAlive()); - check(! t2.isAlive()); - } - - //--------------------- Infrastructure --------------------------- - volatile int passed = 0, failed = 0; - void pass() {passed++;} - void fail() {failed++; Thread.dumpStack();} - void fail(String msg) {System.err.println(msg); fail();} - void unexpected(Throwable t) {failed++; t.printStackTrace();} - void check(boolean cond) {if (cond) pass(); else fail();} - void equal(Object x, Object y) { - if (x == null ? y == null : x.equals(y)) pass(); - else fail(x + " not equal to " + y);} - public static void main(String[] args) throws Throwable { - new OfferRemoveLoops().instanceMain(args);} - public void instanceMain(String[] args) throws Throwable { - try {test(args);} catch (Throwable t) {unexpected(t);} - System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); - if (failed > 0) throw new AssertionError("Some tests failed");} -} diff --git a/jdk/test/javax/swing/JComponent/4337267/bug4337267.java b/jdk/test/javax/swing/JComponent/4337267/bug4337267.java new file mode 100644 index 00000000000..a3e3f24b0ad --- /dev/null +++ b/jdk/test/javax/swing/JComponent/4337267/bug4337267.java @@ -0,0 +1,254 @@ +/* + * @test + * @bug 4337267 + * @summary test that numeric shaping works in Swing components + * @author Sergey Groznyh + * @run main bug4337267 + */ + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.font.NumericShaper; +import java.awt.font.TextAttribute; +import java.awt.image.BufferedImage; +import javax.swing.BoxLayout; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +public class bug4337267 { + TestJPanel p1, p2; + TestBufferedImage i1, i2; + JComponent[] printq; + JFrame window; + static boolean testFailed = false; + static boolean done = false; + + String shaped = + "000 (E) 111 (A) \u0641\u0642\u0643 \u0662\u0662\u0662 (E) 333"; + String text = "000 (E) 111 (A) \u0641\u0642\u0643 222 (E) 333"; + + void run() { + initUI(); + testTextComponent(); + testNonTextComponentHTML(); + testNonTextComponentPlain(); + + doneTask(); + } + + void initUI() { + window = new JFrame("bug4337267"); + window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + window.setSize(800, 600); + Component content = createContentPane(); + window.add(content); + window.setVisible(true); + } + + Runnable printComponents = new Runnable() { + public void run() { + printComponent(printq[0], i1); + printComponent(printq[1], i2); + } + }; + + Runnable compareRasters = new Runnable() { + public void run() { + assertEquals(p1.image, p2.image); + assertEquals(i1, i2); + } + }; + + void doneTask() { + final Object monitor = this; + SwingUtilities.invokeLater(new Runnable() { + public void run() { + done = true; + synchronized(monitor) { + monitor.notify(); + } + } + }); + } + + + void fail(String message) { + testFailed = true; + throw new RuntimeException(message); + } + + void assertEquals(Object o1, Object o2) { + if ((o1 == null) && (o2 != null)) { + fail("Expected null, got " + o2); + } else if ((o1 != null) && (o2 == null)) { + fail("Expected " + o1 + ", got null"); + } else if (!o1.equals(o2)) { + fail("Expected " + o1 + ", got " + o2); + } + } + + void testTextComponent() { + System.out.println("testTextComponent:"); + JTextArea area1 = new JTextArea(); + injectComponent(p1, area1, false); + area1.setText(shaped); + JTextArea area2 = new JTextArea(); + injectComponent(p2, area2, true); + area2.setText(text); + window.repaint(); + printq = new JComponent[] { area1, area2 }; + SwingUtilities.invokeLater(printComponents); + SwingUtilities.invokeLater(compareRasters); + } + + void testNonTextComponentHTML() { + System.out.println("testNonTextComponentHTML:"); + JLabel label1 = new JLabel(); + injectComponent(p1, label1, false); + label1.setText("" + shaped); + JLabel label2 = new JLabel(); + injectComponent(p2, label2, true); + label2.setText("" + text); + window.repaint(); + printq = new JComponent[] { label1, label2 }; + SwingUtilities.invokeLater(printComponents); + SwingUtilities.invokeLater(compareRasters); + } + + void testNonTextComponentPlain() { + System.out.println("testNonTextComponentHTML:"); + JLabel label1 = new JLabel(); + injectComponent(p1, label1, false); + label1.setText(shaped); + JLabel label2 = new JLabel(); + injectComponent(p2, label2, true); + label2.setText(text); + window.repaint(); + printq = new JComponent[] { label1, label2 }; + SwingUtilities.invokeLater(printComponents); + SwingUtilities.invokeLater(compareRasters); + } + + void setShaping(JComponent c) { + c.putClientProperty(TextAttribute.NUMERIC_SHAPING, + NumericShaper.getContextualShaper(NumericShaper.ARABIC)); + } + + void injectComponent(JComponent p, JComponent c, boolean shape) { + if (shape) { + setShaping(c); + } + p.removeAll(); + p.add(c); + } + + void printComponent(JComponent c, TestBufferedImage i) { + Graphics g = i.getGraphics(); + g.setColor(c.getBackground()); + g.fillRect(0, 0, i.getWidth(), i.getHeight()); + c.print(g); + } + + Component createContentPane() { + Dimension size = new Dimension(500, 100); + i1 = new TestBufferedImage(size.width, size.height, + BufferedImage.TYPE_INT_ARGB); + i2 = new TestBufferedImage(size.width, size.height, + BufferedImage.TYPE_INT_ARGB); + p1 = new TestJPanel(); + p1.setPreferredSize(size); + p2 = new TestJPanel(); + p2.setPreferredSize(size); + JPanel panel = new JPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.add(p1); + panel.add(p2); + + return panel; + } + + static class TestBufferedImage extends BufferedImage { + int MAX_GLITCHES = 0; + + TestBufferedImage(int width, int height, int imageType) { + super(width, height, imageType); + } + + @Override + public boolean equals(Object other) { + if (! (other instanceof TestBufferedImage)) { + return false; + } + TestBufferedImage image2 = (TestBufferedImage) other; + int width = getWidth(); + int height = getHeight(); + if ((image2.getWidth() != width) || (image2.getHeight() != height)) { + return false; + } + int glitches = 0; + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + int rgb1 = getRGB(x, y); + int rgb2 = image2.getRGB(x, y); + if (rgb1 != rgb2) { + //System.out.println(x+" "+y+" "+rgb1+" "+rgb2); + glitches++; + } + } + } + return glitches <= MAX_GLITCHES; + } + } + + static class TestJPanel extends JPanel { + TestBufferedImage image = createImage(new Dimension(1, 1)); + + TestBufferedImage createImage(Dimension d) { + return new TestBufferedImage(d.width, d.height, + BufferedImage.TYPE_INT_ARGB); + } + + public void setPreferredSize(Dimension size) { + super.setPreferredSize(size); + image = createImage(size); + } + + public void paint(Graphics g) { + Graphics g0 = image.getGraphics(); + super.paint(g0); + g.drawImage(image, 0, 0, this); + } + } + + + + public static void main(String[] args) throws Throwable { + final bug4337267 test = new bug4337267(); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + test.run(); + } + }); + + synchronized(test) { + while (!done) { + try { + test.wait(); + } catch (InterruptedException ex) { + // do nothing + } + } + } + + if (testFailed) { + throw new RuntimeException("FAIL"); + } + + System.out.println("OK"); + } +} diff --git a/jdk/test/javax/swing/JFileChooser/6484091/bug6484091.java b/jdk/test/javax/swing/JFileChooser/6484091/bug6484091.java new file mode 100644 index 00000000000..bad995f9da2 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/6484091/bug6484091.java @@ -0,0 +1,61 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6484091 + * @summary FileSystemView leaks directory info + * @author Pavel Porvatov + @run main bug6484091 + */ + +import javax.swing.filechooser.FileSystemView; +import java.io.File; +import java.security.AccessControlException; + +public class bug6484091 { + public static void main(String[] args) { + File dir = FileSystemView.getFileSystemView().getDefaultDirectory(); + + printDirContent(dir); + + System.setSecurityManager(new SecurityManager()); + + // The next test cases use 'dir' obtained without SecurityManager + + try { + printDirContent(dir); + + throw new RuntimeException("Dir content was derived bypass SecurityManager"); + } catch (AccessControlException e) { + // It's a successful situation + } + } + + private static void printDirContent(File dir) { + System.out.println("Files in " + dir.getAbsolutePath() + ":"); + + for (File file : dir.listFiles()) { + System.out.println(file.getName()); + } + } +} diff --git a/jdk/test/javax/swing/JFileChooser/6489130/bug6489130.java b/jdk/test/javax/swing/JFileChooser/6489130/bug6489130.java new file mode 100644 index 00000000000..684d691fedc --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/6489130/bug6489130.java @@ -0,0 +1,96 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6489130 + * @summary FileChooserDemo hung by keeping pressing Enter key + * @author Pavel Porvatov + @run main bug6489130 + */ + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +public class bug6489130 { + private final JFileChooser chooser = new JFileChooser(); + + private static final CountDownLatch MUX = new CountDownLatch(1); + + private final Timer timer = new Timer(1000, new ActionListener() { + public void actionPerformed(ActionEvent e) { + switch (state) { + case 0: + case 1: { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + chooser.showOpenDialog(null); + } + }); + + break; + } + + case 2: + case 3: { + Window[] windows = Frame.getWindows(); + + if (windows.length > 0) { + windows[0].dispose(); + } + + break; + } + + case 4: { + MUX.countDown(); + + break; + } + } + + state++; + } + }); + + private int state = 0; + + public static void main(String[] args) throws InterruptedException { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + new bug6489130().run(); + } + }); + + if (!MUX.await(10, TimeUnit.SECONDS)) { + throw new RuntimeException("Timeout"); + } + } + + private void run() { + timer.start(); + } +} diff --git a/jdk/test/javax/swing/JFileChooser/6840086/bug6840086.java b/jdk/test/javax/swing/JFileChooser/6840086/bug6840086.java new file mode 100644 index 00000000000..bdd012f4cf3 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/6840086/bug6840086.java @@ -0,0 +1,66 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + @bug 6840086 + @summary JFileChooser lacks icons on top right when running on Windows 7 + @author Pavel Porvatov + @run main bug6840086 +*/ + +import sun.awt.OSInfo; +import sun.awt.shell.ShellFolder; + +import java.awt.*; + +public class bug6840086 { + private static final String[] KEYS = { + "fileChooserIcon ListView", + "fileChooserIcon ViewMenu", + "fileChooserIcon DetailsView", + "fileChooserIcon UpFolder", + "fileChooserIcon NewFolder", + }; + + public static void main(String[] args) { + if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) { + System.out.println("The test was skipped because it is sensible only for Windows."); + + return; + } + + for (String key : KEYS) { + Image image = (Image) ShellFolder.get(key); + + if (image == null) { + throw new RuntimeException("The image '" + key + "' not found."); + } + + if (image != ShellFolder.get(key)) { + throw new RuntimeException("The image '" + key + "' is not cached."); + } + } + + System.out.println("The test passed."); + } +} diff --git a/jdk/test/javax/swing/JLayer/6824395/bug6824395.java b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java new file mode 100644 index 00000000000..28858c98bf0 --- /dev/null +++ b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java @@ -0,0 +1,80 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + + /* + * @test + * @summary Checks that JLayer inside JViewport works is correctly laid out + * @author Alexander Potochkin + * @run main bug6824395 + */ + + +import sun.awt.SunToolkit; + +import javax.swing.*; +import javax.swing.plaf.LayerUI; +import java.awt.*; + +public class bug6824395 { + + static JScrollPane scrollPane; + + public static void main(String[] args) throws Exception { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + JFrame frame = new JFrame("testing"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JEditorPane editorPane = new JEditorPane(); + String str = "hello\n"; + for(int i = 0; i<5; i++) { + str += str; + } + + editorPane.setText(str); + + JLayer editorPaneLayer = new JLayer(editorPane); + LayerUI layerUI = new LayerUI(); + editorPaneLayer.setUI(layerUI); + + scrollPane = new JScrollPane(editorPaneLayer); + + scrollPane.setPreferredSize(new Dimension(200, 250)); + frame.add(scrollPane); + + frame.setSize(200, 200); + frame.pack(); + frame.setVisible(true); + } + }); + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) { + throw new RuntimeException("Wrong component's width!"); + } + } + }); + } +} diff --git a/jdk/test/javax/swing/JLayer/6872503/bug6872503.java b/jdk/test/javax/swing/JLayer/6872503/bug6872503.java new file mode 100644 index 00000000000..875ba4fd2d6 --- /dev/null +++ b/jdk/test/javax/swing/JLayer/6872503/bug6872503.java @@ -0,0 +1,135 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6872503 + * @summary Checks that JLayer correctly works with its AWTEventListener + * @author Alexander Potochkin + */ + +import javax.swing.*; +import java.awt.*; +import java.awt.event.AWTEventListener; +import java.awt.event.AWTEventListenerProxy; + +public class bug6872503 { + + static JLayer l1; + static JLayer l2; + + private static void createGui() { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + int length = toolkit.getAWTEventListeners().length; + + l1 = new JLayer(); + l1.setLayerEventMask(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK); + + l2 = new JLayer(); + l2.setLayerEventMask(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK); + + if (isLayerEventControllerAdded()) { + throw new RuntimeException("Unexpected AWTEventListener was added"); + } + + JFrame frame = new JFrame(); + frame.setLayout(new FlowLayout()); + frame.add(l1); + frame.add(l2); + + if (isLayerEventControllerAdded()) { + throw new RuntimeException("Unexpected AWTEventListener was added"); + } + + frame.pack(); + + if (!isLayerEventControllerAdded()) { + throw new RuntimeException("AWTEventListener was not added"); + } + + if (!layerEventControllerMaskEquals(l1.getLayerEventMask() | l2.getLayerEventMask())) { + throw new RuntimeException("Wrong mask for AWTEventListener"); + } + + frame.dispose(); + + if (isLayerEventControllerAdded()) { + throw new RuntimeException("Unexpected AWTEventListener was added"); + } + } + + static boolean isLayerEventControllerAdded() { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + AWTEventListener layerEventController = null; + for (AWTEventListener listener : toolkit.getAWTEventListeners()) { + if (listener instanceof AWTEventListenerProxy) { + listener = ((AWTEventListenerProxy)listener).getListener(); + + } + if ("LayerEventController".equals(listener.getClass().getSimpleName())) { + if (layerEventController != null) { + throw new RuntimeException("Duplicated LayerEventController"); + } + layerEventController = listener; + } + } + boolean ret = layerEventController != null; + if (ret) { + System.out.println("LayerEventController found"); + } else { + System.out.println("No LayerEventController"); + } + return ret; + } + + static boolean layerEventControllerMaskEquals(long mask) { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + AWTEventListener layerEventController = null; + for (AWTEventListener listener : toolkit.getAWTEventListeners(mask)) { + if (listener instanceof AWTEventListenerProxy) { + listener = ((AWTEventListenerProxy)listener).getListener(); + + } + if ("LayerEventController".equals(listener.getClass().getSimpleName())) { + if (layerEventController != null) { + throw new RuntimeException("Duplicated LayerEventController"); + } + layerEventController = listener; + } + } + boolean ret = layerEventController != null; + if (ret) { + System.out.println("LayerEventController with the correct mask found"); + } else { + System.out.println("No LayerEventController with the correct mask"); + } + return ret; + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + bug6872503.createGui(); + } + }); + } +} diff --git a/jdk/test/javax/swing/JLayer/6875153/bug6875153.java b/jdk/test/javax/swing/JLayer/6875153/bug6875153.java new file mode 100644 index 00000000000..8e416acc339 --- /dev/null +++ b/jdk/test/javax/swing/JLayer/6875153/bug6875153.java @@ -0,0 +1,47 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6875153 + * @summary JLayer.isOptimizedDrawingEnabled() throws NPE for null glass pane set + * @author Alexander Potochkin + */ + +import javax.swing.*; + +public class bug6875153 { + + private static void createGui() { + JLayer layer = new JLayer(); + layer.setGlassPane(null); + layer.isOptimizedDrawingEnabled(); + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + bug6875153.createGui(); + } + }); + } +} diff --git a/jdk/test/javax/swing/JLayer/6875716/bug6875716.java b/jdk/test/javax/swing/JLayer/6875716/bug6875716.java new file mode 100644 index 00000000000..c59c4544a6e --- /dev/null +++ b/jdk/test/javax/swing/JLayer/6875716/bug6875716.java @@ -0,0 +1,46 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6875716 + * @summary JLayer.remove((Component)null) should behave consistently in (not) throwing NPE + * @author Alexander Potochkin + */ + +import javax.swing.*; +import java.awt.*; + +public class bug6875716 { + + public static void main(String[] args) throws Exception { + JLayer layer = new JLayer(new Component(){}); + layer.setGlassPane(null); + try { + layer.remove((Component)null); + } catch (NullPointerException e) { + //this is what we expect + return; + } + throw new RuntimeException("Test failed"); + } +} diff --git a/jdk/test/javax/swing/JLayer/SerializationTest/SerializationTest.java b/jdk/test/javax/swing/JLayer/SerializationTest/SerializationTest.java index 0c18e41491e..cb6ec60846c 100644 --- a/jdk/test/javax/swing/JLayer/SerializationTest/SerializationTest.java +++ b/jdk/test/javax/swing/JLayer/SerializationTest/SerializationTest.java @@ -1,3 +1,26 @@ +/* + * Copyright 2008 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + /* * @test * @summary Makes sure that JLayer is synchronizable @@ -50,4 +73,4 @@ public class SerializationTest { return "TestLayerUI"; } } -} \ No newline at end of file +} diff --git a/jdk/test/javax/swing/JMenuItem/6883341/bug6883341.java b/jdk/test/javax/swing/JMenuItem/6883341/bug6883341.java new file mode 100644 index 00000000000..9abaef96b30 --- /dev/null +++ b/jdk/test/javax/swing/JMenuItem/6883341/bug6883341.java @@ -0,0 +1,50 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + + /* + * @test + * @bug 6883341 + * @summary Checks that menu items with no text don't throw an exception + * @author Alexander Potochkin + * @run main bug6883341 + */ + +import javax.swing.*; + +public class bug6883341 { + + private static void createGui() { + JPopupMenu menu = new JPopupMenu(); + menu.add(new JMenuItem()); + menu.setVisible(true); + menu.setVisible(false); + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + bug6883341.createGui(); + } + }); + } +} diff --git a/jdk/test/javax/swing/JSlider/6579827/bug6579827.java b/jdk/test/javax/swing/JSlider/6579827/bug6579827.java new file mode 100644 index 00000000000..78fdb7af0c2 --- /dev/null +++ b/jdk/test/javax/swing/JSlider/6579827/bug6579827.java @@ -0,0 +1,68 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6579827 + * @summary vista : JSlider on JColorchooser is not properly render or can't be seen completely + * @author Pavel Porvatov + @run main bug6579827 + */ + +import sun.awt.OSInfo; + +import javax.swing.*; +import java.awt.*; + +public class bug6579827 { + public static void main(String[] args) throws Exception { + if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS || + OSInfo.getWindowsVersion() != OSInfo.WINDOWS_VISTA) { + System.out.println("This test is only for Windows Vista. Skipped."); + + return; + } + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (Exception e) { + e.printStackTrace(); + + throw new RuntimeException(e); + } + + JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 0); + + Dimension prefferdSize = slider.getPreferredSize(); + + slider.setPaintTrack(false); + slider.putClientProperty("Slider.paintThumbArrowShape", Boolean.TRUE); + + if (prefferdSize.equals(slider.getPreferredSize())) { + throw new RuntimeException(); + } + } + }); + } +} diff --git a/jdk/test/javax/swing/SwingUtilities/6797139/bug6797139.java b/jdk/test/javax/swing/SwingUtilities/6797139/bug6797139.java new file mode 100644 index 00000000000..acd9e1299e3 --- /dev/null +++ b/jdk/test/javax/swing/SwingUtilities/6797139/bug6797139.java @@ -0,0 +1,62 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * + * @bug 6797139 + * @author Alexander Potochkin + * @summary tests that JButton's text is not incorrectly truncated + */ +import javax.swing.*; +import javax.swing.plaf.basic.BasicButtonUI; +import java.awt.*; +import java.awt.image.BufferedImage; + +public class bug6797139 { + + private static void createGui() { + JButton b = new JButton("Probably"); + b.setUI(new BasicButtonUI() { + protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) { + super.paintText(g, b, textRect, text); + if (text.endsWith("...")) { + throw new RuntimeException("Text is truncated!"); + } + } + }); + b.setSize(b.getPreferredSize()); + BufferedImage image = new BufferedImage(b.getWidth(), b.getHeight(), + BufferedImage.TYPE_INT_ARGB); + Graphics g = image.getGraphics(); + b.paint(g); + g.dispose(); + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createGui(); + } + }); + } +} diff --git a/jdk/test/sun/misc/BootClassLoaderHook/TestHook.java b/jdk/test/sun/misc/BootClassLoaderHook/TestHook.java new file mode 100644 index 00000000000..f346ffd1554 --- /dev/null +++ b/jdk/test/sun/misc/BootClassLoaderHook/TestHook.java @@ -0,0 +1,112 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +import java.io.File; +import java.util.TreeSet; +import java.util.Set; +import sun.misc.BootClassLoaderHook; + +/* @test + * @bug 6888802 + * @summary Sanity test of BootClassLoaderHook interface + * + * @build TestHook + * @run main TestHook + */ + +public class TestHook extends BootClassLoaderHook { + + private static final TestHook hook = new TestHook(); + private static Set names = new TreeSet(); + private static final String LOGRECORD_CLASS = + "java.util.logging.LogRecord"; + private static final String NONEXIST_RESOURCE = + "non.exist.resource"; + private static final String LIBHELLO = "hello"; + + public static void main(String[] args) throws Exception { + BootClassLoaderHook.setHook(hook); + if (BootClassLoaderHook.getHook() == null) { + throw new RuntimeException("Null boot classloader hook "); + } + + testHook(); + + if (!names.contains(LOGRECORD_CLASS)) { + throw new RuntimeException("loadBootstrapClass for " + LOGRECORD_CLASS + " not called"); + } + + if (!names.contains(NONEXIST_RESOURCE)) { + throw new RuntimeException("getBootstrapResource for " + NONEXIST_RESOURCE + " not called"); + } + if (!names.contains(LIBHELLO)) { + throw new RuntimeException("loadLibrary for " + LIBHELLO + " not called"); + } + + Set copy = new TreeSet(); + copy.addAll(names); + for (String s : copy) { + System.out.println(" Loaded " + s); + } + + if (BootClassLoaderHook.getBootstrapPaths().length > 0) { + throw new RuntimeException("Unexpected returned value from getBootstrapPaths()"); + } + } + + private static void testHook() throws Exception { + Class.forName(LOGRECORD_CLASS); + ClassLoader.getSystemResource(NONEXIST_RESOURCE); + try { + System.loadLibrary(LIBHELLO); + } catch (UnsatisfiedLinkError e) { + } + } + + public String loadBootstrapClass(String className) { + names.add(className); + return null; + } + + public String getBootstrapResource(String resourceName) { + names.add(resourceName); + return null; + } + + public boolean loadLibrary(String libname) { + names.add(libname); + return false; + } + + public File[] getAdditionalBootstrapPaths() { + return new File[0]; + } + + public boolean isCurrentThreadPrefetching() { + return false; + } + + public boolean prefetchFile(String name) { + return false; + } +} diff --git a/jdk/test/sun/net/www/httptest/HttpTransaction.java b/jdk/test/sun/net/www/httptest/HttpTransaction.java index 37cdf0e0ab8..81b0d82d491 100644 --- a/jdk/test/sun/net/www/httptest/HttpTransaction.java +++ b/jdk/test/sun/net/www/httptest/HttpTransaction.java @@ -102,7 +102,8 @@ public class HttpTransaction { if (rspheaders != null) { buf.append (rspheaders.toString()).append("\r\n"); } - buf.append ("Body: ").append (new String(rspbody)).append("\r\n"); + String rbody = rspbody == null? "": new String (rspbody); + buf.append ("Body: ").append (rbody).append("\r\n"); return new String (buf); } diff --git a/jdk/test/sun/pisces/ThinLineTest.java b/jdk/test/sun/pisces/ThinLineTest.java new file mode 100644 index 00000000000..fff015a4f3c --- /dev/null +++ b/jdk/test/sun/pisces/ThinLineTest.java @@ -0,0 +1,63 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +import java.awt.*; +import java.awt.geom.Ellipse2D; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +/** + * @author chrisn@google.com (Chris Nokleberg) + * @author yamauchi@google.com (Hiroshi Yamauchi) + */ +public class ThinLineTest { + private static final int PIXEL = 381; + + public static void main(String[] args) throws Exception { + BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB); + Graphics2D g = image.createGraphics(); + + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g.setPaint(Color.WHITE); + g.fill(new Rectangle(image.getWidth(), image.getHeight())); + + g.scale(0.5 / PIXEL, 0.5 / PIXEL); + g.setPaint(Color.BLACK); + g.setStroke(new BasicStroke(PIXEL)); + g.draw(new Ellipse2D.Double(PIXEL * 50, PIXEL * 50, PIXEL * 300, PIXEL * 300)); + + // To visually check it + //ImageIO.write(image, "PNG", new File(args[0])); + + boolean nonWhitePixelFound = false; + for (int x = 0; x < 200; ++x) { + if (image.getRGB(x, 100) != Color.WHITE.getRGB()) { + nonWhitePixelFound = true; + break; + } + } + if (!nonWhitePixelFound) { + throw new RuntimeException("The thin line disappeared."); + } + } +} diff --git a/jdk/test/sun/security/ec/TestEC.java b/jdk/test/sun/security/ec/TestEC.java index 12694a03c64..5429e51394a 100644 --- a/jdk/test/sun/security/ec/TestEC.java +++ b/jdk/test/sun/security/ec/TestEC.java @@ -27,6 +27,8 @@ * @summary Provide out-of-the-box support for ECC algorithms * @library ../pkcs11 * @library ../pkcs11/ec + * @library ../pkcs11/sslecc + * @compile -XDignore.symbol.file TestEC.java * @run main TestEC */ @@ -35,12 +37,15 @@ import java.security.Provider; /* * Leverage the collection of EC tests used by PKCS11 * - * NOTE: the following files were copied here from the PKCS11 EC Test area + * NOTE: the following 6 files were copied here from the PKCS11 EC Test area * and must be kept in sync with the originals: * * ../pkcs11/ec/p12passwords.txt + * ../pkcs11/ec/certs/sunlabscerts.pem * ../pkcs11/ec/pkcs12/secp256r1server-secp384r1ca.p12 * ../pkcs11/ec/pkcs12/sect193r1server-rsa1024ca.p12 + * ../pkcs11/sslecc/keystore + * ../pkcs11/sslecc/truststore */ public class TestEC { @@ -49,18 +54,23 @@ public class TestEC { Provider p = new sun.security.ec.SunEC(); System.out.println("Running tests with " + p.getName() + " provider...\n"); - long start = System.currentTimeMillis(); + + /* + * The entry point used for each test is its instance method + * called main (not its static method called main). + */ new TestECDH().main(p); new TestECDSA().main(p); new TestCurves().main(p); new TestKeyFactory().main(p); new TestECGenSpec().main(p); new ReadPKCS12().main(p); - //new ReadCertificates().main(p); - long stop = System.currentTimeMillis(); + new ReadCertificates().main(p); + new ClientJSSEServerJSSE().main(p); + long stop = System.currentTimeMillis(); System.out.println("\nCompleted tests with " + p.getName() + - " provider (" + (stop - start) + " ms)."); + " provider (" + ((stop - start) / 1000.0) + " seconds)."); } } diff --git a/jdk/test/sun/security/ec/certs/sunlabscerts.pem b/jdk/test/sun/security/ec/certs/sunlabscerts.pem new file mode 100644 index 00000000000..5dfb352408a --- /dev/null +++ b/jdk/test/sun/security/ec/certs/sunlabscerts.pem @@ -0,0 +1,1317 @@ +-----BEGIN CERTIFICATE----- +MIIDyDCCAzGgAwIBAgIJAJh6e4zfP9lXMA0GCSqGSIb3DQEBBQUAMIGfMQswCQYD +VQQGEwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAk +BgNVBAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMR8wHQYDVQQLDBZU +ZXN0IFNlcnZlciAoUlNBIDEwMjQpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFs +c3R1ZmYuY29tMB4XDTA1MTIwNjIxMjk1OFoXDTEwMDExNDIxMjk1OFowgZ8xCzAJ +BgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEm +MCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHzAdBgNVBAsM +FlRlc3QgU2VydmVyIChSU0EgMTAyNCkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50 +YWxzdHVmZi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJrKL3D9xOca +b5C5m1yeIFXvwufm5m06RnQdLWaj5Epg9+6tM3uZNn9B0r4k7MKYPbzBqyQO9ZSm +sulV9U3nWLhjChOrrNCIxzAUIR1//11QVKfjv3k8Ts7N5g5kIIiG8GUXh1WCNYhN +SvPo0BpNJ3FFwMMCZu0VpAP0j9krqWjfAgMBAAGjggEIMIIBBDAdBgNVHQ4EFgQU +FrXN7dxlrB1ccI0ZOi+NzYpz6UIwgdQGA1UdIwSBzDCByYAUFrXN7dxlrB1ccI0Z +Oi+NzYpz6UKhgaWkgaIwgZ8xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQG +A1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBM +YWJvcmF0b3JpZXMxHzAdBgNVBAsMFlRlc3QgU2VydmVyIChSU0EgMTAyNCkxIjAg +BgNVBAMMGWRldi5leHBlcmltZW50YWxzdHVmZi5jb22CCQCYenuM3z/ZVzAMBgNV +HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAAEQHmeWmoe+s784Qi1oK04eNeI3 +m3Iw06IWjdKH5xatQqj9VjvngLWnmY26PYlF6PK3cAktuempXVA2rZ3Dv5pkgAdQ +f3LXGHBKfAEsSjSSpxIsQA6Q+Yk7zqht5hSPOtUXHcWUx9EMvh7HnjmEEdR80fw/ +txvN4xm8V+flmK/T +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICxjCCAi8CCQCg3U8Mc7XCZzANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAxMDI0KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwNTlaFw0xMDAxMTQyMTMwNTlaMIGuMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMS4wLAYDVQQLDCVUZXN0 +IFNlcnZlciAocnNhMTAyNHNlcnZlci1yc2ExMDI0Y2EpMSIwIAYDVQQDDBlkZXYu +ZXhwZXJpbWVudGFsc3R1ZmYuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB +gQCZCOorl//TxbVdj8X+fb9xhMlApe9sAU/jlHRtrv+7FflqCLMmhcR8s90LTCjq +gcX0mGm7fIusBff4/hjaKlmrto0YLNg8c8Zvev5CD+0HQHtbGUfx3TGOHv7gvG31 +nt88ZOzyIlPe2khcDTmb613zxFZhgJBs3bCsQz0TK3bR/wIDAQABMA0GCSqGSIb3 +DQEBBQUAA4GBABHP8xO3ouLm6SgZefjJnmbURTpjosE7oR15T1Fpf6o0WARaTeYO +07H/GdDFUgV3RTA/zNMimfq6XqJB5r5WBziVkLLuixzS7nNaAci6o5b2UaU7shUc +z3k0O4Dclybb4J1dYeAIwXUGqLAzI1NCgjRoGirFWT+O+02tT1KCiSl3 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDRzCCAi8CCQCg3U8Mc7XCaDANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAyMDQ4KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMxMDBaFw0xMDAxMTQyMTMxMDBaMIGuMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMS4wLAYDVQQLDCVUZXN0 +IFNlcnZlciAocnNhMTAyNHNlcnZlci1yc2EyMDQ4Y2EpMSIwIAYDVQQDDBlkZXYu +ZXhwZXJpbWVudGFsc3R1ZmYuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB +gQC5EyeXl7YTi5NPgJiIZHNSrG9qlAVoM5BYKqAVtFwHCbLYB7ZWyN2BuEfUSf8p +KSKkq28DkNTqnyz6Rg57kHzO3+kca0+iHlqFpbcP6uuN4ubOGZCuEDT0Ti7VXRtc +a8hGNrOEzZKA6DCl9csfrN0jHB5VBfJ4qTJCEi8fXNQbzwIDAQABMA0GCSqGSIb3 +DQEBBQUAA4IBAQC05575dPOqJ6Qk2rs7wHu4tGE15OR2jnXSZXXDObRUHetykmfQ +YbUq9/z9f3k4R53GAisgDwbVUb3EUsXofy7eMTUD89A7MiZ99SvebPilDQE3djqM +D0uA9a96LG6fAarc1MdpbMPcFiFFiwwlqJVtx4TNlektFbFQRzrrbMSF/ISLzdWK +fR3XD5qpwiCQbSug9Zm7cornUk8cK/Fs571wErOrdPo47aw1C8NjspLhux/JtHM9 +hNuAqona/4lX5lMVNpnSkWaT+B281+ysm1uEK8lvsDSUuLy+fZvokCrhQPFLoI+h +l5HGNqXdyIu1POCl6yqd6+BKNnfA5Qy+Bp87 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICbDCCAioCCQCg3U8Mc7XCYTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMTYwcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA0OVoXDTEwMDExNDIxMzA0OVowgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2ExMDI0c2VydmVyLXNlY3AxNjByMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyvWS +/5LJKlEJNR+jEWB1VMQVC09227El9V80yZ8WYqL0RdvWvDHN/vN1HKlFni/X5pwK +Def0vpXEDueeUgs9nQd+WDI/HOHTZ6BwUu2x2JParIBm9+dylWiBqhV+9LI/TyIr +4KMKjcnTMlCKZvzrIplIvcf+Gu/OFG46q3PUIFcCAwEAATAJBgcqhkjOPQQBAzEA +MC4CFQCslg/BEN7fygz0CIIWO+1n/yenNwIVAMivW2BhQhk1TEPw5Zs3QgXEw187 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIChDCCAioCCQCg3U8Mc7XCYjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMjU2cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA1MVoXDTEwMDExNDIxMzA1MVowgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2ExMDI0c2VydmVyLXNlY3AyNTZyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA5v3h +NBYB07K2o8TMStAW5j5qDfy1XciU6Hx32qeoPwBdsvalmiAP+Scawfi7xPWGCMTK +zBiRSRHVgFU+tsvpFhJ+7mnl0k7zQMdmuzJCH/IV8889TAobQbGsvSdMa5ry+FRo +u+2QoEAaOQik4RFZcZmw+46wbMbeNhesirEkG20CAwEAATAJBgcqhkjOPQQBA0kA +MEYCIQCMTGl7AImRhjsdQuEUaODQKFWGcZSFT0ZVe+ikWQCdcQIhANOPoSjaBDHa +kJVhR6MrTMHvnfAGL+EZpAqHGPMM12JD +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICpDCCAioCCQCg3U8Mc7XCYzAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMzg0cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA1MloXDTEwMDExNDIxMzA1MlowgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2ExMDI0c2VydmVyLXNlY3AzODRyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArsTW +yLsCTz6nEeBEHW1JvMFPFnFqvXWWJJsEHbJtPDU0FF3xurgfNX4T7BsPW5LNIneh +MJbKqSCRgw0q97zgVLhB1WBE6y5jkfYCTDA5QAuNOlqgTGrBg0WIANgsXjHFZ5kQ +46i98IzFOFHZFOdtj+i0T3GviZWKGCbjKShyWnMCAwEAATAJBgcqhkjOPQQBA2kA +MGYCMQD4L6X8M2oCiwQE0/HqNNI4zCt6gp2o8Uk2HWa5If59QhwlfjXQSdbvVGfW +T2XpnUACMQDJ6Ir8G4H9Mu9ktf64MhnYg6A22hV4nWZ5bpM3AiD+10q+30r+TWV4 +89YQz707Eok= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICyDCCAioCCQCg3U8Mc7XCZDAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwNTIxcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA1NFoXDTEwMDExNDIxMzA1NFowgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2ExMDI0c2VydmVyLXNlY3A1MjFyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1Nmx +2TOGk8FQXJIzDM2+x4jVWocD2lRShsFQaMhltST4PWm+TbXBPSxpvS9oFW7eZE3J +50OqxMiZkmH8un44Iet7E6fi0iRhw0bl4uqG2JHtyMzSYR6niSy0yqgHVJVwM24Q +Z/39X17PD0NwCEiPBGFx9Xa5E2JP9KcnCbrj49sCAwEAATAJBgcqhkjOPQQBA4GM +ADCBiAJCAZ4Apzk6L7BLjKoln+NEl5a/I1TmNIPVR0HtcLwbdZQ/y9b0+vhENkkS +XIGTc/2Jx+OV/tc4JyNW7PNM/YPl5FDUAkIByKevbRtsBD0HuCVK6WOf+6uz+QFs +fgxz0XoMyWMuoUIM2ytx+Eq9UY13QgqCQ5FxYWJ6RtDiNhEovr5GMjqjG0Q= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICbDCCAioCCQCg3U8Mc7XCZTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTYzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA1NVoXDTEwMDExNDIxMzA1NVowgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2ExMDI0c2VydmVyLXNlY3QxNjNyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAy4Vh +Ju/NaZEhiu6wsh4fsKGvwdHwRKvmJwMk8wEk3/Vz92/9kPR5B/Co3XVGBmW4UJwD +0BcdPcMyr1TDHYOL7kS65MJGq0eFcBblA5hr2G3unZwgVwpS9GzMA7n8s3BtDGYN +UpUyt5u5C6mTqQoK39xVWWbke5tM90T3jr6MiN0CAwEAATAJBgcqhkjOPQQBAzEA +MC4CFQOcO1rEZFieKqpNL8E8T1wwchv2FQIVAQ4DEcV2AkLqSXxgt+h03NyWPeEN +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICcjCCAioCCQCg3U8Mc7XCZjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTkzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA1N1oXDTEwMDExNDIxMzA1N1owgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2ExMDI0c2VydmVyLXNlY3QxOTNyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAws4d +5PHRj1UOeuc60MnkGhmwJ/RD7Vmaq8NUJwliTHnAscTlZuv5Irv9cYHhAka2p8WJ +mo8xZxlUQMIUxIx/9ocZEYAKrv/vjWo05iaDQowJOUHM77usJnTZbDrVfeuOBqFo +6G2scl6RBGdCUOGUBVdRT6sEWQnYm/wIcTxj9OcCAwEAATAJBgcqhkjOPQQBAzcA +MDQCGHDRiFsRMDB+Y4+Mnjs4jWHHKyjqoOYFlwIYemZsC0uC1/oI/ZFUuERW7TEe +BPpqMQgX +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICyzCCAjQCCQClVpDHKllBjTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEpMCcGA1UECwwgVGVzdCBT +ZXJ2ZXIgKHJzYTEwMjRzZXJ2ZXItc2VsZikxIjAgBgNVBAMMGWRldi5leHBlcmlt +ZW50YWxzdHVmZi5jb20wHhcNMDUxMjA2MjEzMTAxWhcNMTAwMTE0MjEzMTAxWjCB +qTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBW +aWV3MSYwJAYDVQQKDB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEpMCcG +A1UECwwgVGVzdCBTZXJ2ZXIgKHJzYTEwMjRzZXJ2ZXItc2VsZikxIjAgBgNVBAMM +GWRldi5leHBlcmltZW50YWxzdHVmZi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0A +MIGJAoGBALx55L25d1DjV6X6z/rqebCJvhD0IfWqUU6ekiADnDgmOhFT8gutI4Xh +2AlBhIyticLU5IMP/MYud0OPnavaH3dcNRsfkJkfmZRULqIDjWnVmtmBhV8th9TM +KaH7V1TOqxqMfGuzFq9uwL8p5i2f8fLQjZ9sNNj7qeuW5XI05cv1AgMBAAEwDQYJ +KoZIhvcNAQEFBQADgYEAG3UcMUmwpTKUwNA6P0i0073ptjmzhRIeDdpf1d69X99Y +Wrnf2H6xA2boa8gBkVFjCaLBakIq6px5IuGFZNB2+0yJqd8QE22DKk1Ikr5hBsEC +owhd0feRaNjO0u/kPFZU1XAVFyz2AGKdLUOw4OEV8tuSOXAmWoMZHwfoocy1JnQ= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIEzTCCA7WgAwIBAgIJAMkNhmYP6nKsMA0GCSqGSIb3DQEBBQUAMIGfMQswCQYD +VQQGEwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAk +BgNVBAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMR8wHQYDVQQLDBZU +ZXN0IFNlcnZlciAoUlNBIDIwNDgpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFs +c3R1ZmYuY29tMB4XDTA1MTIwNjIxMzAwOVoXDTEwMDExNDIxMzAwOVowgZ8xCzAJ +BgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEm +MCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHzAdBgNVBAsM +FlRlc3QgU2VydmVyIChSU0EgMjA0OCkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50 +YWxzdHVmZi5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDO/6vZ +zPZAmeKP/fMAwKTRzCmy30TnoEZJybsk8QDlL9xaYIcEiIhf6eOV0/IYPcSwPakv +Ha5lT9aCTEEdcxACqAQlm2LOFZ79pUc0bGEmeFpHDZoO2w7+/RCYbGLkdWKTfj1D +kKG9PoWX5MelBZqkQuvE3+6eAr70IlQRA8uMA+Aq+Hl7KZys+eTX3eVWcNYZu94U +Z9wOKsRnRT4Yzf1G8aPJq4gIwxW4nBVAHqUc2N8bUzsHVqbTpcytU3KYT1YlcLGG +Ir1LulgjWws3Lncx1rZQuAIT5cyjCmW8wZ/O+GewzmbgV95lFsf8HCd0ZD4j65sS +/l0xB4zHnSBAegntAgMBAAGjggEIMIIBBDAdBgNVHQ4EFgQUS1aD1pb8BOGcjSyh +9IhovqLk1TcwgdQGA1UdIwSBzDCByYAUS1aD1pb8BOGcjSyh9IhovqLk1TehgaWk +gaIwgZ8xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRh +aW4gVmlldzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMx +HzAdBgNVBAsMFlRlc3QgU2VydmVyIChSU0EgMjA0OCkxIjAgBgNVBAMMGWRldi5l +eHBlcmltZW50YWxzdHVmZi5jb22CCQDJDYZmD+pyrDAMBgNVHRMEBTADAQH/MA0G +CSqGSIb3DQEBBQUAA4IBAQBDl6f5HVzv0r0/DNAMy6vaKHrKXCJYVXLh7AZWLShP +3BfvekDRncLFjldTEqE1vqD4wndxpHVVwyZWWBWHVcw76AAtYnZp36ex5ZP56pHw +Mg308O+tYLgjdm5cDEzGzqNgavUIi/T/lMnWJrls1Zr/qnf7hzbvIAlMGJ4jcZGF +U1Z8T4mpFyroafXSbHEE/awX9DbyZL0ryXXtlTggxgLfzPqmSx4ZXurqv4LFdjlu +pZ/+/b6qU3JAlDMDMReb+iDBIllNGVZj88QTp3cC2CtwnYBYvLLWFtWoQpN2Ppz4 +X5xcdh4VuTICpk5kQSbzrij3GXZl0fDVuX4Z+5J1xodl +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDSjCCArMCCQCg3U8Mc7XCbzANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAxMDI0KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMyMjlaFw0xMDAxMTQyMTMyMjlaMIGuMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMS4wLAYDVQQLDCVUZXN0 +IFNlcnZlciAocnNhMjA0OHNlcnZlci1yc2ExMDI0Y2EpMSIwIAYDVQQDDBlkZXYu +ZXhwZXJpbWVudGFsc3R1ZmYuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEA7I6hIU6+t1DQABGWtaqyhUjieQTzoaN3dZzmzTcUXY62F+IedLuVrxcQ +3YJU8+jcM6rl+/eIa90rNcKpxjrdzx676CqFCHO3/aHF1iCMmQF368ezfs2lDPTF +mobrn6KMNe71SM8bQ8MHFmRxY1wWk7GKIuz8OQnJOHD1nXQisjv1GBZ7HssaEPGd +m8c1rKCvzqrC4Nj/U+cKV0VeWtJod5inIx5RT/5FYW4QdBwuhovoKumPxpImYz6Y +SuFAce2hTMjxmvFXD0V1+VfWsYUe0/TilRgOv5l9iWo4haGBftYFWW8w0iqOB4+q +cPqcKozI7Tjs9r3Rby0zTdjB6vZi9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAAUd +cnt8YHDUvIroDiLQQsH+p2mDD+ra10K3C9H0Lsvt6cb3/2jn6PupFVJzwkEEankS +Lo/pOe+bO5uSA4C2FQAymrYZX5Hh1guK/Has+Sf0K+HKPx28QPGg1EoS2KAbUf1t +RBX2jtq8Suz3iS9u77PbpB7aMNAEBihr2jAyfSka +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDyzCCArMCCQCg3U8Mc7XCcDANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAyMDQ4KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMyMzVaFw0xMDAxMTQyMTMyMzVaMIGuMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMS4wLAYDVQQLDCVUZXN0 +IFNlcnZlciAocnNhMjA0OHNlcnZlci1yc2EyMDQ4Y2EpMSIwIAYDVQQDDBlkZXYu +ZXhwZXJpbWVudGFsc3R1ZmYuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAxHxrsAwLznaK+dmgQxUzmWTsNLhuKk+yBkpJZQDQDjkdxVrime1DxPAZ +MDi4OL+9YCIDS3ZWG0uLH49Atq08/2TB+aYDm0YBjrq3BRphTBrNNpntezSgP/nz +R2hOBvBgSvFqorTLzRF9THq18CrSJJB/OPFzvl6mYK8dtS4CnOfdUs0Pv8SwdxhJ +X6qsO0NJclrfBYBodGW1PiY62NPX0h2mLcg4OmD3gThfjUvXnsdjLJYV6hZFT+YC +vPJNTxTGebfnJr4sRGdqRUyBrjiqZtXwGpIBCSg/YpnUOfDSxJNA2Wd/WFJJv8Fq +kBh2oDRqlFNC/Z+HjGqKj0gFowTq3QIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQBp +iFO+5KbnHfRBStgxZdTBrr+HEezeFlxeE04bM7kSWII2SiQbAWSG5Rkb518m5x65 +q23KqUK+YJiy7k0zoKInvG/qLf1D5osFlwaAll7AKBadn/R8x822xSJCydHgD64V +b3u89zBY5Jtl+EzTA+n+UWRsurlLL1K9ockWZrDiZn6gGO5/ucR8OkZ192sxqKRr +iQbN12LWSmUCYPwba8nvDdm1ymAbnFOg1oQJ9HvxmFI3GaGjdmNo9rlaoNS/xQ35 +iTtJyi1MK2d+O2JPD5cS5otGfFnQiTWIngBiuEoOwzw7x8eWsOQaBPVnNSlMdU+z +Zrc6M1OSOUh2+DqvAoBp +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC8DCCAq4CCQCg3U8Mc7XCaTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMTYwcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzExM1oXDTEwMDExNDIxMzExM1owgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2EyMDQ4c2VydmVyLXNlY3AxNjByMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AMPD0turqL6uNjGfquQy3MTv90+RvDCvCQXGnxdJa6QcOOHnv/4ua9g/TOO2cVuc +UuF3EnMSDg+HIo8qJhdKcOa4nnp1IxAnPsQs1K9vq8eqtuSuFMZUoUKy969ThPqd +UTYyZpOn87XMftm76nz92q2gDPLj7ZxD1QOv0MpMHjXJMSRHWEhsoCpYBdFT5Nl5 +28bK0AWTv4nw2RmQryn+UMblAqnJBNiIWzVHBUa1UNMBt2lnO12w6EpSGmkx9+Op +rv8kcfJgXnUkH/l7krHUADplp4yxO1hIzdH5Xsd+Hxrnl85vGjNJyuNOlFJ1Eh0x +AJTT6m1ypPKAs+zF1nWJaJECAwEAATAJBgcqhkjOPQQBAzEAMC4CFQCsQDzAbX4C +uri94k3X0mUTxCrweAIVAON/UYsS+fYp74XS5ucP8I31tl8n +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDCDCCAq4CCQCg3U8Mc7XCajAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMjU2cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzEyOFoXDTEwMDExNDIxMzEyOFowgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2EyMDQ4c2VydmVyLXNlY3AyNTZyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ALYeH/U234MovGN9iM3mr3kah93WJY64Dg8kGHg4zaUeKSmZVBgj/IlaCbfsRzXp +0xtsBCXAHGlZosiIInQzfxVNS/XIUOI3B5h+n3wMl61BsC2R/pmHyEg8eFp6Jiwv +1HMW9xKYF4qGgH396HczXPxOov3iJvtHHLElzYXDwCqy+x4D1PzXQLEkaGQzXsY4 +xhqskq1qg4pacNvow1eJair9zk5ebrV9t39icdTMkrtwgNBYAM/RU5DBxjdHDb/p +Ef26uOmpEfgopcRpoZlDY7mpBozK49Ocsx+PCAx74A1kj8M2i7s+edlLMxIl66Co ++ELzqZW7YjwtyrOakPNb1m0CAwEAATAJBgcqhkjOPQQBA0kAMEYCIQCwL9kS1Dza +3G7UiC3Hxo2f/kfp9621l8dLV5Uh+yhxagIhAIj28sZe3blr+MkrJHZjkYsAMY1e +JijPcsnXEr0uGamb +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDJzCCAq4CCQCg3U8Mc7XCazAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMzg0cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzE0NloXDTEwMDExNDIxMzE0NlowgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2EyMDQ4c2VydmVyLXNlY3AzODRyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AK0JI2U8gdr/OdkEIeWTRnwnmfXJYyIvTQjsMIK/v2o9jpCh5rRiEJfF/JuypP5O +yHg6F1Qs6P/XafvxC/jsEe6VLbkwvT8THCKKMEvy6WyJuq58U5N5Zy2VEdMi+Q8C +XI4QrL6igOEW2W4wgYHgh6qxUee0kUeqY7DJJwvgTVTTHVTWpub/yrY+5LOAiQis +6eHxgp7xfUKKt64nk7pPdEdXeJ80PuCbau27/lQMhT8mBdE9YPkzX8dpS6ivYWFk +6VCv/qTz0qxQZF9BHHLJeStRgcGIQOV3Udm/EsjRfcTipDwVdxhHxJxpAOQ/xO+m +kJRKFitovc90AV9K2TtlG5UCAwEAATAJBgcqhkjOPQQBA2gAMGUCMHzhiyCuCuN6 +UxwoWA0q0nytE4H9t/2PnFGtAgmrzhnb4aWHw4xs5EJbTjGbqfVgBQIxAOIU5d2o +nnpT/vmlvyijgAHFXAE8qHsKi2XTI7bPy9PDrv2FCS7lLAw8+mNF2mJCug== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDSzCCAq4CCQCg3U8Mc7XCbDAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwNTIxcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzE1MloXDTEwMDExNDIxMzE1MlowgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2EyMDQ4c2VydmVyLXNlY3A1MjFyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AKB2axKYh2X1jRjtLpQIqhjLeIv55HiqlhF2dElrdTQP/qGN9TAYG9m0hAEzLKE/ +djgYMrsp0M9QfSxlNcLYjOtmYVLz57v1BQnDZI7/DS4jWOKfcnlvJSPbwE7LBoLQ +KKfmXmDWvMwmTBtIEs4nxPph2UuROc5exd1samwS6doAcUm09wqP60aM3lK+9ml3 +/Ukd0coK9824cWa5m4OUcqPtbS8u3LcYJqFb7q7N8q0yYBwuU4kUVpGRlKz5baEv +43qr5l+Fyib/pNEEAO1YhEW+7WjmvOAW4F/GSTI7SHce3Q4+3EoMoORM9nF9t482 +ojDsCe8emGFsGq0eS6MwYY0CAwEAATAJBgcqhkjOPQQBA4GLADCBhwJBdd9GUYv4 +BCF0NKQ583v33GreTlqD2Z0iXnni5du9A+8qJgG1wZlAGAosqXpZCi7i+3q2DVxI +hCU67LcsUi59GJMCQgDTLuJI2gkKvqNufZXIR5vR7/RUd4EddkLw2whv4NMfwLJM +532DeZIH+BtbyfjWYFujjoR/rhhcvtU0+lXsRT4xPQ== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC7zCCAq4CCQCg3U8Mc7XCbTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTYzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzE1N1oXDTEwMDExNDIxMzE1N1owgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2EyMDQ4c2VydmVyLXNlY3QxNjNyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AJ/8bNSkM/3fhVhEiFtu2r1fam1CVdbHE1tW1MjF2HOHBt2kz2LwLrJZq8ae9NkF +82qSw7TB7b5EWWa+o7y6we8So8VenTXnk1oxRRh1tJi2AMFgqpx+LVh4EVqnhfAp +r7UrtrnM+eAxOyGUVaTMgJKIkhDcfdIS3zHEL1i4tlbmLYRhWUE+wyogZ56FyWhR +mIpfWv9yV8pMaF1VDEBEN/Yl/6w5f8DG4bQnvkOhL51GVb9GdUBKXI/0bybKTgr3 +Ku/T4q1ppHJSSFohM4Riju4EAgrJ2f3p0ebhX0dtTV7SuCH6vgTpOmSqTIGQ5cHh +sGFV4/9Aoky/grDx9hp9D4sCAwEAATAJBgcqhkjOPQQBAzAAMC0CFA1Rg/uMcGW2 +lXuIUjKOiWxBhox7AhUDz3eNq7ir06Ukk5DxFpjGWA4kx2s= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC9zCCAq4CCQCg3U8Mc7XCbjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTkzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzIxM1oXDTEwMDExNDIxMzIxM1owgbAxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMDAuBgNVBAsMJ1Rlc3QgU2VydmVy +IChyc2EyMDQ4c2VydmVyLXNlY3QxOTNyMWNhKTEiMCAGA1UEAwwZZGV2LmV4cGVy +aW1lbnRhbHN0dWZmLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ALY3OYbAL3fEdoDHiak/3aj7141wmsobDVXPbNR1QFoHDrUqpgdQR3zHGY+BPjDD +qvo0xzzIUE40Hg49R3ya6WyECH8ozl9WJ+JS+lH63RYlHDWOJfzjylF6ihiqixj7 +Twjk1j9ZBPjjiGUA/6RlikxsRhoQTDU/pDD6bSn+yosimpePbOao1BDPfntYFejw +JWPlgC307o++ZKLcGjZH/9IfaKvgiBgl48rVDlQjFNLRkehufk1lviz5CdGph4uF +D8qoO83mIH/wGJ9kWVjv0nvcEOGeGfaM1mDBwsuzVPXqtvUQHOnCfc18B8y8Fw8g +bdoNde6lzDo6IMttKQEa+LMCAwEAATAJBgcqhkjOPQQBAzgAMDUCGQCV2p48seE6 +bqHpTgNOe3WdVuZe9dQYJgECGFG66yqtsjvMSg7snsWmMU/S2a8jvMywLg== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIID0DCCArgCCQDHAy9pv/zMBzANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEpMCcGA1UECwwgVGVzdCBT +ZXJ2ZXIgKHJzYTIwNDhzZXJ2ZXItc2VsZikxIjAgBgNVBAMMGWRldi5leHBlcmlt +ZW50YWxzdHVmZi5jb20wHhcNMDUxMjA2MjEzMjM5WhcNMTAwMTE0MjEzMjM5WjCB +qTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBW +aWV3MSYwJAYDVQQKDB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEpMCcG +A1UECwwgVGVzdCBTZXJ2ZXIgKHJzYTIwNDhzZXJ2ZXItc2VsZikxIjAgBgNVBAMM +GWRldi5leHBlcmltZW50YWxzdHVmZi5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQDt8MTCSkfQyPw/EjB/lzT1yHMDVuniAFLkxe8GzJYOUEbZQTRt +3gIZ56kX65DDW4R7VCcrFtDbF+PBVwwuBR3YT5adV0mbI0k2jBkteBe2N7CrQMAn +3m5Mmb3pcxLZOHSSH2HJXJzDGY7YCY4UfdUjNCFro56NeSKylTF1TdVpPkDPzbEm +BliscaJZ56WB9AKujbVx2apEaNcpaEXnJ5XbEmtccC463TPXX6Su8haccdXrfDFV +mLe+kwe1w8B/nQbVGWw/v9lysIdx6i1FmWtsU8lJp+kwzg47RiCeb68cumJxvJHp +/WoZGHFE15CYEp4N7lbF/UuiyWsn1VqHfkqnAgMBAAEwDQYJKoZIhvcNAQEFBQAD +ggEBAF0+NeYI0T+ZiDhR4B9kOMZfeQGYov+m2d/Y3Ly3rV35NJ6PbuGpb/VbYSxP +m0l6PhLB/c0V0pyg7MwgwtumhAxlnR5te0wNyYXzuO2oVBoO/8JmsQT8jnCFoANG +9KNrI+A6ed0V7V1u4Uz3YFbD33FWIDWIR+nfDe07FNl7th/8jzpZAhqudtj372jy +Andyzedx/kI4yePpjkHf8F0/MocI691C3rPW8uhSYloPfmaTftYoGl7+E1Xc85bW +JMvnUqwPptOzIVrd2Ei4/4jQDxmI05gDKxZ8aMZddJFkLPKMIFAMwEzo75fCJCBr +7Qo20ez/vMV+XAWGbHr1qLYhHzU= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDAzCCAsKgAwIBAgIJAIsK5NQHdHWbMAkGByqGSM49BAEwgZwxCzAJBgNVBAYT +AlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UE +CgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHDAaBgNVBAsME1Rlc3Qg +Q0EgKHNlY3AxNjByMSkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50YWxzdHVmZi5j +b20wHhcNMDUxMjA2MjEyOTUzWhcNMTAwMTE0MjEyOTUzWjCBnDELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEcMBoGA1UECwwTVGVzdCBD +QSAoc2VjcDE2MHIxKTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZmLmNv +bTA+MBAGByqGSM49AgEGBSuBBAAIAyoABEomOz9/rS0q4OSF2hP23h8Cobi6nftl +PlvgqVcjp+vnica6wXZ8TYOjggEFMIIBATAdBgNVHQ4EFgQUfdItvmVsDmZPpKZD +nEvW2UkF1GEwgdEGA1UdIwSByTCBxoAUfdItvmVsDmZPpKZDnEvW2UkF1GGhgaKk +gZ8wgZwxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRh +aW4gVmlldzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMx +HDAaBgNVBAsME1Rlc3QgQ0EgKHNlY3AxNjByMSkxIjAgBgNVBAMMGWRldi5leHBl +cmltZW50YWxzdHVmZi5jb22CCQCLCuTUB3R1mzAMBgNVHRMEBTADAQH/MAkGByqG +SM49BAEDMAAwLQIUGxw8NFGW58flX5kQ+9sTr62kN/UCFQClrPQNlpt7uW9Q5qMB +WRpd1SDyIQ== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICZjCCAc8CCQCg3U8Mc7XCNzANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAxMDI0KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwMTNaFw0xMDAxMTQyMTMwMTNaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjcDE2MHIxc2VydmVyLXJzYTEwMjRjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wPjAQBgcqhkjOPQIBBgUrgQQACAMqAAT9 +re7ILR102TfjTOu5h9XN7kIs42BEGeVyFHGqc9El4PEOy8Q4h5waMA0GCSqGSIb3 +DQEBBQUAA4GBAG0/n0eT7HK/1cgn4Qa6czMBpms0ca22r/V11Aj+h2mAqJNuz4aU +7q1r+W94hblFrzAlGSZqRIHykFL/yr6/xzStCB3gd9OslvXIjgrGatzuhAttuO8A +mA6VmPYG2aT5Ih9Bdg/HKuWdkSIeZTDJKMZli/CNWdtl/YcjsmyJDPUX +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC5zCCAc8CCQCg3U8Mc7XCODANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAyMDQ4KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwMTRaFw0xMDAxMTQyMTMwMTRaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjcDE2MHIxc2VydmVyLXJzYTIwNDhjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wPjAQBgcqhkjOPQIBBgUrgQQACAMqAAT+ +gt3/qI+svlfcqv3G+ldM/9cBveia+Z4S+UUurYsZR3joZVEUSm2JMA0GCSqGSIb3 +DQEBBQUAA4IBAQAGZFmNoRJUjpqoVkZWOP7ZDgjAgQqKFYI3Mm0QGNPvIEq1VCcj +LQnx9PY2B1oMKZJQQ/1KsNqnEMm8jlFXq+O25/QuD1/jv37ME2sn8rZe6vsdKLr6 +4SB/GU4mHID4eNDttT4WepT8OfRBO2EY8MWv+97tkUIr9saxjVMYrp4nK0vJ2Yql +LY0Jw3PgZ11y+WDKwkTWQkOx0SaZhKGRKZelbZZ2xcrV5XUtOFj2Ze27RMARRmmG +SEnSPUg95eaKjpFbjMiPvTACcYJfnpRKN+ev/dQ0lJa1mZEnsXkaNqzb3q7F91Fm +/NQ0Qi0OLeNZWeUUo1q3xhA3L2YvRyvz3425 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICDDCCAcoCCQCg3U8Mc7XCMTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMTYwcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxMFoXDTEwMDExNDIxMzAxMFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMTYwcjFzZXJ2ZXItc2VjcDE2MHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMD4wEAYHKoZIzj0CAQYFK4EEAAgDKgAEeIPEikmn +11U+4+r1Q1MikFns3u/81SlifvD9FK7i2eHXsm4pJbz66DAJBgcqhkjOPQQBAzEA +MC4CFQD+m6pQXn1FPgD5NS62SFJwZxTe+QIVAOGRJ9XxBZ8CfPMEDDmNkzEyw5I+ +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICIzCCAcoCCQCg3U8Mc7XCMjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMjU2cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxMFoXDTEwMDExNDIxMzAxMFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMTYwcjFzZXJ2ZXItc2VjcDI1NnIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMD4wEAYHKoZIzj0CAQYFK4EEAAgDKgAEsNpgI810 +hR1H/L88VDCIsDJbvQVU/WBqSi+dTVX0E1lITw4S8oJwSDAJBgcqhkjOPQQBA0gA +MEUCIQDTPITeYMLlsJT8jh2CyDHjEskSGLb62OaM4a0iq7wiPwIgbM9hJwczrPcw +3uCNgCT990nAdET61HPVfWOBwDJi7tU= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICQjCCAcoCCQCg3U8Mc7XCMzAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMzg0cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxMVoXDTEwMDExNDIxMzAxMVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMTYwcjFzZXJ2ZXItc2VjcDM4NHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMD4wEAYHKoZIzj0CAQYFK4EEAAgDKgAE/E51tE6b +bbeYQtaomWTWdwqTlW/8UbNDlC/LDHFXhYhNNJJzGdHoLzAJBgcqhkjOPQQBA2cA +MGQCMHjfuIklGYjJgYQYBBDNraRptWiaPe7dsI58LZdeJIwJcQcesTpPjjLDszS9 +jfTUNgIwZiD6FVi1yVTckFvPIGqNwzz46KrpKEO1JWR05DkawDnYoUzOoZjEtDhI +fktezP7a +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICZzCCAcoCCQCg3U8Mc7XCNDAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwNTIxcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxMVoXDTEwMDExNDIxMzAxMVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMTYwcjFzZXJ2ZXItc2VjcDUyMXIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMD4wEAYHKoZIzj0CAQYFK4EEAAgDKgAExrjEN9Rb +kS59txyKYNnlunaAY8PGDBeWy/t5JItcB8BdYNNaQ6Td1jAJBgcqhkjOPQQBA4GL +ADCBhwJBDPCBtcw+W8IBo9x6F9ajBOlstHeR9lV6dE3sLyJhpV9sn697LHA6fQ6u +s4x0aT8OJLod+62DFwDX40ATPoT3RoACQgHscuDNMVpOCx8mdka2mvD442Tcb76w +Qc5DQSd+d0Rw0c9zAvPwObwSttNaaNmuT4v3DturgBVQGdb02bmQIuDNrA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICDDCCAcoCCQCg3U8Mc7XCNTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTYzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxMloXDTEwMDExNDIxMzAxMlowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMTYwcjFzZXJ2ZXItc2VjdDE2M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMD4wEAYHKoZIzj0CAQYFK4EEAAgDKgAEuQ9FFr/a +O6E1WAQ0LtG1wH8nczXWLqJc7f+sgDgzrub2NjvOvfcQ5DAJBgcqhkjOPQQBAzEA +MC4CFQGBzvmRQ4HhuGwqOnKztHmUS9viEwIVAKZCrx0tZO03y9nSpGBRXeTB+bb2 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICEzCCAcoCCQCg3U8Mc7XCNjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTkzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxM1oXDTEwMDExNDIxMzAxM1owgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMTYwcjFzZXJ2ZXItc2VjdDE5M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMD4wEAYHKoZIzj0CAQYFK4EEAAgDKgAEp8qqFVSZ +48NmZKnPWpaJXybje/F2E0wDq8rNOX+LC73zfK3ZC7xDvDAJBgcqhkjOPQQBAzgA +MDUCGQCQP6SvfPS/AVHix6tG38uduEl53DG97JACGBWSckcbWsXYXDhKo3LrNy0h +9uBgV9Gs5Q== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICEzCCAdICCQDt+YU/aZ6s4TAJBgcqhkjOPQQBMIGrMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMSswKQYDVQQLDCJUZXN0IFNlcnZl +ciAoc2VjcDE2MHIxc2VydmVyLXNlbGYpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVu +dGFsc3R1ZmYuY29tMB4XDTA1MTIwNjIxMzAxNFoXDTEwMDExNDIxMzAxNFowgasx +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmll +dzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxKzApBgNV +BAsMIlRlc3QgU2VydmVyIChzZWNwMTYwcjFzZXJ2ZXItc2VsZikxIjAgBgNVBAMM +GWRldi5leHBlcmltZW50YWxzdHVmZi5jb20wPjAQBgcqhkjOPQIBBgUrgQQACAMq +AATr4Hx367/3ldBBiTV/6WfVuaRjVYUrFtcXLqsF04z3yL3dw4TcwSnQMAkGByqG +SM49BAEDMAAwLQIVAICB0ciEiBjudkS5M+TgDRowS9wqAhQxdt3pJoNMch0sBGvy +ZvpPEqW4lA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDNTCCAt2gAwIBAgIJAMWAX1EW46gEMAkGByqGSM49BAEwgZwxCzAJBgNVBAYT +AlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UE +CgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHDAaBgNVBAsME1Rlc3Qg +Q0EgKHNlY3AyNTZyMSkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50YWxzdHVmZi5j +b20wHhcNMDUxMjA2MjEyOTUzWhcNMTAwMTE0MjEyOTUzWjCBnDELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEcMBoGA1UECwwTVGVzdCBD +QSAoc2VjcDI1NnIxKTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZmLmNv +bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABNzAD4317T6bb1oio1J2awuyb2wS +F7okuHwbFhfTuXgvLsQcAWh34Md5SJ711rN7an+sEr0RVyE6h6zgQkD8DUyjggEF +MIIBATAdBgNVHQ4EFgQUSPfZCnqQodFg6YlBySBCsrjQ7hYwgdEGA1UdIwSByTCB +xoAUSPfZCnqQodFg6YlBySBCsrjQ7hahgaKkgZ8wgZwxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHDAaBgNVBAsME1Rlc3QgQ0EgKHNl +Y3AyNTZyMSkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50YWxzdHVmZi5jb22CCQDF +gF9RFuOoBDAMBgNVHRMEBTADAQH/MAkGByqGSM49BAEDRwAwRAIgeXLod9K7A3VG +Rw/3wMXrnxNUA+K4yzfAf1OlCy8923kCIGqu3+9B5lZgHWvHiWBkjpkBqegBp5t1 +7YyV4K1ALxcH +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICgTCCAeoCCQCg3U8Mc7XCPzANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAxMDI0KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwMThaFw0xMDAxMTQyMTMwMThaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjcDI1NnIxc2VydmVyLXJzYTEwMjRjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AARnBDetfBY6JJYtJ6BTttMX/edfb+Lc/DCwTneZzjE5lUaM+LzNwNt02H/+XD27 +hhTDJWXP5r26qZzuBkwpi2UJMA0GCSqGSIb3DQEBBQUAA4GBAF1uQyY7WpxJkkht +Ru87ib8WISy/liosB1ijy2bcPHjcpKRSW+LH2+A2+mQYiasfOkLck+9pS7efhFtT +b1A/3BkI9tMGhvMgop8860Khkl6pRETNu/nlVIQ2xzdRdpvJCmFPa67YK25/cn0O +XN6PHMPJF1JVyJhppvjmV/u6TS2N +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDAjCCAeoCCQCg3U8Mc7XCQDANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAyMDQ4KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwMTlaFw0xMDAxMTQyMTMwMTlaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjcDI1NnIxc2VydmVyLXJzYTIwNDhjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AAQmlPt4PtwUBkFqDl1dc+5XqpiPYJ8t0oVklz86WljYLHXNWl20Wd+t+/4akyc+ +3L9Wr2OzkZyXWv4nA4UteyFiMA0GCSqGSIb3DQEBBQUAA4IBAQBWbbxxLkiwz7eo +uN7Jfa+I9xMNFwPhCc7api63Z6Q6P1tcdTxtl6xQefdiFc550H+tOWb+sn3EmBFo +r8XIPAb73dG+41Vp2bSajkY9povAT/UHFYt9rwr9bQfWtJktd939A/hQix4YImzV +7cw8b+SAoEWuWifScDKDlFQvs4zxUAOxFeXbOrb3X1oGDjE93TEx7+x9DBNMDSu3 +hN11j9cyMotJCWB5OFYzCf3ibwwo0usiz768Wu1C3RvauET+xbcE3NkxM6rsQxI1 +lNXM1NNbm7/nOm+zK2lTH7g4Qui8owSgwR0uwEHhmrAHIug0uHC7GbrIn4yibkrq +xkZaaUr3 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICJTCCAeUCCQCg3U8Mc7XCOTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMTYwcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxNVoXDTEwMDExNDIxMzAxNVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMjU2cjFzZXJ2ZXItc2VjcDE2MHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErJOw +EmmdQcay7oSZTNySdc2m4/iwftH3KfY3wDA5qVusJ85AJUYPbwEvqloKpOTdCZI7 +P4za7x7COTuZAzVFVzAJBgcqhkjOPQQBAy8AMCwCFG5V4voKrcE0UlK1osPuHXZD +N2f5AhQR9TzLTT7D1Ee270xtQ+Bwcq9mBA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICPjCCAeUCCQCg3U8Mc7XCOjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMjU2cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxNVoXDTEwMDExNDIxMzAxNVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMjU2cjFzZXJ2ZXItc2VjcDI1NnIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERwmM +YUHXpp9LfbDmk33yWOjAf9flz43IHqFq2xa6bczvcht7ZDka7UmSOVQ8A8d2FdjG +BlqAnEKvCHlxqw41SjAJBgcqhkjOPQQBA0gAMEUCIH++MmRaY7IhySci6HGfsACD +otlDDt6kvpJOCTXQS0G8AiEAwNA+4/wVeEvtjendgLX7icNK33L53fK9CqiZovfi +w7o= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICXjCCAeUCCQCg3U8Mc7XCOzAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMzg0cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxNloXDTEwMDExNDIxMzAxNlowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMjU2cjFzZXJ2ZXItc2VjcDM4NHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEXjcN +bCMqCgsKw4WhdPm6ankP3pHHg/bKWiJXJ6BI4QQYGsNBXPb8YvwP6Q1tFPSyjSJo +VRUVmWGn9X7FzQAGQzAJBgcqhkjOPQQBA2gAMGUCMG4SIhLBYKht8fGzVRte/4lJ +Aj+hMTbCuNa36BMOoez16SskyhCtar46QkFIGnmoQgIxAKIxzKgH4dBAdRGu7fsU +OawK3AvNYm9Xb8bn7js+KjB4pJdYBZw4Q3kHB2cBgX+hvg== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICgjCCAeUCCQCg3U8Mc7XCPDAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwNTIxcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxNloXDTEwMDExNDIxMzAxNlowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMjU2cjFzZXJ2ZXItc2VjcDUyMXIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEH/cQ +KncxMblNmy+gpvCcfxdnC96RTzVT5ZdbeTBlmsRLXxWlrORx4+URCmHGpFdFzpmb +Hfc8rPAIQNGiQucuQDAJBgcqhkjOPQQBA4GLADCBhwJCANGrCUSZ/X2XMwFavryU +JGEOQFLMAAsEWVMUYbJifwNyeQVuwNV7cJjE5UGEzFDLbazmdrPVmDeSt4nQYCYN +zy/nAkEhOcJqFzXb2PW1E2MK7qGOswGNr1EifKIF5Tn//nCmpfDSH7G7VXH2IqPC +X6P0wdhzr72Gy3YmjXoj/CTZ/fK6Vg== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICJjCCAeUCCQCg3U8Mc7XCPTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTYzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxN1oXDTEwMDExNDIxMzAxN1owgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMjU2cjFzZXJ2ZXItc2VjdDE2M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHEs0 +EFQnApDDnOBH0DZtSu7mDqzv3BEwm43BWfjQbuvWtKZxTzCc6Pv3dxLgdblE3Fl5 +MK/8Gk3ugDZwe563KzAJBgcqhkjOPQQBAzAAMC0CFQD8O8WJ7okGjHRs/J6rWo+n +FNrwCgIUcFcuAK3K1tfYuE3QGm4smu2n8iM= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICLzCCAeUCCQCg3U8Mc7XCPjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTkzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAxOFoXDTEwMDExNDIxMzAxOFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMjU2cjFzZXJ2ZXItc2VjdDE5M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE6I/f +uxD+wYynPua+enF00uSb3hHLi105QljhMjfpXRyMt7jW7N0N44AeQLqvUuX/Ou0B +zXDtE8R5tbU5n1p9vjAJBgcqhkjOPQQBAzkAMDYCGQCRU8ROxYXzP4UclxGtca7W +b03WyYZAva8CGQCTE3650WcJy0ka07FL3RuScknp/D4SZh0= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICRTCCAe0CCQCwSXFmzpBH6zAJBgcqhkjOPQQBMIGrMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMSswKQYDVQQLDCJUZXN0IFNlcnZl +ciAoc2VjcDI1NnIxc2VydmVyLXNlbGYpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVu +dGFsc3R1ZmYuY29tMB4XDTA1MTIwNjIxMzAxOVoXDTEwMDExNDIxMzAxOVowgasx +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmll +dzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxKzApBgNV +BAsMIlRlc3QgU2VydmVyIChzZWNwMjU2cjFzZXJ2ZXItc2VsZikxIjAgBgNVBAMM +GWRldi5leHBlcmltZW50YWxzdHVmZi5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAAQtDOsv5pQz7RzsMK68LUeAIDtdJddk55oLsrd2+93FHIr1CiqOwr/3sH3V +USapRS4Xlb7VvtkFmCGLMna0TEdiMAkGByqGSM49BAEDRwAwRAIgGqI3kC9COsLQ +nUnZmwVaNp6le9PQwro6m6b0r6MgaOgCIFH1x+AgAV+HvbGkPTjIW+Cp1oUcbMgd +iDnA5kk037nh +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDczCCAvqgAwIBAgIJAMKpQMf1IUoCMAkGByqGSM49BAEwgZwxCzAJBgNVBAYT +AlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UE +CgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHDAaBgNVBAsME1Rlc3Qg +Q0EgKHNlY3AzODRyMSkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50YWxzdHVmZi5j +b20wHhcNMDUxMjA2MjEyOTU0WhcNMTAwMTE0MjEyOTU0WjCBnDELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEcMBoGA1UECwwTVGVzdCBD +QSAoc2VjcDM4NHIxKTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZmLmNv +bTB2MBAGByqGSM49AgEGBSuBBAAiA2IABMaXMYyVYpN6QWe+5TpTN8r9jbAPUEO/ +YuR23HOX5Kq1bP0GoF96uXx53X0V0EOncf/navTd9e7oF4BOgkCsHe0bD2p8b82I +IbQ953K3DDT6eIW4TXF7YvS/xF9ByIx/iaOCAQUwggEBMB0GA1UdDgQWBBTqywJZ +V6bCSeOnSQ3riDM0TDfIMTCB0QYDVR0jBIHJMIHGgBTqywJZV6bCSeOnSQ3riDM0 +TDfIMaGBoqSBnzCBnDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQH +DA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQKDB1TdW4gTWljcm9zeXN0ZW1zIExhYm9y +YXRvcmllczEcMBoGA1UECwwTVGVzdCBDQSAoc2VjcDM4NHIxKTEiMCAGA1UEAwwZ +ZGV2LmV4cGVyaW1lbnRhbHN0dWZmLmNvbYIJAMKpQMf1IUoCMAwGA1UdEwQFMAMB +Af8wCQYHKoZIzj0EAQNoADBlAjBb8D7U8OiqO8ZU9gUrkMo0Y23AN58o3TSapRge +7qiAuUOVraWioNrrNVpC2z2YI2YCMQC53bKQvlqIQ+GbGMY6C5v+F/zESmVie06v +ba7qe2vIl6OIBiPOP5c5gCj4Nj1g3uI= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICnjCCAgcCCQCg3U8Mc7XCRzANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAxMDI0KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwMjVaFw0xMDAxMTQyMTMwMjVaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjcDM4NHIxc2VydmVyLXJzYTEwMjRjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR+ ++z6+8do8BpOuYXtGlnKN6jwDj1MdbcUM9sqJBdvVnBJdHfOCL+nVGSvyTY5BUxJ7 +FT5XG+9H0+juJlC7iUu7guxwXdhkChnOQ28buUqsWYH0yHiKJe5F/Re2ESERPi8w +DQYJKoZIhvcNAQEFBQADgYEAPPio0j09V6vXhN3GYwa3ARjboJIO53kTNa65UGgC +qvdLNufcBRldt2vezR0NKj3CTY+/uD+lNwTp+HdnIGkz0hHA722nv0VZGX2MWdMs +/2/D36kJA89IIPLKkQjzmmjIQ9wNDSAt31j9b/TiUfeodaEZZR/iST5UHDvkSIZE +EHs= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDHzCCAgcCCQCg3U8Mc7XCSDANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAyMDQ4KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwMjVaFw0xMDAxMTQyMTMwMjVaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjcDM4NHIxc2VydmVyLXJzYTIwNDhjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASw +i3q++pOW/2tqHTpGB6X85pKO+oCQa/1KSQhKCjVExJxwfQlClNkHgerFUnMr1Zvu +e468EX7/r4gdnMQn+8FPWcYZ+2PYLHaNa4zmLPZq1YJRq5gjIU96uE9nJLoCJO8w +DQYJKoZIhvcNAQEFBQADggEBAE5R94CP/nqChXrMPmHThRReMGXc65FOXtXrQvNb +YKa26EKHy50fqh0sZkfIMqF8CVYhpMM96f7xJgHBJ1GY20Ayp4Om+nmC1U6in5yk +G+LO1H5uDwn3be9tLXW9Jiif/FSDJvY7GhWMys9W9QpojHrNT1eVGPu5zmZxfvDn +nPlrxOxx2yVSkc04zAfBibKd+iNBLI9x1hEWv9gVILow/nsF+HEceGqCKrKtw3CB +vRek+mUZCUDD6gKsN0LeGnRbEFTjyYp3iqbA7/zaCsXi0C9RowKD/uhQmmsduxFT ++mRBNP2Ni4BGJoFGt6ynkhQMKMcZOgCfG9qu9xFpRa2wn+s= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICRDCCAgICCQCg3U8Mc7XCQTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMTYwcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyMFoXDTEwMDExNDIxMzAyMFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMzg0cjFzZXJ2ZXItc2VjcDE2MHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEeU60tao/ +d69lrHxMAx6xC9aIXgbFzDxSl39sQORDuiv7YgqxSNxusAnCCER5YT7i0WfH2LEh +kSO16D40edXpxFXXctF6uOT9KK84oCT2ciV1QbArI1ROExKum1U/qYd3MAkGByqG +SM49BAEDMQAwLgIVAJNssWK3wbZ17bXdaVCc2oydMEqBAhUApNb51n/19FEejcXt +msPefDlmlWA= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICWzCCAgICCQCg3U8Mc7XCQjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMjU2cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyMVoXDTEwMDExNDIxMzAyMVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMzg0cjFzZXJ2ZXItc2VjcDI1NnIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEUKGBne87 +l7cssaiEtxw1EOATJFv/yHz1811mfKPqCJjpVi5NVLt5q2b7DfWvi4839ywNdD5l +ne3mzh6WT20lH52LkS/sMj2shtx0NAIWQM+SJMi7BrBRtymaXtRZQQxdMAkGByqG +SM49BAEDSAAwRQIgBmcyaM69Ryota/XMkDJzkW8a3zCZahsE5DlTrg+Y+VkCIQD1 +Sp6MuZy6JzwtASW/l/Z313mvQduVpzdtezQtvhXqMw== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICfDCCAgICCQCg3U8Mc7XCQzAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMzg0cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyMloXDTEwMDExNDIxMzAyMlowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMzg0cjFzZXJ2ZXItc2VjcDM4NHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAELraTwEbQ +rTk40nU76I/MUWvDrX4HEhnNt2Wor50zzHpNtcWlDh64xyDIUO6IgwPumY93PMUR +E2ObEw1zm2jLx+ld32CHZhVD3NFg1eyUzxUWXlnV5YyMQg4kM+Q4RfSoMAkGByqG +SM49BAEDaQAwZgIxAJp22vZKPO/FetlqwLIcghqoy0rueCskFQC53fhU0zAybTiI +zDLzM3AwwwIjHHIvOQIxALyleafaqz+Uh10WWnhenZ4wEcGtnvMq7NOLA26DttBq +Hda4UJnBkRFBo5+N0m+l6Q== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICoDCCAgICCQCg3U8Mc7XCRDAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwNTIxcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyMloXDTEwMDExNDIxMzAyMlowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMzg0cjFzZXJ2ZXItc2VjcDUyMXIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEtyVcUCcJ +RsoFtoxLIFg32suhU2Vsm3HjI5+uMg/04EdQWsSZ20b2aPZ0G9eOI//t4LT9ha7D +Q8XjDRQl4+MMpcQZPz05CPeM3V+51ORa0TsU5H55mkaI6jzyqjBqU1zMMAkGByqG +SM49BAEDgYwAMIGIAkIApq6d1qKZ5OzFIEJQ2eqFa4TRW2BH18BhK/5+LHv4hI5Q +yIFU0wvnWufrlDpPd0sHZs4Rtyv7DXKLalafI0rt8wMCQgF3KIktGZN0ppn42anJ +UgxeryI8lssrz6y7o1t8bgkCSpPUHFOJiaPcAMaCJIy9/pTkNqItAS6vD9OXvLCq +qkTIUg== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICQzCCAgICCQCg3U8Mc7XCRTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTYzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyM1oXDTEwMDExNDIxMzAyM1owgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMzg0cjFzZXJ2ZXItc2VjdDE2M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEkRuBmaS+ +693na8/kbscQtkKYQyhZ1w+fRbK8vSoPey6GxxDsFU01DAZtxhAiFKDh5Eh1s8ur +goSjJFGjIJWSzgzK2NN6zrvlpuNFYeIbM4ALvRsYDAMJ+3tl3Vq30BWhMAkGByqG +SM49BAEDMAAwLQIUDc0O2pwXZTxjX/TO4dmxlMoBUUYCFQL051eCJ9zO3XAww5Rv +n2Obyhhq6w== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICTDCCAgICCQCg3U8Mc7XCRjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTkzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyNFoXDTEwMDExNDIxMzAyNFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwMzg0cjFzZXJ2ZXItc2VjdDE5M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAENttarKTc +CJ4k1b8Fd14pSbGQprsbAFfxk7QhONku4iyam7bmVM5b9Q0SjfNzKIT8yW2swCdi +cFFOcMlpYFGbGNk9kV3mkMhHi5qgbw4iv6/U3WiT7kxfbJjNzWAcGQOQMAkGByqG +SM49BAEDOQAwNgIZAIDGXPjGWx96qYTgjUzg80VsiRV5TINzjQIZAIoa/jec5ioW +ZAvx7piEzY3fRw/YpRMF1A== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICgjCCAgoCCQCROG+IEgiARDAJBgcqhkjOPQQBMIGrMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMSswKQYDVQQLDCJUZXN0IFNlcnZl +ciAoc2VjcDM4NHIxc2VydmVyLXNlbGYpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVu +dGFsc3R1ZmYuY29tMB4XDTA1MTIwNjIxMzAyNloXDTEwMDExNDIxMzAyNlowgasx +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmll +dzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxKzApBgNV +BAsMIlRlc3QgU2VydmVyIChzZWNwMzg0cjFzZXJ2ZXItc2VsZikxIjAgBgNVBAMM +GWRldi5leHBlcmltZW50YWxzdHVmZi5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNi +AASCHyVEN+D1kiuu8teqNLvuT/r0cNoE7RyKEt9wpkOMB9NdcFEzVClX9A0AmovZ ++OGwM4ltWN40BFkImyHmwzGRwZEJYdgmFtZOwRKJaMWadbqpto5PtuB+SpFhtQmO +dDMwCQYHKoZIzj0EAQNnADBkAjBCpsIVKSYpyYXCWfeYVf5odGJ7ZAgnT7iYstM3 +HZBfdXA6t8zjXICA2ICOqrR1xUoCMDm7poy6GrsHEOMsBoVS5T9U0p3ouMyOhkIm +0EykkGk1wK+9Z6QM/DLP8lLJB0IrDA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDvjCCAyCgAwIBAgIJANErVg+ok6iAMAkGByqGSM49BAEwgZwxCzAJBgNVBAYT +AlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UE +CgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHDAaBgNVBAsME1Rlc3Qg +Q0EgKHNlY3A1MjFyMSkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50YWxzdHVmZi5j +b20wHhcNMDUxMjA2MjEyOTU1WhcNMTAwMTE0MjEyOTU1WjCBnDELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEcMBoGA1UECwwTVGVzdCBD +QSAoc2VjcDUyMXIxKTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZmLmNv +bTCBmzAQBgcqhkjOPQIBBgUrgQQAIwOBhgAEADNScfIghIZGN1TI9A6iM8F+LrAg +xrInc7nmKIBtdYYfsFWwT4P6bQqNrOZixrSmTiZXSGWhzaj+gGAdF8vfr81YAVNe +1hkuP3iC/4iaRk9vyMDHNvKDHQeUxFNIL2UTAfSTl0vYmL1C5KkpYU3+qBVFTLpa +7uImk1s3wQIkTTHyFLLMo4IBBTCCAQEwHQYDVR0OBBYEFAwP2eZOjIq6F87PsSjp +qniRzxZpMIHRBgNVHSMEgckwgcaAFAwP2eZOjIq6F87PsSjpqniRzxZpoYGipIGf +MIGcMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWlu +IFZpZXcxJjAkBgNVBAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRww +GgYDVQQLDBNUZXN0IENBIChzZWNwNTIxcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJp +bWVudGFsc3R1ZmYuY29tggkA0StWD6iTqIAwDAYDVR0TBAUwAwEB/zAJBgcqhkjO +PQQBA4GMADCBiAJCAYD/Rk9FMPk0ZzNrXCHKRdXkjBqfsoB5VYRjFIQnIz8+xEAC +KqHjdmYd4djR6l6NA4olKQn+LUwE2hmtom6res2GAkIBPDlBcwGzoDxU4CQQb/rP +cFEMaA5I4fpGdSNYtIJDkXNluVHAPkv+uK9lrhsjuvpVbh76+mM3B9bg4Tq6+Pxb +KN0= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICxDCCAi0CCQCg3U8Mc7XCTzANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAxMDI0KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwMzRaFw0xMDAxMTQyMTMwMzRaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjcDUyMXIxc2VydmVyLXJzYTEwMjRjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wgZswEAYHKoZIzj0CAQYFK4EEACMDgYYA +BAB+Wp/To8yXNzzp1Iw12ACR2Zc2s8o19H3E8cgC26eDcDYzlAf67/ldZyQ0WDzI +xUlxeJjmNcdiavR5usOo/2lE2AEK1tWu/xVhZZZHWiNQ0vZdZ43BHtBPcqdHRZKv +RRZWrP1pd9ubq1UDzegZdFQ5JwwQjPXz4jpOfTYO5TrmftxZjzANBgkqhkiG9w0B +AQUFAAOBgQAMYv77n1SJ+MDneFbJ2ssBd6aw+hbVqwBVopd0YC+i1Kt5bDe649d/ +vMAtnEmOF8G9/ugg5XVoB0M+6DINC/a5HYYZEYAW/g3Q44XaZCJWOvEVYhFAeUNb +BigmNP4yGv3vP+1rqwEqhb9quxYF2n1e3BuBbi9HkIf2Gp0sMP3pcA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDRTCCAi0CCQCg3U8Mc7XCUDANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAyMDQ4KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwMzVaFw0xMDAxMTQyMTMwMzVaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjcDUyMXIxc2VydmVyLXJzYTIwNDhjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wgZswEAYHKoZIzj0CAQYFK4EEACMDgYYA +BABjwtNCj8IRxv8e0qyePjKGqOvlcPDzx54bcokXDVHxWOL3OEljqi8qWxJm+Mzg +Xhr888VBZdWjF8iXGgtGPEyNRwF635gdYvpcJoz+I1Jg5XzJYo+kLpf/xt5V44/P +EizJQyx/aJ4thsf2gCfFg/zWpDQbcjrwjz10fzLW7rkt7otbAjANBgkqhkiG9w0B +AQUFAAOCAQEAK88ka6Xlvl/Bg2W9TyAh6zPEtDHU3WPN10LxU4ghbStUGx/YupTr +LSg7nLOQo9CI8LKb+tpTaMPmCSTH5Cfwh+f7Uw20wbvPBg06GiBdQjuK3Dvk64B6 +41s4Y75J0wpXJfgezARRlLe0VLAWwH9ZnZRiqtndF527dPBi8EF3qc8X1sGaQ8tn +EVCd2ifptLgp+eI78QdKsgDFpjDOSJNbLDI1yQcm/0EafyJLKd+xH3EBkaaiw+OV +ctYsD3ebQ6tldDnopgbisTmtwvHGqzVGTG8DDX1El2YhVe4bwZTtLBjcbtJxDg/V +0FLkpRjQ/sDqMbDMb6CUoHRa8Urq13e0Cg== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICaDCCAigCCQCg3U8Mc7XCSTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMTYwcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyN1oXDTEwMDExNDIxMzAyN1owgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwNTIxcjFzZXJ2ZXItc2VjcDE2MHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBQ/O2 +98Fp8ZlEDVNNUHEHYrdrhmofdEsOMsyaabFAWp4cexMjGYgOZaD4/sCYjc1N9sXp +1LqIlBVeAfQ5BCSdqJYAaUQrvL/4evYANvIiymw/peV60y6Vchz/XuKH3M4RVCxa +8d7eeobwzCbM2PjR1loiInAhdFrKJHF2z3M84MPgQJswCQYHKoZIzj0EAQMvADAs +AhQ7SDvm2UNjV6SQf5HoMMrh+K1V4wIUBIIDOf2vtxEmVLXZvaoJGbOf9Vs= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICgTCCAigCCQCg3U8Mc7XCSjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMjU2cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyOFoXDTEwMDExNDIxMzAyOFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwNTIxcjFzZXJ2ZXItc2VjcDI1NnIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAqYn6 +hGbL5dTx1gnWnUBp40JXPKxlrAi4p6ofvM6Kd1HwtQLgeNpIqi1TtxXPc4HkHu9F +gqV5pOJhEUAF9ABqeigBCGHqHtp7eqq8ZKVfIdQKDUTGsHZe1mkQA9JHqBwi35Mo +TOkUlws3aEFtXyfZcjgUd7PYzOM5Ry/m56RiZGdMu+EwCQYHKoZIzj0EAQNIADBF +AiEAzxdUODAqmgqDDM13NLrIREDlN8BlRgFUW4AFxOg87Y4CICW2qf+ioupQuvWE +da8fLQVnCbVbLUKFZlJd02uIsud7 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICojCCAigCCQCg3U8Mc7XCSzAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMzg0cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAyOVoXDTEwMDExNDIxMzAyOVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwNTIxcjFzZXJ2ZXItc2VjcDM4NHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAx9bl +XZ1Voix3FACqRqpURu5ZjoPPMIY93jbYEL6wZdDU4FFbXOiTYt2At+aQPi8Rjy8a +DI3CxXQ5PCPrCPip8gwABVTtjfQzwJwbqIlZuE/HZL6ZmRkz1iCOmWhk4qDqGUpw +/k78Wgl4GYPBdsZOxzSa0g+XIQEW3MeLGzpEH86zKY8wCQYHKoZIzj0EAQNpADBm +AjEAv1WKxcvLV9MQWHIu1rWic1soAGPIt30b/7Q8VZB7HnRTBtOQUteQevoHHxjo +DZWaAjEA43j2Sh07TKD1c6lglFFONNNuR7orVCapEgoXNgcMceF8cwIuYyCqW75A +EneclLfr +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICxjCCAigCCQCg3U8Mc7XCTDAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwNTIxcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzMFoXDTEwMDExNDIxMzAzMFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwNTIxcjFzZXJ2ZXItc2VjcDUyMXIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAyY+l +SUAwJE5hPEUCwuccerdfzoZMp3c9Hkw/fnvVjQpA0Vvb0piBJ39MRCGYi63RbaRs +QexmUq3XGdbL8mwoV0YB5niOZ9cg6YeqXRAnkcS/GboHNjtYQWysta+D+dfX8S1g +YBuXdNZrbGdAj9UP7+gz/9WrPOctz6gwyeiKLKsvosMwCQYHKoZIzj0EAQOBjAAw +gYgCQgErxOvqzrTt5eHrdH4ZxUn4AM9dBAqX33jKXBKNuRgmyYIxoIO2c2tqkdxC +rXmeudFZmFGEEBor5bg2RMI6pkcoWwJCAe6TIx0KcaF6D1wW9tlmRXZ+888SS6Fq +BdVwn4a8/6TrTxQGmDD6qVTwGco76umjHnam50Kcvg6iBAjfSUmwj/56 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICajCCAigCCQCg3U8Mc7XCTTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTYzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzMloXDTEwMDExNDIxMzAzMlowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwNTIxcjFzZXJ2ZXItc2VjdDE2M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQB3xU0 +hOYQMnJ7L+TLdSkB7ruVnjWo6iwLe0N2GlpCc5jSmBfhGr0NyoKrNY1Zy+VcnGCu +vYgT/aqN7nOnZ86qoQQAq8o2wpdlTbeyzzE26txGTVi+7IN3sVB7DFmqI/R6ngKK +GdkmE6ZOBBcyipzOc/eXRpqoRaIRA+FP2LAPdBnsuNkwCQYHKoZIzj0EAQMxADAu +AhUBOyoJaoo5E6UZ8ICdSZAsL7FpwcMCFQJ1wcD/KuK0g+2WMgpCAuElR+dZIg== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICcDCCAigCCQCg3U8Mc7XCTjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTkzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzM1oXDTEwMDExNDIxMzAzM1owgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWNwNTIxcjFzZXJ2ZXItc2VjdDE5M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBvNN+ +2syVq0vx/Qj1W5IYpeUdyswTzyBNdz0LveNcNEV07jql3o25dPHNGZcVcCvPFw2H +2zpaWV8t0YHjHETM3mEBxgyxwpbM3dkdCuM0VlKEA+rUY64QU8/f0WYU+1cFPBBi +fMOuMKXfb1JNK93W9A9jzmFSVJJVauXYs6JURy60Z+8wCQYHKoZIzj0EAQM3ADA0 +AhgoBo+CqnLTn7UxFzNYtHabS0zMzBzBhN0CGAaNavBCHkk1eX0xmp+7BIxHnWOl +bbeeYQ== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICzjCCAjACCQCYUruIqLYp5jAJBgcqhkjOPQQBMIGrMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMSswKQYDVQQLDCJUZXN0IFNlcnZl +ciAoc2VjcDUyMXIxc2VydmVyLXNlbGYpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVu +dGFsc3R1ZmYuY29tMB4XDTA1MTIwNjIxMzAzNloXDTEwMDExNDIxMzAzNlowgasx +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmll +dzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxKzApBgNV +BAsMIlRlc3QgU2VydmVyIChzZWNwNTIxcjFzZXJ2ZXItc2VsZikxIjAgBgNVBAMM +GWRldi5leHBlcmltZW50YWxzdHVmZi5jb20wgZswEAYHKoZIzj0CAQYFK4EEACMD +gYYABAH3WSHvJZH8mqyGfVxtoyF5pCUVJZTnebvRphld+jK1PFKlzglYN22J8yN9 +l7Ca2h2OjuuEVj3fZAwSAInZtZQzxAEHFMZEVAzoHUPjx9qEAJiNjXcVV79cvrvc +Q8SbYBF3vGB0su2Qydig+VEjmkyklGhxFLQE8fo7fEZh+FfwGG3x6TAJBgcqhkjO +PQQBA4GMADCBiAJCAYLsxXVifQfzuyZRMNqzldUcASTgs1L/MMtJcEvYtFpeaGXd +Nn1jIynPkC3rgjbejtLe4OypPymrkVE0Bjn3rKU/AkIB1TtXqfmYkTdOO/AUriRl +GSatOobx7QQ+CyOtziObl1UPe7hDYGX8quZPxWnx6MgtO4I4sSZWA7/0C6N61XSq +NPs= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDBjCCAsSgAwIBAgIJAJUfXqNiGl4gMAkGByqGSM49BAEwgZwxCzAJBgNVBAYT +AlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UE +CgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHDAaBgNVBAsME1Rlc3Qg +Q0EgKHNlY3QxNjNyMSkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50YWxzdHVmZi5j +b20wHhcNMDUxMjA2MjEyOTU2WhcNMTAwMTE0MjEyOTU2WjCBnDELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEcMBoGA1UECwwTVGVzdCBD +QSAoc2VjdDE2M3IxKTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZmLmNv +bTBAMBAGByqGSM49AgEGBSuBBAACAywABATc2/gR5Sk1spq3ktZK4UCWH8ILGQJy +xhua4tLSekXuk3joLxw7GVD/K6OCAQUwggEBMB0GA1UdDgQWBBTRQhIcGNnfzY1r +7mAO0j6l4jrt1jCB0QYDVR0jBIHJMIHGgBTRQhIcGNnfzY1r7mAO0j6l4jrt1qGB +oqSBnzCBnDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3Vu +dGFpbiBWaWV3MSYwJAYDVQQKDB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmll +czEcMBoGA1UECwwTVGVzdCBDQSAoc2VjdDE2M3IxKTEiMCAGA1UEAwwZZGV2LmV4 +cGVyaW1lbnRhbHN0dWZmLmNvbYIJAJUfXqNiGl4gMAwGA1UdEwQFMAMBAf8wCQYH +KoZIzj0EAQMxADAuAhUD5UVJP72K01PbvDeANWleHbjxd48CFQN6Qt34E0JeefbC +NVkYG6pXLegBvQ== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICaDCCAdECCQCg3U8Mc7XCVzANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAxMDI0KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwNDBaFw0xMDAxMTQyMTMwNDBaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjdDE2M3Ixc2VydmVyLXJzYTEwMjRjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wQDAQBgcqhkjOPQIBBgUrgQQAAgMsAAQE +/r8twiEWpvxX4VUSmCw1JJNHF9IDvIxktMTtZqcK2/57GElqT5Hmi1swDQYJKoZI +hvcNAQEFBQADgYEAHmeOaUdqT4x1o7UCpXTW8D2+XCTCFMpPENH0plL7ALUj5R2D +av2TvKKSwpbyOJa26Rx5KEMNntGpSN1X4+a+wPHZ87J3wmtU7B6nEaHIkFM/iGRQ +M2Ip+lBhebd1e+itwIRnpFcNt5dD276F30928E6kxwSge2uoQJySFV+Xuho= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC6TCCAdECCQCg3U8Mc7XCWDANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAyMDQ4KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwNDFaFw0xMDAxMTQyMTMwNDFaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjdDE2M3Ixc2VydmVyLXJzYTIwNDhjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wQDAQBgcqhkjOPQIBBgUrgQQAAgMsAAQD +jbQ3J7+yvmgc++WxXN52nfRQWnkFc1DUqspljUJyusmdPI1+8ki7FcMwDQYJKoZI +hvcNAQEFBQADggEBAAF3SF1Wmlk6F/IeQs0hlLHF/ik0xWngsO/Qgqrax6MGLdPW +jjJDE1UY6mjNXo8kuV9nIr4+27RN1q3hlSaVC47BX9kZNOs+nO/8h4mFXSV3osq4 +7RrJ5RJ/seXk6s7QItfmZslv7LR/FrzTF7pDv385WwwRXpfhCIY3X24bSt7dgK4j +CkXf6GV9WTrICmNRBeV8/LJAbETU6XPhBXpIlYO0sasSfbCd/j4voIUhwZgPXdGx +iNVWcwgntcOwx4wXJOoWoiiU/j+eS6YDrsxqgdV3j0+JYWQNUvFhrotI/HjbZ8RU +rUiYpAcbghxkent0pcmkcHbJJcj/8/AzQcp+iYg= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICDTCCAcwCCQCg3U8Mc7XCUTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMTYwcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzN1oXDTEwMDExNDIxMzAzN1owgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTYzcjFzZXJ2ZXItc2VjcDE2MHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEAwEAYHKoZIzj0CAQYFK4EEAAIDLAAEBW5dGOJD +CIYYqj8GEUDWGalB2d6wAQzBC6qR3h5seNsC212ApAdfYdTUMAkGByqGSM49BAED +MAAwLQIVANtclGRvcbIOV+XiYhSBeiuj/XAZAhQjQSZ21bwoOnKjnybeDYMhqEIG +1w== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICJTCCAcwCCQCg3U8Mc7XCUjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMjU2cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzN1oXDTEwMDExNDIxMzAzN1owgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTYzcjFzZXJ2ZXItc2VjcDI1NnIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEAwEAYHKoZIzj0CAQYFK4EEAAIDLAAEAEvhHRk9 +YT/OvjnDdKuUpfv4RLbvA+ea8m5+4zH4agPsJFjEgC+Tl2AoMAkGByqGSM49BAED +SAAwRQIgEE8zOqy0HkGCnAqdj0xUdpN43vyhBy08G6wx5tWFYekCIQDk0Rc/a8Mz +id0zWgeo4cFUv75+S86WaSSxnkbgKD/PfA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICRDCCAcwCCQCg3U8Mc7XCUzAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMzg0cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzOFoXDTEwMDExNDIxMzAzOFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTYzcjFzZXJ2ZXItc2VjcDM4NHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEAwEAYHKoZIzj0CAQYFK4EEAAIDLAAEBLc5EQ+F +QABNsN7pyoOE60q/aokmAgE6Su1TfwZKvAGjxcAF4+l/I015MAkGByqGSM49BAED +ZwAwZAIwD2i5VWRPgSSx/Q2JgJTN96q/T/rmDW+IzyqEU78KwzVIhf8zUIjQH5Pv +az+KrObIAjBNUjCd2rUJorAOrDcf/s8d7KFBnxoiRjNCRKO6SiPvI8Cc4jaXfja5 +XZJjzk8P/nc= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICajCCAcwCCQCg3U8Mc7XCVDAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwNTIxcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzOFoXDTEwMDExNDIxMzAzOFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTYzcjFzZXJ2ZXItc2VjcDUyMXIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEAwEAYHKoZIzj0CAQYFK4EEAAIDLAAEAcPPApQN +hrXdgu0Rxv5SSy9Exry/Ag78xFNPzTR9mJxS1X8tN1wfiJOBMAkGByqGSM49BAED +gYwAMIGIAkIA1Fm7h0vZAywp1Wf3xNI3wm29lK0BSWOVO6fQyWYmKghKi325Tkbw +MbyO3D9YXC2K1G7zQrG5GXA1Jo82ndhpsKUCQgHK67lXzYtfCndSWDrPftXEqn0T +epSGI3I5vxlJuvx2UW1fvZt098Ku4bR8ixKVgDHo8TuEEsJJg+johh0oZHQj7Q== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICDTCCAcwCCQCg3U8Mc7XCVTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTYzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzOVoXDTEwMDExNDIxMzAzOVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTYzcjFzZXJ2ZXItc2VjdDE2M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEAwEAYHKoZIzj0CAQYFK4EEAAIDLAAEBd4sp9FM +F2RQWVjZqhqKPRhVhcOrB20Iqn3MfUIXpKnZWBugJZYgQVIvMAkGByqGSM49BAED +MAAwLQIUAwzB/r2hCllysJwxwC4VKKF90igCFQCO0ik9fYlw5RInDzDH/f7xjOOS +gw== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICFTCCAcwCCQCg3U8Mc7XCVjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTkzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzAzOVoXDTEwMDExNDIxMzAzOVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTYzcjFzZXJ2ZXItc2VjdDE5M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEAwEAYHKoZIzj0CAQYFK4EEAAIDLAAEAgD1SibB +UQJtSvkK42sdggot73fzBk2J+aj3WSvDHwMXsYslaPQG71lYMAkGByqGSM49BAED +OAAwNQIZANBEfel7WcTKFV0q3UTeod1T3K7ClZQpQgIYZe6dll2Llj3A2S6eRB1G +qjDJaejrFGxR +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICFjCCAdQCCQCKZ9MLoj/3JDAJBgcqhkjOPQQBMIGrMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMSswKQYDVQQLDCJUZXN0IFNlcnZl +ciAoc2VjdDE2M3Ixc2VydmVyLXNlbGYpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVu +dGFsc3R1ZmYuY29tMB4XDTA1MTIwNjIxMzA0MVoXDTEwMDExNDIxMzA0MVowgasx +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmll +dzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxKzApBgNV +BAsMIlRlc3QgU2VydmVyIChzZWN0MTYzcjFzZXJ2ZXItc2VsZikxIjAgBgNVBAMM +GWRldi5leHBlcmltZW50YWxzdHVmZi5jb20wQDAQBgcqhkjOPQIBBgUrgQQAAgMs +AAQAbsGEXvpTlsxcf5b1S0Uv+CW6aDIAD1SB5MwpErkmq6eCFPVF2c3iIZ4wCQYH +KoZIzj0EAQMxADAuAhUAhh4DeqrebKZ7IoIO+gYcs1tT4IsCFQD51UVBnZrYhqHT +tKfswmapHLXMzA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDFTCCAsygAwIBAgIJAI4aIMim8fazMAkGByqGSM49BAEwgZwxCzAJBgNVBAYT +AlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UE +CgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxHDAaBgNVBAsME1Rlc3Qg +Q0EgKHNlY3QxOTNyMSkxIjAgBgNVBAMMGWRldi5leHBlcmltZW50YWxzdHVmZi5j +b20wHhcNMDUxMjA2MjEyOTU2WhcNMTAwMTE0MjEyOTU2WjCBnDELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEcMBoGA1UECwwTVGVzdCBD +QSAoc2VjdDE5M3IxKTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZmLmNv +bTBIMBAGByqGSM49AgEGBSuBBAAYAzQABADC/YtwwrsyHusPx05mHRMV3Rjw5dcw +LLUAIh3jrWVGFFLWZl0QCs2xBnGF6KfjKnOdo4IBBTCCAQEwHQYDVR0OBBYEFHVx +jVCVss3ZetdFkR0auNgmLXljMIHRBgNVHSMEgckwgcaAFHVxjVCVss3ZetdFkR0a +uNgmLXljoYGipIGfMIGcMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFjAUBgNV +BAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1biBNaWNyb3N5c3RlbXMgTGFi +b3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChzZWN0MTkzcjEpMSIwIAYDVQQD +DBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tggkAjhogyKbx9rMwDAYDVR0TBAUw +AwEB/zAJBgcqhkjOPQQBAzgAMDUCGFVX2d9M0NbxeusbaUjMcWwviXPQpNEHvwIZ +AOPKXDtDGAwkb42kO7ms7rzN7R4LN788MA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICcDCCAdkCCQCg3U8Mc7XCXzANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAxMDI0KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwNDVaFw0xMDAxMTQyMTMwNDVaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjdDE5M3Ixc2VydmVyLXJzYTEwMjRjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wSDAQBgcqhkjOPQIBBgUrgQQAGAM0AAQA +vZA91W5lNk3Ru3pALBexkJpZ9K0WjZrLASMO9wZGvbukocKAPYTfDYdcSwdwqHuU +RzANBgkqhkiG9w0BAQUFAAOBgQB/Gcwd09VVyOWJq9cIA5tga/ZBYwgXv+T3eAUU +Ert7tGQgD/eysWYvTB+Vu9zUvGyWWtUfzoFMP1R2MeuxnDMiXyhhQ+7UKl3P7AQy +P060oo1DP7RWK8D8oz8IFeP6ttaiRgetE3hnHUwbxnO30bdiN61EdWBT0Dp+0LuP +Yg6Ndw== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC8TCCAdkCCQCg3U8Mc7XCYDANBgkqhkiG9w0BAQUFADCBnzELMAkGA1UEBhMC +VVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MSYwJAYDVQQK +DB1TdW4gTWljcm9zeXN0ZW1zIExhYm9yYXRvcmllczEfMB0GA1UECwwWVGVzdCBT +ZXJ2ZXIgKFJTQSAyMDQ4KTEiMCAGA1UEAwwZZGV2LmV4cGVyaW1lbnRhbHN0dWZm +LmNvbTAeFw0wNTEyMDYyMTMwNDZaFw0xMDAxMTQyMTMwNDZaMIGwMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNV +BAoMHVN1biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMTAwLgYDVQQLDCdUZXN0 +IFNlcnZlciAoc2VjdDE5M3Ixc2VydmVyLXJzYTIwNDhjYSkxIjAgBgNVBAMMGWRl +di5leHBlcmltZW50YWxzdHVmZi5jb20wSDAQBgcqhkjOPQIBBgUrgQQAGAM0AAQA +qMKb0SJmrWoWnZxXZh5jhRZnF9vRyljvARAR7/z2+gU/qkOTcxuE9RYxgqHtDVRE +fjANBgkqhkiG9w0BAQUFAAOCAQEAScWVdynbg9B9VCtF4Ct8sXMRRYuwCLUt5Yp/ +rtLXmhUuZR0qCvuCMoDo2+HdQNcwEZr7teH2jZ9gYcfq1GWouwA36rafR8e4GQ4P +egySyKLYkZ7sKhrKacN4k1XItlxHsWWtVRs79smAVgpVIu5IA2Pm5BZEuIUPCIAF +3gSHM6Y0UHWGazxaToUEiPh7jVh5eUA8wAdhKFhiLtrIlZo9u2BCXmPiwBj71fSY +iyEArag7u/n5pfoBYzwiiAFLddQiuwaxe8jPt0+RJI5Dhs0IzX6L/Xzu06qkKPjF +9AX5PkBWj5GAjPCU/8t3O2wrMBvCw7G7epMXNXjTqJf6no5sig== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICFTCCAdQCCQCg3U8Mc7XCWTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMTYwcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA0MloXDTEwMDExNDIxMzA0MlowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTkzcjFzZXJ2ZXItc2VjcDE2MHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEgwEAYHKoZIzj0CAQYFK4EEABgDNAAEANui7TQR +XIBnrqvvP9zgztIKdqeIwISmzQBKKwC3FMR/Ma/MJCuBuXANUV3Xbi/rwwswCQYH +KoZIzj0EAQMwADAtAhUAhNmGbEAG/eht1YE9KUUf7v/k9ywCFDO9YqZLm7mvDe2Q +Vp2EWIS8AFw0 +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICLjCCAdQCCQCg3U8Mc7XCWjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMjU2cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA0MloXDTEwMDExNDIxMzA0MlowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTkzcjFzZXJ2ZXItc2VjcDI1NnIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEgwEAYHKoZIzj0CAQYFK4EEABgDNAAEAE/bjnPS +yBqy8ageF1ZpfzHTAoEzcV5UywAlrF6AsP5UDVbbxWzEYENodBbIAyu5gmswCQYH +KoZIzj0EAQNJADBGAiEAyOvzEV5o/+YRAkIQY/+Le1n3wzUvr9QMwVlOg/yZMvsC +IQCFFD9AOt0tQTxWsDgGzCoVbz9MnnWzptIsGx4HXUm4YA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICTTCCAdQCCQCg3U8Mc7XCWzAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWNwMzg0cjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA0M1oXDTEwMDExNDIxMzA0M1owgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTkzcjFzZXJ2ZXItc2VjcDM4NHIxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEgwEAYHKoZIzj0CAQYFK4EEABgDNAAEASNBKWzJ ++B+4G2UTsTqBM0cjsdS6C5cmHwC1oYKyagdGeWkSzI3wsNJri29OBB3wg1YwCQYH +KoZIzj0EAQNoADBlAjEAvCF43f3XJZHJ43dChTwVcMxrvrkEg33BCdkpab3ZzQGc +4z8YLxgXwNgQtoWakxepAjAT9zi78gOcvIOLt+cONUWX1Q3dwsqz7ELfB51+H9EC +njcMe07enAwPTGZhifhBqfQ= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICFjCCAdQCCQCg3U8Mc7XCXTAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTYzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA0NFoXDTEwMDExNDIxMzA0NFowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTkzcjFzZXJ2ZXItc2VjdDE2M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEgwEAYHKoZIzj0CAQYFK4EEABgDNAAEAInznYj4 +XfwSdi2XrqLF6uQ1/sJoFEveBQCqz+XoSsXKgRmMCO2iMHVGctNbcz8RptMwCQYH +KoZIzj0EAQMxADAuAhUBfBAH/3ROR9VsZKAhW0fR6i/ud9gCFQCdjuAk1NhSTtAD +AcZ+gSnBmESa1g== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICHDCCAdQCCQCg3U8Mc7XCXjAJBgcqhkjOPQQBMIGcMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMRwwGgYDVQQLDBNUZXN0IENBIChz +ZWN0MTkzcjEpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVudGFsc3R1ZmYuY29tMB4X +DTA1MTIwNjIxMzA0NVoXDTEwMDExNDIxMzA0NVowgbIxCzAJBgNVBAYTAlVTMQsw +CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEmMCQGA1UECgwdU3Vu +IE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxMjAwBgNVBAsMKVRlc3QgU2VydmVy +IChzZWN0MTkzcjFzZXJ2ZXItc2VjdDE5M3IxY2EpMSIwIAYDVQQDDBlkZXYuZXhw +ZXJpbWVudGFsc3R1ZmYuY29tMEgwEAYHKoZIzj0CAQYFK4EEABgDNAAEAGJbRZVS +qbKx8P+C60EaCmnuolgSDf7fqwE0oMSo8dtSmq1vSmqXjbQHWaze3zev50swCQYH +KoZIzj0EAQM3ADA0AhhsmuN8sbGYzItLtNqk/kXRvBSk+gOeKaECGBAT5pnVqKan +q4wuATzeJEv5LeT9H3GU1A== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICJDCCAdwCCQCzW7zGCDpEhzAJBgcqhkjOPQQBMIGrMQswCQYDVQQGEwJVUzEL +MAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxJjAkBgNVBAoMHVN1 +biBNaWNyb3N5c3RlbXMgTGFib3JhdG9yaWVzMSswKQYDVQQLDCJUZXN0IFNlcnZl +ciAoc2VjdDE5M3Ixc2VydmVyLXNlbGYpMSIwIAYDVQQDDBlkZXYuZXhwZXJpbWVu +dGFsc3R1ZmYuY29tMB4XDTA1MTIwNjIxMzA0N1oXDTEwMDExNDIxMzA0N1owgasx +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmll +dzEmMCQGA1UECgwdU3VuIE1pY3Jvc3lzdGVtcyBMYWJvcmF0b3JpZXMxKzApBgNV +BAsMIlRlc3QgU2VydmVyIChzZWN0MTkzcjFzZXJ2ZXItc2VsZikxIjAgBgNVBAMM +GWRldi5leHBlcmltZW50YWxzdHVmZi5jb20wSDAQBgcqhkjOPQIBBgUrgQQAGAM0 +AAQAjhf42KmZLPPrcBCdsOJpU9uDCZDh7CD7Af3pMkj8friWXyIZBoKwChbkPOnT +wq4XMTAJBgcqhkjOPQQBAzcAMDQCGD0nycV04j9b/1/l1cnRJWtuaHUK2LPmdAIY +fDH6KdS9OQSXMHdiCLnK5mWYTDG0g0em +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ec/keystore b/jdk/test/sun/security/ec/keystore new file mode 100644 index 00000000000..b59a2ab43c6 Binary files /dev/null and b/jdk/test/sun/security/ec/keystore differ diff --git a/jdk/test/sun/security/ec/truststore b/jdk/test/sun/security/ec/truststore new file mode 100644 index 00000000000..643c7a84dab Binary files /dev/null and b/jdk/test/sun/security/ec/truststore differ diff --git a/jdk/test/sun/security/krb5/IPv6.java b/jdk/test/sun/security/krb5/IPv6.java new file mode 100644 index 00000000000..768a10f5a16 --- /dev/null +++ b/jdk/test/sun/security/krb5/IPv6.java @@ -0,0 +1,130 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6877357 6885166 + * @summary IPv6 address does not work + */ + +import com.sun.security.auth.module.Krb5LoginModule; +import java.io.*; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.security.auth.Subject; + +public class IPv6 { + + public static void main(String[] args) throws Exception { + + String[][] kdcs = { + {"simple.host", null}, // These are legal settings + {"simple.host", ""}, + {"simple.host", "8080"}, + {"0.0.0.1", null}, + {"0.0.0.1", ""}, + {"0.0.0.1", "8080"}, + {"1::1", null}, + {"[1::1]", null}, + {"[1::1]", ""}, + {"[1::1]", "8080"}, + {"[1::1", null}, // Two illegal settings + {"[1::1]abc", null}, + }; + // Prepares a krb5.conf with every kind of KDC settings + PrintStream out = new PrintStream(new FileOutputStream("ipv6.conf")); + out.println("[libdefaults]"); + out.println("default_realm = V6"); + out.println("kdc_timeout = 1"); + out.println("[realms]"); + out.println("V6 = {"); + for (String[] hp: kdcs) { + if (hp[1] != null) out.println(" kdc = "+hp[0]+":"+hp[1]); + else out.println(" kdc = " + hp[0]); + } + out.println("}"); + out.close(); + + System.setProperty("sun.security.krb5.debug", "true"); + System.setProperty("java.security.krb5.conf", "ipv6.conf"); + + ByteArrayOutputStream bo = new ByteArrayOutputStream(); + PrintStream po = new PrintStream(bo); + PrintStream oldout = System.out; + System.setOut(po); + + try { + Subject subject = new Subject(); + Krb5LoginModule krb5 = new Krb5LoginModule(); + Map map = new HashMap(); + Map shared = new HashMap(); + + map.put("debug", "true"); + map.put("doNotPrompt", "true"); + map.put("useTicketCache", "false"); + map.put("useFirstPass", "true"); + shared.put("javax.security.auth.login.name", "any"); + shared.put("javax.security.auth.login.password", "any".toCharArray()); + krb5.initialize(subject, null, shared, map); + krb5.login(); + } catch (Exception e) { + // Ignore + } + + po.flush(); + + System.setOut(oldout); + BufferedReader br = new BufferedReader(new StringReader( + new String(bo.toByteArray()))); + int cc = 0; + Pattern r = Pattern.compile(".*KrbKdcReq send: kdc=(.*) UDP:(\\d+),.*"); + String line; + while ((line = br.readLine()) != null) { + Matcher m = r.matcher(line.subSequence(0, line.length())); + if (m.matches()) { + System.out.println("------------------"); + System.out.println(line); + String h = m.group(1), p = m.group(2); + String eh = kdcs[cc][0], ep = kdcs[cc][1]; + if (eh.charAt(0) == '[') { + eh = eh.substring(1, eh.length()-1); + } + System.out.println("Expected: " + eh + " : " + ep); + System.out.println("Actual: " + h + " : " + p); + if (!eh.equals(h) || + (ep == null || ep.length() == 0) && !p.equals("88") || + (ep != null && ep.length() > 0) && !p.equals(ep)) { + throw new Exception("Mismatch"); + } + cc++; + } + } + if (cc != kdcs.length - 2) { // 2 illegal settings at the end + throw new Exception("Not traversed"); + } + } +} + + diff --git a/jdk/test/sun/security/krb5/RFC396xTest.java b/jdk/test/sun/security/krb5/RFC396xTest.java new file mode 100644 index 00000000000..6ab9255d4f5 --- /dev/null +++ b/jdk/test/sun/security/krb5/RFC396xTest.java @@ -0,0 +1,248 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +/* + * @test + * @bug 6862679 + * @summary ESC: AD Authentication with user with umlauts fails + */ + +import java.lang.reflect.Array; +import java.lang.reflect.Method; +import sun.security.krb5.EncryptedData; +import sun.security.krb5.internal.crypto.Des; +import sun.security.krb5.internal.crypto.EType; +import sun.security.krb5.internal.crypto.crc32; +import sun.security.krb5.internal.crypto.dk.AesDkCrypto; +import sun.security.krb5.internal.crypto.dk.Des3DkCrypto; +import sun.security.krb5.internal.crypto.dk.DkCrypto; +import java.nio.*; +import javax.crypto.*; +import javax.crypto.spec.*; + +public class RFC396xTest { + + static final String gclef = new String(Character.toChars(0x1d11e)); + + /** Creates a new instance of NewClass */ + public static void main(String[] args) throws Exception { + System.setProperty("sun.security.krb5.msinterop.des.s2kcharset", + "utf-8"); + test(); + } + + static void test() throws Exception { + // RFC 3961 + // A.1 + Method nfold = DkCrypto.class.getDeclaredMethod("nfold", byte[].class, Integer.TYPE); + nfold.setAccessible(true); + assertStringEquals(hex((byte[])nfold.invoke(null, "012345".getBytes("UTF-8"), 64)), "be072631276b1955"); + assertStringEquals(hex((byte[])nfold.invoke(null, "password".getBytes("UTF-8"), 56)), "78a07b6caf85fa"); + assertStringEquals(hex((byte[])nfold.invoke(null, "Rough Consensus, and Running Code".getBytes("UTF-8"), 64)), "bb6ed30870b7f0e0"); + assertStringEquals(hex((byte[])nfold.invoke(null, "password".getBytes("UTF-8"), 168)), "59e4a8ca7c0385c3c37b3f6d2000247cb6e6bd5b3e"); + assertStringEquals(hex((byte[])nfold.invoke(null, "MASSACHVSETTS INSTITVTE OF TECHNOLOGY".getBytes("UTF-8"), 192)), "db3b0d8f0b061e603282b308a50841229ad798fab9540c1b"); + assertStringEquals(hex((byte[])nfold.invoke(null, "Q".getBytes("UTF-8"), 168)), "518a54a215a8452a518a54a215a8452a518a54a215"); + assertStringEquals(hex((byte[])nfold.invoke(null, "ba".getBytes("UTF-8"), 168)), "fb25d531ae8974499f52fd92ea9857c4ba24cf297e"); + assertStringEquals(hex((byte[])nfold.invoke(null, "kerberos".getBytes("UTF-8"), 64)), "6b65726265726f73"); + assertStringEquals(hex((byte[])nfold.invoke(null, "kerberos".getBytes("UTF-8"), 128)), "6b65726265726f737b9b5b2b93132b93"); + assertStringEquals(hex((byte[])nfold.invoke(null, "kerberos".getBytes("UTF-8"), 168)), "8372c236344e5f1550cd0747e15d62ca7a5a3bcea4"); + assertStringEquals(hex((byte[])nfold.invoke(null, "kerberos".getBytes("UTF-8"), 256)), "6b65726265726f737b9b5b2b93132b935c9bdcdad95c9899c4cae4dee6d6cae4"); + + // A.2 + assertStringEquals(hex(Des.string_to_key_bytes("passwordATHENA.MIT.EDUraeburn".toCharArray())), "cbc22fae235298e3"); + assertStringEquals(hex(Des.string_to_key_bytes("potatoeWHITEHOUSE.GOVdanny".toCharArray())), "df3d32a74fd92a01"); + assertStringEquals(hex(Des.string_to_key_bytes((gclef+"EXAMPLE.COMpianist").toCharArray())), "4ffb26bab0cd9413"); + assertStringEquals(hex(Des.string_to_key_bytes("\u00dfATHENA.MIT.EDUJuri\u0161i\u0107".toCharArray())), "62c81a5232b5e69d"); + // Next 2 won't pass, since there's no real weak key here + //assertStringEquals(hex(Des.string_to_key_bytes("11119999AAAAAAAA".toCharArray())), "984054d0f1a73e31"); + //assertStringEquals(hex(Des.string_to_key_bytes("NNNN6666FFFFAAAA".toCharArray())), "c4bf6b25adf7a4f8"); + + // A.3 + Object o = Des3DkCrypto.class.getConstructor().newInstance(); + Method dr = DkCrypto.class.getDeclaredMethod("dr", byte[].class, byte[].class); + Method randomToKey = DkCrypto.class.getDeclaredMethod("randomToKey", byte[].class); + dr.setAccessible(true); + randomToKey.setAccessible(true); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("dce06b1f64c857a11c3db57c51899b2cc1791008ce973b92"), + xeh("0000000155")))), + "925179d04591a79b5d3192c4a7e9c289b049c71f6ee604cd"); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("5e13d31c70ef765746578531cb51c15bf11ca82c97cee9f2"), + xeh("00000001aa")))), + "9e58e5a146d9942a101c469845d67a20e3c4259ed913f207"); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("98e6fd8a04a4b6859b75a176540b9752bad3ecd610a252bc"), + xeh("0000000155")))), + "13fef80d763e94ec6d13fd2ca1d085070249dad39808eabf"); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("622aec25a2fe2cad7094680b7c64940280084c1a7cec92b5"), + xeh("00000001aa")))), + "f8dfbf04b097e6d9dc0702686bcb3489d91fd9a4516b703e"); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("d3f8298ccb166438dcb9b93ee5a7629286a491f838f802fb"), + xeh("6b65726265726f73")))), + "2370da575d2a3da864cebfdc5204d56df779a7df43d9da43"); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("c1081649ada74362e6a1459d01dfd30d67c2234c940704da"), + xeh("0000000155")))), + "348057ec98fdc48016161c2a4c7a943e92ae492c989175f7"); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("5d154af238f46713155719d55e2f1f790dd661f279a7917c"), + xeh("00000001aa")))), + "a8808ac267dada3dcbe9a7c84626fbc761c294b01315e5c1"); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("798562e049852f57dc8c343ba17f2ca1d97394efc8adc443"), + xeh("0000000155")))), + "c813f88a3be3b334f75425ce9175fbe3c8493b89c8703b49"); + assertStringEquals(hex((byte[])randomToKey.invoke(o, (byte[])dr.invoke(o, + xeh("26dce334b545292f2feab9a8701a89a4b99eb9942cecd016"), + xeh("00000001aa")))), + "f48ffd6e83f83e7354e694fd252cf83bfe58f7d5ba37ec5d"); + + // A.4 + assertStringEquals(hex(new Des3DkCrypto().stringToKey("passwordATHENA.MIT.EDUraeburn".toCharArray())), "850bb51358548cd05e86768c313e3bfef7511937dcf72c3e"); + assertStringEquals(hex(new Des3DkCrypto().stringToKey("potatoeWHITEHOUSE.GOVdanny".toCharArray())), "dfcd233dd0a43204ea6dc437fb15e061b02979c1f74f377a"); + assertStringEquals(hex(new Des3DkCrypto().stringToKey("pennyEXAMPLE.COMbuckaroo".toCharArray())), "6d2fcdf2d6fbbc3ddcadb5da5710a23489b0d3b69d5d9d4a"); + assertStringEquals(hex(new Des3DkCrypto().stringToKey("\u00DFATHENA.MIT.EDUJuri\u0161i\u0107".toCharArray())), "16d5a40e1ce3bacb61b9dce00470324c831973a7b952feb0"); + assertStringEquals(hex(new Des3DkCrypto().stringToKey((gclef+"EXAMPLE.COMpianist").toCharArray())), "85763726585dbc1cce6ec43e1f751f07f1c4cbb098f40b19"); + + // A.5 + assertStringEquals(hex(crc32.byte2crc32sum_bytes("foo".getBytes("UTF-8"))), "33bc3273"); + assertStringEquals(hex(crc32.byte2crc32sum_bytes("test0123456789".getBytes("UTF-8"))), "d6883eb8"); + assertStringEquals(hex(crc32.byte2crc32sum_bytes("MASSACHVSETTS INSTITVTE OF TECHNOLOGY".getBytes("UTF-8"))), "f78041e3"); + assertStringEquals(hex(crc32.byte2crc32sum_bytes(new byte[] {(byte)0x80, 0})), "4b98833b"); + assertStringEquals(hex(crc32.byte2crc32sum_bytes(new byte[] {0, 8})), "3288db0e"); + assertStringEquals(hex(crc32.byte2crc32sum_bytes(new byte[] {0, (byte)0x80})), "2083b8ed"); + assertStringEquals(hex(crc32.byte2crc32sum_bytes(new byte[] {(byte)0x80})), "2083b8ed"); + assertStringEquals(hex(crc32.byte2crc32sum_bytes(new byte[] {(byte)0x80, 0, 0, 0})), "3bb659ed"); + assertStringEquals(hex(crc32.byte2crc32sum_bytes(new byte[] {0, 0, 0, 1})), "96300777"); + + // RFC 3962 + AesDkCrypto a1 = new AesDkCrypto(128); + Method pbkdf2 = AesDkCrypto.class.getDeclaredMethod("PBKDF2", char[].class, byte[].class, Integer.TYPE, Integer.TYPE); + Method s2k = AesDkCrypto.class.getDeclaredMethod("stringToKey", char[].class, byte[].class, byte[].class); + pbkdf2.setAccessible(true); + s2k.setAccessible(true); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "password".toCharArray(), "ATHENA.MIT.EDUraeburn".getBytes("UTF-8"), 1, 128)), "cd ed b5 28 1b b2 f8 01 56 5a 11 22 b2 56 35 15"); + assertStringEquals(hex(a1.stringToKey("password".toCharArray(), "ATHENA.MIT.EDUraeburn", i2b(1))), "42 26 3c 6e 89 f4 fc 28 b8 df 68 ee 09 79 9f 15"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "password".toCharArray(), "ATHENA.MIT.EDUraeburn".getBytes("UTF-8"), 1, 256)), "cd ed b5 28 1b b2 f8 01 56 5a 11 22 b2 56 35 15 0a d1 f7 a0 4b b9 f3 a3 33 ec c0 e2 e1 f7 08 37"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "password".toCharArray(), "ATHENA.MIT.EDUraeburn".getBytes("UTF-8"), 2, 128)), "01 db ee 7f 4a 9e 24 3e 98 8b 62 c7 3c da 93 5d"); + assertStringEquals(hex(a1.stringToKey("password".toCharArray(), "ATHENA.MIT.EDUraeburn", i2b(2))), "c6 51 bf 29 e2 30 0a c2 7f a4 69 d6 93 bd da 13"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "password".toCharArray(), "ATHENA.MIT.EDUraeburn".getBytes("UTF-8"), 2, 256)), "01 db ee 7f 4a 9e 24 3e 98 8b 62 c7 3c da 93 5d a0 53 78 b9 32 44 ec 8f 48 a9 9e 61 ad 79 9d 86"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "password".toCharArray(), "ATHENA.MIT.EDUraeburn".getBytes("UTF-8"), 1200, 128)), "5c 08 eb 61 fd f7 1e 4e 4e c3 cf 6b a1 f5 51 2b"); + assertStringEquals(hex(a1.stringToKey("password".toCharArray(), "ATHENA.MIT.EDUraeburn", i2b(1200))), "4c 01 cd 46 d6 32 d0 1e 6d be 23 0a 01 ed 64 2a"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "password".toCharArray(), "ATHENA.MIT.EDUraeburn".getBytes("UTF-8"), 1200, 256)), "5c 08 eb 61 fd f7 1e 4e 4e c3 cf 6b a1 f5 51 2b a7 e5 2d db c5 e5 14 2f 70 8a 31 e2 e6 2b 1e 13"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "password".toCharArray(), xeh("1234567878563412"), 5, 128)), "d1 da a7 86 15 f2 87 e6 a1 c8 b1 20 d7 06 2a 49"); + assertStringEquals(hex((byte[])s2k.invoke(a1, "password".toCharArray(), xeh("1234567878563412"), i2b(5))), "e9 b2 3d 52 27 37 47 dd 5c 35 cb 55 be 61 9d 8e"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "password".toCharArray(), xeh("1234567878563412"), 5, 256)), "d1 da a7 86 15 f2 87 e6 a1 c8 b1 20 d7 06 2a 49 3f 98 d2 03 e6 be 49 a6 ad f4 fa 57 4b 6e 64 ee"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".toCharArray(), "pass phrase equals block size".getBytes("UTF-8"), 1200, 128)), "13 9c 30 c0 96 6b c3 2b a5 5f db f2 12 53 0a c9"); + assertStringEquals(hex(a1.stringToKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".toCharArray(), "pass phrase equals block size", i2b(1200))), "59 d1 bb 78 9a 82 8b 1a a5 4e f9 c2 88 3f 69 ed"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".toCharArray(), "pass phrase equals block size".getBytes("UTF-8"), 1200, 256)), "13 9c 30 c0 96 6b c3 2b a5 5f db f2 12 53 0a c9 c5 ec 59 f1 a4 52 f5 cc 9a d9 40 fe a0 59 8e d1"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".toCharArray(), "pass phrase exceeds block size".getBytes("UTF-8"), 1200, 128)), "9c ca d6 d4 68 77 0c d5 1b 10 e6 a6 87 21 be 61"); + assertStringEquals(hex(a1.stringToKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".toCharArray(), "pass phrase exceeds block size", i2b(1200))), "cb 80 05 dc 5f 90 17 9a 7f 02 10 4c 00 18 75 1d"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".toCharArray(), "pass phrase exceeds block size".getBytes("UTF-8"), 1200, 256)), "9c ca d6 d4 68 77 0c d5 1b 10 e6 a6 87 21 be 61 1a 8b 4d 28 26 01 db 3b 36 be 92 46 91 5e c8 2a"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, gclef.toCharArray(), "EXAMPLE.COMpianist".getBytes("UTF-8"), 50, 128)), "6b 9c f2 6d 45 45 5a 43 a5 b8 bb 27 6a 40 3b 39"); + assertStringEquals(hex(a1.stringToKey(gclef.toCharArray(), "EXAMPLE.COMpianist", i2b(50))), "f1 49 c1 f2 e1 54 a7 34 52 d4 3e 7f e6 2a 56 e5"); + assertStringEquals(hex((byte[])pbkdf2.invoke(null, gclef.toCharArray(), "EXAMPLE.COMpianist".getBytes("UTF-8"), 50, 256)), "6b 9c f2 6d 45 45 5a 43 a5 b8 bb 27 6a 40 3b 39 e7 fe 37 a0 c4 1e 02 c2 81 ff 30 69 e1 e9 4f 52"); + + if (EType.isSupported(EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96)) { + AesDkCrypto a2 = new AesDkCrypto(256); + assertStringEquals(hex(a2.stringToKey("password".toCharArray(), "ATHENA.MIT.EDUraeburn", i2b(1))), "fe 69 7b 52 bc 0d 3c e1 44 32 ba 03 6a 92 e6 5b bb 52 28 09 90 a2 fa 27 88 39 98 d7 2a f3 01 61"); + assertStringEquals(hex(a2.stringToKey("password".toCharArray(), "ATHENA.MIT.EDUraeburn", i2b(2))), "a2 e1 6d 16 b3 60 69 c1 35 d5 e9 d2 e2 5f 89 61 02 68 56 18 b9 59 14 b4 67 c6 76 22 22 58 24 ff"); + assertStringEquals(hex(a2.stringToKey("password".toCharArray(), "ATHENA.MIT.EDUraeburn", i2b(1200))), "55 a6 ac 74 0a d1 7b 48 46 94 10 51 e1 e8 b0 a7 54 8d 93 b0 ab 30 a8 bc 3f f1 62 80 38 2b 8c 2a"); + assertStringEquals(hex((byte[])s2k.invoke(a2, "password".toCharArray(), xeh("1234567878563412"), i2b(5))), "97 a4 e7 86 be 20 d8 1a 38 2d 5e bc 96 d5 90 9c ab cd ad c8 7c a4 8f 57 45 04 15 9f 16 c3 6e 31"); + assertStringEquals(hex(a2.stringToKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".toCharArray(), "pass phrase equals block size", i2b(1200))), "89 ad ee 36 08 db 8b c7 1f 1b fb fe 45 94 86 b0 56 18 b7 0c ba e2 20 92 53 4e 56 c5 53 ba 4b 34"); + assertStringEquals(hex(a2.stringToKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".toCharArray(), "pass phrase exceeds block size", i2b(1200))), "d7 8c 5c 9c b8 72 a8 c9 da d4 69 7f 0b b5 b2 d2 14 96 c8 2b eb 2c ae da 21 12 fc ee a0 57 40 1b"); + assertStringEquals(hex(a2.stringToKey(gclef.toCharArray(), "EXAMPLE.COMpianist", i2b(50))), "4b 6d 98 39 f8 44 06 df 1f 09 cc 16 6d b4 b8 3c 57 18 48 b7 84 a3 d6 bd c3 46 58 9a 3e 39 3f 9e"); + } + + Cipher cipher = Cipher.getInstance("AES/CTS/NoPadding"); + + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec( + xeh("63 68 69 63 6b 65 6e 20 74 65 72 69 79 61 6b 69"), "AES"), + new IvParameterSpec( + xeh("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), 0, 16)); + assertStringEquals(hex(cipher.doFinal( + xeh("49 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20"))), + "c6 35 35 68 f2 bf 8c b4 d8 a5 80 36 2d a7 ff 7f 97"); + assertStringEquals(hex(cipher.doFinal( + xeh("49 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20 47 65 6e 65 72 61 6c 20 47 61 75 27 73 20"))), + "fc 00 78 3e 0e fd b2 c1 d4 45 d4 c8 ef f7 ed 22 97 68 72 68 d6 ec cc c0 c0 7b 25 e2 5e cf e5"); + assertStringEquals(hex(cipher.doFinal( + xeh("49 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20 47 65 6e 65 72 61 6c 20 47 61 75 27 73 20 43"))), + "39 31 25 23 a7 86 62 d5 be 7f cb cc 98 eb f5 a8 97 68 72 68 d6 ec cc c0 c0 7b 25 e2 5e cf e5 84"); + assertStringEquals(hex(cipher.doFinal( + xeh("49 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20 47 65 6e 65 72 61 6c 20 47 61 75 27 73 20 43 68 69 63 6b 65 6e 2c 20 70 6c 65 61 73 65 2c"))), + "97 68 72 68 d6 ec cc c0 c0 7b 25 e2 5e cf e5 84 b3 ff fd 94 0c 16 a1 8c 1b 55 49 d2 f8 38 02 9e 39 31 25 23 a7 86 62 d5 be 7f cb cc 98 eb f5"); + assertStringEquals(hex(cipher.doFinal( + xeh("49 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20 47 65 6e 65 72 61 6c 20 47 61 75 27 73 20 43 68 69 63 6b 65 6e 2c 20 70 6c 65 61 73 65 2c 20"))), + "97 68 72 68 d6 ec cc c0 c0 7b 25 e2 5e cf e5 84 9d ad 8b bb 96 c4 cd c0 3b c1 03 e1 a1 94 bb d8 39 31 25 23 a7 86 62 d5 be 7f cb cc 98 eb f5 a8"); + assertStringEquals(hex(cipher.doFinal( + xeh("49 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20 47 65 6e 65 72 61 6c 20 47 61 75 27 73 20 43 68 69 63 6b 65 6e 2c 20 70 6c 65 61 73 65 2c 20 61 6e 64 20 77 6f 6e 74 6f 6e 20 73 6f 75 70 2e"))), + "97 68 72 68 d6 ec cc c0 c0 7b 25 e2 5e cf e5 84 39 31 25 23 a7 86 62 d5 be 7f cb cc 98 eb f5 a8 48 07 ef e8 36 ee 89 a5 26 73 0d bc 2f 7b c8 40 9d ad 8b bb 96 c4 cd c0 3b c1 03 e1 a1 94 bb d8"); + } + + static byte[] i2b(int i) { + ByteBuffer bb = ByteBuffer.allocate(4); + byte[] b = new byte[4]; + bb.putInt(i); + bb.flip(); + bb.get(b); + return b; + } + + static String hex(byte[] bs) { + StringBuffer sb = new StringBuffer(bs.length * 2); + for(byte b: bs) { + char c = (char)((b+256)%256); + if (c / 16 < 10) + sb.append((char)(c/16+'0')); + else + sb.append((char)(c/16-10+'a')); + if (c % 16 < 10) + sb.append((char)(c%16+'0')); + else + sb.append((char)(c%16-10+'a')); + } + return new String(sb); + } + + static byte[] xeh(String in) { + in = in.replaceAll(" ", ""); + int len = in.length()/2; + byte[] out = new byte[len]; + for (int i=0; i 0) && args[0].equals("sh")) { + if ((args != null) && (args.length > 0) && args[0].equals("sh")) { relPath = pathToStoresSH; } else { relPath = pathToStores; diff --git a/jdk/test/sun/security/ssl/sun/net/www/httpstest/HttpTransaction.java b/jdk/test/sun/security/ssl/sun/net/www/httpstest/HttpTransaction.java index 058632abb19..3d011a41db6 100644 --- a/jdk/test/sun/security/ssl/sun/net/www/httpstest/HttpTransaction.java +++ b/jdk/test/sun/security/ssl/sun/net/www/httpstest/HttpTransaction.java @@ -102,7 +102,8 @@ public class HttpTransaction { if (rspheaders != null) { buf.append (rspheaders.toString()).append("\r\n"); } - buf.append ("Body: ").append (new String(rspbody)).append("\r\n"); + String rbody = rspbody == null? "": new String (rspbody); + buf.append ("Body: ").append (rbody).append("\r\n"); return new String (buf); } diff --git a/jdk/test/sun/security/tools/jarsigner/nameclash.sh b/jdk/test/sun/security/tools/jarsigner/nameclash.sh new file mode 100644 index 00000000000..bbb6ce7980d --- /dev/null +++ b/jdk/test/sun/security/tools/jarsigner/nameclash.sh @@ -0,0 +1,66 @@ +# +# Copyright 2009 Sun Microsystems, Inc. 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# @test +# @bug 6876328 +# @summary different names for the same digest algorithms breaks jarsigner +# + +if [ "${TESTJAVA}" = "" ] ; then + JAVAC_CMD=`which javac` + TESTJAVA=`dirname $JAVAC_CMD`/.. +fi + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + Windows_* ) + FS="\\" + ;; + * ) + FS="/" + ;; +esac + +KS=nc.jks +JFILE=nc.jar + +KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS" +JAR=$TESTJAVA${FS}bin${FS}jar +JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner + +rm $KS $JFILE + +$KT -alias a -dname CN=a -keyalg rsa -genkey -validity 300 +$KT -alias b -dname CN=b -keyalg rsa -genkey -validity 300 + +echo A > A +$JAR cvf $JFILE A + +$JARSIGNER -keystore $KS -storepass changeit $JFILE a -digestalg SHA1 || exit 1 +$JARSIGNER -keystore $KS -storepass changeit $JFILE b -digestalg SHA-1 || exit 2 + +$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 3 + +exit 0 + diff --git a/jdk/test/sun/security/tools/jarsigner/passtype.sh b/jdk/test/sun/security/tools/jarsigner/passtype.sh new file mode 100644 index 00000000000..7e942350956 --- /dev/null +++ b/jdk/test/sun/security/tools/jarsigner/passtype.sh @@ -0,0 +1,72 @@ +# +# Copyright 2009 Sun Microsystems, Inc. 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# @test +# @bug 6868579 +# @summary RFE: jarsigner to support reading password from environment variable +# + +if [ "${TESTJAVA}" = "" ] ; then + JAVAC_CMD=`which javac` + TESTJAVA=`dirname $JAVAC_CMD`/.. +fi + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + Windows_* ) + FS="\\" + ;; + * ) + FS="/" + ;; +esac + +KS=pt.jks +JFILE=pt.jar + +KT="$TESTJAVA${FS}bin${FS}keytool -keystore $KS -validity 300" +JAR=$TESTJAVA${FS}bin${FS}jar +JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner + +rm $KS $JFILE + +$KT -alias a -dname CN=a -keyalg rsa -genkey \ + -storepass test12 -keypass test12 || exit 1 +PASSENV=test12 $KT -alias b -dname CN=b -keyalg rsa -genkey \ + -storepass:env PASSENV -keypass:env PASSENV || exit 2 +echo test12 > passfile +$KT -alias c -dname CN=c -keyalg rsa -genkey \ + -storepass:file passfile -keypass:file passfile || exit 3 + +echo A > A +$JAR cvf $JFILE A + +$JARSIGNER -keystore $KS -storepass test12 $JFILE a || exit 4 +PASSENV=test12 $JARSIGNER -keystore $KS -storepass:env PASSENV $JFILE b || exit 5 +$JARSIGNER -keystore $KS -storepass:file passfile $JFILE b || exit 6 + +$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 7 + +exit 0 + diff --git a/langtools/src/share/classes/com/sun/tools/javah/resources/Linux_sparc.properties b/jdk/test/sun/security/tools/keytool/newhelp.sh similarity index 61% rename from langtools/src/share/classes/com/sun/tools/javah/resources/Linux_sparc.properties rename to jdk/test/sun/security/tools/keytool/newhelp.sh index 164c09ff6c9..08c7422e545 100644 --- a/langtools/src/share/classes/com/sun/tools/javah/resources/Linux_sparc.properties +++ b/jdk/test/sun/security/tools/keytool/newhelp.sh @@ -1,12 +1,10 @@ # -# Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2009 Sun Microsystems, Inc. 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 # under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. +# published by the Free Software Foundation. # # This code is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -21,7 +19,35 @@ # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, # CA 95054 USA or visit www.sun.com if you need additional information or # have any questions. -# +# + +# @test +# @bug 6324292 +# @summary keytool -help is unhelpful +# + +if [ "${TESTJAVA}" = "" ] ; then + JAVAC_CMD=`which javac` + TESTJAVA=`dirname $JAVAC_CMD`/.. +fi + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + Windows_* ) + FS="\\" + ;; + * ) + FS="/" + ;; +esac + +LANG=C +$TESTJAVA${FS}bin${FS}keytool -help 2> h1 || exit 1 +$TESTJAVA${FS}bin${FS}keytool -help -list 2> h2 || exit 2 + +grep Commands: h1 || exit 3 +grep Options: h2 || exit 4 + +exit 0 -pack.pragma.start=\#pragma pack(4)\n -pack.pragma.end=\#pragma pack()\n diff --git a/jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java b/jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java new file mode 100644 index 00000000000..a1b81118a57 --- /dev/null +++ b/jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java @@ -0,0 +1,39 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6871847 + * @summary AlgorithmId.get("SHA256withECDSA") not available + */ + +import sun.security.x509.*; + +public class SHA256withECDSA { + public static void main(String[] args) throws Exception { + AlgorithmId.get("SHA224withECDSA"); + AlgorithmId.get("SHA256withECDSA"); + AlgorithmId.get("SHA384withECDSA"); + AlgorithmId.get("SHA512withECDSA"); + } +} diff --git a/jdk/test/sun/util/logging/PlatformLoggerTest.java b/jdk/test/sun/util/logging/PlatformLoggerTest.java new file mode 100644 index 00000000000..0c5daf0422e --- /dev/null +++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java @@ -0,0 +1,111 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6882376 + * @summary Test if java.util.logging.Logger is created before and after + * logging is enabled. Also validate some basic PlatformLogger + * operations. + * + * @build PlatformLoggerTest + * @run main PlatformLoggerTest + */ + +import java.util.logging.*; +import sun.util.logging.PlatformLogger; + +public class PlatformLoggerTest { + private static final int defaultEffectiveLevel = 0; + public static void main(String[] args) throws Exception { + final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo"; + final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar"; + final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo"; + final String BAR_LOGGER = "test.logger.bar"; + PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER); + + // Create a platform logger using the default + PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER); + checkPlatformLogger(foo, FOO_PLATFORM_LOGGER); + + // create a java.util.logging.Logger + // now java.util.logging.Logger should be created for each platform logger + Logger logger = Logger.getLogger(BAR_LOGGER); + logger.setLevel(Level.WARNING); + + PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER); + checkPlatformLogger(bar, BAR_PLATFORM_LOGGER); + + checkLogger(FOO_PLATFORM_LOGGER, Level.FINER); + checkLogger(BAR_PLATFORM_LOGGER, Level.FINER); + + checkLogger(GOO_PLATFORM_LOGGER, null); + checkLogger(BAR_LOGGER, Level.WARNING); + + foo.setLevel(PlatformLogger.SEVERE); + checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE); + } + + private static void checkPlatformLogger(PlatformLogger logger, String name) { + if (!logger.getName().equals(name)) { + throw new RuntimeException("Invalid logger's name " + + logger.getName() + " but expected " + name); + } + + if (logger.getLevel() != defaultEffectiveLevel) { + throw new RuntimeException("Invalid default level for logger " + + logger.getName()); + } + + if (logger.isLoggable(PlatformLogger.FINE) != false) { + throw new RuntimeException("isLoggerable(FINE) returns true for logger " + + logger.getName() + " but expected false"); + } + + logger.setLevel(PlatformLogger.FINER); + if (logger.getLevel() != Level.FINER.intValue()) { + throw new RuntimeException("Invalid level for logger " + + logger.getName() + " " + logger.getLevel()); + } + + if (logger.isLoggable(PlatformLogger.FINE) != true) { + throw new RuntimeException("isLoggerable(FINE) returns false for logger " + + logger.getName() + " but expected true"); + } + + logger.info("OK: Testing log message"); + } + + private static void checkLogger(String name, Level level) { + Logger logger = LogManager.getLogManager().getLogger(name); + if (logger == null) { + throw new RuntimeException("Logger " + name + + " does not exist"); + } + + if (logger.getLevel() != level) { + throw new RuntimeException("Invalid level for logger " + + logger.getName() + " " + logger.getLevel()); + } + } +} diff --git a/jdk/test/tools/launcher/6842838/CreateBadJar.java b/jdk/test/tools/launcher/6842838/CreateBadJar.java new file mode 100644 index 00000000000..dfdc9163de2 --- /dev/null +++ b/jdk/test/tools/launcher/6842838/CreateBadJar.java @@ -0,0 +1,168 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * Borrowing significantly from Martin Buchholz's CorruptedZipFiles.java + * + * Needed a way of testing the checks for corrupt zip/jar entry in + * inflate_file from file j2se/src/share/bin/parse_manifest.c + * and running them with the 64-bit launcher. e.g. + * sparcv9/bin/java -jar badjar.jar + * + * Run from a script driver Test6842838.sh as we want to specifically run + * bin/sparcv9/java, the 64-bit launcher. + * + * So this program will create a zip file and damage it in the way + * required to tickle this bug. + * + * It will cause a buffer overrun: but that will not always crash. + * Use libumem preloaded by the script driver in order to + * abort quickly when the overrun happens. That makes the test + * Solaris-specific. + */ + +import java.util.*; +import java.util.zip.*; +import java.io.*; +import static java.lang.System.*; +import static java.util.zip.ZipFile.*; + +public class CreateBadJar { + +public static void main(String [] arguments) { + + if (arguments.length != 2) { + throw new RuntimeException("Arguments: jarfilename entryname"); + } + String outFile = arguments[0]; + String entryName = arguments[1]; + + try { + // If the named file doesn't exist, create it. + // If it does, we are expecting it to contain the named entry, for + // alteration. + if (!new File(outFile).exists()) { + System.out.println("Creating file " + outFile); + + // Create the requested zip/jar file. + ZipOutputStream zos = null; + zos = new ZipOutputStream( + new FileOutputStream(outFile)); + + ZipEntry e = new ZipEntry(entryName); + zos.putNextEntry(e); + for (int j=0; j<50000; j++) { + zos.write((int)'a'); + } + zos.closeEntry(); + zos.close(); + zos = null; + } + + // Read it. + int len = (int)(new File(outFile).length()); + byte[] good = new byte[len]; + FileInputStream fis = new FileInputStream(outFile); + fis.read(good); + fis.close(); + fis = null; + + int endpos = len - ENDHDR; + int cenpos = u16(good, endpos+ENDOFF); + if (u32(good, cenpos) != CENSIG) throw new RuntimeException("Where's CENSIG?"); + + byte[] bad; + bad = good.clone(); + + // Corrupt it... + int pos = findInCEN(bad, cenpos, entryName); + + // What bad stuff are we doing to it? + // Store a 32-bit -1 in uncomp size. + bad[pos+0x18]=(byte)0xff; + bad[pos+0x19]=(byte)0xff; + bad[pos+0x1a]=(byte)0xff; + bad[pos+0x1b]=(byte)0xff; + + // Bad work complete, delete the original. + new File(outFile).delete(); + + // Write it. + FileOutputStream fos = new FileOutputStream(outFile); + fos.write(bad); + fos.close(); + fos = null; + + } catch (Exception e) { + e.printStackTrace(); + } + +} + + /* + * Scan Central Directory File Headers looking for the named entry. + */ + + static int findInCEN(byte[] bytes, int cenpos, String entryName) { + int pos = cenpos; + int nextPos = 0; + String filename = null; + do { + if (nextPos != 0) { + pos = nextPos; + } + System.out.println("entry at pos = " + pos); + if (u32(bytes, pos) != CENSIG) throw new RuntimeException ("entry not found in CEN or premature end..."); + + int csize = u32(bytes, pos+0x14); // +0x14 1 dword csize + int uncompsize = u32(bytes, pos+0x18); // +0x18 1 dword uncomp size + int filenameLength = u16(bytes, pos+0x1c); // +0x1c 1 word length of filename + int extraLength = u16(bytes, pos+0x1e); // +0x1e 1 world length of extra field + int commentLength = u16(bytes, pos+0x20); // +0x20 1 world length of file comment + filename = new String(bytes, pos+0x2e, filenameLength); // +0x2e chars of filename + int offset = u32(bytes, pos+0x2a); // +0x2a chars of filename + + System.out.println("filename = " + filename + "\ncsize = " + csize + + " uncomp.size = " + uncompsize +" file offset = " + offset); + nextPos = pos + 0x2e + filenameLength + extraLength + commentLength; + + } while (!filename.equals(entryName)); + + System.out.println("entry found at pos = " + pos); + return pos; + } + + static int u8(byte[] data, int offset) { + return data[offset]&0xff; + } + + static int u16(byte[] data, int offset) { + return u8(data,offset) + (u8(data,offset+1)<<8); + } + + static int u32(byte[] data, int offset) { + return u16(data,offset) + (u16(data,offset+2)<<16); + } + +} + diff --git a/jdk/test/tools/launcher/6842838/Test6842838.sh b/jdk/test/tools/launcher/6842838/Test6842838.sh new file mode 100644 index 00000000000..0d0ba756496 --- /dev/null +++ b/jdk/test/tools/launcher/6842838/Test6842838.sh @@ -0,0 +1,76 @@ +# +# Copyright 2009 Sun Microsystems, Inc. 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + + +# @test Test6842838.sh +# @bug 6842838 +# @summary Test 6842838 64-bit launcher failure due to corrupt jar +# @compile CreateBadJar.java +# @run shell Test6842838.sh + +set -x + +if [ "${TESTJAVA}" = "" ]; then + PARENT=`dirname \`which java\`` + TESTJAVA=`dirname ${PARENT}` + printf "TESTJAVA not set. Test cannot execute. Failed.\n" +fi + +if [ "${TESTCLASSES}" = "" ]; then + printf "TESTCLASSES not set. Test cannot execute. Failed.\n" + exit 1 +fi + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + SunOS ) + NULL=/dev/null + PS=":" + FS="/" + JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java + ;; + * ) + printf "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)\n" + exit 0; + ;; +esac + +if [ ! -x ${JAVA_EXE} ]; then + printf "Warning: sparcv9 components not installed - skipping test.\n" + exit 0 +fi + +LIBUMEM=/lib/64/libumem.so +if [ ! -x ${LIBUMEM} ]; then + printf "Warning: libumem not installed - skipping test.\n" + exit 0 +fi + +BADFILE=newbadjar.jar +${JAVA_EXE} -version +${JAVA_EXE} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF" +LD_PRELOAD=${LIBUMEM} ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1 + +grep "Invalid or corrupt jarfile" test.out +exit $? diff --git a/langtools/.hgtags b/langtools/.hgtags index 7e3ac0faa70..c7be42cd2b4 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -45,3 +45,6 @@ d8f23a81d46f47a4186f1044dd9e44841bbeab84 jdk7-b64 95c1212b07e33b1b8c689b1d279d82ffd5a56e43 jdk7-b68 ce9bcdcb7859bb7ef10afd078ad59ba7847f208d jdk7-b69 97d06f3e87873e310aa2f3fbca58fc8872d86b9f jdk7-b70 +33c8c38e1757006c17d80499fb3347102501fae5 jdk7-b71 +261c54b2312ed26d6ec45c675831375460250519 jdk7-b72 +9596dff460935f09684c11d156ce591f92584f0d jdk7-b73 diff --git a/langtools/make/build.xml b/langtools/make/build.xml index 30d63801cf1..6b04ca30fc1 100644 --- a/langtools/make/build.xml +++ b/langtools/make/build.xml @@ -286,10 +286,10 @@ jarclasspath="javadoc.jar doclets.jar javac.jar"/> - + + jarclasspath="javac.jar"/> diff --git a/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java b/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java index fcdf29d461a..35506ac5e02 100644 --- a/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java +++ b/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java @@ -201,7 +201,7 @@ public class Apt extends ListBuffer> { computeAnnotationSet(param, annotationSet); if (symbol.members() != null) { - for(Scope.Entry e: symbol.members().table) + for(Scope.Entry e = symbol.members().elems; e != null; e = e.sibling) computeAnnotationSet(e.sym, annotationSet); } } diff --git a/langtools/src/share/classes/com/sun/tools/apt/mirror/util/SourcePositionImpl.java b/langtools/src/share/classes/com/sun/tools/apt/mirror/util/SourcePositionImpl.java index 7da66d6faa7..e4d5c15f64c 100644 --- a/langtools/src/share/classes/com/sun/tools/apt/mirror/util/SourcePositionImpl.java +++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/util/SourcePositionImpl.java @@ -67,15 +67,15 @@ public class SourcePositionImpl implements SourcePosition { public String toString() { int ln = line(); return (ln == Position.NOPOS) - ? sourcefile.toString() - : sourcefile + ":" + ln; + ? sourcefile.getName() + : sourcefile.getName() + ":" + ln; } /** * {@inheritDoc} */ public File file() { - return new File(sourcefile.toString()); + return new File(sourcefile.toUri()); } /** diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java index 453b8e8e74a..37415017f99 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java @@ -1435,7 +1435,17 @@ public class HtmlDocletWriter extends HtmlDocWriter { // documented, this must be an inherited link. Redirect it. // The current class either overrides the referenced member or // inherits it automatically. - containing = ((ClassWriterImpl) this).getClassDoc(); + if (this instanceof ClassWriterImpl) { + containing = ((ClassWriterImpl) this).getClassDoc(); + } else if (!containing.isPublic()){ + configuration.getDocletSpecificMsg().warning( + see.position(), "doclet.see.class_or_package_not_accessible", + tagName, containing.qualifiedName()); + } else { + configuration.getDocletSpecificMsg().warning( + see.position(), "doclet.see.class_or_package_not_found", + tagName, seetext); + } } if (configuration.currentcd != containing) { refMemName = containing.name() + "." + refMemName; diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties index f4d86e3d5d8..598cc88d74b 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties @@ -69,6 +69,7 @@ doclet.URL_error=Error fetching URL: {0} doclet.No_Package_Comment_File=For Package {0} Package.Comment file not found doclet.No_Source_For_Class=Source information for class {0} not available. doclet.see.class_or_package_not_found=Tag {0}: reference not found: {1} +doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1} doclet.see.malformed_tag=Tag {0}: Malformed: {1} doclet.Inherited_API_Summary=Inherited API Summary doclet.Deprecated_API=Deprecated API diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml index fa1f6181782..a88acc9b314 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml @@ -1,7 +1,7 @@