summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-10-25 12:56:45 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-10-25 13:28:08 -0700
commitf7f6ce39ca5f1988f04696581f261bf59c23dc4c (patch)
tree13e022c1a6a7baf6570a7190126db54dbc4c3b43
parentda45a0a835bf2d2abb2810ca7bdb9cbc450f7135 (diff)
Const cleanup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--Dvi.c4
-rw-r--r--DviChar.c8
-rw-r--r--DviChar.h14
-rw-r--r--DviP.h4
-rw-r--r--XFontName.c5
-rw-r--r--draw.c17
-rw-r--r--font.c16
-rw-r--r--xdit.bm2
-rw-r--r--xdit_mask.bm2
-rw-r--r--xditview.c6
10 files changed, 40 insertions, 38 deletions
diff --git a/Dvi.c b/Dvi.c
index 9c4a502..ee7aa18 100644
--- a/Dvi.c
+++ b/Dvi.c
@@ -66,7 +66,7 @@ from the X Consortium.
* therefor it has been split in to and assigned to resources
* in the ClassInitialize routine.
*/
-static char default_font_map_1[] = "\
+static const char *default_font_map_1 = "\
R -*-times-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\
I -*-times-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\
B -*-times-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\
@@ -85,7 +85,7 @@ HO -*-helvetica-medium-o-normal--*-*-*-*-*-*-iso8859-1\n\
HB -*-helvetica-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\
HF -*-helvetica-bold-o-normal--*-*-*-*-*-*-iso8859-1\n\
";
-static char default_font_map_2[] = "\
+static const char *default_font_map_2 = "\
N -*-new century schoolbook-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\
NI -*-new century schoolbook-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\
NB -*-new century schoolbook-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\
diff --git a/DviChar.c b/DviChar.c
index 3765358..2a561be 100644
--- a/DviChar.c
+++ b/DviChar.c
@@ -22,12 +22,12 @@ static struct map_list *world;
static int standard_maps_loaded = 0;
static void load_standard_maps (void);
-static int hash_name (char *name);
+static int hash_name (const char *name);
static void dispose_hash(DviCharNameMap *map);
static void compute_hash(DviCharNameMap *map);
DviCharNameMap *
-DviFindMap (char *encoding)
+DviFindMap (const char *encoding)
{
struct map_list *m;
@@ -76,7 +76,7 @@ dispose_hash (DviCharNameMap *map)
}
static int
-hash_name (char *name)
+hash_name (const char *name)
{
int i = 0;
@@ -112,7 +112,7 @@ compute_hash (DviCharNameMap *map)
}
int
-DviCharIndex (DviCharNameMap *map, char *name)
+DviCharIndex (DviCharNameMap *map, const char *name)
{
int i;
DviCharNameHash *h;
diff --git a/DviChar.h b/DviChar.h
index 1097f6a..5b64751 100644
--- a/DviChar.h
+++ b/DviChar.h
@@ -23,27 +23,27 @@
typedef struct _dviCharNameHash {
struct _dviCharNameHash *next;
- char *name;
+ const char *name;
int position;
} DviCharNameHash;
typedef struct _dviCharNameMap {
- char *encoding;
+ const char * encoding;
int special;
- char *dvi_names[DVI_MAP_SIZE][DVI_MAX_SYNONYMS];
- char *ligatures[DVI_MAX_LIGATURES][2];
+ const char * const dvi_names[DVI_MAP_SIZE][DVI_MAX_SYNONYMS];
+ const char * const ligatures[DVI_MAX_LIGATURES][2];
DviCharNameHash *buckets[DVI_HASH_SIZE];
} DviCharNameMap;
-extern DviCharNameMap *DviFindMap (char *);
+extern DviCharNameMap *DviFindMap (const char *);
extern void DviRegisterMap (DviCharNameMap *);
#ifdef NOTDEF
extern char *DviCharName (DviCharNameMap *, int, int);
#else
#define DviCharName(map,index,synonym) ((map)->dvi_names[index][synonym])
#endif
-extern int DviCharIndex (DviCharNameMap *, char *);
-extern unsigned char *DviCharIsLigature (DviCharNameMap *, char *);
+extern int DviCharIndex (DviCharNameMap *, const char *);
+extern unsigned char *DviCharIsLigature (DviCharNameMap *, const char *);
extern void ResetFonts (DviWidget);
#endif
diff --git a/DviP.h b/DviP.h
index 2ead024..3fecfd9 100644
--- a/DviP.h
+++ b/DviP.h
@@ -259,12 +259,12 @@ extern void DrawLine(DviWidget, int, int);
extern void DrawCircle(DviWidget, int);
extern void DrawEllipse(DviWidget, int, int);
extern void DrawArc(DviWidget, int, int, int, int);
-extern void DrawSpline(DviWidget, char *, int);
+extern void DrawSpline(DviWidget, const char *, int);
/* font.c */
extern void ParseFontMap(DviWidget);
extern void DestroyFontMap(DviFontMap *);
-extern void SetFontPosition(DviWidget, int, char *, char *);
+extern void SetFontPosition(DviWidget, int, const char *, const char *);
#ifdef USE_XFT
extern XftFont * QueryFont(DviWidget, int, int);
#else
diff --git a/XFontName.c b/XFontName.c
index ac911c1..c9ce253 100644
--- a/XFontName.c
+++ b/XFontName.c
@@ -128,7 +128,8 @@ XFormatFontName (XFontName *fontName, unsigned int fontNameAttributes,
XFontNameString fontNameString)
{
XFontNameString tmp;
- char *name = tmp, *f;
+ char *name = tmp;
+ const char *f;
int left = sizeof (tmp) - 1;
char number[32];
@@ -226,7 +227,7 @@ XCompareFontName (
Bool
XCopyFontName (
- XFontName *name1,
+ const XFontName *name1,
XFontName *name2,
unsigned int fontNameAttributes)
{
diff --git a/draw.c b/draw.c
index ae58db7..f18a137 100644
--- a/draw.c
+++ b/draw.c
@@ -75,7 +75,7 @@ static Point *spline = (Point *)NULL; /* head of spline linked list */
static void ApproxSpline(int n);
static void DeletePoint(Point *p);
static void DrawSplineSegments(DviWidget dw);
-static int GetSpline(char *s);
+static int GetSpline(const char *s);
static void InsertPoint(Point *p, Point *q);
static void LineApprox(Point *p1, Point *p2, Point *p3);
static Point * MakePoint(double x, double y);
@@ -292,8 +292,8 @@ DrawArc (DviWidget dw, int x0, int y0, int x1, int y1)
/* copy next non-blank string from p to temp, update p */
-static char *
-getstr(char *p, char *temp)
+static const char *
+getstr(const char *p, char *temp)
{
while (*p == ' ' || *p == '\t' || *p == '\n')
p++;
@@ -312,7 +312,7 @@ getstr(char *p, char *temp)
/*ARGSUSED*/
void
-DrawSpline (DviWidget dw, char *s, int len)
+DrawSpline (DviWidget dw, const char *s, int len)
{
int n;
@@ -330,12 +330,13 @@ DrawSpline (DviWidget dw, char *s, int len)
/* as its head. Return the number of coordinate pairs found. */
static int
-GetSpline(char *s)
+GetSpline(const char *s)
{
double x, y, x1, y1;
int n = 0;
Point *pt;
- char *p = s, d[10];
+ const char *p = s;
+ char d[10];
if (!*p)
return(n);
@@ -345,10 +346,10 @@ GetSpline(char *s)
x = y = 0.0;
p = s;
while (p && *p) {
- if ((p = getstr(p, d)) == (char *)NULL)
+ if ((p = getstr(p, d)) == (const char *)NULL)
break;
x1 = x + atof(d);
- if ((p = getstr(p, d)) == (char *)NULL)
+ if ((p = getstr(p, d)) == (const char *)NULL)
break;
y1 = y + atof(d);
pt->next = MakePoint(x1, y1);
diff --git a/font.c b/font.c
index 5743d57..a35cbba 100644
--- a/font.c
+++ b/font.c
@@ -15,7 +15,7 @@
#include "XFontName.h"
static char *
-savestr (char *s)
+savestr (const char *s)
{
char *n;
@@ -240,10 +240,10 @@ InstallFontSizes (DviWidget dw, char *x_name, Boolean *scalablep)
}
static DviFontList *
-InstallFont (DviWidget dw, int position, char *dvi_name, char *x_name)
+InstallFont (DviWidget dw, int position, const char *dvi_name, const char *x_name)
{
DviFontList *f;
- char *encoding;
+ const char *encoding;
f = LookupFontByPosition (dw, position);
if (f) {
@@ -284,8 +284,8 @@ InstallFont (DviWidget dw, int position, char *dvi_name, char *x_name)
return f;
}
-static char *
-MapDviNameToXName (DviWidget dw, char *dvi_name)
+static const char *
+MapDviNameToXName (DviWidget dw, const char *dvi_name)
{
DviFontMap *fm;
@@ -366,9 +366,9 @@ DestroyFontMap (DviFontMap *font_map)
/*ARGSUSED*/
void
-SetFontPosition (DviWidget dw, int position, char *dvi_name, char *extra)
+SetFontPosition (DviWidget dw, int position, const char *dvi_name, const char *extra)
{
- char *x_name;
+ const char *x_name;
x_name = MapDviNameToXName (dw, dvi_name);
(void) InstallFont (dw, position, dvi_name, x_name);
@@ -440,7 +440,7 @@ QueryFontMap (DviWidget dw, int position)
}
unsigned char *
-DviCharIsLigature (DviCharNameMap *map, char *name)
+DviCharIsLigature (DviCharNameMap *map, const char *name)
{
int i;
diff --git a/xdit.bm b/xdit.bm
index 0c7aa8c..9a2a353 100644
--- a/xdit.bm
+++ b/xdit.bm
@@ -1,6 +1,6 @@
#define xdit_width 32
#define xdit_height 32
-static unsigned char xdit_bits[] = {
+static unsigned const char xdit_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x02, 0x00, 0x00, 0x02,
0x8a, 0xa2, 0xfc, 0x03, 0x52, 0x14, 0x03, 0x04, 0x02, 0x80, 0x00, 0x08,
0x52, 0x54, 0x00, 0x10, 0x8a, 0x22, 0x8f, 0x23, 0x02, 0x20, 0x06, 0x21,
diff --git a/xdit_mask.bm b/xdit_mask.bm
index a584629..3cc92c6 100644
--- a/xdit_mask.bm
+++ b/xdit_mask.bm
@@ -1,6 +1,6 @@
#define xdit_mask_width 32
#define xdit_mask_height 32
-static unsigned char xdit_mask_bits[] = {
+static unsigned const char xdit_mask_bits[] = {
0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07,
0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x1f,
0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f,
diff --git a/xditview.c b/xditview.c
index 4dae3f9..9c9f5db 100644
--- a/xditview.c
+++ b/xditview.c
@@ -73,14 +73,14 @@ static XrmOptionDescRec options[] = {
static char current_file_name[1024];
static FILE *current_file;
-static void MakePrompt(Widget, char *, void (*)(char *), char *);
+static void MakePrompt(Widget, const char *, void (*)(char *), char *);
/*
* Report the syntax for calling xditview.
*/
static void
-Syntax(char *call)
+Syntax(const char *call)
{
(void) printf ("Usage: %s [-fg <color>] [-bg <color>]\n", call);
(void) printf (" [-bd <color>] [-bw <pixels>] [-help]\n");
@@ -574,7 +574,7 @@ void Noop (Widget w, XEvent *xev, String *s, Cardinal *c)
}
static void
-MakePrompt(Widget centerw, char *prompt, void (*func)(char *), char *def)
+MakePrompt(Widget centerw, const char *prompt, void (*func)(char *), char *def)
{
static Arg dialogArgs[] = {
{XtNlabel, (XtArgVal) 0},