diff -Nru pinfo-0.6.12/configure.ac pinfo-0.6.13/configure.ac --- pinfo-0.6.12/configure.ac 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/configure.ac 2019-02-16 20:23:32.000000000 +0000 @@ -25,7 +25,7 @@ # # init -AC_INIT([pinfo],[0.6.12],[https://github.com/baszoetekouw/pinfo]) +AC_INIT([pinfo],[0.6.13],[https://github.com/baszoetekouw/pinfo]) # require a recent autoconf AC_PREREQ([2.69]) # for identification of derived ./configure scripts @@ -119,7 +119,7 @@ # curses AX_WITH_CURSES -if test "x$ax_cv_ncursesw" != xyes && test "x$ax_cv_ncurses" != xyes; then +if test "x$ax_cv_curses" != xyes; then AC_MSG_ERROR([requires a (n)curses library]) fi # check for some functions in curses diff -Nru pinfo-0.6.12/debian/changelog pinfo-0.6.13/debian/changelog --- pinfo-0.6.12/debian/changelog 2019-02-11 14:59:41.000000000 +0000 +++ pinfo-0.6.13/debian/changelog 2019-02-16 20:28:19.000000000 +0000 @@ -1,3 +1,12 @@ +pinfo (0.6.13-1) sid; urgency=medium + + * New upstream release + - Fix crash on some architectures (Closes: #922455) + * Remove patch 0001-Fix-signed-unsigned-comparisons-causing-Wsign-compar.patch + (included in upstream) + + -- Bas Zoetekouw Sat, 16 Feb 2019 21:28:19 +0100 + pinfo (0.6.12-2) unstable; urgency=medium * Fix build failures on 32 bit architectures (fixed signed/unsigned comparison) diff -Nru pinfo-0.6.12/debian/patches/0001-Fix-signed-unsigned-comparisons-causing-Wsign-compar.patch pinfo-0.6.13/debian/patches/0001-Fix-signed-unsigned-comparisons-causing-Wsign-compar.patch --- pinfo-0.6.12/debian/patches/0001-Fix-signed-unsigned-comparisons-causing-Wsign-compar.patch 2019-02-11 14:59:32.000000000 +0000 +++ pinfo-0.6.13/debian/patches/0001-Fix-signed-unsigned-comparisons-causing-Wsign-compar.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,546 +0,0 @@ -From 76cf55dc46c97d3126385c44872cf647b27acb5f Mon Sep 17 00:00:00 2001 -From: Bas Zoetekouw -Date: Mon, 11 Feb 2019 15:48:46 +0100 -Subject: [PATCH 1/2] Fix signed/unsigned comparisons (causing -Wsign-compare - warnings) - ---- - src/datatypes.c | 2 +- - src/datatypes.h | 2 +- - src/filehandling_functions.c | 24 ++++++++++-------------- - src/filehandling_functions.h | 10 +++++----- - src/initializelinks.c | 7 ++++++- - src/mainfunction.c | 31 ++++++++++++++++++------------- - src/mainfunction.h | 2 +- - src/manual.c | 23 +++++++++++++---------- - src/pinfo.c | 2 +- - src/printinfo.c | 2 +- - src/printinfo.h | 2 +- - src/video.c | 14 +++++++------- - src/video.h | 2 +- - 13 files changed, 66 insertions(+), 57 deletions(-) - -diff --git a/src/datatypes.c b/src/datatypes.c -index ef9fadf..352b9a6 100644 ---- a/src/datatypes.c -+++ b/src/datatypes.c -@@ -39,7 +39,7 @@ char *tmpfilename2 = 0; - SearchAgain searchagain; - - HyperObject *hyperobjects = 0; --unsigned hyperobjectcount = 0; -+unsigned long hyperobjectcount = 0; - - Indirect *indirect = 0; - TagTable *tag_table = 0; -diff --git a/src/datatypes.h b/src/datatypes.h -index 37a04b5..7247533 100644 ---- a/src/datatypes.h -+++ b/src/datatypes.h -@@ -123,7 +123,7 @@ extern SearchAgain searchagain; - - /* an array of references for info */ - extern HyperObject *hyperobjects; --extern unsigned hyperobjectcount; -+extern unsigned long hyperobjectcount; - /* an array of indirect entries [1 to n] */ - extern Indirect *indirect; - /* number of indirect entries */ -diff --git a/src/filehandling_functions.c b/src/filehandling_functions.c -index 0d8b62c..98fdac8 100644 ---- a/src/filehandling_functions.c -+++ b/src/filehandling_functions.c -@@ -134,7 +134,7 @@ matchfile(char **buf, char *name) - } - - FILE * --dirpage_lookup(char **type, char ***message, long *lines, -+dirpage_lookup(char **type, char ***message, unsigned long *lines, - char *filename, char **first_node) - { - #define Type (*type) -@@ -145,7 +145,6 @@ dirpage_lookup(char **type, char ***message, long *lines, - int goodHit = 0; - char name[256]; - char file[256]; -- int i; - char *nameend, *filestart, *fileend, *dot; - - id = opendirfile(0); -@@ -155,7 +154,7 @@ dirpage_lookup(char **type, char ***message, long *lines, - read_item(id, type, message, lines); - - /* search for node-links in every line */ -- for (i = 1; i < Lines; i++) -+ for (unsigned long i = 1; i < Lines; i++) - { - if ( (Message[i][0] == '*') && (Message[i][1] == ' ') - && ( nameend = strchr(Message[i], ':') ) -@@ -221,12 +220,11 @@ dirpage_lookup(char **type, char ***message, long *lines, - } - - void --freeitem(char **type, char ***buf, long *lines) -+freeitem(char **type, char ***buf, unsigned long *lines) - { - #define Type (*type) - #define Buf (*buf) - #define Lines (*lines) -- long i; - - if (Type != 0) - { -@@ -235,7 +233,7 @@ freeitem(char **type, char ***buf, long *lines) - } - if (Buf != 0) - { -- for (i = 1; i <= Lines; i++) -+ for (unsigned long i = 1; i <= Lines; i++) - if (Buf[i] != 0) - { - xfree(Buf[i]); -@@ -250,7 +248,7 @@ freeitem(char **type, char ***buf, long *lines) - } - - void --read_item(FILE * id, char **type, char ***buf, long *lines) -+read_item(FILE * id, char **type, char ***buf, unsigned long *lines) - { - - #define Type (*type) -@@ -341,13 +339,12 @@ read_item(FILE * id, char **type, char ***buf, long *lines) - - } - void --load_indirect(char **message, long lines) -+load_indirect(char **message, unsigned long lines) - { -- long i; - char *wsk; - int cut = 0; /* number of invalid entries */ - indirect = xmalloc((lines + 1) * sizeof(Indirect)); -- for (i = 1; i < lines; i++) -+ for (unsigned long i = 1; i < lines; i++) - { - char *check; - wsk = message[i]; -@@ -374,9 +371,8 @@ load_indirect(char **message, long lines) - } - - void --load_tag_table(char **message, long lines) -+load_tag_table(char **message, unsigned long lines) - { -- long i; - char *wsk, *wsk1; - int is_indirect = 0; - register unsigned int j; -@@ -390,7 +386,7 @@ load_tag_table(char **message, long lines) - if (strcasecmp("(Indirect)", message[1]) == 0) - is_indirect = 1; - tag_table = xmalloc((lines + 1) * sizeof(TagTable)); -- for (i = 1; i < lines - is_indirect; i++) -+ for (unsigned long i = 1; i < lines - is_indirect; i++) - { - char *check; - wsk = message[i + is_indirect]; -@@ -432,7 +428,7 @@ load_tag_table(char **message, long lines) - /* FIXME: info should ALWAYS start at the 'Top' node, not at the first - mentioned node(vide ocaml.info) */ - -- for (i = 1; i <= TagTableEntries; i++) -+ for (unsigned int i = 1; i <= TagTableEntries; i++) - { - if (strcasecmp(tag_table[i].nodename, "Top") == 0) - { -diff --git a/src/filehandling_functions.h b/src/filehandling_functions.h -index 8501482..00c0040 100644 ---- a/src/filehandling_functions.h -+++ b/src/filehandling_functions.h -@@ -42,14 +42,14 @@ int seeknode (int tag_table_pos, FILE ** Id); - * free allocated memory, hold by buf (node** content, stored line by line), - * and type (a char* pointer, which stores the node header). - */ --void freeitem (char **type, char ***buf, long *lines); -+void freeitem (char **type, char ***buf, unsigned long *lines); - - /* - * reads a node from 'id' to 'buf', and the header of node to 'type'. It sets - * the numer of read lines to *lines. Warning! First line of 'buf' is left - * empty. - */ --void read_item (FILE * id, char **type, char ***buf, long *lines); -+void read_item (FILE * id, char **type, char ***buf, unsigned long *lines); - /* searches for indirect entry of info file */ - int seek_indirect (FILE * id); - /* as above, but with tag table entry */ -@@ -58,9 +58,9 @@ int seek_tag_table (FILE * id,int quiet); - * loads indirect table (from a special node, stored in message, of lines - * length) - */ --void load_indirect (char **message, long lines); -+void load_indirect (char **message, unsigned long lines); - /* loads tag table (as above) */ --void load_tag_table (char **message, long lines); -+void load_tag_table (char **message, unsigned long lines); - /* opens info file */ - FILE *openinfo (char *filename, int number); - /* opens dir info file */ -@@ -82,7 +82,7 @@ void create_indirect_tag_table (); - * lines: pointer to long, which holds the number of lines in dir entry - */ - FILE * --dirpage_lookup (char **type, char ***message, long *lines, -+dirpage_lookup (char **type, char ***message, unsigned long *lines, - char *filename, char **first_node); - - /* removes trailing .gz, .bz2, etc. */ -diff --git a/src/initializelinks.c b/src/initializelinks.c -index 7bce85f..c45e3e6 100644 ---- a/src/initializelinks.c -+++ b/src/initializelinks.c -@@ -95,6 +95,7 @@ freelinks() /* frees space allocated previously by node-links */ - /* - * Finds url end. It is recognized by an invalid character. - */ -+/* TODO: fix possible string overflow (no bounds checking) */ - char * - findurlend(char *str) - { -@@ -108,12 +109,14 @@ findurlend(char *str) - if (*(end - 1) == '.') - end--; - } -+ assert(end>=str); - return end; - } - - /* - * Searchs for a note/menu delimiter. it may be dot, comma, tab, or newline. - */ -+/* TODO: fix possible string overflow (no bounds checking) */ - char * - finddot(char *str, int mynote) - { -@@ -153,6 +156,7 @@ finddot(char *str, int mynote) - if ((end[i] < closest) &&(end[i])) - closest = end[i]; - } -+ assert(closest>=str); - return closest; - } - -@@ -160,6 +164,7 @@ finddot(char *str, int mynote) - * Moves you to the beginning of username in email address. If username has - * length=0, NULL is returned. - */ -+/* TODO: fix possible string overflow (no bounds checking) */ - char * - findemailstart(char *str) - { -@@ -194,7 +199,7 @@ initializelinks(char *line1, char *line2, int line) - char *quotestart = 0, *quoteend = 0; - char *buf = xmalloc(strlen(line1) + strlen(line2) + 1); - /* required to sort properly the hyperlinks from current line only */ -- long initialhyperobjectcount = hyperobjectcount; -+ unsigned long initialhyperobjectcount = hyperobjectcount; - int changed; - int line1len = strlen(line1); - -diff --git a/src/mainfunction.c b/src/mainfunction.c -index 61044f0..78762e6 100644 ---- a/src/mainfunction.c -+++ b/src/mainfunction.c -@@ -36,7 +36,9 @@ int aftersearch = 0; - * caused by the sequential auto-pgdn reading code - */ - int toggled_by_menu = 0; --long pos, cursor, infomenu, infocolumn=0; -+unsigned pos; -+long cursor; -+long infomenu, infocolumn=0; - - /* strdup src string, but when doing so, strip leading/trailing spaces and - * substitute multiple spaces with a single space. This is needed when *Node -@@ -65,7 +67,7 @@ canonical_strdup(const char *src) - } - - WorkRVal --work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) -+work(char ***message, char **type, unsigned long *lines, FILE * id, int tag_table_pos) - { - #define Message (*message) - #define Lines (*lines) -@@ -102,7 +104,7 @@ work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) - #endif /* getmaxyx */ - /* free memory allocated previously by hypertext links */ - freelinks(); -- for (unsigned i = 1; i < Lines; i++) /* initialize node-links for every line */ -+ for (unsigned long i = 1; i < Lines; i++) /* initialize node-links for every line */ - { - initializelinks(Message[i], Message[i + 1], i); - } -@@ -212,7 +214,7 @@ work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) - if ((key == keys.goline_1) || - (key == keys.goline_2)) - { -- long newpos; -+ unsigned long newpos; - attrset(bottomline); /* read user's value */ - move(maxy - 1, 0); - echo(); -@@ -269,7 +271,7 @@ work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) - mypipe = popen(token, "w"); /* open mypipe */ - if (mypipe != NULL) - { -- for (unsigned i = 1; i <= Lines; i++) /* and flush the msg to stdin */ -+ for (unsigned long i = 1; i <= Lines; i++) /* and flush the msg to stdin */ - fprintf(mypipe, "%s", Message[i]); - pclose(mypipe); - getchar(); -@@ -607,7 +609,7 @@ work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) - - } - /* scan for the token in the following lines. */ -- for (unsigned i = pos + 1; i < Lines; i++) -+ for (unsigned long i = pos + 1; i < Lines; i++) - { - tmp = xmalloc(strlen(Message[i]) + strlen(Message[i + 1]) + 2); - /* -@@ -867,7 +869,7 @@ skip_search: - if (pos > 1) /* lower the nodepos */ - pos--; - /* and scan for a hyperlink in the new line */ -- for (unsigned i = 0; i < hyperobjectcount; i++) -+ for (unsigned long i = 0; i < hyperobjectcount; i++) - { - if (hyperobjects[i].line == pos) - { -@@ -945,8 +947,10 @@ skip_search: - (key == keys.down_2)) /* top+bottom line \|/ */ - { - cursorchanged = 0; /* works similar to keys.up */ -- if (cursor < hyperobjectcount) -- for (unsigned i = cursor + 1; i < hyperobjectcount; i++) -+ if (cursor < 0) cursor = -1; -+ if (cursor < 0 || (unsigned long) cursor < hyperobjectcount) -+ { -+ for (unsigned long i = (unsigned long) (cursor + 1); i < hyperobjectcount; i++) - { - if ((hyperobjects[i].line >= pos) && - (hyperobjects[i].line < pos +(maxy - 2))) -@@ -959,11 +963,12 @@ skip_search: - } - } - } -+ } - if (!cursorchanged) - { - if (pos <= Lines -(maxy - 2)) - pos++; -- for (unsigned i = cursor + 1; i < hyperobjectcount; i++) -+ for (unsigned long i = cursor + 1; i < hyperobjectcount; i++) - { - if ((hyperobjects[i].line >= pos) && - (hyperobjects[i].line < pos +(maxy - 2))) -@@ -1021,7 +1026,7 @@ skip_search: - infohistory.menu[infohistory.length] = infomenu; - if (!toggled_by_menu) - infohistory.menu[infohistory.length] = cursor; -- if ((cursor >= 0) &&(cursor < hyperobjectcount)) -+ if ((cursor >= 0) && ((unsigned long) cursor < hyperobjectcount)) - if ( - ( (hyperobjects[cursor].line >= pos) - && (hyperobjects[cursor].line < pos +(maxy - 2) ) -@@ -1227,7 +1232,7 @@ next_infomenu() - infomenu = -1; - return; - } -- for (unsigned i = infomenu + 1; i < hyperobjectcount; i++) -+ for (unsigned long i = infomenu + 1; i < hyperobjectcount; i++) - { - if (hyperobjects[i].type <= 1) /* menu item */ - { -@@ -1241,7 +1246,7 @@ next_infomenu() - void - rescan_cursor() - { -- for (unsigned i = 0; i < hyperobjectcount; i++) -+ for (unsigned long i = 0; i < hyperobjectcount; i++) - { - if ((hyperobjects[i].line >= pos) && - (hyperobjects[i].line < pos +(maxy - 2))) -diff --git a/src/mainfunction.h b/src/mainfunction.h -index bbcf258..e82d6c4 100644 ---- a/src/mainfunction.h -+++ b/src/mainfunction.h -@@ -46,6 +46,6 @@ extern int aftersearch; - * id: file descriptor of current info file - * tag_table_pos: position in tag table of the current node (needed for history) - */ --WorkRVal work (char ***message, char **type, long *lines, -+WorkRVal work (char ***message, char **type, unsigned long *lines, - FILE * id, int tag_table_pos); - #endif -diff --git a/src/manual.c b/src/manual.c -index 18a769c..5f058ff 100644 ---- a/src/manual.c -+++ b/src/manual.c -@@ -739,7 +739,7 @@ man_initializelinks(char *tmp, int carry) - int tmpcnt = strlen(tmp) + 1; - char *mylink = tmp; - char *urlstart, *urlend; -- long initialManualLinks = ManualLinks; -+ unsigned initialManualLinks = ManualLinks; - int i, b; - /****************************************************************************** - * handle url refrences * -@@ -1073,7 +1073,7 @@ manualwork() - { - newpos = atol(token); - newpos -=(maxy - 1); -- if ((newpos >= 0) &&(newpos < ManualLines -(maxy - 2))) -+ if ((newpos >= 0) && ((unsigned long) newpos < ManualLines - (maxy - 2))) - manualpos = newpos; - else if (newpos > 0) - manualpos = ManualLines -(maxy - 2); -@@ -1849,19 +1849,22 @@ add_highlights() - * to the line defined in manlinks(line+1) - */ - char *tmpstr = strdup(manual[ltline]); -- char *wsk = tmpstr, *wskend; -+ unsigned long k = 0; -+ char *wskend; - strip_manual(tmpstr); - /* skip spaces */ -- while (isspace(*wsk)) -- wsk++; -+ while (isspace(tmpstr[k])) -+ k++; - /* find the end of url */ -- wskend = findurlend(wsk); -+ wskend = findurlend(tmpstr+k); -+ if (wskendmanualcol) -diff --git a/src/pinfo.c b/src/pinfo.c -index 7df4f6e..0048860 100644 ---- a/src/pinfo.c -+++ b/src/pinfo.c -@@ -52,7 +52,7 @@ main(int argc, char *argv[]) - int command_line_option; - FILE *id = NULL; - /* line count in message */ -- long lines = 0; -+ unsigned long lines = 0; - /* this will hold node's text */ - char **message = 0; - /* this will hold the node's header */ -diff --git a/src/printinfo.c b/src/printinfo.c -index 6083084..1f52110 100644 ---- a/src/printinfo.c -+++ b/src/printinfo.c -@@ -27,7 +27,7 @@ - * are darker than the rest :) - */ - void --printnode(char ***message, long *lines) -+printnode(char ***message, unsigned long *lines) - { - #define Message (*message) - #define Lines (*lines) -diff --git a/src/printinfo.h b/src/printinfo.h -index 632248b..c44c69c 100644 ---- a/src/printinfo.h -+++ b/src/printinfo.h -@@ -23,6 +23,6 @@ - #define PRINTINFO_H - - /* prints node, pointed by `message', of `lines' length. */ --void printnode (char ***message, long *lines); -+void printnode (char ***message, unsigned long *lines); - - #endif -diff --git a/src/video.c b/src/video.c -index 2e0198c..f6b444a 100644 ---- a/src/video.c -+++ b/src/video.c -@@ -23,7 +23,7 @@ - - #include "common_includes.h" - --void info_add_highlights(unsigned pos, unsigned cursor, long lines, unsigned column, char **message); -+void info_add_highlights(unsigned pos, unsigned cursor, unsigned long lines, unsigned column, char **message); - - void - substitutestr(char *src, char *dest, char *from, char *to) -@@ -74,9 +74,8 @@ addtopline(char *type, int column) - } - - void --showscreen(char **message, long lines, long pos, long cursor, int column) -+showscreen(char **message, unsigned long lines, unsigned long pos, long cursor, int column) - { -- long i; - #ifdef getmaxyx - getmaxyx(stdscr, maxy, maxx); - #endif -@@ -84,7 +83,7 @@ showscreen(char **message, long lines, long pos, long cursor, int column) - bkgdset(' ' | normal); - #endif - attrset(normal); -- for (i = pos;(i < lines) &&(i < pos + maxy - 2); i++) -+ for (unsigned long i = pos; (i < lines) && (i < pos + maxy - 2); i++) - { - int tmp; - -@@ -142,9 +141,9 @@ info_addstr(int y, int x, char *txt, int column, int txtlen) - } - - void --info_add_highlights(unsigned pos, unsigned cursor, long lines, unsigned column, char **message) -+info_add_highlights(unsigned pos, unsigned cursor, unsigned long lines, unsigned column, char **message) - { -- for (unsigned i = 0; i < hyperobjectcount; i++) -+ for (unsigned long i = 0; i < hyperobjectcount; i++) - { - if ((hyperobjects[i].line >= pos) && - (hyperobjects[i].line < pos +(maxy - 2))) -@@ -260,7 +259,8 @@ info_add_highlights(unsigned pos, unsigned cursor, long lines, unsigned column, - if ((h_regexp_num) ||(aftersearch)) - { - regmatch_t pmatch[1]; -- long maxpos = pos +(maxy - 2); -+ if (maxy<2) maxy=2; -+ unsigned long maxpos = pos +(maxy - 2); - int maxregexp; - if (maxpos > lines) - { -diff --git a/src/video.h b/src/video.h -index fc159ed..33838e6 100644 ---- a/src/video.h -+++ b/src/video.h -@@ -23,7 +23,7 @@ - #ifndef __VIDEO_H - #define __VIDEO_H - /* paints the screen while viewing info file */ --void showscreen (char **message, long lines, long pos, -+void showscreen (char **message, unsigned long lines, unsigned long pos, - long cursor, int column); - /* prints unselected menu option */ - void mvaddstr_menu (int y, int x, char *line, int linenumber); --- -2.20.1 - diff -Nru pinfo-0.6.12/debian/patches/series pinfo-0.6.13/debian/patches/series --- pinfo-0.6.12/debian/patches/series 2019-02-11 14:59:15.000000000 +0000 +++ pinfo-0.6.13/debian/patches/series 2019-02-16 20:28:19.000000000 +0000 @@ -1 +0,0 @@ -0001-Fix-signed-unsigned-comparisons-causing-Wsign-compar.patch diff -Nru pinfo-0.6.12/doc/Makefile.am pinfo-0.6.13/doc/Makefile.am --- pinfo-0.6.12/doc/Makefile.am 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/doc/Makefile.am 2019-02-16 20:23:32.000000000 +0000 @@ -5,5 +5,5 @@ man_MANS = pinfo.1 info_TEXINFOS = pinfo.texi -CLEANFILES = stamp-vti pinfo.1 pinfo.info +CLEANFILES = stamp-vti pinfo.1 pinfo.info version.texi diff -Nru pinfo-0.6.12/NEWS pinfo-0.6.13/NEWS --- pinfo-0.6.12/NEWS 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/NEWS 2019-02-16 20:23:32.000000000 +0000 @@ -1,3 +1,6 @@ +0.6.13: (2019-02-16) + - Fix crash on 32-bit architectures + 0.6.12: (2019-02-11) - minor release to fix the use of defualt colors (COLOR_DEFAULT) on ncurses installs; COLOR_DEFAULT values in pinforc were silently ignored, causing diff -Nru pinfo-0.6.12/src/datatypes.c pinfo-0.6.13/src/datatypes.c --- pinfo-0.6.12/src/datatypes.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/datatypes.c 2019-02-16 20:23:32.000000000 +0000 @@ -39,7 +39,7 @@ SearchAgain searchagain; HyperObject *hyperobjects = 0; -unsigned hyperobjectcount = 0; +unsigned long hyperobjectcount = 0; Indirect *indirect = 0; TagTable *tag_table = 0; diff -Nru pinfo-0.6.12/src/datatypes.h pinfo-0.6.13/src/datatypes.h --- pinfo-0.6.12/src/datatypes.h 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/datatypes.h 2019-02-16 20:23:32.000000000 +0000 @@ -123,7 +123,7 @@ /* an array of references for info */ extern HyperObject *hyperobjects; -extern unsigned hyperobjectcount; +extern unsigned long hyperobjectcount; /* an array of indirect entries [1 to n] */ extern Indirect *indirect; /* number of indirect entries */ diff -Nru pinfo-0.6.12/src/filehandling_functions.c pinfo-0.6.13/src/filehandling_functions.c --- pinfo-0.6.12/src/filehandling_functions.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/filehandling_functions.c 2019-02-16 20:23:32.000000000 +0000 @@ -134,7 +134,7 @@ } FILE * -dirpage_lookup(char **type, char ***message, long *lines, +dirpage_lookup(char **type, char ***message, unsigned long *lines, char *filename, char **first_node) { #define Type (*type) @@ -145,7 +145,6 @@ int goodHit = 0; char name[256]; char file[256]; - int i; char *nameend, *filestart, *fileend, *dot; id = opendirfile(0); @@ -155,7 +154,7 @@ read_item(id, type, message, lines); /* search for node-links in every line */ - for (i = 1; i < Lines; i++) + for (unsigned long i = 1; i < Lines; i++) { if ( (Message[i][0] == '*') && (Message[i][1] == ' ') && ( nameend = strchr(Message[i], ':') ) @@ -221,12 +220,11 @@ } void -freeitem(char **type, char ***buf, long *lines) +freeitem(char **type, char ***buf, unsigned long *lines) { #define Type (*type) #define Buf (*buf) #define Lines (*lines) - long i; if (Type != 0) { @@ -235,7 +233,7 @@ } if (Buf != 0) { - for (i = 1; i <= Lines; i++) + for (unsigned long i = 1; i <= Lines; i++) if (Buf[i] != 0) { xfree(Buf[i]); @@ -250,7 +248,7 @@ } void -read_item(FILE * id, char **type, char ***buf, long *lines) +read_item(FILE * id, char **type, char ***buf, unsigned long *lines) { #define Type (*type) @@ -341,13 +339,12 @@ } void -load_indirect(char **message, long lines) +load_indirect(char **message, unsigned long lines) { - long i; char *wsk; int cut = 0; /* number of invalid entries */ indirect = xmalloc((lines + 1) * sizeof(Indirect)); - for (i = 1; i < lines; i++) + for (unsigned long i = 1; i < lines; i++) { char *check; wsk = message[i]; @@ -374,9 +371,8 @@ } void -load_tag_table(char **message, long lines) +load_tag_table(char **message, unsigned long lines) { - long i; char *wsk, *wsk1; int is_indirect = 0; register unsigned int j; @@ -390,7 +386,7 @@ if (strcasecmp("(Indirect)", message[1]) == 0) is_indirect = 1; tag_table = xmalloc((lines + 1) * sizeof(TagTable)); - for (i = 1; i < lines - is_indirect; i++) + for (unsigned long i = 1; i < lines - is_indirect; i++) { char *check; wsk = message[i + is_indirect]; @@ -432,7 +428,7 @@ /* FIXME: info should ALWAYS start at the 'Top' node, not at the first mentioned node(vide ocaml.info) */ - for (i = 1; i <= TagTableEntries; i++) + for (unsigned int i = 1; i <= TagTableEntries; i++) { if (strcasecmp(tag_table[i].nodename, "Top") == 0) { @@ -1037,11 +1033,16 @@ /* ok, now we have all the (possibly) revelevant paths in paths[] */ /* now loop over them, see if they are valid and if they are duplicates*/ - inodes = (ino_t *) xmalloc( maxpaths * sizeof(ino_t *) ); + /* TODO: cleanup all malloc calls (get rid of cast, use sizeof(varname) instead of sizeof(type) */ + inodes = (ino_t *) xmalloc( maxpaths * sizeof(ino_t) ); numpaths = 0; len = 0; for (i=0; i< maxpaths; i++) { + /* TODO: check where these NULL paths come from */ + if (paths[i]==NULL) + continue; + /* stat() the dir */ ret = stat( paths[i], &sbuf); /* and see if it could be opened */ diff -Nru pinfo-0.6.12/src/filehandling_functions.h pinfo-0.6.13/src/filehandling_functions.h --- pinfo-0.6.12/src/filehandling_functions.h 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/filehandling_functions.h 2019-02-16 20:23:32.000000000 +0000 @@ -42,14 +42,14 @@ * free allocated memory, hold by buf (node** content, stored line by line), * and type (a char* pointer, which stores the node header). */ -void freeitem (char **type, char ***buf, long *lines); +void freeitem (char **type, char ***buf, unsigned long *lines); /* * reads a node from 'id' to 'buf', and the header of node to 'type'. It sets * the numer of read lines to *lines. Warning! First line of 'buf' is left * empty. */ -void read_item (FILE * id, char **type, char ***buf, long *lines); +void read_item (FILE * id, char **type, char ***buf, unsigned long *lines); /* searches for indirect entry of info file */ int seek_indirect (FILE * id); /* as above, but with tag table entry */ @@ -58,9 +58,9 @@ * loads indirect table (from a special node, stored in message, of lines * length) */ -void load_indirect (char **message, long lines); +void load_indirect (char **message, unsigned long lines); /* loads tag table (as above) */ -void load_tag_table (char **message, long lines); +void load_tag_table (char **message, unsigned long lines); /* opens info file */ FILE *openinfo (char *filename, int number); /* opens dir info file */ @@ -82,7 +82,7 @@ * lines: pointer to long, which holds the number of lines in dir entry */ FILE * -dirpage_lookup (char **type, char ***message, long *lines, +dirpage_lookup (char **type, char ***message, unsigned long *lines, char *filename, char **first_node); /* removes trailing .gz, .bz2, etc. */ diff -Nru pinfo-0.6.12/src/initializelinks.c pinfo-0.6.13/src/initializelinks.c --- pinfo-0.6.12/src/initializelinks.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/initializelinks.c 2019-02-16 20:23:32.000000000 +0000 @@ -95,6 +95,7 @@ /* * Finds url end. It is recognized by an invalid character. */ +/* TODO: fix possible string overflow (no bounds checking) */ char * findurlend(char *str) { @@ -108,12 +109,14 @@ if (*(end - 1) == '.') end--; } + assert(end>=str); return end; } /* * Searchs for a note/menu delimiter. it may be dot, comma, tab, or newline. */ +/* TODO: fix possible string overflow (no bounds checking) */ char * finddot(char *str, int mynote) { @@ -153,6 +156,7 @@ if ((end[i] < closest) &&(end[i])) closest = end[i]; } + assert(closest>=str); return closest; } @@ -160,6 +164,7 @@ * Moves you to the beginning of username in email address. If username has * length=0, NULL is returned. */ +/* TODO: fix possible string overflow (no bounds checking) */ char * findemailstart(char *str) { @@ -194,7 +199,7 @@ char *quotestart = 0, *quoteend = 0; char *buf = xmalloc(strlen(line1) + strlen(line2) + 1); /* required to sort properly the hyperlinks from current line only */ - long initialhyperobjectcount = hyperobjectcount; + unsigned long initialhyperobjectcount = hyperobjectcount; int changed; int line1len = strlen(line1); diff -Nru pinfo-0.6.12/src/mainfunction.c pinfo-0.6.13/src/mainfunction.c --- pinfo-0.6.12/src/mainfunction.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/mainfunction.c 2019-02-16 20:23:32.000000000 +0000 @@ -36,7 +36,9 @@ * caused by the sequential auto-pgdn reading code */ int toggled_by_menu = 0; -long pos, cursor, infomenu, infocolumn=0; +unsigned pos; +long cursor; +long infomenu, infocolumn=0; /* strdup src string, but when doing so, strip leading/trailing spaces and * substitute multiple spaces with a single space. This is needed when *Node @@ -65,7 +67,7 @@ } WorkRVal -work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) +work(char ***message, char **type, unsigned long *lines, FILE * id, int tag_table_pos) { #define Message (*message) #define Lines (*lines) @@ -102,7 +104,7 @@ #endif /* getmaxyx */ /* free memory allocated previously by hypertext links */ freelinks(); - for (unsigned i = 1; i < Lines; i++) /* initialize node-links for every line */ + for (unsigned long i = 1; i < Lines; i++) /* initialize node-links for every line */ { initializelinks(Message[i], Message[i + 1], i); } @@ -212,7 +214,7 @@ if ((key == keys.goline_1) || (key == keys.goline_2)) { - long newpos; + unsigned long newpos; attrset(bottomline); /* read user's value */ move(maxy - 1, 0); echo(); @@ -269,7 +271,7 @@ mypipe = popen(token, "w"); /* open mypipe */ if (mypipe != NULL) { - for (unsigned i = 1; i <= Lines; i++) /* and flush the msg to stdin */ + for (unsigned long i = 1; i <= Lines; i++) /* and flush the msg to stdin */ fprintf(mypipe, "%s", Message[i]); pclose(mypipe); getchar(); @@ -607,7 +609,7 @@ } /* scan for the token in the following lines. */ - for (unsigned i = pos + 1; i < Lines; i++) + for (unsigned long i = pos + 1; i < Lines; i++) { tmp = xmalloc(strlen(Message[i]) + strlen(Message[i + 1]) + 2); /* @@ -867,7 +869,7 @@ if (pos > 1) /* lower the nodepos */ pos--; /* and scan for a hyperlink in the new line */ - for (unsigned i = 0; i < hyperobjectcount; i++) + for (unsigned long i = 0; i < hyperobjectcount; i++) { if (hyperobjects[i].line == pos) { @@ -945,8 +947,10 @@ (key == keys.down_2)) /* top+bottom line \|/ */ { cursorchanged = 0; /* works similar to keys.up */ - if (cursor < hyperobjectcount) - for (unsigned i = cursor + 1; i < hyperobjectcount; i++) + if (cursor < 0) cursor = -1; + if (cursor < 0 || (unsigned long) cursor < hyperobjectcount) + { + for (unsigned long i = (unsigned long) (cursor + 1); i < hyperobjectcount; i++) { if ((hyperobjects[i].line >= pos) && (hyperobjects[i].line < pos +(maxy - 2))) @@ -959,11 +963,12 @@ } } } + } if (!cursorchanged) { if (pos <= Lines -(maxy - 2)) pos++; - for (unsigned i = cursor + 1; i < hyperobjectcount; i++) + for (unsigned long i = cursor + 1; i < hyperobjectcount; i++) { if ((hyperobjects[i].line >= pos) && (hyperobjects[i].line < pos +(maxy - 2))) @@ -1021,7 +1026,7 @@ infohistory.menu[infohistory.length] = infomenu; if (!toggled_by_menu) infohistory.menu[infohistory.length] = cursor; - if ((cursor >= 0) &&(cursor < hyperobjectcount)) + if ((cursor >= 0) && ((unsigned long) cursor < hyperobjectcount)) if ( ( (hyperobjects[cursor].line >= pos) && (hyperobjects[cursor].line < pos +(maxy - 2) ) @@ -1227,7 +1232,7 @@ infomenu = -1; return; } - for (unsigned i = infomenu + 1; i < hyperobjectcount; i++) + for (unsigned long i = infomenu + 1; i < hyperobjectcount; i++) { if (hyperobjects[i].type <= 1) /* menu item */ { @@ -1241,7 +1246,7 @@ void rescan_cursor() { - for (unsigned i = 0; i < hyperobjectcount; i++) + for (unsigned long i = 0; i < hyperobjectcount; i++) { if ((hyperobjects[i].line >= pos) && (hyperobjects[i].line < pos +(maxy - 2))) diff -Nru pinfo-0.6.12/src/mainfunction.h pinfo-0.6.13/src/mainfunction.h --- pinfo-0.6.12/src/mainfunction.h 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/mainfunction.h 2019-02-16 20:23:32.000000000 +0000 @@ -46,6 +46,6 @@ * id: file descriptor of current info file * tag_table_pos: position in tag table of the current node (needed for history) */ -WorkRVal work (char ***message, char **type, long *lines, +WorkRVal work (char ***message, char **type, unsigned long *lines, FILE * id, int tag_table_pos); #endif diff -Nru pinfo-0.6.12/src/manual.c pinfo-0.6.13/src/manual.c --- pinfo-0.6.12/src/manual.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/manual.c 2019-02-16 20:23:32.000000000 +0000 @@ -739,7 +739,7 @@ int tmpcnt = strlen(tmp) + 1; char *mylink = tmp; char *urlstart, *urlend; - long initialManualLinks = ManualLinks; + unsigned initialManualLinks = ManualLinks; int i, b; /****************************************************************************** * handle url refrences * @@ -1073,7 +1073,7 @@ { newpos = atol(token); newpos -=(maxy - 1); - if ((newpos >= 0) &&(newpos < ManualLines -(maxy - 2))) + if ((newpos >= 0) && ((unsigned long) newpos < ManualLines - (maxy - 2))) manualpos = newpos; else if (newpos > 0) manualpos = ManualLines -(maxy - 2); @@ -1849,19 +1849,22 @@ * to the line defined in manlinks(line+1) */ char *tmpstr = strdup(manual[ltline]); - char *wsk = tmpstr, *wskend; + unsigned long k = 0; + char *wskend; strip_manual(tmpstr); /* skip spaces */ - while (isspace(*wsk)) - wsk++; + while (isspace(tmpstr[k])) + k++; /* find the end of url */ - wskend = findurlend(wsk); + wskend = findurlend(tmpstr+k); + if (wskendmanualcol) diff -Nru pinfo-0.6.12/src/pinfo.c pinfo-0.6.13/src/pinfo.c --- pinfo-0.6.12/src/pinfo.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/pinfo.c 2019-02-16 20:23:32.000000000 +0000 @@ -52,7 +52,7 @@ int command_line_option; FILE *id = NULL; /* line count in message */ - long lines = 0; + unsigned long lines = 0; /* this will hold node's text */ char **message = 0; /* this will hold the node's header */ diff -Nru pinfo-0.6.12/src/printinfo.c pinfo-0.6.13/src/printinfo.c --- pinfo-0.6.12/src/printinfo.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/printinfo.c 2019-02-16 20:23:32.000000000 +0000 @@ -27,7 +27,7 @@ * are darker than the rest :) */ void -printnode(char ***message, long *lines) +printnode(char ***message, unsigned long *lines) { #define Message (*message) #define Lines (*lines) diff -Nru pinfo-0.6.12/src/printinfo.h pinfo-0.6.13/src/printinfo.h --- pinfo-0.6.12/src/printinfo.h 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/printinfo.h 2019-02-16 20:23:32.000000000 +0000 @@ -23,6 +23,6 @@ #define PRINTINFO_H /* prints node, pointed by `message', of `lines' length. */ -void printnode (char ***message, long *lines); +void printnode (char ***message, unsigned long *lines); #endif diff -Nru pinfo-0.6.12/src/utils.c pinfo-0.6.13/src/utils.c --- pinfo-0.6.12/src/utils.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/utils.c 2019-02-16 20:23:32.000000000 +0000 @@ -104,6 +104,7 @@ free(ptr); } +/* TODO: get rid of this xmalloc nonsense */ void * xmalloc(size_t size) { diff -Nru pinfo-0.6.12/src/video.c pinfo-0.6.13/src/video.c --- pinfo-0.6.12/src/video.c 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/video.c 2019-02-16 20:23:32.000000000 +0000 @@ -23,7 +23,7 @@ #include "common_includes.h" -void info_add_highlights(unsigned pos, unsigned cursor, long lines, unsigned column, char **message); +void info_add_highlights(unsigned pos, unsigned cursor, unsigned long lines, unsigned column, char **message); void substitutestr(char *src, char *dest, char *from, char *to) @@ -74,9 +74,8 @@ } void -showscreen(char **message, long lines, long pos, long cursor, int column) +showscreen(char **message, unsigned long lines, unsigned long pos, long cursor, int column) { - long i; #ifdef getmaxyx getmaxyx(stdscr, maxy, maxx); #endif @@ -84,7 +83,7 @@ bkgdset(' ' | normal); #endif attrset(normal); - for (i = pos;(i < lines) &&(i < pos + maxy - 2); i++) + for (unsigned long i = pos; (i < lines) && (i < pos + maxy - 2); i++) { int tmp; @@ -142,9 +141,9 @@ } void -info_add_highlights(unsigned pos, unsigned cursor, long lines, unsigned column, char **message) +info_add_highlights(unsigned pos, unsigned cursor, unsigned long lines, unsigned column, char **message) { - for (unsigned i = 0; i < hyperobjectcount; i++) + for (unsigned long i = 0; i < hyperobjectcount; i++) { if ((hyperobjects[i].line >= pos) && (hyperobjects[i].line < pos +(maxy - 2))) @@ -260,7 +259,8 @@ if ((h_regexp_num) ||(aftersearch)) { regmatch_t pmatch[1]; - long maxpos = pos +(maxy - 2); + if (maxy<2) maxy=2; + unsigned long maxpos = pos +(maxy - 2); int maxregexp; if (maxpos > lines) { diff -Nru pinfo-0.6.12/src/video.h pinfo-0.6.13/src/video.h --- pinfo-0.6.12/src/video.h 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/src/video.h 2019-02-16 20:23:32.000000000 +0000 @@ -23,7 +23,7 @@ #ifndef __VIDEO_H #define __VIDEO_H /* paints the screen while viewing info file */ -void showscreen (char **message, long lines, long pos, +void showscreen (char **message, unsigned long lines, unsigned long pos, long cursor, int column); /* prints unselected menu option */ void mvaddstr_menu (int y, int x, char *line, int linenumber); diff -Nru pinfo-0.6.12/.travis.yml pinfo-0.6.13/.travis.yml --- pinfo-0.6.12/.travis.yml 2019-02-11 09:00:29.000000000 +0000 +++ pinfo-0.6.13/.travis.yml 2019-02-16 20:23:32.000000000 +0000 @@ -66,6 +66,30 @@ - "gcc-7" - stage: "Compiler version/OS checks" + name: "linux/gcc-8" + os: linux + compiler: "gcc-8" + addons: + apt: + sources: + - *source_apt + packages: + - *pkg_apt + - "gcc-8" + + - stage: "Compiler version/OS checks" + name: "linux/gcc-9" + os: linux + compiler: "gcc-9" + addons: + apt: + sources: + - *source_apt + packages: + - *pkg_apt + - "gcc-9" + + - stage: "Compiler version/OS checks" name: "linux/clang-5" os: linux compiler: "clang-5.0" @@ -146,12 +170,28 @@ - *pkg_apt - "gcc@8" + - stage: "Crosscompiler checks" + name: "x86_32" + os: linux + compiler: "gcc-8" + env: { CFLAGS: "-m32" } + addons: + apt: + sources: + - *source_apt + packages: + - *pkg_apt + - "gcc-8" + - "gcc-8-multilib" + - "lib32gcc-8-dev" + - "lib32ncurses5-dev" + - "lib32readline-dev" + - stage: "Optimization checks" name: "gcc-8 -Os" os: linux compiler: "gcc-8" - env: - CFLAGS: "-Os" + env: { CFLAGS: "-Os" } addons: apt: sources: @@ -164,8 +204,7 @@ name: "gcc-8 -O3" os: linux compiler: "gcc-8" - env: - CFLAGS: "-O3" + env: { CFLAGS: "-O3" } addons: apt: sources: @@ -204,8 +243,13 @@ draft: true allow_failures: + - os: linux + compiler: gcc-9 - os: osx compiler: gcc-8 + - os: linux + compiler: "gcc-8" + env: { CFLAGS: "-m32" } before_install: - "$CC --version"