comparison src/channel.c @ 8080:b6cb94ad97a4 v7.4.1334

commit https://github.com/vim/vim/commit/6aa2cd4be287f35f95f35c2cec6d5a24f53c4d3c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 16 15:06:59 2016 +0100 patch 7.4.1334 Problem: Many compiler warnings with MingW. Solution: Add type casts. (Yasuhiro Matsumoto)
author Christian Brabandt <cb@256bit.org>
date Tue, 16 Feb 2016 15:15:06 +0100
parents dc32c8026899
children 3ea56a74077f
comparison
equal deleted inserted replaced
8079:6dac7e594219 8080:b6cb94ad97a4
56 extern HWND s_hwnd; /* Gvim's Window handle */ 56 extern HWND s_hwnd; /* Gvim's Window handle */
57 #endif 57 #endif
58 58
59 #ifdef WIN32 59 #ifdef WIN32
60 static int 60 static int
61 fd_read(sock_T fd, char_u *buf, size_t len) 61 fd_read(sock_T fd, char *buf, size_t len)
62 { 62 {
63 HANDLE h = (HANDLE)fd; 63 HANDLE h = (HANDLE)fd;
64 DWORD nread; 64 DWORD nread;
65 65
66 if (!ReadFile(h, buf, (DWORD)len, &nread, NULL)) 66 if (!ReadFile(h, buf, (DWORD)len, &nread, NULL))
67 return -1; 67 return -1;
68 return (int)nread; 68 return (int)nread;
69 } 69 }
70 70
71 static int 71 static int
72 fd_write(sock_T fd, char_u *buf, size_t len) 72 fd_write(sock_T fd, char *buf, size_t len)
73 { 73 {
74 HANDLE h = (HANDLE)fd; 74 HANDLE h = (HANDLE)fd;
75 DWORD nwrite; 75 DWORD nwrite;
76 76
77 if (!WriteFile(h, buf, (DWORD)len, &nwrite, NULL)) 77 if (!WriteFile(h, buf, (DWORD)len, &nwrite, NULL))
1391 DWORD deadline = GetTickCount() + timeout; 1391 DWORD deadline = GetTickCount() + timeout;
1392 1392
1393 /* reading from a pipe, not a socket */ 1393 /* reading from a pipe, not a socket */
1394 while (TRUE) 1394 while (TRUE)
1395 { 1395 {
1396 if (PeekNamedPipe(fd, NULL, 0, NULL, &nread, NULL) && nread > 0) 1396 if (PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL) && nread > 0)
1397 return OK; 1397 return OK;
1398 diff = deadline - GetTickCount(); 1398 diff = deadline - GetTickCount();
1399 if (diff < 0) 1399 if (diff < 0)
1400 break; 1400 break;
1401 /* Wait for 5 msec. 1401 /* Wait for 5 msec.
1507 for (;;) 1507 for (;;)
1508 { 1508 {
1509 if (channel_wait(channel, fd, 0) == FAIL) 1509 if (channel_wait(channel, fd, 0) == FAIL)
1510 break; 1510 break;
1511 if (use_socket) 1511 if (use_socket)
1512 len = sock_read(fd, buf, MAXMSGSIZE); 1512 len = sock_read(fd, (char *)buf, MAXMSGSIZE);
1513 else 1513 else
1514 len = fd_read(fd, buf, MAXMSGSIZE); 1514 len = fd_read(fd, (char *)buf, MAXMSGSIZE);
1515 if (len <= 0) 1515 if (len <= 0)
1516 break; /* error or nothing more to read */ 1516 break; /* error or nothing more to read */
1517 1517
1518 /* Store the read message in the queue. */ 1518 /* Store the read message in the queue. */
1519 channel_save(channel, buf, len); 1519 channel_save(channel, buf, len);
1711 fprintf(log_fd, "'\n"); 1711 fprintf(log_fd, "'\n");
1712 fflush(log_fd); 1712 fflush(log_fd);
1713 } 1713 }
1714 1714
1715 if (use_socket) 1715 if (use_socket)
1716 res = sock_write(fd, buf, len); 1716 res = sock_write(fd, (char *)buf, len);
1717 else 1717 else
1718 res = fd_write(fd, buf, len); 1718 res = fd_write(fd, (char *)buf, len);
1719 if (res != len) 1719 if (res != len)
1720 { 1720 {
1721 if (!channel->ch_error && fun != NULL) 1721 if (!channel->ch_error && fun != NULL)
1722 { 1722 {
1723 ch_errors(channel, "%s(): write failed\n", fun); 1723 ch_errors(channel, "%s(): write failed\n", fun);