]> err.no Git - sope/commitdiff
fixed a few cString related issues
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sat, 9 Feb 2008 15:16:22 +0000 (15:16 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sat, 9 Feb 2008 15:16:22 +0000 (15:16 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1600 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-gdl1/PostgreSQL/ChangeLog
sope-gdl1/PostgreSQL/NSString+PostgreSQL72.m
sope-gdl1/PostgreSQL/PGResultSet.m
sope-gdl1/PostgreSQL/PostgreSQL72Channel+Model.m
sope-gdl1/PostgreSQL/Version

index d762e00e449eb501dc1d56faa918a808a506c9ab..6ff193d6421b00169191d3a19ebeb1432b91e22c 100644 (file)
@@ -1,3 +1,12 @@
+2008-02-09  Helge Hess  <helge.hess@opengroupware.org>
+
+       * v4.7.52
+
+       * NSString+PostgreSQL72.m: properly use -length, not -cStringLength
+
+       * PostgreSQL72Channel+Model.m, PGResultSet.m: use -UTF8String instead
+         of -cString
+
 2007-09-27  Helge Hess  <helge.hess@opengroupware.org>
 
        * PostgreSQL72Context.m: changed to use -evaluateExpressionX: for
index f0088b46d0c1a416750d70da310c60e18747ac70..11f8abc7d63a66714011c582dd1d8caf4537df56 100644 (file)
@@ -78,7 +78,7 @@
     return @"";
 
   // TODO: use UTF-8 here
-  clen = [self cStringLength];
+  clen = [self length];
   us   = malloc((clen + 10) * sizeof(unichar));
   
   [self getCharacters:us];
index 3615302e2deda80c7c09d0d7f5d85ddfad7272c4..ce8db023514d15b8663cd3f6ed7dcd16193fbe16 100644 (file)
 }
 
 - (int)indexOfFieldNamed:(NSString *)_name {
+#if LIB_FOUNDATION_LIBRARY
+  // TBD: might be wrong even in this case?
   return PQfnumber(self->results, [_name cString]);
+#else
+  return PQfnumber(self->results, [_name UTF8String]);
+#endif
 }
 
 - (int)fieldSizeAtIndex:(unsigned int)_idx {
index 68c15deebae0b39e7785e552a40cfa396bc9f5bf..b98286d0fab0faf657af72c3ad06da8d9e9d1bfb 100644 (file)
@@ -2,7 +2,7 @@
    PostgreSQL72Channel+Model.m
 
    Copyright (C) 1999 MDlink online service center GmbH and Helge Hess
-   Copyright (C) 2000-2004 SKYRIX Software AG and Helge Hess
+   Copyright (C) 2000-2008 SKYRIX Software AG and Helge Hess
 
    Author: Helge Hess (helge.hess@opengroupware.org)
    
@@ -61,7 +61,7 @@ static BOOL debugOn = NO;
   if (![self evaluateExpression:sqlExpr]) {
     fprintf(stderr,
            "Could not evaluate column-describe '%s' on table '%s'\n",
-           [sqlExpr cString], [_tableName cString]);
+           [sqlExpr UTF8String], [_tableName UTF8String]);
     return nil;
   }
   
@@ -213,19 +213,15 @@ static BOOL debugOn = NO;
         relName = [@"to" stringByAppendingString:
                     [[sa _pgModelMakeInstanceVarName]
                          _pgStringWithCapitalizedFirstChar]];
-        if ([relName hasSuffix:@"Id"]) {
-          int cLength = [relName cStringLength];
-
-          relName = [relName substringToIndex:cLength - 2];
-        }
+        if ([relName hasSuffix:@"Id"])
+          relName = [relName substringToIndex:([relName length] - 2)];
       }
       if ([relNamesUsed objectForKey:relName] != nil) {
         int useCount = [[relNamesUsed objectForKey:relName] intValue];
         
         [relNamesUsed setObject:[NSNumber numberWithInt:(useCount++)] 
                      forKey:relName];
-        relName = [NSString stringWithFormat:@"%s%d",
-                              [relName cString], useCount];
+        relName = [NSString stringWithFormat:@"%@%d", relName, useCount];
       }
       else
         [relNamesUsed setObject:[NSNumber numberWithInt:0] forKey:relName];
@@ -321,7 +317,13 @@ static BOOL debugOn = NO;
   NSDictionary   *row;
   
   if (![self evaluateExpression:_query]) {
-    fprintf(stderr, "Could not evaluate expression: '%s'\n", [_query cString]);
+    fprintf(stderr, "Could not evaluate expression: '%s'\n",
+#if LIB_FOUNDATION_LIBRARY
+           [_query cString]
+#else
+           [_query UTF8String]
+#endif
+           );
     return nil;
   }
   
index 13f24be801d650e36f7f95384735325dbe7be579..3638a1634c12a2275ba5faa4e9e8edc2c8a1e6b0 100644 (file)
@@ -1,5 +1,5 @@
 # version file
 
-SUBMINOR_VERSION:=51
+SUBMINOR_VERSION:=52
 
 # v4.5.41 requires libGDLAccess v4.5.50