Skip to content

Commit

Permalink
fix precision loss integer to long long
Browse files Browse the repository at this point in the history
  • Loading branch information
djih committed Dec 30, 2015
1 parent 00ade5c commit e5754da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Amplitude/AMPDatabaseHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -330,18 +330,18 @@ - (NSMutableArray*)getEventsFromTable:(NSString*) table upToId:(long long) upToI

[self inDatabaseWithStatement:querySQL block:^(sqlite3_stmt *stmt) {
while (sqlite3_step(stmt) == SQLITE_ROW) {
NSInteger eventId = sqlite3_column_int64(stmt, 0);
long long eventId = sqlite3_column_int64(stmt, 0);
NSString *eventString = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt, 1)];
NSData *eventData = [eventString dataUsingEncoding:NSUTF8StringEncoding];

id eventImmutable = [NSJSONSerialization JSONObjectWithData:eventData options:0 error:NULL];
if (eventImmutable == nil) {
NSLog(@"Error JSON deserialization of event id %ld from table %@", eventId, table);
NSLog(@"Error JSON deserialization of event id %lld from table %@", eventId, table);
continue;
}

NSMutableDictionary *event = [eventImmutable mutableCopy];
[event setValue:[NSNumber numberWithInteger:eventId] forKey:@"event_id"];
[event setValue:[NSNumber numberWithLongLong:eventId] forKey:@"event_id"];
[events addObject:event];
SAFE_ARC_RELEASE(event);
}
Expand Down

0 comments on commit e5754da

Please sign in to comment.