summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-06-18 14:50:36 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-06-18 14:50:36 +0000
commit7b0a89166040f4b1d53f19b343ab0bd4431690c8 (patch)
tree18dd7db921f06d95fde0559b2ba2b95a46d14d49 /Build/source
parent15df75ba0bf120cae4e19bfc91674ab1a7cd59e0 (diff)
enable compiler warnings
git-svn-id: svn://tug.org/texlive/trunk@13814 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/dvipos/ChangeLog15
-rw-r--r--Build/source/texk/dvipos/Makefile.am1
-rw-r--r--Build/source/texk/dvipos/Makefile.in1
-rw-r--r--Build/source/texk/dvipos/dvicore.c37
-rw-r--r--Build/source/texk/dvipos/tfm.c14
5 files changed, 48 insertions, 20 deletions
diff --git a/Build/source/texk/dvipos/ChangeLog b/Build/source/texk/dvipos/ChangeLog
index 5408e3ffcfa..c5e5250de2b 100644
--- a/Build/source/texk/dvipos/ChangeLog
+++ b/Build/source/texk/dvipos/ChangeLog
@@ -1,3 +1,18 @@
+2009-06-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * Makefile.am (AM_CFLAGS): enable compiler warnings.
+ * dvicore.c: initialize various local vars (although not
+ needed) to avoid compiler warnings.
+ (write_bbox): use long format spec for long vars.
+ (dvi_unsigned_quad): unused.
+ (sqxfw): always return at end of non-void function.
+ (define_font): allocate empty string for null font name to
+ avoid later problems (possibly a segmentation fault).
+ * tfm.c:#include "tfm.h" for function prototypes.
+ (tfm_open): parentheses around assignment used as truth value.
+ (a_tfm_init): declare as static.
+ (dump_sizes): declare as static, unused.
+
2009-06-02 Peter Breitenlohner <peb@mppmu.mpg.de>
* dvicore.c, utils.h: rename INFINITY -> WEB_INFINITY, to avoid
diff --git a/Build/source/texk/dvipos/Makefile.am b/Build/source/texk/dvipos/Makefile.am
index 2519a29bd40..24406cea313 100644
--- a/Build/source/texk/dvipos/Makefile.am
+++ b/Build/source/texk/dvipos/Makefile.am
@@ -7,6 +7,7 @@ ACLOCAL_AMFLAGS = -I ../../m4
INCLUDES = $(KPATHSEA_INCLUDES)
AM_CPPFLAGS = -DKPATHSEA
+AM_CFLAGS = $(WARNING_CFLAGS)
bin_PROGRAMS = dvipos
diff --git a/Build/source/texk/dvipos/Makefile.in b/Build/source/texk/dvipos/Makefile.in
index f0a207695c9..cfaed57b0c2 100644
--- a/Build/source/texk/dvipos/Makefile.in
+++ b/Build/source/texk/dvipos/Makefile.in
@@ -245,6 +245,7 @@ top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I ../../m4
INCLUDES = $(KPATHSEA_INCLUDES)
AM_CPPFLAGS = -DKPATHSEA
+AM_CFLAGS = $(WARNING_CFLAGS)
dvipos_SOURCES = \
dvicore.c \
dvicore.h \
diff --git a/Build/source/texk/dvipos/dvicore.c b/Build/source/texk/dvipos/dvicore.c
index 06bc4ee99b8..d843a22f301 100644
--- a/Build/source/texk/dvipos/dvicore.c
+++ b/Build/source/texk/dvipos/dvicore.c
@@ -215,13 +215,15 @@ static void new_bbox (unsigned char *tag, int type)
static void write_bbox (BBOX *bb)
{
if (bbxfp) {
- fprintf(bbxfp, "\"%d.%04X & ", (bb->fb / 65536), (bb->fb < 0 ? -1 : 1) * (bb->fb % 65536));
- fprintf(bbxfp, "\"%d.%04X \"%d.%04X \"%d.%04X \"%d.%04X & ",
+ fprintf(bbxfp, "\"%ld.%04lX & ",
+ (bb->fb / 65536), (bb->fb < 0 ? -1 : 1) * (bb->fb % 65536));
+ fprintf(bbxfp, "\"%ld.%04lX \"%ld.%04lX \"%ld.%04lX \"%ld.%04lX & ",
(bb->v1 / 65536), (bb->v1 < 0 ? -1 : 1) * (bb->v1 % 65536),
(bb->h1 / 65536), (bb->h1 < 0 ? -1 : 1) * (bb->h1 % 65536),
(bb->v2 / 65536), (bb->v2 < 0 ? -1 : 1) * (bb->v2 % 65536),
(bb->h2 / 65536), (bb->h2 < 0 ? -1 : 1) * (bb->h2 % 65536));
- fprintf(bbxfp, "\"%d.%04X\n", (bb->cb / 65536), (bb->cb < 0 ? -1 : 1) * (bb->cb % 65536));
+ fprintf(bbxfp, "\"%ld.%04lX\n",
+ (bb->cb / 65536), (bb->cb < 0 ? -1 : 1) * (bb->cb % 65536));
/*
fprintf(bbxfp, "\"%ld & ", bb->fb);
fprintf(bbxfp, "\"%ld \"%ld \"%ld \"%ld & ", bb->v1, bb->h1, bb->v2, bb->h2);
@@ -321,11 +323,14 @@ static SIGNED_PAIR dvi_signed_triple (void)
return get_signed_triple(dvi_file);
}
+#if 0
+/* Not used */
static UNSIGNED_PAIR dvi_unsigned_quad (void)
{
dvi_location += 4;
return get_unsigned_quad(dvi_file);
}
+#endif
static SIGNED_PAIR dvi_signed_quad (void)
{
@@ -351,10 +356,11 @@ static SIGNED_QUAD sqxfw (SIGNED_QUAD z, SIGNED_QUAD b)
result = (((((b3 * z) / 0x100) + (b2 * z)) / 0x100) + (b1 * z)) / beta;
- if (b0 == 0) return result;
- else if (b0 == 255) return (result - alpha);
+ if (b0 == 255) result -= alpha;
+ else if (b0 != 0)
+ msg_out(M_FAIL, "[fatal] sqxfw(): TFM file is bad.\n");
- msg_out(M_FAIL, "[fatal] sqxfw(): TFM file is bad.\n");
+ return result;
}
static SIGNED_QUAD xround (double p)
@@ -499,7 +505,7 @@ static void out_vmove (SIGNED_QUAD p)
static void do_space (UNSIGNED_BYTE opcode)
{
- SIGNED_QUAD x;
+ SIGNED_QUAD x = 0; /* avoid uninitialized warning */
msg_out(M_DEBUG, "%ld: ", dvi_location);
switch (opcode) {
@@ -582,7 +588,7 @@ static void do_space (UNSIGNED_BYTE opcode)
static void do_vmove (UNSIGNED_BYTE opcode)
{
- SIGNED_QUAD y;
+ SIGNED_QUAD y = 0; /* avoid uninitialized warning */
flush_text();
msg_out(M_DEBUG, "%ld: ", dvi_location);
@@ -748,7 +754,7 @@ static void do_setchar (UNSIGNED_BYTE opcode)
* goto move_right or done> */
static void do_set (UNSIGNED_BYTE opcode)
{
- SIGNED_QUAD ch;
+ SIGNED_QUAD ch = 0; /* avoid uninitialized warning */
flush_text();
msg_out(M_DEBUG, "%ld: ", dvi_location);
@@ -780,7 +786,7 @@ static void do_set (UNSIGNED_BYTE opcode)
* goto move_right or done> */
static void do_put (UNSIGNED_BYTE opcode)
{
- SIGNED_QUAD ch;
+ SIGNED_QUAD ch = 0; /* avoid uninitialized warning */
flush_text();
msg_out(M_DEBUG, "%ld: ", dvi_location);
@@ -849,7 +855,7 @@ static void do_pop (void)
static void do_fnt_num (UNSIGNED_BYTE opcode)
{
register int i;
- SIGNED_QUAD id;
+ SIGNED_QUAD id = 0; /* avoid uninitialized warning */
flush_text();
msg_out(M_DEBUG, "%ld: ", dvi_location);
@@ -897,7 +903,8 @@ static void do_fnt_num (UNSIGNED_BYTE opcode)
static void do_pos_special (unsigned char *buffer, SIGNED_QUAD buffer_len)
{
unsigned char *cmd, *tag, *p;
- SIGNED_QUAD x, y, w, h, d;
+ SIGNED_QUAD x, y;
+ SIGNED_QUAD w = 0, h = 0, d = 0; /* avoid uninitialized warning */
double w_pt, h_pt, d_pt; /* in pt */
int parsed = 0; /* how many conversions the sscanf managed */
@@ -966,7 +973,7 @@ static void do_pos_special (unsigned char *buffer, SIGNED_QUAD buffer_len)
static void do_xxx (UNSIGNED_BYTE opcode)
{
- SIGNED_QUAD size;
+ SIGNED_QUAD size = 0; /* avoid uninitialized warning */
unsigned char *sp_buf;
flush_text();
@@ -1298,12 +1305,12 @@ static void define_font (SIGNED_QUAD e)
msg_out(M_DEBUG, "Font %ld: ", e);
/* Retrieve the directory name and the font name */
+ name = (char *)calloc(p+n+1, sizeof(char));
if (p + n > 0) {
- name = (char *)calloc(p+n+1, sizeof(char));
if (fread(name, sizeof(char), p+n, dvi_file) != p+n)
msg_out(M_FAIL, "[fatal] Failed to retrieve a font name.\n");
- name[p+n] = 0;
}
+ name[p+n] = 0;
msg_out(M_DEBUG, "%s", (p + n > 0 ? name : "null font name!"));
diff --git a/Build/source/texk/dvipos/tfm.c b/Build/source/texk/dvipos/tfm.c
index 2bf61357f89..4f7d6bb950d 100644
--- a/Build/source/texk/dvipos/tfm.c
+++ b/Build/source/texk/dvipos/tfm.c
@@ -26,6 +26,7 @@
#include "utils.h"
#include "dvicore.h"
+#include "tfm.h"
#define tfm_unsigned_byte() get_unsigned_byte(tfm_file)
#define tfm_signed_byte() get_signed_byte(tfm_file)
@@ -71,7 +72,8 @@ struct a_tfm {
fixword *unpacked_depths;
};
-void a_tfm_init (struct a_tfm *a_tfm)
+static void
+a_tfm_init (struct a_tfm *a_tfm)
{
a_tfm->id = 0;
a_tfm->nt = 0;
@@ -222,6 +224,8 @@ static int ofm_get_sizes (struct a_tfm *a_tfm)
return (int) (level);
}
+#if 0
+/* Not used */
static void dump_sizes (struct a_tfm *a_tfm)
{
fprintf (stderr, "\nwlenfile: %ld, ", a_tfm -> wlenfile);
@@ -238,7 +242,7 @@ static void dump_sizes (struct a_tfm *a_tfm)
fprintf (stderr, "nfonparm: %ld\n", a_tfm -> nfonparm);
return;
}
-
+#endif
static void get_fix_word_array (SIGNED_QUAD *a_word, SIGNED_QUAD length)
{
@@ -516,14 +520,14 @@ int tfm_open (const char *tfm_name, int must_exist)
tfm file with the must_exist flag set.
4. If not found and must_exist flag is not set, return -1. */
- if (file_name = kpse_find_file(tfm_name, kpse_tfm_format, 0))
+ if ((file_name = kpse_find_file(tfm_name, kpse_tfm_format, 0)))
format = TFM_FORMAT;
- else if (file_name = kpse_find_file(tfm_name, kpse_ofm_format, 0))
+ else if ((file_name = kpse_find_file(tfm_name, kpse_ofm_format, 0)))
format = OFM_FORMAT;
/* In case that must_exist is set, MiKTeX returns always non-NULL value
even if the tfm file is not found. */
else if (must_exist) {
- if (file_name = kpse_find_file(tfm_name, kpse_tfm_format, 1))
+ if ((file_name = kpse_find_file(tfm_name, kpse_tfm_format, 1)))
format = TFM_FORMAT;
else {
fprintf(stderr, "\n** Fatal: Unable to find TFM file '%s'.\n", tfm_name);