Monotone-Parent: b06af30d92e12a7505221842044947bace0edc08

Monotone-Revision: a822829663fdf41f5ab083e6fb2ca305b833454f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-09-01T16:49:13
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-09-01 16:49:13 +00:00
parent 3d986a1fdf
commit 3353a468cc
1 changed files with 236 additions and 196 deletions

View File

@ -1,3 +1,190 @@
Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
===================================================================
--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1626)
+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (copie de travail)
@@ -713,6 +713,39 @@
return ms;
}
+/* GCSEOAdaptorChannel protocol */
+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
+ @" c_name VARCHAR (256) NOT NULL PRIMARY KEY,\n"
+ @" c_content VARCHAR (100000) NOT NULL,\n"
+ @" c_creationdate INT4 NOT NULL,\n"
+ @" c_lastmodified INT4 NOT NULL,\n"
+ @" c_version INT4 NOT NULL,\n"
+ @" c_deleted INT4 NULL\n"
+ @")");
+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
+ @" c_uid VARCHAR (256) NOT NULL,\n"
+ @" c_object VARCHAR (256) NOT NULL,\n"
+ @" c_role VARCHAR (80) NOT NULL\n"
+ @")");
+
+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
+{
+ NSString *sql;
+
+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
+
+ return [self evaluateExpressionX: sql];
+}
+
+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
+{
+ NSString *sql;
+
+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
+
+ return [self evaluateExpressionX: sql];
+}
+
@end /* PostgreSQL72Channel */
@implementation PostgreSQL72Channel(PrimaryKeyGeneration)
Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m
===================================================================
--- sope-gdl1/Oracle8/OracleAdaptorChannel.m (révision 1626)
+++ sope-gdl1/Oracle8/OracleAdaptorChannel.m (copie de travail)
@@ -30,6 +30,7 @@
#import <NGExtensions/NSObject+Logs.h>
+static BOOL debugOn = NO;
//
//
//
@@ -41,10 +42,19 @@
@implementation OracleAdaptorChannel (Private)
-- (void) _cleanup
++ (void) initialize
{
+ NSUserDefaults *ud;
+
+ ud = [NSUserDefaults standardUserDefaults];
+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
+}
+
+- (void) _cleanup
+{
column_info *info;
int c;
+ sword result;
[_resultSetProperties removeAllObjects];
@@ -58,11 +68,29 @@
// so we just free the value instead.
if (info->value)
{
- if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
+ if (info->type == SQLT_CLOB
+ || info->type == SQLT_BLOB
+ || info->type == SQLT_BFILEE
+ || info->type == SQLT_CFILEE)
+ {
+ result = OCIDescriptorFree((dvoid *)info->value, (ub4) OCI_DTYPE_LOB);
+ if (result != OCI_SUCCESS)
+ {
+ NSLog (@"value was not a LOB descriptor");
+ abort();
+ }
+ }
+ else
free(info->value);
info->value = NULL;
}
- free(info);
+ else
+ {
+ NSLog (@"trying to free an already freed value!");
+ abort();
+ }
+ free(info);
+
[_row_buffer removeObjectAtIndex: c];
}
@@ -231,6 +259,9 @@
[self _cleanup];
+ if (debugOn)
+ [self logWithFormat: @"expression: %@", theExpression];
+
if (!theExpression || ![theExpression length])
{
[NSException raise: @"OracleInvalidExpressionException"
@@ -302,7 +333,9 @@
// We read the maximum width of a column
info->max_width = 0;
status = OCIAttrGet((dvoid*)param, (ub4)OCI_DTYPE_PARAM, (dvoid*)&(info->max_width), (ub4 *)0, (ub4)OCI_ATTR_DATA_SIZE, (OCIError *)_oci_err);
-
+
+ if (debugOn)
+ NSLog(@"name: %s, type: %d", cname, info->type);
attribute = [EOAttribute attributeWithOracleType: info->type name: cname length: clen width: info->max_width];
[_resultSetProperties addObject: attribute];
@@ -609,7 +642,7 @@
/* GCSEOAdaptorChannel protocol */
static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
- @" c_name VARCHAR2 (256) NOT NULL,\n"
+ @" c_name VARCHAR2 (256) NOT NULL PRIMARY KEY,\n"
@" c_content CLOB NOT NULL,\n"
@" c_creationdate INTEGER NOT NULL,\n"
@" c_lastmodified INTEGER NOT NULL,\n"
Index: sope-gdl1/Oracle8/OracleAdaptorChannelController.m
===================================================================
--- sope-gdl1/Oracle8/OracleAdaptorChannelController.m (révision 1626)
+++ sope-gdl1/Oracle8/OracleAdaptorChannelController.m (copie de travail)
@@ -31,6 +31,8 @@
#import <Foundation/Foundation.h>
#import <GDLAccess/EOSQLExpression.h>
+static BOOL debugOn = NO;
+
//
//
//
@@ -48,6 +50,14 @@
//
@implementation OracleAdaptorChannelController
++ (void) initialize
+{
+ NSUserDefaults *ud;
+
+ ud = [NSUserDefaults standardUserDefaults];
+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
+}
+
- (EODelegateResponse) adaptorChannel: (id) theChannel
willInsertRow: (NSMutableDictionary *) theRow
forEntity: (EOEntity *) theEntity
@@ -56,7 +66,8 @@
NSArray *keys;
int i, c;
- NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
+ if (debugOn)
+ NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
s = AUTORELEASE([[NSMutableString alloc] init]);
@@ -101,7 +112,8 @@
NSArray *keys;
int i, c;
- NSLog(@"willUpdatetRow: %@ %@", [theRow description], [theQualifier description]);
+ if (debugOn)
+ NSLog(@"willUpdateRow: %@ %@", [theRow description], [theQualifier description]);
s = AUTORELEASE([[NSMutableString alloc] init]);
Index: sope-mime/NGImap4/NGImap4Client.h
===================================================================
--- sope-mime/NGImap4/NGImap4Client.h (révision 1626)
@ -1169,7 +1356,7 @@ Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m
+ length++;
+ abbreviation = [[NSString alloc] initWithBytes: *p
+ length: length - 1
+ encoding: NSASCIIStringEncoding];
+ encoding: NSISOLatin1StringEncoding];
+ offsetTZ = [NSTimeZone timeZoneWithAbbreviation: abbreviation];
+ [abbreviation release];
+ *p += length;
@ -1396,8 +1583,8 @@ Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m
- buf[length] = '\0';
-
+
+ length = [_data lengthOfBytesUsingEncoding: NSASCIIStringEncoding];
+ bytes = [_data cStringUsingEncoding: NSASCIIStringEncoding];
+ length = [_data lengthOfBytesUsingEncoding: NSISOLatin1StringEncoding];
+ bytes = [_data cStringUsingEncoding: NSISOLatin1StringEncoding];
+
/* remove leading chars (skip to first digit, the day of the month) */
while (length > 0 && (!isdigit(*bytes))) {
@ -1445,6 +1632,19 @@ Index: sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m
[rfc822Set setGenerator:gen forField:@"Disposition-Notification-To"];
}
Index: sope-mime/NGMime/NGMimeType.m
===================================================================
--- sope-mime/NGMime/NGMimeType.m (révision 1626)
+++ sope-mime/NGMime/NGMimeType.m (copie de travail)
@@ -152,7 +152,7 @@
}
else if ([charset isEqualToString:@"x-unknown"] ||
[charset isEqualToString:@"unknown"]) {
- encoding = NSASCIIStringEncoding;
+ encoding = NSISOLatin1StringEncoding;
}
/* ISO Latin 9 */
#if !(NeXT_Foundation_LIBRARY || APPLE_Foundation_LIBRARY)
Index: sope-mime/NGMime/NGMimeBodyPart.m
===================================================================
--- sope-mime/NGMime/NGMimeBodyPart.m (révision 1626)
@ -1499,6 +1699,30 @@ Index: sope-mime/NGMime/GNUmakefile.preamble
NGMime_INCLUDE_DIRS += \
-I.. -I../.. \
-I../../sope-core/NGStreams/ \
Index: sope-mime/NGMime/ChangeLog
===================================================================
--- sope-mime/NGMime/ChangeLog (révision 1626)
+++ sope-mime/NGMime/ChangeLog (copie de travail)
@@ -1,3 +1,19 @@
+2008-09-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * NGMimeRFC822DateHeaderFieldParser.m ([NGMimeRFC
+ -parseValue:ofHeaderField:]): use an 8-bit safe encoding when
+ parsing dates. Since we only consider 7-bits characters, we ensure
+ that bad user-agents can be handled more properly.
+
+ * NGMimeType.m ([NGMimeType +stringEncodingForCharset:]):
+ x-unknown encoding is now translated to an 8-bit safe encoding
+ (NSISOLatin1StringEncoding).
+
+ * NGMimeAddressHeaderFieldGenerator.m
+ ([NGMimeAddressHeaderFieldGenerator
+ -generateDataForHeaderFieldNamed:value:]): encode resulting string
+ in an 8-bit safe encoding (NSISOLatin1StringEncoding).
+
2008-01-29 Albrecht Dress <albrecht.dress@lios-tech.com>
* fixes for OGo bug #789 (reply-to QP encoding)
Index: sope-mime/NGMime/NGMimeBodyParser.m
===================================================================
--- sope-mime/NGMime/NGMimeBodyParser.m (révision 1626)
@ -1631,20 +1855,23 @@ Index: sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m
- tmp = [NSString stringWithCString:(char *)des
- length:(isoLen + desLen + isoEndLen)];
+ tmp = [[NSString alloc] initWithData: [NSData dataWithBytes:(char *)des length:(isoLen + desLen + isoEndLen)]
+ encoding: NSASCIIStringEncoding];
+ encoding: NSISOLatin1StringEncoding];
+ [tmp autorelease];
}
else {
[self warnWithFormat:
@@ -193,7 +199,7 @@
#if APPLE_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
@@ -190,11 +196,7 @@
}
}
-#if APPLE_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
data = [result dataUsingEncoding:NSISOLatin1StringEncoding];
#else
-#else
- data = [result dataUsingEncoding:NSISOLatin9StringEncoding];
+ data = [result dataUsingEncoding:NSASCIIStringEncoding];
#endif
-#endif
[result release];
return data;
Index: sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m
===================================================================
--- sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m (révision 1626)
@ -1781,193 +2008,6 @@ Index: sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m
}
return data;
}
Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
===================================================================
--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1626)
+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (copie de travail)
@@ -713,6 +713,39 @@
return ms;
}
+/* GCSEOAdaptorChannel protocol */
+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
+ @" c_name VARCHAR (256) NOT NULL PRIMARY KEY,\n"
+ @" c_content VARCHAR (100000) NOT NULL,\n"
+ @" c_creationdate INT4 NOT NULL,\n"
+ @" c_lastmodified INT4 NOT NULL,\n"
+ @" c_version INT4 NOT NULL,\n"
+ @" c_deleted INT4 NULL\n"
+ @")");
+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
+ @" c_uid VARCHAR (256) NOT NULL,\n"
+ @" c_object VARCHAR (256) NOT NULL,\n"
+ @" c_role VARCHAR (80) NOT NULL\n"
+ @")");
+
+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
+{
+ NSString *sql;
+
+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
+
+ return [self evaluateExpressionX: sql];
+}
+
+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
+{
+ NSString *sql;
+
+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
+
+ return [self evaluateExpressionX: sql];
+}
+
@end /* PostgreSQL72Channel */
@implementation PostgreSQL72Channel(PrimaryKeyGeneration)
Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m
===================================================================
--- sope-gdl1/Oracle8/OracleAdaptorChannel.m (révision 1626)
+++ sope-gdl1/Oracle8/OracleAdaptorChannel.m (copie de travail)
@@ -30,6 +30,7 @@
#import <NGExtensions/NSObject+Logs.h>
+static BOOL debugOn = NO;
//
//
//
@@ -41,10 +42,19 @@
@implementation OracleAdaptorChannel (Private)
-- (void) _cleanup
++ (void) initialize
{
+ NSUserDefaults *ud;
+
+ ud = [NSUserDefaults standardUserDefaults];
+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
+}
+
+- (void) _cleanup
+{
column_info *info;
int c;
+ sword result;
[_resultSetProperties removeAllObjects];
@@ -58,11 +68,29 @@
// so we just free the value instead.
if (info->value)
{
- if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
+ if (info->type == SQLT_CLOB
+ || info->type == SQLT_BLOB
+ || info->type == SQLT_BFILEE
+ || info->type == SQLT_CFILEE)
+ {
+ result = OCIDescriptorFree((dvoid *)info->value, (ub4) OCI_DTYPE_LOB);
+ if (result != OCI_SUCCESS)
+ {
+ NSLog (@"value was not a LOB descriptor");
+ abort();
+ }
+ }
+ else
free(info->value);
info->value = NULL;
}
- free(info);
+ else
+ {
+ NSLog (@"trying to free an already freed value!");
+ abort();
+ }
+ free(info);
+
[_row_buffer removeObjectAtIndex: c];
}
@@ -231,6 +259,9 @@
[self _cleanup];
+ if (debugOn)
+ [self logWithFormat: @"expression: %@", theExpression];
+
if (!theExpression || ![theExpression length])
{
[NSException raise: @"OracleInvalidExpressionException"
@@ -302,7 +333,9 @@
// We read the maximum width of a column
info->max_width = 0;
status = OCIAttrGet((dvoid*)param, (ub4)OCI_DTYPE_PARAM, (dvoid*)&(info->max_width), (ub4 *)0, (ub4)OCI_ATTR_DATA_SIZE, (OCIError *)_oci_err);
-
+
+ if (debugOn)
+ NSLog(@"name: %s, type: %d", cname, info->type);
attribute = [EOAttribute attributeWithOracleType: info->type name: cname length: clen width: info->max_width];
[_resultSetProperties addObject: attribute];
@@ -609,7 +642,7 @@
/* GCSEOAdaptorChannel protocol */
static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
- @" c_name VARCHAR2 (256) NOT NULL,\n"
+ @" c_name VARCHAR2 (256) NOT NULL PRIMARY KEY,\n"
@" c_content CLOB NOT NULL,\n"
@" c_creationdate INTEGER NOT NULL,\n"
@" c_lastmodified INTEGER NOT NULL,\n"
Index: sope-gdl1/Oracle8/OracleAdaptorChannelController.m
===================================================================
--- sope-gdl1/Oracle8/OracleAdaptorChannelController.m (révision 1626)
+++ sope-gdl1/Oracle8/OracleAdaptorChannelController.m (copie de travail)
@@ -31,6 +31,8 @@
#import <Foundation/Foundation.h>
#import <GDLAccess/EOSQLExpression.h>
+static BOOL debugOn = NO;
+
//
//
//
@@ -48,6 +50,14 @@
//
@implementation OracleAdaptorChannelController
++ (void) initialize
+{
+ NSUserDefaults *ud;
+
+ ud = [NSUserDefaults standardUserDefaults];
+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
+}
+
- (EODelegateResponse) adaptorChannel: (id) theChannel
willInsertRow: (NSMutableDictionary *) theRow
forEntity: (EOEntity *) theEntity
@@ -56,7 +66,8 @@
NSArray *keys;
int i, c;
- NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
+ if (debugOn)
+ NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
s = AUTORELEASE([[NSMutableString alloc] init]);
@@ -101,7 +112,8 @@
NSArray *keys;
int i, c;
- NSLog(@"willUpdatetRow: %@ %@", [theRow description], [theQualifier description]);
+ if (debugOn)
+ NSLog(@"willUpdateRow: %@ %@", [theRow description], [theQualifier description]);
s = AUTORELEASE([[NSMutableString alloc] init]);
Index: sope-core/NGExtensions/NGExtensions/NSString+Ext.h
===================================================================
--- sope-core/NGExtensions/NGExtensions/NSString+Ext.h (révision 1626)