Fixed #1989 (clang bug with function definition within method)

This commit is contained in:
Ludovic Marcotte
2012-09-24 13:16:14 -04:00
parent c1fba4805e
commit a6b07cd158
3 changed files with 24 additions and 16 deletions

View File

@@ -41,7 +41,7 @@
#import "MSExchangeFreeBusySOAPRequest.h"
#import "MSExchangeFreeBusy.h"
size_t curlBodyFunction(void *ptr, size_t size, size_t nmemb, void *inSelf)
size_t curl_body_function_freebusy(void *ptr, size_t size, size_t nmemb, void *inSelf)
{
return [(MSExchangeFreeBusy *)inSelf curlWritePtr:ptr size:size number:nmemb];
}
@@ -139,7 +139,7 @@ size_t curlBodyFunction(void *ptr, size_t size, size_t nmemb, void *inSelf)
//curl_easy_setopt(curl, CURLOPT_HEADER, 1);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlBodyFunction);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_body_function_freebusy);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, self);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error);

View File

@@ -1,8 +1,9 @@
/* SOGoWebAppointmentFolder.h - this file is part of SOGo
*
* Copyright (C) 2009 Inverse inc.
* Copyright (C) 2009-2012 Inverse inc.
*
* Author: Cyril Robert <crobert@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +27,10 @@
#import "SOGoAppointmentFolder.h"
@interface SOGoWebAppointmentFolder : SOGoAppointmentFolder
{
@public
NSMutableData *buffer;
}
- (void) setUsername: (NSString *) username
andPassword: (NSString *) password;

View File

@@ -46,6 +46,16 @@
@class WOHTTPURLHandle;
size_t curl_body_function(void *ptr, size_t size, size_t nmemb, void *inSelf)
{
size_t total;
total = size * nmemb;
[((SOGoWebAppointmentFolder *)inSelf)->buffer appendBytes: ptr length: total];
return total;
}
@implementation SOGoWebAppointmentFolder
- (void) deleteAllContent
@@ -107,7 +117,6 @@
{
NSString *location, *httpauth;
NSDictionary *authInfos;
NSMutableData *bodyData;
NSURL *url;
CURL *curl;
CURLcode rc;
@@ -142,17 +151,11 @@
curl_easy_setopt (curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
}
bodyData = [NSMutableData data];
size_t curlBodyFunction (void *ptr, size_t size, size_t nmemb, void *inSelf)
{
size_t total;
/* buffering ivar, no need to retain/release */
buffer = [NSMutableData data];
total = size * nmemb;
[bodyData appendBytes: ptr length: total];
return total;
}
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, curlBodyFunction);
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, curl_body_function);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, self);
error[0] = 0;
curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, &error);
@@ -167,10 +170,10 @@
if (status == 200)
{
content = [[NSString alloc] initWithData: bodyData
content = [[NSString alloc] initWithData: buffer
encoding: NSUTF8StringEncoding];
if (!content)
content = [[NSString alloc] initWithData: bodyData
content = [[NSString alloc] initWithData: buffer
encoding: NSISOLatin1StringEncoding];
[content autorelease];
calendar = [iCalCalendar parseSingleFromSource: content];