Skip to content

Commit 84c2fda

Browse files
committed
Merge pull request #14
Pull request #14 on GitHub: #14
2 parents aac1374 + e93e625 commit 84c2fda

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

autoload/xolox/shell.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim auto-load script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: May 27, 2013
3+
" Last Change: May 28, 2013
44
" URL: http://peterodding.com/code/vim/shell/
55

6-
let g:xolox#shell#version = '0.12.8'
6+
let g:xolox#shell#version = '0.12.9'
77

88
if !exists('s:fullscreen_enabled')
99
let s:enoimpl = "%s() hasn't been implemented on your platform! %s"

misc/shell/shell-x64.dll

0 Bytes
Binary file not shown.

misc/shell/shell-x86.dll

0 Bytes
Binary file not shown.

misc/shell/shell.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* This should create the dynamic link library "shell.dll" which you can call
2121
* from Vim using for example :call libcall('c:/shell.dll', 'fullscreen', 'enable').
2222
*
23-
* Happy vimming!
23+
* Happy Vimming!
2424
*
2525
* - Peter Odding <peter@peterodding.com>
2626
*/
@@ -33,8 +33,9 @@
3333
#include <stdio.h>
3434
#include <shellapi.h> /* ShellExecute? */
3535

36-
/* Dynamic strings are returned using a static buffer to avoid memory leaks */
37-
static char buffer[1024 * 10];
36+
/* Dynamic strings are returned using static buffers to avoid memory leaks. */
37+
static char message_buffer[1024 * 10];
38+
static char rv_buffer[512];
3839

3940
#undef MessageBox
4041
#define MessageBox(message) MessageBoxA(NULL, message, "Vim Library", 0)
@@ -44,13 +45,13 @@ static const char *GetError(void) /* {{{1 */
4445
size_t i;
4546

4647
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
47-
NULL, GetLastError(), 0, buffer, sizeof buffer, NULL);
48-
i = strlen(buffer);
49-
while (i >= 2 && isspace(buffer[i-2])) {
50-
buffer[i-2] = '\0';
48+
NULL, GetLastError(), 0, message_buffer, sizeof message_buffer, NULL);
49+
i = strlen(message_buffer);
50+
while (i >= 2 && isspace(message_buffer[i-2])) {
51+
message_buffer[i-2] = '\0';
5152
i--;
5253
}
53-
return buffer;
54+
return message_buffer;
5455
}
5556

5657
static const char *Success(const char *result) /* {{{1 */
@@ -76,14 +77,13 @@ static const char *execute(char *command, int wait) /* {{{1 */
7677
if (!wait) {
7778
return Success(NULL);
7879
} else {
79-
char rv[500];
8080
DWORD exit_code;
8181
if (WaitForSingleObject(pi.hProcess, INFINITE) != WAIT_FAILED
8282
&& GetExitCodeProcess(pi.hProcess, &exit_code)
8383
&& CloseHandle(pi.hProcess)
8484
&& CloseHandle(pi.hThread)
85-
&& sprintf(rv, "exit_code=%u", exit_code)) {
86-
return Success(rv);
85+
&& sprintf(rv_buffer, "exit_code=%u", exit_code)) {
86+
return Success(rv_buffer);
8787
}
8888
}
8989
}

0 commit comments

Comments
 (0)