projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
accel.pl knows about the accelerators added by winctrls.c:prefslist().
[u/mdw/putty]
/
misc.c
diff --git
a/misc.c
b/misc.c
index
6b2f9e6
..
e4c6d4a
100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-174,9
+174,9
@@
int bufchain_size(bufchain *ch)
return ch->buffersize;
}
return ch->buffersize;
}
-void bufchain_add(bufchain *ch, void *data, int len)
+void bufchain_add(bufchain *ch,
const
void *data, int len)
{
{
- c
har *buf = (
char *)data;
+ c
onst char *buf = (const
char *)data;
ch->buffersize += len;
ch->buffersize += len;
@@
-592,6
+592,7
@@
void safefree(void *ptr)
#ifdef DEBUG
static FILE *debug_fp = NULL;
#ifdef DEBUG
static FILE *debug_fp = NULL;
+static HANDLE debug_hdl = INVALID_HANDLE_VALUE;
static int debug_got_console = 0;
static void dputs(char *buf)
static int debug_got_console = 0;
static void dputs(char *buf)
@@
-599,15
+600,18
@@
static void dputs(char *buf)
DWORD dw;
if (!debug_got_console) {
DWORD dw;
if (!debug_got_console) {
- AllocConsole();
- debug_got_console = 1;
+ if (AllocConsole()) {
+ debug_got_console = 1;
+ debug_hdl = GetStdHandle(STD_OUTPUT_HANDLE);
+ }
}
if (!debug_fp) {
debug_fp = fopen("debug.log", "w");
}
}
if (!debug_fp) {
debug_fp = fopen("debug.log", "w");
}
- WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &dw,
- NULL);
+ if (debug_hdl != INVALID_HANDLE_VALUE) {
+ WriteFile(debug_hdl, buf, strlen(buf), &dw, NULL);
+ }
fputs(buf, debug_fp);
fflush(debug_fp);
}
fputs(buf, debug_fp);
fflush(debug_fp);
}