gcc -Wall -Werror safe

* anchor.c (addMultirowsImg): unused variable: fi
* display.c (redrawLineImage): unused variable: ncol
* file.c (process_img): uninitialized variables: r2, ni, w0, i0, ismap
		unused variable: url, ext
* file.c (loadHTMLstream): need volatile image_flag
* image.c (image_index): int
* image.c (getCharSize): need prototype
* image.c (getImage): uninitialized variable: key
		return NULL
* map.c (follow_map_menu): used only USE_IMAGE: px, py, map
* map.c (newMapArea): used only USE_IMAGE: p, i, max
* proto.h (addMultirowsImg): added
* w3mimgdisplay.c (main): format string fix
* w3mimgdisplay.c (DrawImage): need (Pixmap) cast

* inflate.c: indent
From: Fumitoshi UKAI  <ukai@debian.or.jp>
This commit is contained in:
Fumitoshi UKAI
2002-01-31 18:28:24 +00:00
parent 9efbc08856
commit 4c7c352e47
9 changed files with 74 additions and 46 deletions
+21 -1
View File
@@ -1,3 +1,23 @@
2002-02-01 Fumitoshi UKAI <ukai@debian.or.jp>
* gcc -Wall -Werror safe
* anchor.c (addMultirowsImg): unused variable: fi
* display.c (redrawLineImage): unused variable: ncol
* file.c (process_img): uninitialized variables: r2, ni, w0, i0, ismap
unused variable: url, ext
* file.c (loadHTMLstream): need volatile image_flag
* image.c (image_index): int
* image.c (getCharSize): need prototype
* image.c (getImage): uninitialized variable: key
return NULL
* map.c (follow_map_menu): used only USE_IMAGE: px, py, map
* map.c (newMapArea): used only USE_IMAGE: p, i, max
* proto.h (addMultirowsImg): added
* w3mimgdisplay.c (main): format string fix
* w3mimgdisplay.c (DrawImage): need (Pixmap) cast
* inflate.c: indent
2002-02-01 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> 2002-02-01 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
* w3m-img merge (w3m-0.2.4+cvs-1.278-img-2.2.patch.gz) * w3m-img merge (w3m-0.2.4+cvs-1.278-img-2.2.patch.gz)
@@ -2673,4 +2693,4 @@
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.287 2002/01/31 17:54:47 ukai Exp $ $Id: ChangeLog,v 1.288 2002/01/31 18:28:24 ukai Exp $
+1 -2
View File
@@ -1,4 +1,4 @@
/* $Id: anchor.c,v 1.8 2002/01/31 17:54:48 ukai Exp $ */ /* $Id: anchor.c,v 1.9 2002/01/31 18:28:24 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "myctype.h" #include "myctype.h"
#include "regex.h" #include "regex.h"
@@ -470,7 +470,6 @@ addMultirowsImg(Buffer *buf, AnchorList *al)
l->propBuf[k] |= PE_ANCHOR; l->propBuf[k] |= PE_ANCHOR;
} }
if (a_form.url) { if (a_form.url) {
FormItemList *fi = (FormItemList *)a_form.url;
buf->formitem = putAnchor(buf->formitem, a_form.url, buf->formitem = putAnchor(buf->formitem, a_form.url,
a_form.target, &a, NULL, a_form.target, &a, NULL,
l->linenumber, pos); l->linenumber, pos);
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: display.c,v 1.15 2002/01/31 17:54:50 ukai Exp $ */ /* $Id: display.c,v 1.16 2002/01/31 18:28:24 ukai Exp $ */
#include <signal.h> #include <signal.h>
#include "fm.h" #include "fm.h"
@@ -620,7 +620,7 @@ redrawLine(Buffer *buf, Line *l, int i)
Line * Line *
redrawLineImage(Buffer *buf, Line *l, int i) redrawLineImage(Buffer *buf, Line *l, int i)
{ {
int j, pos, rcol, ncol; int j, pos, rcol;
int column = buf->currentColumn; int column = buf->currentColumn;
Anchor *a; Anchor *a;
int x, y, sx, sy, w, h; int x, y, sx, sy, w, h;
+5 -5
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.55 2002/01/31 17:54:50 ukai Exp $ */ /* $Id: file.c,v 1.56 2002/01/31 18:28:24 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include "myctype.h" #include "myctype.h"
@@ -2754,9 +2754,10 @@ restore_fonteffect(struct html_feed_environ *h_env, struct readbuffer *obuf)
Str Str
process_img(struct parsed_tag *tag, int width) process_img(struct parsed_tag *tag, int width)
{ {
char *p, *q, *r, *r2, *s; char *p, *q, *r, *r2 = NULL, *s;
#ifdef USE_IMAGE #ifdef USE_IMAGE
int w, i, nw, ni, n, w0, i0, align, xoffset, yoffset, top, bottom, ismap; int w, i, nw, ni = 1, n, w0 = -1, i0 = -1;
int align, xoffset, yoffset, top, bottom, ismap = 0;
int use_image = activeImage && displayImage; int use_image = activeImage && displayImage;
#else #else
int w, i, nw, n; int w, i, nw, n;
@@ -2842,7 +2843,6 @@ process_img(struct parsed_tag *tag, int width)
w0 = w; w0 = w;
i0 = i; i0 = i;
if (w < 0 || i < 0) { if (w < 0 || i < 0) {
char *url, *ext;
Image image; Image image;
ParsedURL u; ParsedURL u;
@@ -5726,7 +5726,7 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal)
struct html_feed_environ htmlenv1; struct html_feed_environ htmlenv1;
struct readbuffer obuf; struct readbuffer obuf;
#ifdef USE_IMAGE #ifdef USE_IMAGE
int image_flag; int volatile image_flag;
#endif #endif
MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL;
+23 -22
View File
@@ -1,4 +1,4 @@
/* $Id: image.c,v 1.1 2002/01/31 17:54:51 ukai Exp $ */ /* $Id: image.c,v 1.2 2002/01/31 18:28:24 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
@@ -11,7 +11,7 @@
#ifdef USE_IMAGE #ifdef USE_IMAGE
static image_index = 0; static int image_index = 0;
/* display image */ /* display image */
@@ -32,6 +32,7 @@ static FILE *Imgdisplay_rf = NULL, *Imgdisplay_wf = NULL;
static pid_t Imgdisplay_pid = 0; static pid_t Imgdisplay_pid = 0;
static int openImgdisplay(); static int openImgdisplay();
static void closeImgdisplay(); static void closeImgdisplay();
int getCharSize();
void void
initImage() initImage()
@@ -60,9 +61,9 @@ getCharSize()
pclose(f); pclose(f);
if (!(w > 0 && h > 0)) if (!(w > 0 && h > 0))
return FALSE; return FALSE;
if (! set_pixel_per_char) if (!set_pixel_per_char)
pixel_per_char = (int)(1.0 * w / COLS + 0.5); pixel_per_char = (int)(1.0 * w / COLS + 0.5);
if (! set_pixel_per_line) if (!set_pixel_per_line)
pixel_per_line = (int)(1.0 * h / LINES + 0.5); pixel_per_line = (int)(1.0 * h / LINES + 0.5);
return TRUE; return TRUE;
} }
@@ -211,7 +212,7 @@ drawImage()
fputs(i->cache->file, Imgdisplay_wf); fputs(i->cache->file, Imgdisplay_wf);
fputs("\n", Imgdisplay_wf); fputs("\n", Imgdisplay_wf);
fputs("4;\n", Imgdisplay_wf); /* put '\n' */ fputs("4;\n", Imgdisplay_wf); /* put '\n' */
again: again:
if (fflush(Imgdisplay_wf) != 0) { if (fflush(Imgdisplay_wf) != 0) {
switch (errno) { switch (errno) {
case EINTR: case EINTR:
@@ -225,7 +226,7 @@ drawImage()
} }
if (!draw) if (!draw)
return; return;
fputs("3;\n", Imgdisplay_wf); /* XSync() */ fputs("3;\n", Imgdisplay_wf); /* XSync() */
fputs("4;\n", Imgdisplay_wf); /* put '\n' */ fputs("4;\n", Imgdisplay_wf); /* put '\n' */
again2: again2:
if (fflush(Imgdisplay_wf) != 0) { if (fflush(Imgdisplay_wf) != 0) {
@@ -238,18 +239,18 @@ drawImage()
} }
if (!fgetc(Imgdisplay_rf)) if (!fgetc(Imgdisplay_rf))
goto err; goto err;
/* /*
touch_line(); * touch_line();
touch_column(CurColumn); * touch_column(CurColumn);
#ifdef JP_CHARSET * #ifdef JP_CHARSET
if (CurColumn > 0 && * if (CurColumn > 0 &&
CHMODE(ScreenImage[CurLine]->lineprop[CurColumn]) == C_WCHAR2) * CHMODE(ScreenImage[CurLine]->lineprop[CurColumn]) == C_WCHAR2)
touch_column(CurColumn - 1); * touch_column(CurColumn - 1);
else if (CurColumn < COLS - 1 && * else if (CurColumn < COLS - 1 &&
CHMODE(ScreenImage[CurLine]->lineprop[CurColumn]) == C_WCHAR1) * CHMODE(ScreenImage[CurLine]->lineprop[CurColumn]) == C_WCHAR1)
touch_column(CurColumn + 1); * touch_column(CurColumn + 1);
#endif * #endif
*/ */
touch_cursor(); touch_cursor();
refresh(); refresh();
return; return;
@@ -422,11 +423,11 @@ loadImage(int flag)
ImageCache * ImageCache *
getImage(Image * image, ParsedURL *current, int flag) getImage(Image * image, ParsedURL *current, int flag)
{ {
Str key; Str key = NULL;
ImageCache *cache; ImageCache *cache;
if (!activeImage) if (!activeImage)
return; return NULL;
if (!image_hash) if (!image_hash)
image_hash = newHash_sv(100); image_hash = newHash_sv(100);
if (image->cache) if (image->cache)
@@ -491,8 +492,8 @@ getImageSize(ImageCache * cache)
tmp = Strnew(); tmp = Strnew();
if (!strchr(Imgsize, '/')) if (!strchr(Imgsize, '/'))
Strcat_m_charp(tmp, LIB_DIR, "/", NULL); Strcat_m_charp(tmp, LIB_DIR, "/", NULL);
Strcat_m_charp(tmp, Imgsize, " ", shell_quote(cache->file), " 2> /dev/null", Strcat_m_charp(tmp, Imgsize, " ", shell_quote(cache->file),
NULL); " 2> /dev/null", NULL);
f = popen(tmp->ptr, "r"); f = popen(tmp->ptr, "r");
if (!f) if (!f)
return 0; return 0;
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: inflate.c,v 1.6 2002/01/31 15:26:19 ukai Exp $ */ /* $Id: inflate.c,v 1.7 2002/01/31 18:28:24 ukai Exp $ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <zlib.h> #include <zlib.h>
@@ -52,7 +52,7 @@ main(int argc, char **argv)
fwrite(outbuf, 1, sizeof(outbuf) - s.avail_out, stdout); fwrite(outbuf, 1, sizeof(outbuf) - s.avail_out, stdout);
break; break;
} }
if (status == Z_DATA_ERROR && ! retry++) { if (status == Z_DATA_ERROR && !retry++) {
status = inflateReset(&s); status = inflateReset(&s);
if (status != Z_OK) { if (status != Z_OK) {
fprintf(stderr, "%s: inflateReset() %s\n", argv[0], fprintf(stderr, "%s: inflateReset() %s\n", argv[0],
+5 -1
View File
@@ -1,4 +1,4 @@
/* $Id: map.c,v 1.5 2002/01/31 17:54:52 ukai Exp $ */ /* $Id: map.c,v 1.6 2002/01/31 18:28:24 ukai Exp $ */
/* /*
* client-side image maps * client-side image maps
*/ */
@@ -69,7 +69,9 @@ follow_map_menu(Buffer *buf, struct parsed_tagarg *arg, Anchor *a_img, int x,
char *name; char *name;
int i, n, selected = -1, initial; int i, n, selected = -1, initial;
char **label; char **label;
#ifdef USE_IMAGE
int px, py, map = 0; int px, py, map = 0;
#endif
name = tag_get_value(arg, "link"); name = tag_get_value(arg, "link");
if (name == NULL) if (name == NULL)
@@ -195,8 +197,10 @@ newMapArea(char *url, char *alt, char *shape, char *coords)
{ {
MapArea *a = New(MapArea); MapArea *a = New(MapArea);
#ifdef MENU_MAP #ifdef MENU_MAP
#ifdef USE_IMAGE
char *p; char *p;
int i, max; int i, max;
#endif
#endif #endif
a->url = url; a->url = url;
+4 -1
View File
@@ -1,4 +1,4 @@
/* $Id: proto.h,v 1.33 2002/01/31 17:54:56 ukai Exp $ */ /* $Id: proto.h,v 1.34 2002/01/31 18:28:24 ukai Exp $ */
/* /*
* This file was automatically generated by version 1.7 of cextract. * This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended. * Manual editing not recommended.
@@ -485,6 +485,9 @@ extern char *reAnchorNews(Buffer *buf, char *re);
extern void addMultirowsForm(Buffer *buf, AnchorList *al); extern void addMultirowsForm(Buffer *buf, AnchorList *al);
extern Anchor *closest_next_anchor(AnchorList *a, Anchor *an, int x, int y); extern Anchor *closest_next_anchor(AnchorList *a, Anchor *an, int x, int y);
extern Anchor *closest_prev_anchor(AnchorList *a, Anchor *an, int x, int y); extern Anchor *closest_prev_anchor(AnchorList *a, Anchor *an, int x, int y);
#ifdef USE_IMAGE
void addMultirowsImg(Buffer *buf, AnchorList *al);
#endif
extern HmarkerList *putHmarker(HmarkerList *ml, int line, int pos, int seq); extern HmarkerList *putHmarker(HmarkerList *ml, int line, int pos, int seq);
extern Str decodeB(char **ww); extern Str decodeB(char **ww);
extern Str decodeQ(char **ww); extern Str decodeQ(char **ww);
+11 -10
View File
@@ -1,4 +1,4 @@
/* $Id: w3mimgdisplay.c,v 1.1 2002/01/31 17:54:57 ukai Exp $ */ /* $Id: w3mimgdisplay.c,v 1.2 2002/01/31 18:28:24 ukai Exp $ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <Imlib.h> #include <Imlib.h>
@@ -104,14 +104,15 @@ main(int argc, char **argv)
XQueryTree(display, window, &root, &parent, &children, &nchildren); XQueryTree(display, window, &root, &parent, &children, &nchildren);
if (defined_debug) if (defined_debug)
fprintf(stderr, fprintf(stderr,
"window=%x root=%x parent=%x nchildren=%d width=%d height=%d\n", "window=%lx root=%lx parent=%lx nchildren=%d width=%d height=%d\n",
window, root, parent, nchildren, width, height); (unsigned long)window, (unsigned long)root,
(unsigned long)parent, nchildren, width, height);
p_window = window; p_window = window;
for (i = 0; i < nchildren; i++) { for (i = 0; i < nchildren; i++) {
XGetWindowAttributes(display, children[i], &attr); XGetWindowAttributes(display, children[i], &attr);
if (defined_debug) if (defined_debug)
fprintf(stderr, fprintf(stderr,
"children[%d]=%x x=%d y=%d width=%d height=%d\n", i, "children[%d]=%lx x=%d y=%d width=%d height=%d\n", i,
children[i], attr.x, attr.y, attr.width, attr.height); children[i], attr.x, attr.y, attr.width, attr.height);
if (attr.width > width * 0.7 && attr.height > height * 0.7) { if (attr.width > width * 0.7 && attr.height > height * 0.7) {
/* maybe text window */ /* maybe text window */
@@ -129,7 +130,7 @@ main(int argc, char **argv)
if (attr.x <= 0 && attr.width < 30 && attr.height > height * 0.7) { if (attr.x <= 0 && attr.width < 30 && attr.height > height * 0.7) {
if (defined_debug) if (defined_debug)
fprintf(stderr, fprintf(stderr,
"children[%d]=%x x=%d y=%d width=%d height=%d\n", "children[%d]=%lx x=%d y=%d width=%d height=%d\n",
i, children[i], attr.x, attr.y, attr.width, i, children[i], attr.x, attr.y, attr.width,
attr.height); attr.height);
/* scrollbar of xterm/kterm ? */ /* scrollbar of xterm/kterm ? */
@@ -165,9 +166,9 @@ main(int argc, char **argv)
XDestroyImage(i); XDestroyImage(i);
XFreeGC(display, gc); XFreeGC(display, gc);
XFreePixmap(display, p); XFreePixmap(display, p);
/* /*
background_pixel = WhitePixel(display, 0); * background_pixel = WhitePixel(display, 0);
*/ */
} }
while (fgets(buf, sizeof(buf), stdin) != NULL) { while (fgets(buf, sizeof(buf), stdin) != NULL) {
@@ -319,11 +320,11 @@ DrawImage(char *buf, int redraw)
imageBuf = (Image *) realloc((void *)imageBuf, imageBuf = (Image *) realloc((void *)imageBuf,
sizeof(Image) * maxImage); sizeof(Image) * maxImage);
for (; i < maxImage; i++) for (; i < maxImage; i++)
imageBuf[i].pixmap = NULL; imageBuf[i].pixmap = (Pixmap) NULL;
} }
if (imageBuf[n].pixmap) { if (imageBuf[n].pixmap) {
XFreePixmap(display, imageBuf[n].pixmap); XFreePixmap(display, imageBuf[n].pixmap);
imageBuf[n].pixmap = NULL; imageBuf[n].pixmap = (Pixmap) NULL;
} }
im = Imlib_load_image(id, p); im = Imlib_load_image(id, p);