mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-19 09:40:59 +00:00
* EOControl/EOPrivate.h/m (GDL2_isLegalDBName): New function.
* EOQualifier.m (getKey): Validate qualifier bind variable key. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@27923 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
68f788d944
commit
b991a133af
4 changed files with 40 additions and 2 deletions
|
@ -3,6 +3,9 @@
|
|||
* EOAccess/EOGenericRecord.h/m ([-entity]): New category.
|
||||
* EOAccess/GNUmakefile (EOGenericRecord): Build and install new
|
||||
category.
|
||||
|
||||
* EOControl/EOPrivate.h/m (GDL2_isLegalDBName): New function.
|
||||
* EOQualifier.m (getKey): Validate qualifier bind variable key.
|
||||
|
||||
2009-02-18 David Ayers <ayers@fsfe.org>
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ GDL2CONTROL_EXPORT unsigned int EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDIn
|
|||
// ==== EOEditingContext ====
|
||||
|
||||
GDL2CONTROL_EXPORT id EOEditingContext_objectForGlobalIDWithImpPtr(EOEditingContext* edContext,IMP* impPtr,EOGlobalID* gid);
|
||||
EOGlobalID* EOEditingContext_globalIDForObjectWithImpPtr(EOEditingContext* edContext,IMP* impPtr,id object);
|
||||
GDL2CONTROL_EXPORT EOGlobalID* EOEditingContext_globalIDForObjectWithImpPtr(EOEditingContext* edContext,IMP* impPtr,id object);
|
||||
GDL2CONTROL_EXPORT id EOEditingContext_recordObjectGlobalIDWithImpPtr(EOEditingContext* edContext,IMP* impPtr,id object,EOGlobalID* gid);
|
||||
|
||||
|
||||
|
@ -371,6 +371,10 @@ GDL2CONTROL_EXPORT id EOEditingContext_recordObjectGlobalIDWithImpPtr(EOEditingC
|
|||
GDL2CONTROL_EXPORT void EOHashAddTable(NSHashTable *to, NSHashTable *from);
|
||||
|
||||
|
||||
// ==== hash convienience functions ====
|
||||
|
||||
GDL2CONTROL_EXPORT BOOL GDL2_isLegalDBName(NSString *name);
|
||||
|
||||
// ==== Memory Management Utilities ====
|
||||
|
||||
@interface NSObject (DeallocHack)
|
||||
|
|
|
@ -642,3 +642,27 @@ static SEL eqSel;
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
BOOL
|
||||
GDL2_isLegalDBName(NSString* name)
|
||||
{
|
||||
static NSCharacterSet *illegalSet = nil;
|
||||
NSRange range;
|
||||
|
||||
if (illegalSet == nil)
|
||||
{
|
||||
NSMutableCharacterSet *mutableSet;
|
||||
illegalSet = [NSCharacterSet alphanumericCharacterSet];
|
||||
mutableSet = AUTORELEASE([illegalSet mutableCopy]);
|
||||
[mutableSet addCharactersInString:@"_-"];
|
||||
illegalSet = RETAIN([mutableSet invertedSet]);
|
||||
}
|
||||
|
||||
if (![name length])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
range = [name rangeOfCharacterFromSet: illegalSet];
|
||||
return (range.location == NSNotFound) ? YES : NO;
|
||||
}
|
||||
|
|
|
@ -502,12 +502,19 @@ getKey(const unichar **cFormat,
|
|||
if (classString && (!(quoted || literalNumber)))
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"expected string literal after cast to class"];
|
||||
format:@"expected string literal after cast to class"];
|
||||
}
|
||||
|
||||
/* not sure about this !isQualVar */
|
||||
if (isQualVar)
|
||||
{
|
||||
if (!GDL2_isLegalDBName(key))
|
||||
{
|
||||
NSString *format
|
||||
= [NSString stringWithFormat: @"illegal qualifier variable $%@",key];
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:format];
|
||||
}
|
||||
key = (id)[[EOQualifierVariable alloc] initWithKey:key];
|
||||
}
|
||||
else if (isKeyValue)
|
||||
|
|
Loading…
Reference in a new issue