mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-03 12:28:51 +00:00
Monotone-Parent: 053b5d33cbcf453e7c7216c0b2a168a0f0ffa0d5
Monotone-Revision: 7c8fce0426b2ec4def5226f16a9bcf2cff5dcfb9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-09-07T16:44:13 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2012-09-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/NSString+MAPIStore.m
|
||||
(-stringByReplacingPercentEscapesUsingEncoding:): we now return
|
||||
nil for non-ascii strings.
|
||||
|
||||
2012-09-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/NSString+MAPIStore.m
|
||||
|
||||
@@ -161,34 +161,39 @@
|
||||
char newByte0, newByte1;
|
||||
|
||||
data = [self dataUsingEncoding: NSASCIIStringEncoding];
|
||||
length = [data length];
|
||||
bytes = [data bytes];
|
||||
newBytes = NSZoneMalloc (NULL, sizeof (char) * length);
|
||||
newCount = 0;
|
||||
for (count = 0; count < length; count++)
|
||||
if (data)
|
||||
{
|
||||
if (bytes[count] == '%')
|
||||
length = [data length];
|
||||
bytes = [data bytes];
|
||||
newBytes = NSZoneMalloc (NULL, sizeof (char) * length);
|
||||
newCount = 0;
|
||||
for (count = 0; count < length; count++)
|
||||
{
|
||||
newByte0 = [self _decodeHexByte: bytes[count+1]];
|
||||
newByte1 = [self _decodeHexByte: bytes[count+2]];
|
||||
if ((newByte0 != -1) && (newByte1 != -1))
|
||||
if (bytes[count] == '%')
|
||||
{
|
||||
newBytes[newCount] = (((newByte0 << 4) & 0xf0)
|
||||
| (newByte1 & 0x0f));
|
||||
count += 2;
|
||||
newByte0 = [self _decodeHexByte: bytes[count+1]];
|
||||
newByte1 = [self _decodeHexByte: bytes[count+2]];
|
||||
if ((newByte0 != -1) && (newByte1 != -1))
|
||||
{
|
||||
newBytes[newCount] = (((newByte0 << 4) & 0xf0)
|
||||
| (newByte1 & 0x0f));
|
||||
count += 2;
|
||||
}
|
||||
else
|
||||
newBytes[newCount] = bytes[count];
|
||||
}
|
||||
else
|
||||
newBytes[newCount] = bytes[count];
|
||||
newCount++;
|
||||
}
|
||||
else
|
||||
newBytes[newCount] = bytes[count];
|
||||
newCount++;
|
||||
}
|
||||
|
||||
data = [NSData dataWithBytesNoCopy: newBytes length: newCount freeWhenDone: YES];
|
||||
newString = [[NSString alloc]
|
||||
initWithData: data encoding: encoding];
|
||||
[newString autorelease];
|
||||
data = [NSData dataWithBytesNoCopy: newBytes length: newCount freeWhenDone: YES];
|
||||
newString = [[NSString alloc]
|
||||
initWithData: data encoding: encoding];
|
||||
[newString autorelease];
|
||||
}
|
||||
else
|
||||
newString = nil;
|
||||
|
||||
return newString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user