(fix) properly initialize values

pull/213/head
Ludovic Marcotte 2016-06-06 13:28:42 -04:00
parent ec61fd10fc
commit f0f9ca9ff0
3 changed files with 22 additions and 12 deletions

View File

@ -835,6 +835,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
return_count = 0;
component = nil;
for (i = 0; i < max; i++)
{
@ -1001,6 +1002,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
theSyncKey = @"-1";
highestmodseq = 0;
RELEASE(sortedByUID);
}
@ -1158,7 +1160,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[self logWithFormat: @"EAS - found in cache: %d k = %d", found_in_cache, k];
return_count = 0;
aCacheObject = nil;
for (; k < [allCacheObjects count]; k++)
{
pool = [[NSAutoreleasePool alloc] init];
@ -1864,6 +1867,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
[output appendString: @"<Collections>"];
s = nil;
// We enter our loop detection change
for (i = 0; i < (heartbeatInterval/internalInterval); i++)
@ -1948,7 +1952,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// We always return the last generated response.
// If we only return <Sync><Collections/></Sync>,
// iOS powered devices will simply crash.
[output appendString: s];
if (s)
[output appendString: s];
[output appendString: @"</Collections></Sync>"];

View File

@ -890,7 +890,9 @@ void handle_eas_terminate(int signum)
else
folderType = @"Contacts";
if ([ cKey rangeOfString: @"/"].location != NSNotFound)
currentFolder = nil;
if ([cKey rangeOfString: @"/"].location != NSNotFound)
currentFolder = [[[[context activeUser] homeFolderInContext: context] lookupName: folderType inContext: context acquire: NO]
lookupName: [cKey substringFromIndex: [cKey rangeOfString: @"/"].location+1] inContext: context acquire: NO];
@ -1765,11 +1767,14 @@ void handle_eas_terminate(int signum)
NSMutableString *s;
NSData *d;
int i;
currentFolder = nil;
moveOperations = (id)[theDocumentElement getElementsByTagName: @"Move"];
newSuccessfulMoveItemsOps = [NSMutableDictionary dictionary];
prevSuccessfulMoveItemsOps = nil;
folderMetadata = nil;
currentFolder = nil;
s = [NSMutableString string];
[s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
@ -1793,7 +1798,6 @@ void handle_eas_terminate(int signum)
{
folderMetadata = [self _folderMetadataForKey: nameInCache];
prevSuccessfulMoveItemsOps = [folderMetadata objectForKey: @"SuccessfulMoveItemsOps"];
newSuccessfulMoveItemsOps = [NSMutableDictionary dictionary] ;
currentFolder = nameInCache;
}

View File

@ -501,6 +501,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if ((o = [theValues objectForKey: @"Location"]))
[self setLocation: o];
deltasecs = 0;
start = nil;
if ((o = [theValues objectForKey: @"StartTime"]))
{
o = [o calendarDate];
@ -508,8 +511,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
oldstart = [start dateTime];
[start setTimeZone: tz];
if (isAllDay)
{
if (isAllDay)
{
[start setDate: o];
[start setTimeZone: nil];
}
@ -520,9 +523,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Calculate delta if start date has been changed.
if (oldstart)
deltasecs = [[start dateTime ] timeIntervalSinceDate: oldstart] * -1;
else
deltasecs = 0;
deltasecs = [[start dateTime ] timeIntervalSinceDate: oldstart] * -1;
}
if ((o = [theValues objectForKey: @"EndTime"]))