2362N/A * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A#
define max(a,b) ( (a>b) ? a : b )
0N/A#
define min(a,b) ( (a<b) ? a : b )
0N/A * Validates that a URI path component does not contain any illegal characters 0N/A/* Compute the low-order mask for the characters in the given string */ 0N/A for (i = 0; i < n; i++) {
0N/A/* Compute the high-order mask for the characters in the given string */ 0N/A for (i = 0; i < n; i++) {
0N/A if ((c >=
64) && (c <
128))
0N/A * Compute a low-order mask for the characters 0N/A * between first and last, inclusive 0N/A for (i = f; i <= l; i++) {
0N/A * Compute a high-order mask for the characters 0N/A * between first and last, inclusive 0N/A for (i = f; i <= l; i++) {
0N/A * Tell whether the given character is permitted by the given mask pair 0N/A if (c >= 0 && c <
64)
0N/A if (c >=
64 && c <
128)
0N/A // digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | 0N/A // upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | 0N/A // "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | 0N/A // "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" 0N/A // lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | 0N/A // "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | 0N/A // "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" 0N/A // alpha = lowalpha | upalpha 0N/A // alphanum = alpha | digit 0N/A // mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | 0N/A // unreserved = alphanum | mark 0N/A // pchar = unreserved | 0N/A // ":" | "@" | "&" | "=" | "+" | "$" | "," 0N/A // hex = digit | "A" | "B" | "C" | "D" | "E" | "F" | 0N/A // "a" | "b" | "c" | "d" | "e" | "f" 0N/A // All valid path characters 0N/A * Validates that the given URI path component does not contain any 0N/A * illegal characters. Returns 0 if only validate characters are present. 0N/A /* initialize on first usage */ 0N/A /* definitely not us-ascii */ 0N/A if (c < 0)
return -
1;
0N/A /* start of an escapted character */ 0N/A /* malformed escape pair */