Commit 39b76a7b authored by Bernhard Link's avatar Bernhard Link

make numpages and nummedia signed to avoid warnings

As numpages and nummedia are usually compared to int
and assigned to them, the bigger unsigned values cannot
be used anway, so make them int to avoid all kind of warnings.

Also remove some casts no longer necessary due to that.
parent 0b7b4993
......@@ -112,7 +112,7 @@ doc_putPageInRange(d,pagenumber)
{
BEGINMESSAGE(doc_putPageInRange)
if (d && d->structured) {
if (pagenumber >= (int)(d->numpages)) pagenumber = ((int)d->numpages)-1;
if (pagenumber >= d->numpages) pagenumber = d->numpages-1;
if (pagenumber < 0) pagenumber = 0;
} else pagenumber = 0;
ENDMESSAGE(doc_putPageInRange)
......@@ -164,7 +164,7 @@ doc_boundingBoxOfPage(d,pagenumber,llxP,llyP,urxP,uryP)
retry=1;
# define BB_VALID (dbb[URX]>dbb[LLX] && dbb[URY]>dbb[LLY])
if (d->structured && 0<=pagenumber && pagenumber<(int)d->numpages)
if (d->structured && 0<=pagenumber && pagenumber<d->numpages)
{ dbb = d->pages[pagenumber].boundingbox; if BB_VALID retry=0; }
if (retry && d->structured)
{ dbb = d->default_page_boundingbox; if BB_VALID retry=0; }
......@@ -206,11 +206,11 @@ doc_preferredMediaOfPage(d,pagenumber,llxP,llyP,urxP,uryP)
}
found=0;
if (!found && d->structured && 0<=pagenumber && pagenumber<(int)d->numpages)
if (!found && d->structured && 0<=pagenumber && pagenumber<d->numpages)
{ media = (Media) d->pages[pagenumber].media; if (media) found=1; }
if (!found)
{ media = (Media) d->default_page_media; if (media) found=1; }
if (d->structured && 0<=pagenumber && pagenumber<(int)d->numpages)
if (d->structured && 0<=pagenumber && pagenumber<d->numpages)
{ dbb = d->pages[pagenumber].boundingbox; if BB_VALID found=-1; }
if (!found && d->structured)
{ dbb = d->default_page_boundingbox; if BB_VALID found=-1; }
......@@ -264,7 +264,7 @@ doc_preferredOrientationOfPage(d,page)
BEGINMESSAGE(doc_preferredOrientationOfPage)
o = O_UNSPECIFIED;
if (d) {
if (d->structured && 0<=page && page<(int)d->numpages && d->pages[page].orientation != O_UNSPECIFIED)
if (d->structured && 0<=page && page<d->numpages && d->pages[page].orientation != O_UNSPECIFIED)
o = d->pages[page].orientation;
else if (d->default_page_orientation != O_UNSPECIFIED)
o = d->default_page_orientation;
......@@ -290,7 +290,7 @@ doc_convStringToPage(d,pageLabel)
BEGINMESSAGE(doc_convStringToPage)
page=-1;
if (pageLabel && d && d->labels_useful) for (i=0; i<d->numpages; i++) {
if (d->pageorder == DESCEND) j = (int)d->numpages-1-i;
if (d->pageorder == DESCEND) j = d->numpages-1-i;
else j = i;
if (!strcmp(pageLabel,d->pages[j].label)) { page=i; break; }
}
......
......@@ -605,11 +605,11 @@ render_page(Widget gvw)
XtSetSensitive(w_prevPage, current_page != 0);
}
if (show_nextPage) {
if (current_page == (int)doc->numpages-1) ButtonReset(w_nextPage,NULL,NULL,NULL);
XtSetSensitive(w_nextPage, current_page != (int)doc->numpages-1);
if (current_page == doc->numpages-1) ButtonReset(w_nextPage,NULL,NULL,NULL);
XtSetSensitive(w_nextPage, current_page != doc->numpages-1);
}
XtSetSensitive(prevEntry, current_page != 0);
XtSetSensitive(nextEntry, current_page != (int)doc->numpages-1);
XtSetSensitive(nextEntry, current_page != doc->numpages-1);
}
{
int n = doc ? doc->nummedia : 0;
......@@ -1022,7 +1022,7 @@ setup_ghostview(void)
int i=0;
if (toc_text) {
s = (char*)XtMalloc((doc->numpages+1)*sizeof(char));
while (i < (int)doc->numpages) {
while (i < doc->numpages) {
s[i] = 'p';
i++;
}
......
......@@ -341,7 +341,7 @@ psscan(FILE **fileP, char *filename, char *filename_raw, char **filename_dscP, c
int page_media_set = NONE;
int preread; /* flag which tells the readline isn't needed */
int i;
unsigned int maxpages = 0;
int maxpages = 0;
unsigned int nextpage = 1; /* Next expected page */
unsigned int thispage;
int ignore = 0; /* whether to ignore page ordinals */
......
......@@ -73,10 +73,10 @@ typedef struct document {
int default_page_boundingbox[4];
int orientation; /* PORTRAIT, LANDSCAPE */
int default_page_orientation; /* PORTRAIT, LANDSCAPE */
unsigned int nummedia;
int nummedia;
struct documentmedia *media;
Media default_page_media;
unsigned int numpages;
int numpages;
struct page *pages;
} *Document;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment