1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-15 18:18:05 -05:00

Const-correctness in the debug functions!

I'm finding missing constifications all over the place this week.
Turns out that dmemdump() has been taking a non-const memory pointer
ever since the beginning, and it's never come up until now. How silly.
This commit is contained in:
Simon Tatham 2015-05-09 15:02:45 +01:00
parent 42c592c4ef
commit a63435f6cc
2 changed files with 5 additions and 5 deletions

6
misc.c
View File

@ -814,7 +814,7 @@ void safefree(void *ptr)
#ifdef DEBUG #ifdef DEBUG
extern void dputs(char *); /* defined in per-platform *misc.c */ extern void dputs(char *); /* defined in per-platform *misc.c */
void debug_printf(char *fmt, ...) void debug_printf(const char *fmt, ...)
{ {
char *buf; char *buf;
va_list ap; va_list ap;
@ -827,10 +827,10 @@ void debug_printf(char *fmt, ...)
} }
void debug_memdump(void *buf, int len, int L) void debug_memdump(const void *buf, int len, int L)
{ {
int i; int i;
unsigned char *p = buf; const unsigned char *p = buf;
char foo[17]; char foo[17];
if (L) { if (L) {
int delta; int delta;

4
misc.h
View File

@ -109,8 +109,8 @@ int match_ssh_id(int stringlen, const void *string, const char *id);
*/ */
#ifdef DEBUG #ifdef DEBUG
void debug_printf(char *fmt, ...); void debug_printf(const char *fmt, ...);
void debug_memdump(void *buf, int len, int L); void debug_memdump(const void *buf, int len, int L);
#define debug(x) (debug_printf x) #define debug(x) (debug_printf x)
#define dmemdump(buf,len) debug_memdump (buf, len, 0); #define dmemdump(buf,len) debug_memdump (buf, len, 0);
#define dmemdumpl(buf,len) debug_memdump (buf, len, 1); #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);