ref: 42f7a9b8a27ae1192b49005f5be3eba32f740d05
parent: 10da45b90cba29506c142982e76abc35c39d5d26
author: Simon Howard <[email protected]>
date: Sun Sep 20 11:27:40 EDT 2009
Use "const char" in libtextscreen where appropriate (thanks entryway). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1679
--- a/textscreen/txt_desktop.c
+++ b/textscreen/txt_desktop.c
@@ -61,7 +61,7 @@
num_windows = to;
}
-static void DrawDesktopBackground(char *title)
+static void DrawDesktopBackground(const char *title)
{
int i;
unsigned char *screendata;
@@ -117,7 +117,7 @@
void TXT_DrawDesktop(void)
{
int i;
- char *title;
+ const char *title;
TXT_InitClipArea();
--- a/textscreen/txt_dropdown.c
+++ b/textscreen/txt_dropdown.c
@@ -193,7 +193,7 @@
{
TXT_CAST_ARG(txt_dropdown_list_t, list);
unsigned int i;
- char *str;
+ const char *str;
// Set bg/fg text colors.
--- a/textscreen/txt_gui.c
+++ b/textscreen/txt_gui.c
@@ -55,7 +55,7 @@
#define VALID_X(x) ((x) >= cliparea->x1 && (x) < cliparea->x2)
#define VALID_Y(y) ((y) >= cliparea->y1 && (y) < cliparea->y2)
-void TXT_DrawDesktopBackground(char *title)
+void TXT_DrawDesktopBackground(const char *title)
{
int i;
unsigned char *screendata;
@@ -125,7 +125,7 @@
}
}
-void TXT_DrawWindowFrame(char *title, int x, int y, int w, int h)
+void TXT_DrawWindowFrame(const char *title, int x, int y, int w, int h)
{
int x1, y1;
int bx, by;
@@ -224,11 +224,11 @@
}
}
-void TXT_DrawString(char *s)
+void TXT_DrawString(const char *s)
{
int x, y;
int x1;
- char *p;
+ const char *p;
TXT_GetXY(&x, &y);
--- a/textscreen/txt_gui.h
+++ b/textscreen/txt_gui.h
@@ -27,10 +27,10 @@
#ifndef TXT_GUI_H
#define TXT_GUI_H
-void TXT_DrawDesktopBackground(char *title);
-void TXT_DrawWindowFrame(char *title, int x, int y, int w, int h);
+void TXT_DrawDesktopBackground(const char *title);
+void TXT_DrawWindowFrame(const char *title, int x, int y, int w, int h);
void TXT_DrawSeparator(int x, int y, int w);
-void TXT_DrawString(char *s);
+void TXT_DrawString(const char *s);
void TXT_DrawHorizScrollbar(int x, int y, int w, int cursor, int range);
void TXT_DrawVertScrollbar(int x, int y, int h, int cursor, int range);
--- a/textscreen/txt_io.c
+++ b/textscreen/txt_io.c
@@ -33,7 +33,7 @@
static struct
{
txt_color_t color;
- char *name;
+ const char *name;
} colors[] = {
{TXT_COLOR_BLACK, "black"},
{TXT_COLOR_BLUE, "blue"},
@@ -147,11 +147,11 @@
PutChar(screen, c);
}
-void TXT_Puts(char *s)
+void TXT_Puts(const char *s)
{
int previous_color = TXT_COLOR_BLACK;
unsigned char *screen;
- char *p;
+ const char *p;
char colorname_buf[20];
char *ending;
int col;
--- a/textscreen/txt_io.h
+++ b/textscreen/txt_io.h
@@ -30,7 +30,7 @@
#include "txt_main.h"
void TXT_PutChar(int c);
-void TXT_Puts(char *s);
+void TXT_Puts(const char *s);
void TXT_GotoXY(int x, int y);
void TXT_GetXY(int *x, int *y);
void TXT_FGColor(txt_color_t color);
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -217,7 +217,7 @@
unsigned char *p;
unsigned char *s, *s1;
int bg, fg;
- int x1, y1;
+ unsigned int x1, y1;
p = &screendata[(y * TXT_SCREEN_W + x) * 2];
character = p[0];
@@ -458,7 +458,7 @@
return -1;
}
-static char *SpecialKeyName(int key)
+static const char *SpecialKeyName(int key)
{
switch (key)
{
@@ -524,7 +524,7 @@
void TXT_GetKeyDescription(int key, char *buf)
{
- char *keyname;
+ const char *keyname;
keyname = SpecialKeyName(key);
--- a/textscreen/txt_widget.c
+++ b/textscreen/txt_widget.c
@@ -94,7 +94,7 @@
}
void TXT_SignalConnect(TXT_UNCAST_ARG(widget),
- char *signal_name,
+ const char *signal_name,
TxtWidgetSignalFunc func,
void *user_data)
{
@@ -117,7 +117,7 @@
callback->user_data = user_data;
}
-void TXT_EmitSignal(TXT_UNCAST_ARG(widget), char *signal_name)
+void TXT_EmitSignal(TXT_UNCAST_ARG(widget), const char *signal_name)
{
TXT_CAST_ARG(txt_widget_t, widget);
txt_callback_table_t *table;
--- a/textscreen/txt_widget.h
+++ b/textscreen/txt_widget.h
@@ -106,7 +106,7 @@
void TXT_InitWidget(TXT_UNCAST_ARG(widget), txt_widget_class_t *widget_class);
void TXT_CalcWidgetSize(TXT_UNCAST_ARG(widget));
void TXT_DrawWidget(TXT_UNCAST_ARG(widget), int selected);
-void TXT_EmitSignal(TXT_UNCAST_ARG(widget), char *signal_name);
+void TXT_EmitSignal(TXT_UNCAST_ARG(widget), const char *signal_name);
int TXT_WidgetKeyPress(TXT_UNCAST_ARG(widget), int key);
void TXT_WidgetMousePress(TXT_UNCAST_ARG(widget), int x, int y, int b);
void TXT_DestroyWidget(TXT_UNCAST_ARG(widget));
@@ -121,7 +121,7 @@
* @param user_data User-specified pointer to pass to the callback function.
*/
-void TXT_SignalConnect(TXT_UNCAST_ARG(widget), char *signal_name,
+void TXT_SignalConnect(TXT_UNCAST_ARG(widget), const char *signal_name,
TxtWidgetSignalFunc func, void *user_data);
/**
--- a/textscreen/txt_window_action.c
+++ b/textscreen/txt_window_action.c
@@ -101,7 +101,7 @@
NULL,
};
-txt_window_action_t *TXT_NewWindowAction(int key, char *label)
+txt_window_action_t *TXT_NewWindowAction(int key, const char *label)
{
txt_window_action_t *action;
--- a/textscreen/txt_window_action.h
+++ b/textscreen/txt_window_action.h
@@ -59,7 +59,7 @@
* @return Pointer to the new window action widget.
*/
-txt_window_action_t *TXT_NewWindowAction(int key, char *label);
+txt_window_action_t *TXT_NewWindowAction(int key, const char *label);
/**
* Create a new window action that closes the window when the