aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResultStore.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-03-09 00:00:43 +0100
committerMax <post@wickenrode.com>2015-03-09 00:00:43 +0100
commit784876380b871b6d85978a705e2477e7b7d2d984 (patch)
tree5705e92b0aab9fecdf7d37954f5a0c3e873de1ff /Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResultStore.m
parentb15c7fb2d407ec8751a2579a7a68bbd8a037ccfe (diff)
downloadsequelpro-784876380b871b6d85978a705e2477e7b7d2d984.tar.gz
sequelpro-784876380b871b6d85978a705e2477e7b7d2d984.tar.bz2
sequelpro-784876380b871b6d85978a705e2477e7b7d2d984.zip
Minimal refactoring
Replaced some (range.location + range.length) with NSMaxRange(range)
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResultStore.m')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResultStore.m8
1 files changed, 4 insertions, 4 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResultStore.m b/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResultStore.m
index 447cf19b..86a6b2b5 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResultStore.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResultStore.m
@@ -630,8 +630,8 @@ static inline void SPMySQLStreamingResultStoreFreeRowData(SPMySQLStreamingResult
{
// Throw an exception if the range is out of bounds
- if (rangeToRemove.location + rangeToRemove.length > numberOfRows) {
- [NSException raise:NSRangeException format:@"Requested storage index (%llu) beyond bounds (%llu)", (unsigned long long)(rangeToRemove.location + rangeToRemove.length), (unsigned long long)numberOfRows];
+ if (NSMaxRange(rangeToRemove) > numberOfRows) {
+ [NSException raise:NSRangeException format:@"Requested storage index (%llu) beyond bounds (%llu)", (unsigned long long)(NSMaxRange(rangeToRemove)), (unsigned long long)numberOfRows];
}
// Lock the data mutex
@@ -639,14 +639,14 @@ static inline void SPMySQLStreamingResultStoreFreeRowData(SPMySQLStreamingResult
// Free rows in the range
NSUInteger i;
- for (i = rangeToRemove.location; i < rangeToRemove.location + rangeToRemove.length; i++) {
+ for (i = rangeToRemove.location; i < NSMaxRange(rangeToRemove); i++) {
SPMySQLStreamingResultStoreFreeRowData(dataStorage[i]);
}
numberOfRows -= rangeToRemove.length;
// Renumber all subsequent indices to fill the gap
size_t pointerSize = sizeof(SPMySQLStreamingResultStoreRowData *);
- memmove(dataStorage + rangeToRemove.location, dataStorage + rangeToRemove.location + rangeToRemove.length, (numberOfRows - rangeToRemove.location) * pointerSize);
+ memmove(dataStorage + rangeToRemove.location, dataStorage + NSMaxRange(rangeToRemove), (numberOfRows - rangeToRemove.location) * pointerSize);
// Unlock the mutex
pthread_mutex_unlock(&dataLock);