(fix) properly initialize values

pull/215/head
Ludovic Marcotte 2016-06-06 13:28:42 -04:00
parent 04e804e62f
commit 53a5561173
3 changed files with 22 additions and 12 deletions

View File

@ -873,6 +873,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
return_count = 0;
component = nil;
for (i = 0; i < max; i++)
{
@ -1039,6 +1040,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
theSyncKey = @"-1";
highestmodseq = 0;
RELEASE(sortedByUID);
}
@ -1196,7 +1198,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];
@ -1902,6 +1905,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++)
@ -1986,7 +1990,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

@ -891,7 +891,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];
@ -1763,11 +1765,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\"?>"];
@ -1791,7 +1796,6 @@ void handle_eas_terminate(int signum)
{
folderMetadata = [self _folderMetadataForKey: nameInCache];
prevSuccessfulMoveItemsOps = [folderMetadata objectForKey: @"SuccessfulMoveItemsOps"];
newSuccessfulMoveItemsOps = [NSMutableDictionary dictionary] ;
currentFolder = nameInCache;
}

View File

@ -508,6 +508,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];
@ -515,8 +518,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];
}
@ -527,9 +530,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"]))