mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-02-14 11:53:26 +01:00
Fix unused-but-set-variable error when built on 12.x
Add `timeout` argument to serverReadReply()
This commit is contained in:
@@ -143,7 +143,7 @@
|
||||
silent:(BOOL)silent;
|
||||
- (NSArray *)serverList;
|
||||
- (NSString *)peekForReplyOnPort:(int)port;
|
||||
- (NSString *)waitForReplyOnPort:(int)port;
|
||||
- (NSString *)waitForReplyOnPort:(int)port timeout:(NSTimeInterval)timeout;
|
||||
- (BOOL)sendReply:(NSString *)reply toPort:(int)port;
|
||||
|
||||
- (BOOL)waitForAck;
|
||||
|
||||
@@ -1582,7 +1582,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)waitForReplyOnPort:(int)port
|
||||
- (NSString *)waitForReplyOnPort:(int)port timeout:(NSTimeInterval)timeout
|
||||
{
|
||||
ASLogDebug(@"port=%d", port);
|
||||
|
||||
@@ -1593,13 +1593,16 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
NSNumber *key = [NSNumber numberWithInt:port];
|
||||
NSMutableArray *replies = nil;
|
||||
NSString *reply = nil;
|
||||
NSDate *limitDate = timeout > 0
|
||||
? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];
|
||||
|
||||
// Wait for reply as long as the connection to the server is valid (unless
|
||||
// user interrupts wait with Ctrl-C).
|
||||
while (!got_int && [conn isValid] &&
|
||||
!(replies = [serverReplyDict objectForKey:key])) {
|
||||
!(replies = [serverReplyDict objectForKey:key]) &&
|
||||
(timeout <= 0 || [limitDate timeIntervalSinceNow] > 0)) {
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
|
||||
beforeDate:[NSDate distantFuture]];
|
||||
beforeDate:limitDate];
|
||||
}
|
||||
|
||||
if (replies) {
|
||||
|
||||
@@ -2118,9 +2118,10 @@ serverPeekReply(int port, char_u **str)
|
||||
* Return -1 on error.
|
||||
*/
|
||||
int
|
||||
serverReadReply(int port, char_u **str)
|
||||
serverReadReply(int port, char_u **str, int timeout)
|
||||
{
|
||||
NSString *reply = [[MMBackend sharedInstance] waitForReplyOnPort:port];
|
||||
NSString *reply = [[MMBackend sharedInstance] waitForReplyOnPort:port
|
||||
timeout:timeout];
|
||||
if (reply && str) {
|
||||
*str = [reply vimStringSave];
|
||||
return 0;
|
||||
|
||||
@@ -457,7 +457,7 @@ cmdsrv_main(
|
||||
if (p == NULL)
|
||||
break;
|
||||
# elif defined(MAC_CLIENTSERVER)
|
||||
if (serverReadReply(srv, &p) < 0)
|
||||
if (serverReadReply(srv, &p, 0) < 0)
|
||||
break;
|
||||
# else
|
||||
if (serverReadReply(xterm_dpy, srv, &p, TRUE, -1) < 0)
|
||||
@@ -934,7 +934,7 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
r = serverGetReply((HWND)n, FALSE, TRUE, TRUE, timeout);
|
||||
if (r == NULL)
|
||||
# elif defined(MAC_CLIENTSERVER)
|
||||
if (serverReadReply(serverStrToPort(serverid), &r) < 0)
|
||||
if (serverReadReply(serverStrToPort(serverid), &r, timeout) < 0)
|
||||
# else
|
||||
if (check_connection() == FAIL
|
||||
|| serverReadReply(X_DISPLAY, serverStrToWin(serverid),
|
||||
|
||||
@@ -91,7 +91,7 @@ int serverSendToVim(char_u *name, char_u *cmd, char_u **result, int *server, int
|
||||
char_u *serverGetVimNames(void);
|
||||
int serverStrToPort(char_u *str);
|
||||
int serverPeekReply(int port, char_u **str);
|
||||
int serverReadReply(int port, char_u **str);
|
||||
int serverReadReply(int port, char_u **str, int timeout);
|
||||
int serverSendReply(char_u *serverid, char_u *str);
|
||||
|
||||
void gui_mch_enter_fullscreen(guicolor_T bg);
|
||||
|
||||
Reference in New Issue
Block a user