Revision: 3562
http://skim-app.svn.sourceforge.net/skim-app/?rev=3562&view=rev
Author: amaxwell
Date: 2008-03-26 13:19:52 -0700 (Wed, 26 Mar 2008)
Log Message:
-----------
Revise agent API to pass data instead of NSString. See comment for details.
This appears to be a bug in encoding NSStrings over DO. Thanks to JiHO
for providing reproducible test cases.
Modified Paths:
--------------
SkimNotesAgent/SkimNotesAgent.h
SkimNotesAgent/SkimNotesAgent.m
Modified: SkimNotesAgent/SkimNotesAgent.h
===================================================================
--- SkimNotesAgent/SkimNotesAgent.h 2008-03-26 15:32:25 UTC (rev 3561)
+++ SkimNotesAgent/SkimNotesAgent.h 2008-03-26 20:19:52 UTC (rev 3562)
@@ -39,6 +39,6 @@
- (bycopy NSData *)SkimNotesAtPath:(in bycopy NSString *)aFile;
- (bycopy NSData *)RTFNotesAtPath:(in bycopy NSString *)aFile;
-- (bycopy NSString *)textNotesAtPath:(in bycopy NSString *)aFile;
+- (bycopy NSData *)textNotesAtPath:(in bycopy NSString *)aFile
encoding:(NSStringEncoding)encoding;
@end
Modified: SkimNotesAgent/SkimNotesAgent.m
===================================================================
--- SkimNotesAgent/SkimNotesAgent.m 2008-03-26 15:32:25 UTC (rev 3561)
+++ SkimNotesAgent/SkimNotesAgent.m 2008-03-26 20:19:52 UTC (rev 3562)
@@ -155,7 +155,7 @@
return data;
}
-- (bycopy NSString *)textNotesAtPath:(in bycopy NSString *)aFile;
+- (bycopy NSData *)textNotesAtPath:(in bycopy NSString *)aFile
encoding:(NSStringEncoding)encoding;
{
NSError *error;
NSString *string = nil;
@@ -172,7 +172,8 @@
if (nil == string && [[[error userInfo]
objectForKey:NSUnderlyingErrorKey] code] != ENOATTR)
fprintf(stderr, "SkimNotesAgent pid %d: error getting text notes
(%s)\n", getpid(), [[error description] UTF8String]);
}
- return string;
+ // Returning the string directly can fail under some conditions. For some
strings with corrupt copy-paste characters (typical for notes), -[NSString
canBeConvertedToEncoding:NSUTF8StringEncoding] returns YES but the actual
conversion fails. A result seems to be that encoding the string also fails,
which causes the DO client to get a timeout. Returning NSUnicodeStringEncoding
data seems to work in those cases (and is safe since we're not going over the
wire between big/little-endian systems).
+ return [string dataUsingEncoding:encoding];
}
- (void)destroyConnection;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit