summaryrefslogtreecommitdiff
path: root/cord/tests
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-02-08 09:57:23 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-02-08 09:57:23 +0300
commit551bed3add45ef909cf4cce02af255e08f4a0ec2 (patch)
treea2cf6076519c0ad7e9e0e6a2c0533134526304ad /cord/tests
parente86bb4f781292c6256f35d055a42b54e5a641392 (diff)
downloadbdwgc-551bed3add45ef909cf4cce02af255e08f4a0ec2.tar.gz
Convert cord tests to valid C++ code
Issue #201 (bdwgc). * cord/tests/de.c (main): Cast buf to char* when passed to setvbuf(). * cord/tests/de_win.c (de_error): Change "char*" to "const char*" for the argument (because ISO C++ forbids converting a string constant to char*). * cord/tests/de_win.h (de_error): Likewise. * cord/tests/de_win.c (WinMain): Change type of hAccel local variable from HANDLE to HACCEL; cast GetStockObject(WHITE_BRUSH) result to HBRUSH type. * cord/tests/de_win.c (plain_chars, control_chars): Cast GC_MALLOC_ATOMIC() result to char*. * cord/tests/de_win.c (WndProc): Change type of hInstance static variable from HANDLE to HINSTANCE.
Diffstat (limited to 'cord/tests')
-rw-r--r--cord/tests/de.c2
-rw-r--r--cord/tests/de_win.c12
-rw-r--r--cord/tests/de_win.h2
3 files changed, 8 insertions, 8 deletions
diff --git a/cord/tests/de.c b/cord/tests/de.c
index 1c00270b..01cc5c57 100644
--- a/cord/tests/de.c
+++ b/cord/tests/de.c
@@ -595,7 +595,7 @@ int main(int argc, char **argv)
arg_file_name = argv[1];
buf = GC_MALLOC_ATOMIC(8192);
if (NULL == buf) OUT_OF_MEMORY;
- setvbuf(stdout, buf, _IOFBF, 8192);
+ setvbuf(stdout, (char *)buf, _IOFBF, 8192);
initscr();
noecho(); nonl(); cbreak();
generic_init();
diff --git a/cord/tests/de_win.c b/cord/tests/de_win.c
index 64ab8040..d99942ec 100644
--- a/cord/tests/de_win.c
+++ b/cord/tests/de_win.c
@@ -32,7 +32,7 @@ int COLS = 0;
HWND hwnd;
-void de_error(char *s)
+void de_error(const char *s)
{
(void)MessageBoxA(hwnd, s, "Demonstration Editor",
MB_ICONINFORMATION | MB_OK);
@@ -44,7 +44,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
{
MSG msg;
WNDCLASS wndclass;
- HANDLE hAccel;
+ HACCEL hAccel;
GC_INIT();
# if defined(CPPCHECK)
@@ -60,7 +60,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, szAppName);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
- wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
+ wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = TEXT("DE");
wndclass.lpszClassName = szAppName;
@@ -120,7 +120,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
/* Return the argument with all control characters replaced by blanks. */
char * plain_chars(char * text, size_t len)
{
- char * result = GC_MALLOC_ATOMIC(len + 1);
+ char * result = (char *)GC_MALLOC_ATOMIC(len + 1);
register size_t i;
if (NULL == result) return NULL;
@@ -139,7 +139,7 @@ char * plain_chars(char * text, size_t len)
/* blank, and all control characters c replaced by c + 32. */
char * control_chars(char * text, size_t len)
{
- char * result = GC_MALLOC_ATOMIC(len + 1);
+ char * result = (char *)GC_MALLOC_ATOMIC(len + 1);
register size_t i;
if (NULL == result) return NULL;
@@ -201,7 +201,7 @@ INT_PTR CALLBACK AboutBoxCallback( HWND hDlg, UINT message,
LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
- static HANDLE hInstance;
+ static HINSTANCE hInstance;
HDC dc;
PAINTSTRUCT ps;
RECT client_area;
diff --git a/cord/tests/de_win.h b/cord/tests/de_win.h
index 93c5eebd..33ecfa25 100644
--- a/cord/tests/de_win.h
+++ b/cord/tests/de_win.h
@@ -93,5 +93,5 @@ void move_cursor(int column, int line);
void invalidate_line(int line);
/* Invalidate line i on the screen. */
-void de_error(char *s);
+void de_error(const char *s);
/* Display error message. */