aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataStorage.m
diff options
context:
space:
mode:
authorAbhi Beckert <abhi@Twist-of-Lemon-2.local>2015-05-16 08:06:06 +1000
committerAbhi Beckert <abhi@Twist-of-Lemon-2.local>2015-05-16 08:06:06 +1000
commit57a6f6c73bdaa202164645370d37fcbe5d14a092 (patch)
treedd30aa6156064f1d4c0e10ea87059625470fc2f9 /Source/SPDataStorage.m
parentb5e972f4504043dfb9c358e272e93fb59ae2127f (diff)
parent0f0c43eb74408b6a65a42e2c6fd46f4142ef8e3f (diff)
downloadsequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.tar.gz
sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.tar.bz2
sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.zip
Merge remote-tracking branch 'sequelpro/master'
Diffstat (limited to 'Source/SPDataStorage.m')
-rw-r--r--Source/SPDataStorage.m16
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/SPDataStorage.m b/Source/SPDataStorage.m
index ed50c7fc..dd5e87a5 100644
--- a/Source/SPDataStorage.m
+++ b/Source/SPDataStorage.m
@@ -58,7 +58,7 @@ static inline NSMutableArray* SPDataStorageGetEditedRow(NSPointerArray* rowStore
{
NSUInteger i;
editedRowCount = 0;
- [editedRows release], editedRows = nil;
+ SPClear(editedRows);
if (unloadedColumns) free(unloadedColumns), unloadedColumns = NULL;
if (dataStorage) {
@@ -68,7 +68,7 @@ static inline NSMutableArray* SPDataStorageGetEditedRow(NSPointerArray* rowStore
[newDataStorage replaceExistingResultStore:dataStorage];
}
- [dataStorage release], dataStorage = nil;
+ SPClear(dataStorage);
}
dataStorage = [newDataStorage retain];
@@ -357,12 +357,12 @@ static inline NSMutableArray* SPDataStorageGetEditedRow(NSPointerArray* rowStore
{
// Throw an exception if the range is out of bounds
- if (rangeToRemove.location + rangeToRemove.length > SPMySQLResultStoreGetRowCount(dataStorage)) {
- [NSException raise:NSRangeException format:@"Requested storage index (%llu) beyond bounds (%llu)", (unsigned long long)(rangeToRemove.location + rangeToRemove.length), SPMySQLResultStoreGetRowCount(dataStorage)];
+ if (NSMaxRange(rangeToRemove) > SPMySQLResultStoreGetRowCount(dataStorage)) {
+ [NSException raise:NSRangeException format:@"Requested storage index (%llu) beyond bounds (%llu)", (unsigned long long)(NSMaxRange(rangeToRemove)), SPMySQLResultStoreGetRowCount(dataStorage)];
}
// Remove the rows from the edited list and underlying storage
- NSUInteger i = MIN(editedRowCount, rangeToRemove.location + rangeToRemove.length);
+ NSUInteger i = MIN(editedRowCount, NSMaxRange(rangeToRemove));
while (--i >= rangeToRemove.location) {
editedRowCount--;
[editedRows removePointerAtIndex:i];
@@ -391,7 +391,7 @@ static inline NSMutableArray* SPDataStorageGetEditedRow(NSPointerArray* rowStore
if (columnIndex >= numberOfColumns) {
[NSException raise:NSRangeException format:@"Invalid column set as unloaded; requested column index (%llu) beyond bounds (%llu)", (unsigned long long)columnIndex, (unsigned long long)numberOfColumns];
}
- unloadedColumns[columnIndex] = true;
+ unloadedColumns[columnIndex] = YES;
}
#pragma mark - Basic information
@@ -449,8 +449,8 @@ static inline NSMutableArray* SPDataStorageGetEditedRow(NSPointerArray* rowStore
}
- (void) dealloc {
- [dataStorage release], dataStorage = nil;
- [editedRows release], editedRows = nil;
+ SPClear(dataStorage);
+ SPClear(editedRows);
if (unloadedColumns) free(unloadedColumns), unloadedColumns = NULL;
[super dealloc];