summaryrefslogtreecommitdiff
path: root/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-01-const
blob: 182d0b4241c4f0bb4a3e93567a07358a8ca1ecd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
diff -ur chktex-1.6.4.orig/ChkTeX.c chktex-1.6.4/ChkTeX.c
--- chktex-1.6.4.orig/ChkTeX.c	2007-10-20 09:10:48.000000000 +0200
+++ chktex-1.6.4/ChkTeX.c	2010-05-02 22:03:42.263715013 +0200
@@ -563,8 +563,8 @@
 {
 #ifndef STRIP_DEBUG
     unsigned long Cnt;
-    char *String;
-    char *iuStr = "";
+    const char *String;
+    const char *iuStr = "";
 
     if (DebugLevel & FLG_DbgMsgs)
     {
@@ -995,7 +995,7 @@
 
 void PrintPrgErr(enum PrgErrNum Error, ...)
 {
-    char *Type;
+    const char *Type;
     va_list MsgArgs;
 
     if (betw(pmMinFault, Error, pmMaxFault))
diff -ur chktex-1.6.4.orig/ChkTeX.h chktex-1.6.4/ChkTeX.h
--- chktex-1.6.4.orig/ChkTeX.h	2007-10-20 09:10:48.000000000 +0200
+++ chktex-1.6.4/ChkTeX.h	2010-05-02 21:56:55.612231528 +0200
@@ -247,7 +247,7 @@
      {
          char *Data;
          const char *LineBuf;
-         char *File;
+         const char *File;
          unsigned long Line, Column, ErrLen;
          enum
          {
@@ -277,11 +277,11 @@
   DEF(int, UsingStdIn,  FALSE) \
   DEF(int, InputFiles,  TRUE) \
   DEF(int, HeadErrOut,  TRUE) \
-  DEF(char *, OutputName, "") \
-  DEF(char *, PseudoInName, NULL) \
+  DEF(const char *, OutputName, "") \
+  DEF(const char *, PseudoInName, NULL) \
   DEF(char *, OutputFormat, VerbNormal) \
   DEF(char *, PipeOutputFormat, NULL) \
-  DEF(char *, Delimit, ":") \
+  DEF(const char *, Delimit, ":") \
   DEF(long,  DebugLevel, 0)
 
 #define STATE_VARS \
@@ -290,7 +290,7 @@
   DEF(int, InHeader, TRUE)  /* Whether we're in the header */ \
   DEF(int, VerbMode, FALSE) /* Whether we're in complete ignore-mode */ \
   DEF(long, MathMode, 0)     /* Whether we're in math mode or not */ \
-  DEF(char *, VerbStr, "")   /* String we'll terminate verbmode upon */ \
+  DEF(const char *, VerbStr, "")   /* String we'll terminate verbmode upon */ \
   DEF(unsigned long, ErrPrint, 0)    /* # errors printed */ \
   DEF(unsigned long, WarnPrint, 0)   /* # warnings printed */ \
   DEF(unsigned long, UserSupp, 0)    /* # user suppressed warnings */
diff -ur chktex-1.6.4.orig/FindErrs.c chktex-1.6.4/FindErrs.c
--- chktex-1.6.4.orig/FindErrs.c	2007-10-20 09:10:48.000000000 +0200
+++ chktex-1.6.4/FindErrs.c	2010-05-02 22:12:06.244928101 +0200
@@ -363,9 +363,9 @@
 
 }
 
-static char *Dot2Str(enum DotLevel dl)
+static const char *Dot2Str(enum DotLevel dl)
 {
-    char *Retval = INTERNFAULT;
+    const char *Retval = INTERNFAULT;
     switch (dl)
     {
     case dtUnknown:
@@ -590,8 +590,8 @@
         dotlev = CheckDots(CmdPtr, BufPtr);
         if (dotlev && (dotlev != realdl))
         {
-            TmpPtr = Dot2Str(dotlev);
-            PSERRA(CmdPtr - Buf, CmdLen, emEllipsis, TmpPtr);
+            const char *cTmpPtr = Dot2Str(dotlev);
+            PSERRA(CmdPtr - Buf, CmdLen, emEllipsis, cTmpPtr);
         }
     }
 
@@ -966,9 +966,10 @@
             case '.':
                 if ((Char == *BufPtr) && (Char == BufPtr[1]))
                 {
+                    const char *cTmpPtr;
                     dotlev = CheckDots(&PrePtr[1], &BufPtr[2]);
-                    TmpPtr = Dot2Str(dotlev);
-                    HEREA(3, emEllipsis, TmpPtr);
+                    cTmpPtr = Dot2Str(dotlev);
+                    HEREA(3, emEllipsis, cTmpPtr);
                 }
 
                 /* Regexp: "([^A-Z@.])\.[.!?:;]*\s+[a-z]" */
@@ -1231,7 +1232,7 @@
  * suffix should be put, e.g. "warning%s". Watch your %'s!
  */
 
-static void Transit(FILE * fh, unsigned long Cnt, char *Str)
+static void Transit(FILE * fh, unsigned long Cnt, const char *Str)
 {
     switch (Cnt)
     {
@@ -1468,7 +1469,7 @@
 
 static enum ErrNum PerformCommand(const char *Cmd, char *Arg)
 {
-    char *Argument = "";
+    const char *Argument = "";
     enum ErrNum en = emMinFault;
     int TmpC;
 
diff -ur chktex-1.6.4.orig/FindErrs.h chktex-1.6.4/FindErrs.h
--- chktex-1.6.4.orig/FindErrs.h	2004-12-31 23:22:01.000000000 +0100
+++ chktex-1.6.4/FindErrs.h	2010-05-02 21:50:34.032246285 +0200
@@ -162,7 +162,7 @@
     /* Requirements posed upon environment */
     enum Context Context;
 
-    char *Message;
+    const char *Message;
 };
 
 enum ItState
diff -ur chktex-1.6.4.orig/OpSys.c chktex-1.6.4/OpSys.c
--- chktex-1.6.4.orig/OpSys.c	2007-10-20 09:10:48.000000000 +0200
+++ chktex-1.6.4/OpSys.c	2010-05-02 22:18:12.805229781 +0200
@@ -110,8 +110,8 @@
 #endif
 
 char ConfigFile[BUFSIZ] = LOCALRCFILE;
-char *ReverseOn;
-char *ReverseOff;
+const char *ReverseOn;
+const char *ReverseOff;
 
 
 static int HasFile(char *Dir, const char *Filename, const char *App);
@@ -256,6 +256,7 @@
     char *termtype = getenv("TERM");
     int success;
     char *buffer;
+    static char str_so[3] = "so", str_se[3] = "se";
 
     if (termtype)
     {
@@ -267,8 +268,8 @@
             PrintPrgErr(pmNoTermDefd);
 
         buffer = (char *) malloc(sizeof(term_buffer));
-        ReverseOn = tgetstr("so", &buffer);
-        ReverseOff = tgetstr("se", &buffer);
+        ReverseOn = tgetstr(str_so, &buffer);
+        ReverseOff = tgetstr(str_se, &buffer);
 
         if (ReverseOn && ReverseOff)
             return;
diff -ur chktex-1.6.4.orig/OpSys.h chktex-1.6.4/OpSys.h
--- chktex-1.6.4.orig/OpSys.h	2005-01-03 01:39:20.000000000 +0100
+++ chktex-1.6.4/OpSys.h	2010-05-02 22:18:32.084824903 +0200
@@ -182,8 +182,8 @@
 * source tree. :-/ 
 */
 
-extern char *ReverseOn;
-extern char *ReverseOff;
+extern const char *ReverseOn;
+extern const char *ReverseOff;
 extern char ConfigFile[BUFSIZ];
 
 char *MatchFileName(char *String);
diff -ur chktex-1.6.4.orig/Resource.c chktex-1.6.4/Resource.c
--- chktex-1.6.4.orig/Resource.c	2004-06-06 07:23:04.000000000 +0200
+++ chktex-1.6.4/Resource.c	2010-05-02 21:32:29.830863107 +0200
@@ -34,7 +34,7 @@
 #define LNEMPTY(a) struct WordList a = {0, 1, {0}, {0}};
 #define LIST(a)    struct WordList a = {0, 0, {0}, {0}};
 #define LCASE(a)   LIST(a) LIST(a ## Case)
-#define KEY(a,def) char *a = def;
+#define KEY(a,def) const char *a = def;
 
 RESOURCE_INFO
 #undef KEY
@@ -43,8 +43,8 @@
 #undef LIST
     struct KeyWord
 {
-    char *Name;
-    char **String;              /* Keyword = item */
+    const char *Name;
+    const char **String;        /* Keyword = item */
     struct WordList *List,      /* Case-sensitive strings */
      *CaseList;                 /* Case-insensitive strings */
 };
@@ -106,7 +106,7 @@
 
      int ReadRC(const char *Filename)
 {
-    char *String = NULL;
+    const char *String = NULL;
     int Success = FALSE;
     FILE *fh;
     enum Token Token;
diff -ur chktex-1.6.4.orig/Resource.h chktex-1.6.4/Resource.h
--- chktex-1.6.4.orig/Resource.h	2004-12-31 23:36:37.000000000 +0100
+++ chktex-1.6.4/Resource.h	2010-05-02 21:26:29.414537608 +0200
@@ -48,7 +48,7 @@
 #define LIST(a) extern struct WordList a;
 #define LNEMPTY LIST
 #define LCASE(a) LIST(a) LIST(a ## Case)
-#define KEY(a,def) extern char *a;
+#define KEY(a,def) extern const char *a;
 
 RESOURCE_INFO
 #undef KEY
diff -ur chktex-1.6.4.orig/Utility.c chktex-1.6.4/Utility.c
--- chktex-1.6.4.orig/Utility.c	2004-12-31 23:22:01.000000000 +0100
+++ chktex-1.6.4/Utility.c	2010-05-02 21:59:51.240570213 +0200
@@ -367,7 +367,7 @@
  *
  */
 
-int strinfront(char *Str, char *Cmp)
+int strinfront(const char *Str, const char *Cmp)
 {
     int CmpLen;
 
@@ -685,7 +685,7 @@
 }
 
 
-int PushFile(char *Name, FILE * fh, struct Stack *stack)
+int PushFile(const char *Name, FILE * fh, struct Stack *stack)
 {
     struct FileNode *fn;
 
@@ -735,10 +735,10 @@
     return (Retval);
 }
 
-char *CurStkName(struct Stack *stack)
+const char *CurStkName(struct Stack *stack)
 {
     struct FileNode *fn;
-    static char *LastName = "";
+    static const char *LastName = "";
 
     if (PseudoInName && (stack->Used <= 1))
         return (PseudoInName);
diff -ur chktex-1.6.4.orig/Utility.h chktex-1.6.4/Utility.h
--- chktex-1.6.4.orig/Utility.h	2004-12-31 23:22:01.000000000 +0100
+++ chktex-1.6.4/Utility.h	2010-05-02 21:59:49.476606920 +0200
@@ -105,7 +105,7 @@
 void strxrep(char *Buf, const char *Prot, const char To);
 char *strip(char *String, const enum Strip What);
 void strwrite(char *To, const char *From, unsigned long Len);
-int strinfront(char *Str, char *Cmp);
+int strinfront(const char *Str, const char *Cmp);
 char *strdupx(const char *String, int Extra);
 void strmove(char *a, const char *b);
 
@@ -124,11 +124,11 @@
 void *StkTop(struct Stack *Stack);
 
 FILE *CurStkFile(struct Stack *stack);
-char *CurStkName(struct Stack *stack);
+const char *CurStkName(struct Stack *stack);
 unsigned long CurStkLine(struct Stack *stack);
 char *FGetsStk(char *Dest, unsigned long len, struct Stack *stack);
 int PushFileName(const char *Name, struct Stack *stack);
-int PushFile(char *, FILE *, struct Stack *);
+int PushFile(const char *, FILE *, struct Stack *);
 
 
 void FreeErrInfo(struct ErrInfo *ei);