mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 03:25:03 +03:00
GH-472 Use the correct type when packing values in Data
This commit is contained in:
parent
4279147b80
commit
d9c6443e2d
@ -546,12 +546,12 @@ void custom_ui_autocmds_groups(
|
||||
|
||||
NSMutableData *data;
|
||||
if (buf == NULL) {
|
||||
data = [[NSMutableData alloc] initWithBytes:&eventCode length:sizeof(NSUInteger)];
|
||||
data = [[NSMutableData alloc] initWithBytes:&eventCode length:sizeof(NSInteger)];
|
||||
} else {
|
||||
NSInteger bufHandle = buf->handle;
|
||||
|
||||
data = [[NSMutableData alloc] initWithCapacity:(sizeof(NSUInteger) + sizeof(NSInteger))];
|
||||
[data appendBytes:&eventCode length:sizeof(NSUInteger)];
|
||||
data = [[NSMutableData alloc] initWithCapacity:(sizeof(NSInteger) + sizeof(NSInteger))];
|
||||
[data appendBytes:&eventCode length:sizeof(NSInteger)];
|
||||
[data appendBytes:&bufHandle length:sizeof(NSInteger)];
|
||||
}
|
||||
|
||||
|
@ -33,20 +33,16 @@ data_to_array(CellAttributes)
|
||||
static void log_cfmachport_error(SInt32 err, NeoVimAgentMsgId msgid, NSData *inputData) {
|
||||
switch (err) {
|
||||
case kCFMessagePortSendTimeout:
|
||||
log4Warn("Got response kCFMessagePortSendTimeout = %d for the msg %lu with data %@.",
|
||||
err, (unsigned long) msgid, inputData);
|
||||
log4Warn("Got response kCFMessagePortSendTimeout = %d for the msg %d with data %@.", err, msgid, inputData);
|
||||
case kCFMessagePortReceiveTimeout:
|
||||
log4Warn("Got response kCFMessagePortReceiveTimeout = %d for the msg %lu with data %@.",
|
||||
err, (unsigned long) msgid, inputData);
|
||||
log4Warn("Got response kCFMessagePortReceiveTimeout = %d for the msg %d with data %@.", err, msgid, inputData);
|
||||
case kCFMessagePortIsInvalid:
|
||||
log4Warn("Got response kCFMessagePortIsInvalid = %d for the msg %lu with data %@.",
|
||||
err, (unsigned long) msgid, inputData);
|
||||
log4Warn("Got response kCFMessagePortIsInvalid = %d for the msg %d with data %@.", err, msgid, inputData);
|
||||
case kCFMessagePortTransportError:
|
||||
log4Warn("Got response kCFMessagePortTransportError = %d for the msg %lu with data %@.",
|
||||
err, (unsigned long) msgid, inputData);
|
||||
log4Warn("Got response kCFMessagePortTransportError = %d for the msg %d with data %@.", err, msgid, inputData);
|
||||
case kCFMessagePortBecameInvalidError:
|
||||
log4Warn("Got response kCFMessagePortBecameInvalidError = %d for the msg %lu with data %@.",
|
||||
err, (unsigned long) msgid, inputData);
|
||||
log4Warn("Got response kCFMessagePortBecameInvalidError = %d for the msg %d with data %@.",
|
||||
err, msgid, inputData);
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -285,7 +281,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local __unused, SInt32 m
|
||||
- (bool)hasDirtyDocs {
|
||||
NSData *response = [self sendMessageWithId:NeoVimAgentMsgIdGetDirtyDocs data:nil expectsReply:YES];
|
||||
if (response == nil) {
|
||||
log4Warn("The response for the msg %lu was nil.", NeoVimAgentMsgIdGetDirtyDocs);
|
||||
log4Warn("The response for the msg %d was nil.", NeoVimAgentMsgIdGetDirtyDocs);
|
||||
return NO;
|
||||
}
|
||||
|
||||
@ -340,7 +336,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local __unused, SInt32 m
|
||||
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:fileNames];
|
||||
NSData *response = [self sendMessageWithId:NeoVimAgentMsgIdGetEscapeFileNames data:data expectsReply:YES];
|
||||
if (response == nil) {
|
||||
log4Warn("The response for the msg %lu was nil.", NeoVimAgentMsgIdGetEscapeFileNames);
|
||||
log4Warn("The response for the msg %d was nil.", NeoVimAgentMsgIdGetEscapeFileNames);
|
||||
return @[];
|
||||
}
|
||||
|
||||
@ -350,7 +346,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local __unused, SInt32 m
|
||||
- (NSArray <NeoVimBuffer *> *)buffers {
|
||||
NSData *response = [self sendMessageWithId:NeoVimAgentMsgIdGetBuffers data:nil expectsReply:YES];
|
||||
if (response == nil) {
|
||||
log4Warn("The response for the msg %lu was nil.", NeoVimAgentMsgIdGetBuffers);
|
||||
log4Warn("The response for the msg %d was nil.", NeoVimAgentMsgIdGetBuffers);
|
||||
return @[];
|
||||
}
|
||||
|
||||
@ -360,7 +356,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local __unused, SInt32 m
|
||||
- (NSArray<NeoVimWindow *> *)tabs {
|
||||
NSData *response = [self sendMessageWithId:NeoVimAgentMsgIdGetTabs data:nil expectsReply:YES];
|
||||
if (response == nil) {
|
||||
log4Warn("The response for the msg %lu was nil.", NeoVimAgentMsgIdGetTabs);
|
||||
log4Warn("The response for the msg %d was nil.", NeoVimAgentMsgIdGetTabs);
|
||||
return @[];
|
||||
}
|
||||
|
||||
@ -636,13 +632,13 @@ static CFDataRef local_server_callback(CFMessagePortRef local __unused, SInt32 m
|
||||
}
|
||||
|
||||
case NeoVimServerMsgIdAutoCommandEvent: {
|
||||
if (data.length == sizeof(NSUInteger) + sizeof(NSInteger)) {
|
||||
NSUInteger *values = (NSUInteger *) data.bytes;
|
||||
if (data.length == 2 * sizeof(NSInteger)) {
|
||||
NSInteger *values = (NSInteger *) data.bytes;
|
||||
NeoVimAutoCommandEvent event = (NeoVimAutoCommandEvent) values[0];
|
||||
NSInteger bufferHandle = ((NSInteger *) (values + 1))[0];
|
||||
NSInteger bufferHandle = (values + 1)[0];
|
||||
[_bridge autoCommandEvent:event bufferHandle:bufferHandle];
|
||||
} else {
|
||||
NSUInteger *values = data_to_NSUInteger_array(data, 1);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 1);
|
||||
[_bridge autoCommandEvent:(NeoVimAutoCommandEvent) values[0] bufferHandle:-1];
|
||||
}
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user