X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=sope-core%2FNGExtensions%2FFdExt.subproj%2FNSString%2BURLEscaping.m;h=acd88786e2588000900950afb0ceb5422926902a;hb=2afe19d91f4d52c499e4772bd2f5f8290874c649;hp=45da79d9d1d04d5e90dacd175e494f95d4e9a49c;hpb=16c3f13b75515189351744501af0dd27b477d79a;p=sope diff --git a/sope-core/NGExtensions/FdExt.subproj/NSString+URLEscaping.m b/sope-core/NGExtensions/FdExt.subproj/NSString+URLEscaping.m index 45da79d9..acd88786 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSString+URLEscaping.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSString+URLEscaping.m @@ -1,20 +1,20 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2000-2005 SKYRIX Software AG - This file is part of OpenGroupware.org. + This file is part of SOPE. - OGo is free software; you can redistribute it and/or modify it under + SOPE is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - OGo is distributed in the hope that it will be useful, but WITHOUT ANY + SOPE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the + License along with SOPE; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -54,7 +54,10 @@ static inline BOOL isUrlDigit(unsigned char _c) { } static inline BOOL isUrlSafeChar(unsigned char _c) { switch (_c) { - case '$': case '-': case '_': case '.': case '+': + case '$': case '-': case '_': case '.': +#if 0 /* see OGo bug #1260, required for forms */ + case '+': +#endif case '@': // TODO: not a safe char?! return YES; @@ -128,7 +131,7 @@ NGEscapeUrlBuffer(const unsigned char *_source, unsigned char *_dest, } else { // any other char is escaped .. *_dest = '%'; _dest++; - sprintf(_dest, "%02X", (unsigned)*src); + sprintf((char *)_dest, "%02X", (unsigned)*src); _dest += 2; } } @@ -233,7 +236,7 @@ NGUnescapeUrlBuffer(const unsigned char *_source, unsigned char *_dest) - (NSString *)stringByUnescapingURL { /* - input is a URL string - per definition ASCII(?!), like "hello%98%88.txt" + Input is a URL string - per definition ASCII(?!), like "hello%98%88.txt" output is a unicode string (never longer than the input) Note that the input itself is in some encoding! That is, the input is @@ -255,12 +258,12 @@ NGUnescapeUrlBuffer(const unsigned char *_source, unsigned char *_dest) cstr[len] = '\0'; buffer = malloc(len + 4); - NGUnescapeUrlBuffer(cstr, buffer); + NGUnescapeUrlBuffer((unsigned char *)cstr, (unsigned char *)buffer); if (doUseUTF8Encoding()) { /* OK, the input is considered UTF-8 encoded in a string */ s = [[NSString alloc] initWithUTF8String:buffer]; - if (buffer) free(buffer); + if (buffer != NULL) free(buffer); buffer = NULL; } else { s = [[NSString alloc] @@ -268,7 +271,7 @@ NGUnescapeUrlBuffer(const unsigned char *_source, unsigned char *_dest) length:strlen(buffer) freeWhenDone:YES]; } - if (cstr) free(cstr); + if (cstr != NULL) free(cstr); cstr = NULL; return [s autorelease]; } @@ -295,18 +298,18 @@ NGUnescapeUrlBuffer(const unsigned char *_source, unsigned char *_dest) return @""; buffer = malloc(len * 3 + 2); - NGEscapeUrlBuffer([data bytes], buffer, len); + NGEscapeUrlBuffer([data bytes], (unsigned char *)buffer, len); } else { unsigned char *cstr; len = [self cStringLength]; cstr = malloc(len + 4); - [self getCString:cstr]; // Unicode! + [self getCString:(char *)cstr]; // Unicode! cstr[len] = '\0'; buffer = malloc(len * 3 + 2); - NGEscapeUrlBuffer(cstr, buffer, len); + NGEscapeUrlBuffer(cstr, (unsigned char *)buffer, len); if (cstr) free(cstr); }