mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Deal with byte order when sending installation progress
This commit is contained in:
1 parent
1a952227a7
commit
4661fee388
2 files changed
+12
-8
No files matched your search
Vendored
+9
-6
@@ -275,12 +275,15 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
|
||||
- (void)unarchiverExtractedProgress:(double)progress
|
||||
{
|
||||
NSData *data = [NSData dataWithBytes:&progress length:sizeof(progress)];
|
||||
[self.remotePort sendMessageWithIdentifier:SUExtractedArchiveWithProgress data:data completion:^(BOOL success) {
|
||||
if (!success) {
|
||||
SULog(@"Error sending extracted progress");
|
||||
}
|
||||
}];
|
||||
if (sizeof(progress) == sizeof(uint64_t)) {
|
||||
uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress);
|
||||
NSData *data = [NSData dataWithBytes:&progressValue length:sizeof(progressValue)];
|
||||
[self.remotePort sendMessageWithIdentifier:SUExtractedArchiveWithProgress data:data completion:^(BOOL success) {
|
||||
if (!success) {
|
||||
SULog(@"Error sending extracted progress");
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFail
|
||||
|
||||
Vendored
+3
-2
@@ -298,8 +298,9 @@
|
||||
if (identifier == SURequestInstallationParameters) {
|
||||
[self sendInstallationData];
|
||||
} else if (identifier == SUExtractedArchiveWithProgress) {
|
||||
if (data.length == sizeof(double)) {
|
||||
double progress = *(const double *)data.bytes;
|
||||
if (data.length == sizeof(double) && sizeof(double) == sizeof(uint64_t)) {
|
||||
uint64_t progressValue = CFSwapInt64LittleToHost(*(const uint64_t *)data.bytes);
|
||||
double progress = *(double *)&progressValue;
|
||||
[self.delegate installerDidExtractUpdateWithProgress:progress];
|
||||
self.currentStage = identifier;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user