if (StringClass == Nil) StringClass = [NSString class];
value = self;
- buf = [_keyPath cString];
- if (index(buf, '.') == NULL)
+ buf = (const unsigned char *)[_keyPath cString];
+ if (index((const char *)buf, '.') == NULL)
/* no point contained .. */
return [self valueForKey:_keyPath];
NSString *key;
key = (start < i)
- ? [StringClass stringWithCString:&(buf[start]) length:(i - start)]
+ ? [StringClass stringWithCString:(const char *)
+ &(buf[start]) length:(i - start)]
: @"";
if ((value = [value valueForKey:key]) == nil)
NSString *key;
key = (start < i)
- ? [StringClass stringWithCString:&(buf[start]) length:(i - start)]
+ ? [StringClass stringWithCString:(const char *)
+ &(buf[start]) length:(i - start)]
: @"";
return [value valueForKey:key];
}
//[self handleTakeValue:_value forUnboundKey:_key];
}
-- (id)valueForKey:(id)_key {
+- (id)valueForKey:(NSString *)_key {
id obj;
if (_key == nil) // TODO: warn about nil key?
[self addEntriesFromDictionary:dictionary];
}
-- (void)takeValue:(id)_value forKey:(id)_key {
+- (void)takeValue:(id)_value forKey:(NSString *)_key {
if (_value == nil) _value = [NSNull null];
[self setObject:_value forKey:_key];
}
} EOQPTokEntry;
static EOQPTokEntry toks[] = {
- { "NULL", nil, 0 },
- { "nil", nil, 1 },
- { "YES", nil, 0 },
- { "NO", nil, 0 },
- { "TRUE", nil, 0 },
- { "FALSE", nil, 0 },
- { NULL, nil, 0 }
+ { (const unsigned char *)"NULL", nil, 0 },
+ { (const unsigned char *)"nil", nil, 1 },
+ { (const unsigned char *)"YES", nil, 0 },
+ { (const unsigned char *)"NO", nil, 0 },
+ { (const unsigned char *)"TRUE", nil, 0 },
+ { (const unsigned char *)"FALSE", nil, 0 },
+ { (const unsigned char *)NULL, nil, 0 }
};
static inline void _setupLiterals(void) {
int rc;
tok = toks[i].token;
- toklen = strlen(tok);
+ toklen = strlen((const char *)tok);
if ((_bufLen - pos) < toklen)
/* remaining string not long enough */
continue;
rc = toks[i].scase
- ? strncmp(&(_buf[pos]), tok, toklen)
- : strncasecmp(&(_buf[pos]), tok, toklen);
+ ? strncmp(&(_buf[pos]), (const char *)tok, toklen)
+ : strncasecmp(&(_buf[pos]), (const char *)tok, toklen);
if (rc != 0)
/* does not match */
continue;
//printf("POS: '%s'\n", &(_buf[pos]));
pos++;
- cs = &(_buf[pos]);
- ce = index(cs, '\'');
- cast = [NSString stringWithCString:cs length:(ce - cs)];
+ cs = (const unsigned char *)&(_buf[pos]);
+ ce = (const unsigned char *)index((const char *)cs, '\'');
+ cast = [NSString stringWithCString:(const char*)cs length:(ce - cs)];
if (qDebug) {
- NSLog(@"%s: parsed complex cast: '%@' to '%@'", __PRETTY_FUNCTION__,
- obj, cast);
+ NSLog(@"%s: parsed complex cast: '%@' to '%@'",
+ __PRETTY_FUNCTION__, obj, cast);
}
pos += (ce - cs);
pos++; // skip '
unichar *scur;
unsigned slen, tlen;
- tlen = strlen(tk);
+ tlen = strlen((const char *)tk);
scur=*pos; slen=*len; // begin transaction
skipSpaces(&scur, &slen);
if (slen < 1) return NO;
- if ([self parseToken:"FROM" from:&scur length:&slen consume:NO]) {
+ if ([self parseToken:(const unsigned char *)"FROM"
+ from:&scur length:&slen consume:NO]) {
/* not an attribute, the from starts ... */
// printf("rejected unquoted attr, is a FROM\n");
return NO;
}
- if ([self parseToken:"WHERE" from:&scur length:&slen consume:NO]) {
+ if ([self parseToken:(const unsigned char *)"WHERE"
+ from:&scur length:&slen consume:NO]) {
/* not an attribute, the where starts ... */
// printf("rejected unquoted attr, is a WHERE\n");
return NO;
if (slen < 12) return NO; // not enough chars
- if (![self parseToken:"CONTAINS" from:pos length:len consume:YES])
+ if (![self parseToken:(const unsigned char *)"CONTAINS"
+ from:pos length:len consume:YES])
return NO;
skipSpaces(&scur, &slen);
- [self parseToken:"('" from:&scur length:&slen consume:YES];
+ [self parseToken:(const unsigned char *)"('"
+ from:&scur length:&slen consume:YES];
if (![self parseIdentifier:&s from:&scur length:&slen consume:YES])
return NO;
skipSpaces(&scur, &slen);
- [self parseToken:"')" from:&scur length:&slen consume:YES];
+ [self parseToken:(const unsigned char *)"')"
+ from:&scur length:&slen consume:YES];
*q_ = [[EOQualifier qualifierWithQualifierFormat:
@"contentAsString doesContain: %@", s] retain];
while (slen > 0) {
if (*scur == 'O' || *scur == 'o') {
- if ([self parseToken:"ORDER" from:&scur length:&slen consume:NO]) {
+ if ([self parseToken:(const unsigned char *)"ORDER"
+ from:&scur length:&slen consume:NO]) {
//printf("FOUND ORDER TOKEN ...\n");
break;
}
}
else if (*scur == 'G' || *scur == 'g') {
- if ([self parseToken:"GROUP" from:&scur length:&slen consume:NO]) {
+ if ([self parseToken:(const unsigned char *)"GROUP"
+ from:&scur length:&slen consume:NO]) {
//printf("FOUND GROUP TOKEN ...\n");
break;
}
/* next the depth */
- if ([self parseToken:"SHALLOW" from:&scur length:&slen consume:YES])
+ if ([self parseToken:(const unsigned char *)"SHALLOW"
+ from:&scur length:&slen consume:YES])
isShallow = YES;
- else if ([self parseToken:"HIERARCHICAL" from:&scur length:&slen consume:YES])
+ else if ([self parseToken:(const unsigned char *)"HIERARCHICAL"
+ from:&scur length:&slen consume:YES])
isDeep = YES;
- else if ([self parseToken:"DEEP" from:&scur length:&slen consume:YES])
+ else if ([self parseToken:(const unsigned char *)"DEEP"
+ from:&scur length:&slen consume:YES])
isDeep = YES;
else
/* unknown traveral key */
return NO;
/* some syntactic sugar (not strict about that ...) */
- [self parseToken:"TRAVERSAL" from:&scur length:&slen consume:YES];
- [self parseToken:"OF" from:&scur length:&slen consume:YES];
+ [self parseToken:(const unsigned char *)"TRAVERSAL"
+ from:&scur length:&slen consume:YES];
+ [self parseToken:(const unsigned char *)"OF"
+ from:&scur length:&slen consume:YES];
if (slen < 1) return NO; // not enough chars
/* now the entity */
*result = nil;
- if (![self parseToken:"SELECT" from:pos length:len consume:YES]) {
+ if (![self parseToken:(const unsigned char *)"SELECT"
+ from:pos length:len consume:YES]) {
/* must begin with SELECT */
if (beStrict) return NO;
}
//[self debugWithFormat:@"parsed attrs (%i): %@", [attrs count], attrs];
/* now a from is expected */
- if ([self parseToken:"FROM" from:pos length:len consume:YES])
+ if ([self parseToken:(const unsigned char *)"FROM"
+ from:pos length:len consume:YES])
hasFrom = YES;
else {
if (beStrict) return NO;
}
/* check whether it's followed by a scope */
- if ([self parseToken:"SCOPE" from:pos length:len consume:YES]) {
+ if ([self parseToken:(const unsigned char *)"SCOPE"
+ from:pos length:len consume:YES]) {
NSString *scopeEntity = nil;
if (![self parseScope:&scope:&scopeEntity from:pos length:len]) {
}
/* check where */
- if ([self parseToken:"WHERE" from:pos length:len consume:YES]) {
+ if ([self parseToken:(const unsigned char *)"WHERE"
+ from:pos length:len consume:YES]) {
/* parse qualifier ... */
- if ([self parseToken:"CONTAINS" from:pos length:len consume:NO]) {
+ if ([self parseToken:(const unsigned char *)"CONTAINS"
+ from:pos length:len consume:NO]) {
if (![self parseContainsQualifier:&q from:pos length:len]) {
if (beStrict) return NO;
}
}
/* check order-by */
- if ([self parseToken:"ORDER" from:pos length:len consume:YES]) {
- if (![self parseToken:"BY" from:pos length:len consume:YES]) {
+ if ([self parseToken:(const unsigned char *)"ORDER"
+ from:pos length:len consume:YES]) {
+ if (![self parseToken:(const unsigned char *)"BY"
+ from:pos length:len consume:YES]) {
if (beStrict) return NO;
missingByOfOrder = YES;
}
}
/* check group-by */
- if ([self parseToken:"GROUP" from:pos length:len consume:YES]) {
- if (![self parseToken:"BY" from:pos length:len consume:YES]) {
+ if ([self parseToken:(const unsigned char *)"GROUP"
+ from:pos length:len consume:YES]) {
+ if (![self parseToken:(const unsigned char *)"BY"
+ from:pos length:len consume:YES]) {
if (beStrict) return NO;
missingByOfGroup = YES;
}
{
if (*len < 1) return NO;
- if ([self parseToken:"SELECT" from:pos length:len consume:NO])
+ if ([self parseToken:(const unsigned char *)"SELECT"
+ from:pos length:len consume:NO])
return [self parseSELECT:result from:pos length:len strict:beStrict];
//if ([self parseToken:"UPDATE" from:pos length:len consume:NO])