summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-04-15 09:05:21 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-04-15 09:05:21 +0000
commitf9a686d424f912154ffe8b7d5eb235032777a16f (patch)
treed0080bb63d613a4a64dc476c5c58e3ffbe8c241c
parent32912d37dba67d5dc461a98e4444d5ea7723d2e3 (diff)
pTeX: avoid compiler warnings
git-svn-id: svn://tug.org/texlive/trunk@17875 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/makejvf/ChangeLog13
-rw-r--r--Build/source/texk/makejvf/makejvf.h4
-rw-r--r--Build/source/texk/makejvf/tfmread.c1
-rw-r--r--Build/source/texk/makejvf/tool.c24
-rw-r--r--Build/source/texk/makejvf/write.c4
-rw-r--r--Build/source/texk/mendexk/ChangeLog.TL23
-rw-r--r--Build/source/texk/mendexk/convert.c21
-rw-r--r--Build/source/texk/mendexk/exvar.h4
-rw-r--r--Build/source/texk/mendexk/fread.c8
-rw-r--r--Build/source/texk/mendexk/kana.h2
-rw-r--r--Build/source/texk/mendexk/kp.c33
-rw-r--r--Build/source/texk/mendexk/kp.h19
-rw-r--r--Build/source/texk/mendexk/main.c2
-rw-r--r--Build/source/texk/mendexk/mendex.h6
-rw-r--r--Build/source/texk/mendexk/pageread.c4
-rw-r--r--Build/source/texk/mendexk/sort.c2
-rw-r--r--Build/source/texk/mendexk/styfile.c30
-rw-r--r--Build/source/texk/mendexk/var.h2
-rw-r--r--Build/source/texk/ptexenc/ChangeLog.TL12
-rw-r--r--Build/source/texk/ptexenc/ptexenc.c20
-rw-r--r--Build/source/texk/ptexenc/ptexenc.h6
-rw-r--r--Build/source/texk/ptexenc/unicode.c2
-rw-r--r--Build/source/texk/web2c/ptexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/ptexdir/pbibtex.ch2
-rw-r--r--Build/source/texk/web2c/ptexdir/ptex-base.ch4
-rw-r--r--Build/source/texk/web2c/ptexdir/ptexhelp.h2
-rw-r--r--Build/source/texk/web2c/ptexdir/ptftopl.ch2
27 files changed, 173 insertions, 85 deletions
diff --git a/Build/source/texk/makejvf/ChangeLog b/Build/source/texk/makejvf/ChangeLog
index c7dea48b2b4..64841831195 100644
--- a/Build/source/texk/makejvf/ChangeLog
+++ b/Build/source/texk/makejvf/ChangeLog
@@ -1,3 +1,16 @@
+2010-04-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * tool.c: #include "makejvf.h" for prototypes.
+ (utri, tri, pair, mget, uftri, ftri, fskip, cutspace, gethex,
+ getdec): Don't compile unused functions.
+ (fputnum): Drop unused local variable.
+ * tfmread.c (tfmget): Drop unused local variables.
+ * makejvf.h, write.c: Change return type of vfclose() and
+ maketfm() from int to void.
+
+ *** FIXME ***
+ * write.c (writevf): height might be used uninitialized.
+
2010-04-12 Peter Breitenlohner <peb@mppmu.mpg.de>
* Makefile: Renamed => Makefile.orig.
diff --git a/Build/source/texk/makejvf/makejvf.h b/Build/source/texk/makejvf/makejvf.h
index b4af75564d4..da6ab06963a 100644
--- a/Build/source/texk/makejvf/makejvf.h
+++ b/Build/source/texk/makejvf/makejvf.h
@@ -27,5 +27,5 @@ int fputstr(char *str, int byte, FILE *fp);
/* write.c */
FILE *vfopen(char *name);
void writevf(int code, FILE *fp);
-int vfclose(FILE *fp);
-int maketfm(char *name);
+void vfclose(FILE *fp);
+void maketfm(char *name);
diff --git a/Build/source/texk/makejvf/tfmread.c b/Build/source/texk/makejvf/tfmread.c
index 5b6104cf994..431528fd83b 100644
--- a/Build/source/texk/makejvf/tfmread.c
+++ b/Build/source/texk/makejvf/tfmread.c
@@ -29,7 +29,6 @@ int jfmread(int kcode)
int tfmget(char *name)
{
- int i,j,cc,tsize;
char nbuff[1024];
FILE *fp;
diff --git a/Build/source/texk/makejvf/tool.c b/Build/source/texk/makejvf/tool.c
index d0bef152a31..eed34c78959 100644
--- a/Build/source/texk/makejvf/tool.c
+++ b/Build/source/texk/makejvf/tool.c
@@ -3,6 +3,7 @@
#include <math.h>
#include <kpathsea/config.h>
+#include "makejvf.h"
int mquad(unsigned char *p)
{
@@ -16,6 +17,7 @@ int mquad(unsigned char *p)
return(cc);
}
+#if 0 /* unused */
unsigned int utri(unsigned char *p)
{
unsigned int i,cc;
@@ -29,7 +31,9 @@ unsigned int utri(unsigned char *p)
return cc;
}
+#endif /* 0 */
+#if 0 /* unused */
int tri(unsigned char *p)
{
int i,cc;
@@ -44,6 +48,7 @@ int tri(unsigned char *p)
if (cc > 8388607) cc -= 16777216;
return cc;
}
+#endif /* 0 */
unsigned int upair(unsigned char *p)
{
@@ -59,6 +64,7 @@ unsigned int upair(unsigned char *p)
return cc;
}
+#if 0 /* unused */
int pair(unsigned char *p)
{
int i,cc;
@@ -73,7 +79,9 @@ int pair(unsigned char *p)
if (cc > 32767) cc -= 65536;
return cc;
}
+#endif /* 0 */
+#if 0 /* unused */
int mget(char *p, int num)
{
switch (num) {
@@ -91,6 +99,7 @@ int mget(char *p, int num)
break;
}
}
+#endif /* 0 */
int fquad(FILE *fp)
{
@@ -104,6 +113,7 @@ int fquad(FILE *fp)
return cc;
}
+#if 0 /* unused */
unsigned int uftri(FILE *fp)
{
unsigned int i,cc;
@@ -117,7 +127,9 @@ unsigned int uftri(FILE *fp)
return cc;
}
+#endif /* 0 */
+#if 0 /* unused */
int ftri(FILE *fp)
{
int i,cc;
@@ -133,6 +145,7 @@ int ftri(FILE *fp)
return cc;
}
+#endif /* 0 */
unsigned int ufpair(FILE *fp)
{
@@ -164,14 +177,16 @@ int fpair(FILE *fp)
return cc;
}
+#if 0 /* unused */
int fskip(FILE *fp, int num)
{
fseek(fp,num,1);
}
+#endif /* 0 */
int fputnum(int num, int byte, FILE *fp)
{
- int i,cc;
+ int i;
unsigned char buf[16];
if (num<0) {
@@ -246,6 +261,8 @@ int fputstr(char *str, int byte, FILE *fp)
return 0;
}
+
+#if 0 /* unused */
int cutspace(FILE *fp)
{
int cc;
@@ -265,7 +282,9 @@ int cutspace(FILE *fp)
}
}
}
+#endif /* 0 */
+#if 0 /* unused */
int gethex(FILE *fp)
{
int cc,i;
@@ -289,7 +308,9 @@ int gethex(FILE *fp)
}
}
}
+#endif /* 0 */
+#if 0 /* unused */
int getdec(FILE *fp)
{
int cc,i;
@@ -308,3 +329,4 @@ int getdec(FILE *fp)
else return -1;
}
}
+#endif /* 0 */
diff --git a/Build/source/texk/makejvf/write.c b/Build/source/texk/makejvf/write.c
index 88ad19452a8..bd10c4eb55c 100644
--- a/Build/source/texk/makejvf/write.c
+++ b/Build/source/texk/makejvf/write.c
@@ -336,7 +336,7 @@ void writevf(int code, FILE *fp)
fputnum(code,2,fp); /* char code */
}
-int vfclose(FILE *fp)
+void vfclose(FILE *fp)
{
int i,cc;
@@ -347,7 +347,7 @@ int vfclose(FILE *fp)
fclose(fp);
}
-int maketfm(char *name)
+void maketfm(char *name)
{
char nbuf[256];
FILE *fp;
diff --git a/Build/source/texk/mendexk/ChangeLog.TL b/Build/source/texk/mendexk/ChangeLog.TL
index 1eb3003dbfb..7117d3223b0 100644
--- a/Build/source/texk/mendexk/ChangeLog.TL
+++ b/Build/source/texk/mendexk/ChangeLog.TL
@@ -1,6 +1,29 @@
ChangeLog.TL: TeX Live (TL) changes for mendexk
===============================================
+2010-04-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * pageread.c: #include "mendex.h" for prototype.
+ * kana.h: #include "exkana.h" for type checking.
+ * var.h: #include "exvar.h" for type checking.
+ * sort.c (wcomp): Initialize local variable prechar.
+ * kp.c (KP_init): Use kpse_set_program_name() because
+ kpse_set_progname() is deprecated since ages and no longer
+ exported from kpathsea.
+
+ FIXME: Is this correct?
+ * exvar.h (atama, page_compositor, page_precedence): Change type
+ from 'unsigned char' to 'char' as defined in var.h.
+
+ FIXME: Is this correct?
+ * convert.c (dicread): Add 'return 0' at end.
+
+ Avoid compiler warnings.
+ * ANSI C function prototypes and definitions.
+ * Declare functions as static, skip compilation of unused ones.
+ * Declare various function param or result, struct member, and
+ local or global var strings as const.
+
2010-04-12 Peter Breitenlohner <peb@mppmu.mpg.de>
* Makefile.am (EXTRA_DIST): Add indexsty, mendex.doc.
diff --git a/Build/source/texk/mendexk/convert.c b/Build/source/texk/mendexk/convert.c
index 30455e4d6fb..03959bcf8ff 100644
--- a/Build/source/texk/mendexk/convert.c
+++ b/Build/source/texk/mendexk/convert.c
@@ -23,7 +23,7 @@ unsigned char dic[2][50];
struct dictionary *dictable,*envdic;
int dlines=0,elines=0;
-int dicvalread(char *filename, struct dictionary *dicval, int line);
+static int dicvalread(const char *filename, struct dictionary *dicval, int line);
/* initialize kana table */
void initkanatable(void)
@@ -60,10 +60,11 @@ void initkanatable(void)
}
/* get dictionary */
-int dicread(char *filename)
+int dicread(const char *filename)
{
int i,ecount=0;
- char *envfile,buff[4096];
+ const char *envfile;
+ char buff[4096];
FILE *fp;
if (filename!=NULL) {
@@ -123,17 +124,19 @@ ENV:
verb_printf(efp,"...done.\n");
}
+
+ return 0; /* FIXME: is this right? */
}
+static int dcomp(const void *bf1, const void *bf2);
+
/* read dictionary file */
-int dicvalread(char *filename, struct dictionary *dicval, int line)
+static int dicvalread(const char *filename, struct dictionary *dicval, int line)
{
int i,j,k;
unsigned char buff[256];
FILE *fp;
- int dcomp();
-
fp=nkf_open(filename,"r");
for (i=0;i<line;i++) {
if (mfgets(buff,255,fp)==NULL) break;
@@ -171,8 +174,10 @@ int dicvalread(char *filename, struct dictionary *dicval, int line)
}
/* comp-function of dictionary sorting */
-int dcomp(struct dictionary *buff1, struct dictionary *buff2)
+static int dcomp(const void *bf1, const void *bf2)
{
+ const struct dictionary *buff1 = (const struct dictionary *) bf1;
+ const struct dictionary *buff2 = (const struct dictionary *) bf2;
int i;
for (i=0;i<50;i++) {
@@ -511,7 +516,9 @@ int pnumconv(char *page, int attr)
return cc;
}
+#if 0 /* unused */
int nbyte(unsigned char *str, int n)
{
return (unsigned int)str[n];
}
+#endif /* 0 */
diff --git a/Build/source/texk/mendexk/exvar.h b/Build/source/texk/mendexk/exvar.h
index 7190a233c72..a30a77220b4 100644
--- a/Build/source/texk/mendexk/exvar.h
+++ b/Build/source/texk/mendexk/exvar.h
@@ -29,6 +29,6 @@ extern char symhead_positive[2048],symhead_negative[2048];
extern char numhead_positive[2048],numhead_negative[2048];
extern int symbol_flag;
extern int letter_head;
-extern unsigned char atama[2048];
-extern unsigned char page_compositor[2048],page_precedence[2048];
+extern char atama[2048];
+extern char page_compositor[2048],page_precedence[2048];
extern char character_order[2048];
diff --git a/Build/source/texk/mendexk/fread.c b/Build/source/texk/mendexk/fread.c
index 5737894d379..9cd5d322eeb 100644
--- a/Build/source/texk/mendexk/fread.c
+++ b/Build/source/texk/mendexk/fread.c
@@ -11,8 +11,8 @@
#define BUFSIZE 65535
-int getestr(unsigned char *buff, unsigned char *estr);
-void chkpageattr(struct page *p);
+static int getestr(unsigned char *buff, unsigned char *estr);
+static void chkpageattr(struct page *p);
/* read idx file */
int idxread(char *filename, int start)
@@ -453,7 +453,7 @@ LOOP:
}
/* pic up encap string */
-int getestr(unsigned char *buff, unsigned char *estr)
+static int getestr(unsigned char *buff, unsigned char *estr)
{
int i,nest=0;
@@ -486,7 +486,7 @@ int getestr(unsigned char *buff, unsigned char *estr)
return -1;
}
-void chkpageattr(struct page *p)
+static void chkpageattr(struct page *p)
{
int i,j,cc=0;
diff --git a/Build/source/texk/mendexk/kana.h b/Build/source/texk/mendexk/kana.h
index 3c6822a9212..e83f4a35fe7 100644
--- a/Build/source/texk/mendexk/kana.h
+++ b/Build/source/texk/mendexk/kana.h
@@ -1,3 +1,5 @@
+#include "exkana.h"
+
unsigned char AKASATANA[]={
0xa4,0xa2, /* дв */
0xa4,0xab, /* дл */
diff --git a/Build/source/texk/mendexk/kp.c b/Build/source/texk/mendexk/kp.c
index 8ca6c7c461f..efc3823e37b 100644
--- a/Build/source/texk/mendexk/kp.c
+++ b/Build/source/texk/mendexk/kp.c
@@ -6,10 +6,9 @@
#include "kp.h"
int
-KP_init(prog)
- char *prog;
+KP_init(char *prog)
{
- kpse_set_progname(prog);
+ kpse_set_program_name(prog, "mendexk");
return 0;
}
@@ -19,10 +18,9 @@ KP_init(prog)
char *var: name of variable.
char *def_val: default value.
*/
-char *KP_get_value(var,def_val)
- char *var,*def_val;
+const char *KP_get_value(const char *var, const char *def_val)
{
- char *p = kpse_var_value(var);
+ const char *p = kpse_var_value(var);
return p ? p : def_val;
}
@@ -36,10 +34,9 @@ char *KP_get_value(var,def_val)
char *cnf: name of variable in `texmf.cnf'.
char *def_val: default value.
*/
-char *KP_get_value(env,cnf,def_val)
- char *env,*cnf,*def_val;
+const char *KP_get_value(const char *env, const char *cnf, const char *def_val)
{
- char *val;
+ const char *val;
char *cnf_val,*env_val;
val = def_val ? def_val : "";
@@ -49,36 +46,36 @@ char *KP_get_value(env,cnf,def_val)
if (cnf_val) val = kpse_expand_default(cnf_val,val);
if (env_val) val = kpse_expand_default(env_val,val);
- return val[0] ? val : ((cnf_val || env_val) ? val : (char *)0);
+ return val[0] ? val : ((cnf_val || env_val) ? val : NULL);
}
#endif
+#ifdef KPATHSEA3
/* KP_get_path(char *var, char *def_val)
ARGUMENTS:
char *var: name of variable.
char *def_val: default value.
*/
-char *KP_get_path(var,def_val)
- char *var,*def_val;
+static const char *KP_get_path(const char *var, const char *def_val)
{
char avar[50];
- char *p;
+ const char *p;
strcpy(avar, "${");
strcat(avar, var);
strcat(avar, "}");
p = kpse_path_expand(avar);
return (p && *p) ? p : def_val;
}
+#endif
/*
*/
-int KP_entry_filetype(info)
- KpathseaSupportInfo *info;
+int KP_entry_filetype(KpathseaSupportInfo *info)
{
#ifdef KPATHSEA3
info->path = KP_get_path(info->var_name,info->path);
#else
- char *path;
+ const char *path;
path = KP_get_value(info->var_name,info->var_name,info->path);
info->path = kpse_path_expand(path);
#endif
@@ -90,9 +87,7 @@ int KP_entry_filetype(info)
KpathseaSupportInfo *info: Informations about the type of files.
char *name: Name of file.
*/
-char *KP_find_file(info,name)
- KpathseaSupportInfo *info;
- char *name;
+const char *KP_find_file(KpathseaSupportInfo *info, const char *name)
{
char *ret;
ret = kpse_path_search(info->path,name,1);
diff --git a/Build/source/texk/mendexk/kp.h b/Build/source/texk/mendexk/kp.h
index f304b2c2542..3f4ba5880b2 100644
--- a/Build/source/texk/mendexk/kp.h
+++ b/Build/source/texk/mendexk/kp.h
@@ -3,15 +3,18 @@
#define KSUPPORT_H_INCLUDED
#ifdef KPATHSEA
typedef struct {
- char *var_name;
- char *path;
- char *suffix;
+ const char *var_name;
+ const char *path;
+ const char *suffix;
} KpathseaSupportInfo;
-extern int KP_init();
-extern int KP_entry_filetype();
-extern char *KP_find_file();
-extern char *KP_get_value();
-extern char *KP_get_path();
+extern int KP_init(char *);
+extern int KP_entry_filetype(KpathseaSupportInfo *);
+extern const char *KP_find_file(KpathseaSupportInfo *, const char *);
+#ifdef KPATHSEA3
+extern const char *KP_get_value(const char *, const char *);
+#else
+extern const char *KP_get_value(const char *, const char *, const char *);
+#endif
#endif /* KPATHSEA */
#endif /* ! KSUPPORT_H_INCLUDED */
diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c
index 9fac729869c..7da7f7c9721 100644
--- a/Build/source/texk/mendexk/main.c
+++ b/Build/source/texk/mendexk/main.c
@@ -31,7 +31,7 @@ KpathseaSupportInfo kp_ist,kp_dict;
int main(int argc, char **argv)
{
int i,j,cc=0,startpagenum=-1,ecount=0;
- char *envbuff;
+ const char *envbuff;
set_enc_string(NULL, "EUC");
#ifdef KPATHSEA
diff --git a/Build/source/texk/mendexk/mendex.h b/Build/source/texk/mendexk/mendex.h
index 4b684880d14..da931e5422b 100644
--- a/Build/source/texk/mendexk/mendex.h
+++ b/Build/source/texk/mendexk/mendex.h
@@ -18,10 +18,10 @@ struct index {
void initkanatable(void);
int convert(unsigned char *buff1, unsigned char *buff2);
int pnumconv(char *page, int attr);
-int dicread(char *filename);
+int dicread(const char *filename);
/* pageread.c */
-int lastpage(char *filename);
+int lastpage(const char *filename);
/* sort.c */
void wsort(struct index *ind, int num);
@@ -33,7 +33,7 @@ int japanese(unsigned char *buff);
int chkcontinue(struct page *p, int num);
/* styfile.c */
-void styread(char *filename);
+void styread(const char *filename);
/* fread.c */
char *mfgets(char *buf, int byte, FILE *fp);
diff --git a/Build/source/texk/mendexk/pageread.c b/Build/source/texk/mendexk/pageread.c
index 9c231690621..41c65de14c1 100644
--- a/Build/source/texk/mendexk/pageread.c
+++ b/Build/source/texk/mendexk/pageread.c
@@ -2,8 +2,10 @@
#include <stdlib.h>
#include <string.h>
+#include "mendex.h"
+
/* checking last page */
-int lastpage(char *filename)
+int lastpage(const char *filename)
{
int i,cc,num= -1;
char logfile[32],numbuff[16];
diff --git a/Build/source/texk/mendexk/sort.c b/Build/source/texk/mendexk/sort.c
index 169dfbb78c0..39d2f19160c 100644
--- a/Build/source/texk/mendexk/sort.c
+++ b/Build/source/texk/mendexk/sort.c
@@ -62,7 +62,7 @@ BREAK:
/* compare for sorting index */
static int wcomp(const void *p, const void *q)
{
- int i,j,prechar;
+ int i, j, prechar = 0;
const struct index *index1 = p, *index2 = q;
scount++;
diff --git a/Build/source/texk/mendexk/styfile.c b/Build/source/texk/mendexk/styfile.c
index 2e26cef8896..ccc2db238c9 100644
--- a/Build/source/texk/mendexk/styfile.c
+++ b/Build/source/texk/mendexk/styfile.c
@@ -15,16 +15,16 @@ extern KpathseaSupportInfo kp_ist;
FILE *fp;
-void convline(char *buff1, int start, char *buff2);
-int scompare(char *buff1, char *buff2);
-int getparam(char *buff, char *paraname, char *param);
-int getparachar(char *buff, char *paraname, char *param);
-size_t sstrlen(const char *buff);
-int sstrcmp(const char *s1, const char *s2);
-int sstrncmp(const char *s1, const char *s2, size_t len);
+static void convline(char *buff1, int start, char *buff2);
+static int scompare(char *buff1, const char *buff2);
+static int getparam(char *buff, const char *paraname, char *param);
+static int getparachar(char *buff, const char *paraname, char *param);
+static size_t sstrlen(const char *buff);
+static int sstrcmp(const char *s1, const char *s2);
+static int sstrncmp(const char *s1, const char *s2, size_t len);
/* read style file */
-void styread(char *filename)
+void styread(const char *filename)
{
int i,cc;
char buff[4096];
@@ -127,7 +127,7 @@ void styread(char *filename)
}
/* analize string parameter of style file */
-void convline(char *buff1, int start, char *buff2)
+static void convline(char *buff1, int start, char *buff2)
{
int i,j,cc;
@@ -172,7 +172,7 @@ void convline(char *buff1, int start, char *buff2)
}
/* compare strings */
-int scompare(char *buff1, char *buff2)
+static int scompare(char *buff1, const char *buff2)
{
int i;
@@ -197,7 +197,7 @@ int scompare(char *buff1, char *buff2)
}
/* get string of style patameter */
-int getparam(char *buff, char *paraname, char *param)
+static int getparam(char *buff, const char *paraname, char *param)
{
int cc;
@@ -210,7 +210,7 @@ int getparam(char *buff, char *paraname, char *param)
}
/* get character of style parameter */
-int getparachar(char *buff, char *paraname, char *param)
+static int getparachar(char *buff, const char *paraname, char *param)
{
int j,cc;
@@ -233,20 +233,20 @@ int getparachar(char *buff, char *paraname, char *param)
return 0;
}
-size_t sstrlen(const char *s)
+static size_t sstrlen(const char *s)
{
if (s == NULL) return 0;
return strlen(s);
}
-int sstrcmp(const char *s1, const char *s2)
+static int sstrcmp(const char *s1, const char *s2)
{
if (s1 == NULL) return -1;
if (s2 == NULL) return 1;
return strcmp(s1, s2);
}
-int sstrncmp(const char *s1, const char *s2, size_t len)
+static int sstrncmp(const char *s1, const char *s2, size_t len)
{
if (s1 == NULL) return -1;
if (s2 == NULL) return 1;
diff --git a/Build/source/texk/mendexk/var.h b/Build/source/texk/mendexk/var.h
index 2041ec48f51..9565dd791d0 100644
--- a/Build/source/texk/mendexk/var.h
+++ b/Build/source/texk/mendexk/var.h
@@ -1,3 +1,5 @@
+#include "exvar.h"
+
FILE *efp;
int lines,idxcount,acc=0,reject=0;
diff --git a/Build/source/texk/ptexenc/ChangeLog.TL b/Build/source/texk/ptexenc/ChangeLog.TL
index 2f555a9d273..ba856685c8f 100644
--- a/Build/source/texk/ptexenc/ChangeLog.TL
+++ b/Build/source/texk/ptexenc/ChangeLog.TL
@@ -1,6 +1,18 @@
ChangeLog.TL: TeX Live (TL) changes for ptexenc
===============================================
+2010-04-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Avoid compiler warnings.
+ * ptexenc.[ch]: Declare ptexenc_version_string, get_enc_string,
+ and set_enc_string's params as const.
+ * ptexenc.c (enc_to_string): Declare return value as const.
+ (string_to_enc): Declare param as const.
+ (in_filter): Declare as const.
+ (getc4, ungetc4): Declare as static.
+ (get_terminal_enc): Declare as static and string var s as const.
+ * unicode.c (UCStoUTF8S): Skip unused function.
+
2010-04-14 Peter Breitenlohner <peb@mppmu.mpg.de>
* Makefile.am (rebuild): New target for forced (re-)build.
diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c
index 613044341fd..bf8378c0044 100644
--- a/Build/source/texk/ptexenc/ptexenc.c
+++ b/Build/source/texk/ptexenc/ptexenc.c
@@ -31,14 +31,14 @@
# define NOFILE OPEN_MAX
#endif
-char *ptexenc_version_string = "ptetex " PTEXENC_VERSION;
+const char *ptexenc_version_string = "ptetex " PTEXENC_VERSION;
static int file_enc = ENC_UNKNOWN;
static int internal_enc = ENC_UNKNOWN;
static int terminal_enc = ENC_UNKNOWN;
-static string enc_to_string(int enc)
+static const_string enc_to_string(int enc)
{
switch (enc) {
case ENC_JIS: return "jis";
@@ -49,7 +49,7 @@ static string enc_to_string(int enc)
}
}
-static int string_to_enc(string str)
+static int string_to_enc(const_string str)
{
if (str == NULL) return ENC_UNKNOWN;
if (strcasecmp(str, "default")== 0) return DEFAULT_KANJI_ENC;
@@ -99,11 +99,11 @@ static int get_internal_enc(void)
return internal_enc;
}
-int get_terminal_enc(void)
+static int get_terminal_enc(void)
{
if (terminal_enc == ENC_UNKNOWN) {
char lang[16]; /* enough large space */
- char *s = getenv("LC_ALL");
+ const char *s = getenv("LC_ALL");
if (s == NULL) s = getenv("LC_MESSAGES");
if (s == NULL) s = getenv("LANG");
if (s == NULL) s = getenv("LANGUAGE");
@@ -124,7 +124,7 @@ int get_terminal_enc(void)
return terminal_enc;
}
-string get_enc_string(void)
+const_string get_enc_string(void)
{
static char buffer[20]; /* enough large space */
@@ -138,7 +138,7 @@ string get_enc_string(void)
}
}
-boolean set_enc_string(string file_str, string internal_str)
+boolean set_enc_string(const_string file_str, const_string internal_str)
{
int file = string_to_enc(file_str);
int internal = string_to_enc(internal_str);
@@ -344,7 +344,7 @@ static struct unget_st {
int buff[4];
} ungetbuff[NOFILE];
-int getc4(FILE *fp)
+static int getc4(FILE *fp)
{
struct unget_st *p = &ungetbuff[fileno(fp)];
@@ -352,7 +352,7 @@ int getc4(FILE *fp)
return p->buff[--p->size];
}
-int ungetc4(int c, FILE *fp)
+static int ungetc4(int c, FILE *fp)
{
struct unget_st *p = &ungetbuff[fileno(fp)];
@@ -592,7 +592,7 @@ long input_line3(FILE *fp, string buff, long pos, const long buffsize)
}
-static string in_filter = NULL;
+static const_string in_filter = NULL;
static FILE *piped_fp[NOFILE];
static int piped_num = 0;
diff --git a/Build/source/texk/ptexenc/ptexenc.h b/Build/source/texk/ptexenc/ptexenc.h
index b7a6e2c1dcf..32dd464cb70 100644
--- a/Build/source/texk/ptexenc/ptexenc.h
+++ b/Build/source/texk/ptexenc/ptexenc.h
@@ -7,13 +7,13 @@
#include <kpathsea/types.h>
-extern KPSEDLL char *ptexenc_version_string;
+extern KPSEDLL const char *ptexenc_version_string;
#define KANJI_OPTS "{jis|euc|sjis|utf8}"
/* get/set Kanji encoding by string */
-extern KPSEDLL string get_enc_string(void);
-extern KPSEDLL int set_enc_string(string file, string inter);
+extern KPSEDLL const_string get_enc_string(void);
+extern KPSEDLL int set_enc_string(const_string file, const_string inter);
#define getencstring get_enc_string
#define setencstring set_enc_string
diff --git a/Build/source/texk/ptexenc/unicode.c b/Build/source/texk/ptexenc/unicode.c
index 2e723f6cd31..275ebd75d40 100644
--- a/Build/source/texk/ptexenc/unicode.c
+++ b/Build/source/texk/ptexenc/unicode.c
@@ -69,6 +69,7 @@ long UTF8StoUCS(string s)
}
}
+#if 0 /* not used */
int UCStoUTF8S(long ucs, string s)
{
if (ucs < 0x80) {
@@ -92,6 +93,7 @@ int UCStoUTF8S(long ucs, string s)
}
return 0; /* unsupported */
}
+#endif /* 0 */
long UCStoUTF8(long ucs)
diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog
index 0305e4796bb..b3d7f1f9bd7 100644
--- a/Build/source/texk/web2c/ptexdir/ChangeLog
+++ b/Build/source/texk/web2c/ptexdir/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * pbibtex.ch, ptex-base.ch, ptftopl.ch: Use conststringcast, not
+ stringcast to cast the get_enc_string() value which is now const.
+ * ptexhelp.h (PDVITYPEHELP): Fixed a typo in help message.
+
2010-04-14 Peter Breitenlohner <peb@mppmu.mpg.de>
* pbibtex.ch: New version from Akira, used on top of bibtex.ch.
diff --git a/Build/source/texk/web2c/ptexdir/pbibtex.ch b/Build/source/texk/web2c/ptexdir/pbibtex.ch
index b4a57ec673a..184f504c087 100644
--- a/Build/source/texk/web2c/ptexdir/pbibtex.ch
+++ b/Build/source/texk/web2c/ptexdir/pbibtex.ch
@@ -53,7 +53,7 @@
@y
print (banner);
print (' (');
- print (stringcast(get_enc_string));
+ print (conststringcast(get_enc_string));
print (')');
@z
diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch
index a7c4a2da015..c050f213643 100644
--- a/Build/source/texk/web2c/ptexdir/ptex-base.ch
+++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch
@@ -337,7 +337,7 @@ if src_specials_p or file_line_error_style_p or parse_first_line_p then
else
wterm(banner);
wterm(' (');
- wterm(stringcast(get_enc_string));
+ wterm(conststringcast(get_enc_string));
wterm(')');
@z
@@ -2617,7 +2617,7 @@ then
else
wlog(banner);
wlog(' (');
- wlog(stringcast(get_enc_string));
+ wlog(conststringcast(get_enc_string));
wlog(')');
@z
diff --git a/Build/source/texk/web2c/ptexdir/ptexhelp.h b/Build/source/texk/web2c/ptexdir/ptexhelp.h
index b5847de1a53..a8737fa5417 100644
--- a/Build/source/texk/web2c/ptexdir/ptexhelp.h
+++ b/Build/source/texk/web2c/ptexdir/ptexhelp.h
@@ -60,7 +60,7 @@ const_string PDVITYPEHELP[] = {
" -page-start=PAGE type, e.g., `1.*.-5' to specify the first page",
" with \\count0=1, \\count2=4.",
" (see the TeX book chapter 15).",
-" -show-opcodes show opcodes in dicimal.",
+" -show-opcodes show opcodes in decimal.",
" -kanji={jis|euc|sjis|utf8} kanji code for output-file.",
" -version print version information and exit.",
" -help print this message and exit.",
diff --git a/Build/source/texk/web2c/ptexdir/ptftopl.ch b/Build/source/texk/web2c/ptexdir/ptftopl.ch
index 76bb02afc48..8994f6f4230 100644
--- a/Build/source/texk/web2c/ptexdir/ptftopl.ch
+++ b/Build/source/texk/web2c/ptexdir/ptftopl.ch
@@ -34,7 +34,7 @@ var @!k:integer; {all-purpose initiallization index}
@y
print_ln (version_string);
print ('process kanji code is ');
- print (stringcast(get_enc_string));
+ print (conststringcast(get_enc_string));
print_ln('.');
@z