Subject: Add const to UT_DEBUG()
From: Matti Picus (matti@picus.org)
Date: Sat Sep 22 2001 - 14:39:50 CDT
_UT_OutputMessage gave me a warning when compiling on Windows, here is a
patch that adds a const to the char * argument, and the windows-specific
corresponding fixes.
RCS file: /cvsroot/abi/src/af/util/win/ut_debugmsg.cpp,v
retrieving revision 1.5
diff -c -r1.5 ut_debugmsg.cpp
*** abi/src/af/util/win/ut_debugmsg.cpp 1998/10/26 15:59:16 1.5
--- abi/src/af/util/win/ut_debugmsg.cpp 2001/09/22 18:30:28
***************
*** 28,41 ****
// TODO aaaaagh! This is Win32-specific
! void _UT_OutputMessage(char *s, ...)
{
char sBuf[1024];
va_list marker;
va_start(marker, s);
! vsprintf(sBuf, s, marker);
OutputDebugString(sBuf);
}
--- 28,43 ----
// TODO aaaaagh! This is Win32-specific
! void _UT_OutputMessage(const char *s, ...)
{
char sBuf[1024];
va_list marker;
va_start(marker, s);
! _vsnprintf(sBuf, 1024, s, marker);
!
! va_end(marker);
OutputDebugString(sBuf);
}
Index: abi/src/af/util/xp/ut_debugmsg.h
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_debugmsg.h,v
retrieving revision 1.6
diff -c -r1.6 ut_debugmsg.h
*** abi/src/af/util/xp/ut_debugmsg.h 1998/12/30 16:30:28 1.6
--- abi/src/af/util/xp/ut_debugmsg.h 2001/09/22 18:30:29
***************
*** 22,28 ****
#ifndef UT_DEBUGMSG_H
#define UT_DEBUGMSG_H
! void _UT_OutputMessage(char *s, ...);
#ifdef UT_DEBUG
#define UT_DEBUGMSG(M) _UT_OutputMessage M
--- 22,28 ----
#ifndef UT_DEBUGMSG_H
#define UT_DEBUGMSG_H
! void _UT_OutputMessage(const char *s, ...);
#ifdef UT_DEBUG
#define UT_DEBUGMSG(M) _UT_OutputMessage M
If this doesn't annoy anyone, could someone please check it in?
Matti
This archive was generated by hypermail 2b25 : Sat Sep 22 2001 - 13:46:25 CDT