2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5506
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
/* This file was generated AUTOMATICALLY from a template file Wed Jun 17 10:43:47 PDT 1998 */
|
|
27 |
|
|
28 |
/*-
|
|
29 |
* code for verifying the date in a ClassClass structure for internal
|
|
30 |
* consistency.
|
|
31 |
*/
|
|
32 |
|
|
33 |
#include <ctype.h>
|
|
34 |
|
|
35 |
#include "oobj.h"
|
|
36 |
#include "interpreter.h"
|
|
37 |
#include "bool.h"
|
|
38 |
#include "utf.h"
|
|
39 |
#include "tree.h"
|
|
40 |
|
|
41 |
extern bool_t verify_class_codes(ClassClass *cb);
|
|
42 |
|
|
43 |
static bool_t verify_constant_pool(ClassClass *cb);
|
|
44 |
|
|
45 |
static bool_t is_legal_fieldname(ClassClass *cb, char *name, int type);
|
|
46 |
static bool_t is_legal_method_signature(ClassClass *cb, char *name, char *signature);
|
|
47 |
static bool_t is_legal_field_signature(ClassClass *cb, char *name, char *signature);
|
|
48 |
|
|
49 |
static char *skip_over_fieldname(char *name, bool_t slash_okay);
|
|
50 |
static char *skip_over_field_signature(char *name, bool_t void_okay);
|
|
51 |
|
|
52 |
static void CCerror (ClassClass *cb, char *format, ...);
|
|
53 |
|
|
54 |
|
|
55 |
/* Argument for is_legal_fieldname */
|
|
56 |
enum { LegalClass, LegalField, LegalMethod };
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
bool_t
|
|
62 |
VerifyClass(ClassClass *cb)
|
|
63 |
{
|
|
64 |
bool_t result = TRUE;
|
|
65 |
struct methodblock *mb;
|
|
66 |
struct fieldblock *fb;
|
|
67 |
int i;
|
|
68 |
if (CCIs(cb, Verified))
|
|
69 |
return TRUE;
|
|
70 |
if (!verify_constant_pool(cb))
|
|
71 |
return FALSE;
|
|
72 |
/* Make sure all the method names and signatures are okay */
|
|
73 |
for (i = cbMethodsCount(cb), mb = cbMethods(cb); --i >= 0; mb++) {
|
|
74 |
char *name = mb->fb.name;
|
|
75 |
char *signature = mb->fb.signature;
|
|
76 |
if (! (is_legal_fieldname(cb, name, LegalMethod) &&
|
|
77 |
is_legal_method_signature(cb, name, signature)))
|
|
78 |
result = FALSE;
|
|
79 |
}
|
|
80 |
/* Make sure all the field names and signatures are okay */
|
|
81 |
for (i = cbFieldsCount(cb), fb = cbFields(cb); --i >= 0; fb++) {
|
|
82 |
if (! (is_legal_fieldname(cb, fb->name, LegalField) &&
|
|
83 |
is_legal_field_signature(cb, fb->name, fb->signature)))
|
|
84 |
result = FALSE;
|
|
85 |
}
|
|
86 |
/* Make sure we are not overriding any final methods or classes*/
|
|
87 |
if (cbIsInterface(cb)) {
|
|
88 |
struct methodblock *mb;
|
|
89 |
if ((cbSuperclass(cb) == NULL) ||
|
|
90 |
(cbSuperclass(cb) != classJavaLangObject)) {
|
|
91 |
CCerror(cb, "Interface %s has bad superclass", cbName(cb));
|
|
92 |
result = FALSE;
|
|
93 |
}
|
|
94 |
for (i = cbMethodsCount(cb), mb = cbMethods(cb); --i >= 0; mb++) {
|
|
95 |
if (mb->fb.access & ACC_STATIC) {
|
|
96 |
if (mb->fb.name[0] != '<') {
|
|
97 |
/* Only internal methods can be static */
|
|
98 |
CCerror(cb, "Illegal static method %s in interface %s",
|
|
99 |
mb->fb.name, cbName(cb));
|
|
100 |
result = FALSE;
|
|
101 |
}
|
|
102 |
}
|
|
103 |
}
|
|
104 |
} else if (cbSuperclass(cb)) {
|
|
105 |
ClassClass *super_cb;
|
|
106 |
unsigned bitvector_size = (unsigned)(cbMethodTableSize(cb) + 31) >> 5;
|
|
107 |
long *bitvector = sysCalloc(bitvector_size, sizeof(long));
|
|
108 |
for (super_cb = cbSuperclass(cb); ; super_cb = cbSuperclass(super_cb)) {
|
|
109 |
if (cbAccess(super_cb) & ACC_FINAL) {
|
|
110 |
CCerror(cb, "Class %s is subclass of final class %s",
|
|
111 |
cbName(cb), cbName(super_cb));
|
|
112 |
result = FALSE;
|
|
113 |
}
|
|
114 |
mb = cbMethods(super_cb);
|
|
115 |
for (i = cbMethodsCount(super_cb); --i >= 0; mb++) {
|
|
116 |
if (mb->fb.access & ACC_FINAL) {
|
|
117 |
unsigned offset = mb->fb.u.offset;
|
|
118 |
bitvector[offset >> 5] |= (1 << (offset & 0x1F));
|
|
119 |
}
|
|
120 |
}
|
|
121 |
if (cbSuperclass(super_cb) == NULL) break;
|
|
122 |
}
|
|
123 |
for (i = cbMethodsCount(cb), mb = cbMethods(cb); --i >= 0; mb++) {
|
|
124 |
unsigned offset = mb->fb.u.offset;
|
|
125 |
if ((offset > 0)
|
|
126 |
&& bitvector[offset >> 5] & (1 << (offset & 0x1F))) {
|
|
127 |
CCerror(cb, "Class %s overrides final method %s.%s",
|
|
128 |
cbName(cb), mb->fb.name, mb->fb.signature);
|
|
129 |
result = FALSE;
|
|
130 |
}
|
|
131 |
}
|
|
132 |
sysFree(bitvector);
|
|
133 |
} else if (cb != classJavaLangObject) {
|
|
134 |
CCerror(cb, "Class %s does not have superclass", cbName(cb));
|
|
135 |
result = FALSE;
|
|
136 |
}
|
|
137 |
|
|
138 |
if (result)
|
|
139 |
result = verify_class_codes(cb);
|
|
140 |
if (result)
|
|
141 |
CCSet(cb, Verified);
|
|
142 |
return result;
|
|
143 |
}
|
|
144 |
|
|
145 |
|
|
146 |
static bool_t
|
|
147 |
verify_constant_pool(ClassClass *cb)
|
|
148 |
{
|
|
149 |
union cp_item_type *cp = cbConstantPool(cb);
|
|
150 |
long cp_count = cbConstantPoolCount(cb);
|
|
151 |
unsigned char *type_table;
|
|
152 |
int i, type;
|
|
153 |
|
|
154 |
const int utf8_resolved = (CONSTANT_Utf8 | CONSTANT_POOL_ENTRY_RESOLVED);
|
|
155 |
|
|
156 |
if (cp_count == 0) /* Primitive classes */
|
|
157 |
return TRUE;
|
|
158 |
type_table = cp[CONSTANT_POOL_TYPE_TABLE_INDEX].type;
|
|
159 |
/* Let's make two quick passes over the constant pool. The first one
|
|
160 |
* checks that everything is of the right type. */
|
|
161 |
for (i = 1; i < cp_count; i++) {
|
|
162 |
switch(type = type_table[i]) {
|
|
163 |
case CONSTANT_String:
|
|
164 |
case CONSTANT_Class: {
|
|
165 |
int index = cp[i].i;
|
|
166 |
if ( (index < 1)
|
|
167 |
|| (index >= cp_count)
|
|
168 |
|| (type_table[index] != utf8_resolved)) {
|
|
169 |
CCerror(cb, "Bad index in constant pool #%d", i);
|
|
170 |
return FALSE;
|
|
171 |
}
|
|
172 |
break;
|
|
173 |
}
|
|
174 |
|
|
175 |
case CONSTANT_String | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
176 |
/* This can only happen if a string is the "initial" value of
|
|
177 |
* some final static String. We assume that the checking has
|
|
178 |
* already been done.
|
|
179 |
*/
|
|
180 |
break;
|
|
181 |
|
|
182 |
case CONSTANT_Fieldref:
|
|
183 |
case CONSTANT_Methodref:
|
|
184 |
case CONSTANT_InterfaceMethodref:
|
|
185 |
case CONSTANT_NameAndType: {
|
|
186 |
unsigned index = (unsigned)(cp[i].i);
|
|
187 |
int key1 = index >> 16;
|
|
188 |
int key2 = index & 0xFFFF;
|
|
189 |
if (key1 < 1 || key1 >= cp_count
|
|
190 |
|| key2 < 1 || key2 >= cp_count) {
|
|
191 |
CCerror(cb, "Bad index in constant pool #%d", i);
|
|
192 |
return FALSE;
|
|
193 |
}
|
|
194 |
if (type == CONSTANT_NameAndType) {
|
|
195 |
if ( (type_table[key1] != utf8_resolved)
|
|
196 |
|| (type_table[key2] != utf8_resolved)) {
|
|
197 |
CCerror(cb, "Bad index in constant pool.");
|
|
198 |
return FALSE;
|
|
199 |
}
|
|
200 |
} else {
|
|
201 |
if ( ((type_table[key1] & CONSTANT_POOL_ENTRY_TYPEMASK)
|
|
202 |
!= CONSTANT_Class)
|
|
203 |
|| ((type_table[key2] != CONSTANT_NameAndType))) {
|
|
204 |
CCerror(cb, "Bad index in constant pool #%d", i);
|
|
205 |
return FALSE;
|
|
206 |
}
|
|
207 |
}
|
|
208 |
break;
|
|
209 |
}
|
|
210 |
|
|
211 |
case CONSTANT_Fieldref | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
212 |
case CONSTANT_Methodref | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
213 |
case CONSTANT_InterfaceMethodref | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
214 |
case CONSTANT_NameAndType | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
215 |
CCerror(cb, "Improperly resolved constant pool #%d", i);
|
|
216 |
return FALSE;
|
|
217 |
|
|
218 |
|
|
219 |
case CONSTANT_Class | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
220 |
case CONSTANT_Utf8 | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
221 |
case CONSTANT_Integer | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
222 |
case CONSTANT_Float | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
223 |
break;
|
|
224 |
|
|
225 |
case CONSTANT_Long | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
226 |
case CONSTANT_Double | CONSTANT_POOL_ENTRY_RESOLVED:
|
|
227 |
if ((i + 1 >= cp_count) ||
|
|
228 |
(type_table[i + 1] != CONSTANT_POOL_ENTRY_RESOLVED)) {
|
|
229 |
CCerror(cb, "Improper constant pool long/double #%d", i);
|
|
230 |
return FALSE;
|
|
231 |
} else {
|
|
232 |
i++;
|
|
233 |
break;
|
|
234 |
}
|
|
235 |
|
|
236 |
case CONSTANT_Integer:
|
|
237 |
case CONSTANT_Float:
|
|
238 |
case CONSTANT_Long:
|
|
239 |
case CONSTANT_Double:
|
|
240 |
case CONSTANT_Utf8:
|
|
241 |
CCerror(cb, "Improperly unresolved constant pool #%d", i);
|
|
242 |
return FALSE;
|
|
243 |
|
|
244 |
|
|
245 |
default:
|
|
246 |
CCerror(cb, "Illegal constant pool type at #%d", i);
|
|
247 |
return FALSE;
|
|
248 |
|
|
249 |
|
|
250 |
}
|
|
251 |
}
|
|
252 |
for (i = 1; i < cp_count; i++) {
|
|
253 |
switch(type = type_table[i]) {
|
|
254 |
case CONSTANT_Class: {
|
|
255 |
int index = cp[i].i;
|
|
256 |
if (!is_legal_fieldname(cb, cp[index].cp, LegalClass))
|
|
257 |
return FALSE;
|
|
258 |
break;
|
|
259 |
}
|
|
260 |
|
|
261 |
case CONSTANT_Fieldref:
|
|
262 |
case CONSTANT_Methodref:
|
|
263 |
case CONSTANT_InterfaceMethodref: {
|
|
264 |
unsigned index = (unsigned)(cp[i].i);
|
|
265 |
int name_type_index = index & 0xFFFF;
|
|
266 |
int name_type_key = cp[name_type_index].i;
|
|
267 |
int name_index = name_type_key >> 16;
|
|
268 |
int signature_index = name_type_key & 0xFFFF;
|
|
269 |
char *name = cp[name_index].cp;
|
|
270 |
char *signature = cp[signature_index].cp;
|
|
271 |
|
|
272 |
if (type == CONSTANT_Fieldref) {
|
|
273 |
if (! (is_legal_fieldname(cb, name, LegalField) &&
|
|
274 |
is_legal_field_signature(cb, name, signature)))
|
|
275 |
return FALSE;
|
|
276 |
} else {
|
|
277 |
if (! (is_legal_fieldname(cb, name, LegalMethod) &&
|
|
278 |
is_legal_method_signature(cb, name, signature)))
|
|
279 |
return FALSE;
|
|
280 |
}
|
|
281 |
break;
|
|
282 |
}
|
|
283 |
}
|
|
284 |
}
|
|
285 |
return TRUE;
|
|
286 |
}
|
|
287 |
|
|
288 |
|
|
289 |
/* Return true if the entire second argument consists of a legal fieldname
|
|
290 |
* (or classname, if the third argument is LegalClass).
|
|
291 |
*/
|
|
292 |
|
|
293 |
static bool_t
|
|
294 |
is_legal_fieldname(ClassClass *cb, char *name, int type)
|
|
295 |
{
|
|
296 |
bool_t result;
|
|
297 |
if (name[0] == '<') {
|
|
298 |
result = (type == LegalMethod) &&
|
|
299 |
((strcmp(name, "<init>") == 0) ||
|
|
300 |
(strcmp(name, "<clinit>") == 0));
|
|
301 |
} else {
|
|
302 |
char *p;
|
|
303 |
if (type == LegalClass && name[0] == SIGNATURE_ARRAY) {
|
|
304 |
p = skip_over_field_signature(name, FALSE);
|
|
305 |
} else {
|
|
306 |
p = skip_over_fieldname(name, type == LegalClass);
|
|
307 |
}
|
|
308 |
result = (p != 0 && p[0] == '\0');
|
|
309 |
}
|
|
310 |
if (!result) {
|
|
311 |
char *thing = (type == LegalField) ? "Field"
|
|
312 |
: (type == LegalMethod) ? "Method" : "Class";
|
|
313 |
|
|
314 |
CCerror(cb, "Illegal %s name \"%s\"", thing, name);
|
|
315 |
return FALSE;
|
|
316 |
} else {
|
|
317 |
return TRUE;
|
|
318 |
|
|
319 |
}
|
|
320 |
}
|
|
321 |
|
|
322 |
/* Return true if the entire string consists of a legal field signature */
|
|
323 |
static bool_t
|
|
324 |
is_legal_field_signature(ClassClass *cb, char *fieldname, char *signature)
|
|
325 |
{
|
|
326 |
char *p = skip_over_field_signature(signature, FALSE);
|
|
327 |
if (p != 0 && p[0] == '\0') {
|
|
328 |
return TRUE;
|
|
329 |
} else {
|
|
330 |
CCerror(cb, "Field \"%s\" has illegal signature \"%s\"",
|
|
331 |
fieldname, signature);
|
|
332 |
return FALSE;
|
|
333 |
}
|
|
334 |
}
|
|
335 |
|
|
336 |
|
|
337 |
static bool_t
|
|
338 |
is_legal_method_signature(ClassClass *cb, char *methodname, char *signature)
|
|
339 |
{
|
|
340 |
char *p = signature;
|
|
341 |
char *next_p;
|
|
342 |
/* The first character must be a '(' */
|
|
343 |
if (*p++ == SIGNATURE_FUNC) {
|
|
344 |
/* Skip over however many legal field signatures there are */
|
|
345 |
while ((next_p = skip_over_field_signature(p, FALSE)) != 0)
|
|
346 |
p = next_p;
|
|
347 |
/* The first non-signature thing better be a ')' */
|
|
348 |
if (*p++ == SIGNATURE_ENDFUNC) {
|
|
349 |
if (methodname[0] == '<') {
|
|
350 |
/* All internal methods must return void */
|
|
351 |
if ((p[0] == SIGNATURE_VOID) && (p[1] == '\0'))
|
|
352 |
return TRUE;
|
|
353 |
} else {
|
|
354 |
/* Now, we better just have a return value. */
|
|
355 |
next_p = skip_over_field_signature(p, TRUE);
|
|
356 |
if (next_p && next_p[0] == '\0')
|
|
357 |
return TRUE;
|
|
358 |
}
|
|
359 |
}
|
|
360 |
}
|
|
361 |
CCerror(cb, "Method \"%s\" has illegal signature \"%s\"",
|
|
362 |
methodname, signature);
|
|
363 |
return FALSE;
|
|
364 |
}
|
|
365 |
|
|
366 |
$$Tables
|
|
367 |
|
|
368 |
/*
|
|
369 |
* This code mirrors Character.isJavaIdentifierStart. It determines whether
|
|
370 |
* the specified character is a legal start of a Java identifier as per JLS.
|
|
371 |
*
|
|
372 |
* The parameter ch is the character to be tested; return 1 if the
|
|
373 |
* character is a letter, 0 otherwise.
|
|
374 |
*/
|
|
375 |
#define isJavaIdentifierStart(ch) ($$Lookup(ch) & $$maskIsJavaIdentifierStart)
|
|
376 |
|
|
377 |
/*
|
|
378 |
* This code mirrors Character.isJavaIdentifierPart. It determines whether
|
|
379 |
* the specified character is a legal part of a Java identifier as per JLS.
|
|
380 |
*
|
|
381 |
* The parameter ch is the character to be tested; return 1 if the
|
|
382 |
* character is a digit, 0 otherwise.
|
|
383 |
*/
|
|
384 |
#define isJavaIdentifierPart(ch) ($$Lookup(ch) & $$maskIsJavaIdentifierPart)
|
|
385 |
|
|
386 |
/* Take pointer to a string. Skip over the longest part of the string that
|
|
387 |
* could be taken as a fieldname. Allow '/' if slash_okay is TRUE.
|
|
388 |
*
|
|
389 |
* Return a pointer to just past the fieldname. Return NULL if no fieldname
|
|
390 |
* at all was found, or in the case of slash_okay being true, we saw
|
|
391 |
* consecutive slashes (meaning we were looking for a qualified path but
|
|
392 |
* found something that was badly-formed).
|
|
393 |
*/
|
|
394 |
static char *
|
|
395 |
skip_over_fieldname(char *name, bool_t slash_okay)
|
|
396 |
{
|
|
397 |
bool_t first;
|
|
398 |
char *p;
|
|
399 |
unicode last_ch = 0;
|
|
400 |
for (p = name, first = TRUE; ; first = FALSE) {
|
|
401 |
char *old_p = p;
|
|
402 |
unicode ch = next_utf2unicode(&p);
|
|
403 |
if (isJavaIdentifierStart(ch) || (!first && isJavaIdentifierPart(ch))
|
|
404 |
|| (slash_okay && ch == '/' && !first)
|
|
405 |
|| ch == '_' || ch == '$') {
|
|
406 |
if (ch == '/' && last_ch == '/') {
|
|
407 |
return 0; /* Don't permit consecutive slashes */
|
|
408 |
} else {
|
|
409 |
last_ch = ch;
|
|
410 |
}
|
|
411 |
} else {
|
|
412 |
return first ? 0 : old_p;
|
|
413 |
}
|
|
414 |
}
|
|
415 |
}
|
|
416 |
|
|
417 |
/* Take pointer to a string. Skip over the longest part of the string that
|
|
418 |
* could be taken as a field signature. Allow "void" if void_okay.
|
|
419 |
*
|
|
420 |
* Return a pointer to just past the signature. Return NULL if no legal
|
|
421 |
* signature is found.
|
|
422 |
*/
|
|
423 |
|
|
424 |
static char *
|
|
425 |
skip_over_field_signature(char *name, bool_t void_okay)
|
|
426 |
{
|
|
427 |
for (;;) {
|
|
428 |
switch (name[0]) {
|
|
429 |
case SIGNATURE_VOID:
|
|
430 |
if (!void_okay) return 0;
|
|
431 |
/* FALL THROUGH */
|
|
432 |
case SIGNATURE_BOOLEAN:
|
|
433 |
case SIGNATURE_BYTE:
|
|
434 |
case SIGNATURE_CHAR:
|
|
435 |
case SIGNATURE_SHORT:
|
|
436 |
case SIGNATURE_INT:
|
|
437 |
case SIGNATURE_FLOAT:
|
|
438 |
case SIGNATURE_LONG:
|
|
439 |
case SIGNATURE_DOUBLE:
|
|
440 |
return name + 1;
|
|
441 |
|
|
442 |
case SIGNATURE_CLASS: {
|
|
443 |
/* Skip over the classname, if one is there. */
|
|
444 |
char *p = skip_over_fieldname(name + 1, TRUE);
|
|
445 |
/* The next character better be a semicolon. */
|
|
446 |
if (p && p[0] == ';')
|
|
447 |
return p + 1;
|
|
448 |
return 0;
|
|
449 |
}
|
|
450 |
|
|
451 |
case SIGNATURE_ARRAY:
|
|
452 |
/* The rest of what's there better be a legal signature. */
|
|
453 |
name++;
|
|
454 |
void_okay = FALSE;
|
|
455 |
break;
|
|
456 |
|
|
457 |
default:
|
|
458 |
return 0;
|
|
459 |
}
|
|
460 |
}
|
|
461 |
}
|
|
462 |
|
|
463 |
|
|
464 |
static void
|
|
465 |
CCerror (ClassClass *cb, char *format, ...)
|
|
466 |
{
|
|
467 |
if (verbose) {
|
|
468 |
va_list args;
|
|
469 |
jio_fprintf(stderr, "VERIFIER CLASS ERROR %s:\n", cbName(cb));
|
|
470 |
va_start(args, format);
|
|
471 |
jio_vfprintf(stderr, format, args);
|
|
472 |
va_end(args);
|
|
473 |
jio_fprintf(stderr, "\n");
|
|
474 |
}
|
|
475 |
}
|
|
476 |
|
|
477 |
/* For use from outside the file. Determine if the specified name is legal
|
|
478 |
* UTF name for a classname.
|
|
479 |
*
|
|
480 |
* Note that this routine expects the internal form of qualified classes:
|
|
481 |
* the dots should have been replaced by slashes.
|
|
482 |
*/
|
|
483 |
bool_t IsLegalClassname(char *name, bool_t allowArrayClass)
|
|
484 |
{
|
|
485 |
char *p;
|
|
486 |
if (name[0] == SIGNATURE_ARRAY) {
|
|
487 |
if (!allowArrayClass) {
|
|
488 |
return FALSE;
|
|
489 |
} else {
|
|
490 |
/* Everything that's left better be a field signature */
|
|
491 |
p = skip_over_field_signature(name, FALSE);
|
|
492 |
}
|
|
493 |
} else {
|
|
494 |
/* skip over the fieldname. Slashes are okay */
|
|
495 |
p = skip_over_fieldname(name, TRUE);
|
|
496 |
}
|
|
497 |
return (p != 0 && p[0] == '\0');
|
|
498 |
}
|