diff options
Diffstat (limited to 'src/hyper')
-rw-r--r-- | src/hyper/ReadBitmap.c | 2 | ||||
-rw-r--r-- | src/hyper/dialog.c | 29 | ||||
-rw-r--r-- | src/hyper/extent1.c | 3 | ||||
-rw-r--r-- | src/hyper/htadd.c | 2 | ||||
-rw-r--r-- | src/hyper/hthits.c | 2 | ||||
-rw-r--r-- | src/hyper/htinp.c | 2 | ||||
-rw-r--r-- | src/hyper/initx.c | 2 | ||||
-rw-r--r-- | src/hyper/keyin.c | 4 | ||||
-rw-r--r-- | src/hyper/lex.c | 2 | ||||
-rw-r--r-- | src/hyper/macro.c | 3 | ||||
-rw-r--r-- | src/hyper/parse-aux.c | 4 | ||||
-rw-r--r-- | src/hyper/parse-input.c | 2 | ||||
-rw-r--r-- | src/hyper/parse-types.c | 4 | ||||
-rw-r--r-- | src/hyper/parse.c | 8 | ||||
-rw-r--r-- | src/hyper/show-types.c | 2 | ||||
-rw-r--r-- | src/hyper/spadint.c | 13 |
16 files changed, 41 insertions, 43 deletions
diff --git a/src/hyper/ReadBitmap.c b/src/hyper/ReadBitmap.c index d1ada58c..ee8e89d2 100644 --- a/src/hyper/ReadBitmap.c +++ b/src/hyper/ReadBitmap.c @@ -58,7 +58,6 @@ HTReadBitmapFile(Display *display,int screen,char * filename, XImage *image; FILE *fd; char Line[256], Buff[256]; - int num_chars; char *ptr; int rch; int version; @@ -134,7 +133,6 @@ HTReadBitmapFile(Display *display,int screen,char * filename, (image)->bytes_per_line = chars_line = (*width + 7) / 8; file_chars_line = chars_line + padding; - num_chars = chars_line * (*height); file_chars = file_chars_line * (*height); (image)->data = (char *) halloc((image)->bytes_per_line * (image)->height, "Read Pixmap--Image data"); diff --git a/src/hyper/dialog.c b/src/hyper/dialog.c index fe7b78aa..e3ae5122 100644 --- a/src/hyper/dialog.c +++ b/src/hyper/dialog.c @@ -88,6 +88,13 @@ static void redraw_win(); static void tough_enter(InputItem * sym); static void +strnmov(char *dest, const char *src, size_t n) +{ + while (n-- && (*dest++ = *src++)); +} + + +static void redraw_win() { XUnmapSubwindows(gXDisplay, gWindow->fMainWindow); @@ -248,7 +255,7 @@ move_sym_forward(LineStruct *line, int num, int size, InputItem *sym) return 1; } else { - strncpy(&line->buffer[num], line->buffer, line->len); + strnmov(&line->buffer[num], line->buffer, line->len); line->len += num; line->changed = 1; return 0; @@ -310,7 +317,7 @@ insert_buffer(char *buffer, InputItem *sym) else { line->next->buffer[0] = line->buffer[size - 1]; line->changed = 1; - strncpy(&line->buffer[line->buff_pntr + 1], + strnmov(&line->buffer[line->buff_pntr + 1], &line->buffer[line->buff_pntr], size - line->buff_pntr - 1); line->buffer[line->buff_pntr++] = buffer[0]; line->changed = 1; @@ -346,7 +353,7 @@ insert_buffer(char *buffer, InputItem *sym) /* we are not the leaders */ newline->buffer[0] = line->buffer[size - 1]; newline->len = 1; - strncpy(&line->buffer[line->buff_pntr + 1], + strnmov(&line->buffer[line->buff_pntr + 1], &line->buffer[line->buff_pntr], size - line->buff_pntr); if (line->buff_pntr < size - 1) { line->buffer[line->buff_pntr++] = buffer[0]; @@ -672,7 +679,7 @@ move_rest_back(LineStruct *line, int size) return c; while (line->next != NULL && line->len > size) { - strncpy(line->buffer, &(line->buffer[1]), size - 1); + strnmov(line->buffer, &(line->buffer[1]), size - 1); line->buffer[size - 1] = line->next->buffer[0]; line->changed = 1; line = line->next; @@ -685,7 +692,7 @@ move_rest_back(LineStruct *line, int size) if (line->len > 0) { line->changed = 1; if (line->len > 1) - strncpy(line->buffer, &(line->buffer[1]), line->len - 1); + strnmov(line->buffer, &(line->buffer[1]), line->len - 1); line->buffer[--line->len] = 0; if (line->len == 0) { /* I have to fix the previous line */ @@ -867,7 +874,7 @@ move_back_one_char(InputItem *sym) else if (line->len > 0) { d = line->buffer[0]; if (line->len <= sym->size) { - strncpy(line->buffer, &(line->buffer[1]), line->len - 1); + strnmov(line->buffer, &(line->buffer[1]), line->len - 1); if (c == 0) { line->len--; line->buffer[line->len] = 0; @@ -876,7 +883,7 @@ move_back_one_char(InputItem *sym) line->buffer[line->len - 1] = c; } else { - strncpy(line->buffer, &(line->buffer[1]), sym->size - 2); + strnmov(line->buffer, &(line->buffer[1]), sym->size - 2); if (c == 0) { line->buffer[sym->size - 1] = 0; line->len--; @@ -905,7 +912,7 @@ move_back_one_char(InputItem *sym) if (line->len <= sym->size) { - strncpy(&line->buffer[line->buff_pntr - 1], + strnmov(&line->buffer[line->buff_pntr - 1], &(line->buffer[line->buff_pntr]), line->len - line->buff_pntr); if (c == 0) @@ -914,7 +921,7 @@ move_back_one_char(InputItem *sym) line->buffer[line->len - 1] = c; } else { - strncpy(&(line->buffer[line->buff_pntr - 1]), + strnmov(&(line->buffer[line->buff_pntr - 1]), &(line->buffer[line->buff_pntr]), sym->size - line->buff_pntr); if (c == 0) { @@ -1040,7 +1047,7 @@ delete_one_char(InputItem *sym) * exists at the end */ if (line->len <= sym->size) { - strncpy(&line->buffer[line->buff_pntr], + strnmov(&line->buffer[line->buff_pntr], &(line->buffer[line->buff_pntr + 1]), line->len - line->buff_pntr); if (c == 0) @@ -1049,7 +1056,7 @@ delete_one_char(InputItem *sym) line->buffer[line->len - 1] = c; } else { - strncpy(&(line->buffer[line->buff_pntr]), + strnmov(&(line->buffer[line->buff_pntr]), &(line->buffer[line->buff_pntr + 1]), sym->size - line->buff_pntr); if (c == 0) { diff --git a/src/hyper/extent1.c b/src/hyper/extent1.c index 0642957c..95766791 100644 --- a/src/hyper/extent1.c +++ b/src/hyper/extent1.c @@ -1319,12 +1319,9 @@ compute_header_extent(HyperDocPage *page) * for the header here */ - int ty; /* UNUSED */ - gExtentRegion = Header; right_margin_space = non_scroll_right_margin_space; init_extents(); - ty = text_y = 3 * top_margin + line_height + max(page->title->height, twheight); gLineNode = page->header->next; compute_text_extent(page->header->next); page->header->height = text_height(page->header->next, diff --git a/src/hyper/htadd.c b/src/hyper/htadd.c index 21321ae7..b3a5962a 100644 --- a/src/hyper/htadd.c +++ b/src/hyper/htadd.c @@ -94,7 +94,7 @@ main(int argc, char **argv) using namespace OpenAxiom; /*int i;*/ char db_dir[256]; /* the directory where the db file is */ - char dbfilename[256]; /* the database filename */ + char dbfilename[512]; /* the database filename */ char *filenames[1000]; /* the files to be added */ char **fnames = filenames; short flag; /* flag for deleting or adding */ diff --git a/src/hyper/hthits.c b/src/hyper/hthits.c index 470bf297..4e628b16 100644 --- a/src/hyper/hthits.c +++ b/src/hyper/hthits.c @@ -220,7 +220,7 @@ handlePage(FILE* infile, PgInfo* pg) static char *pgBuf = 0; static int pgBufSize = 0; - char *title, *body; + char *title = NULL, *body = NULL; if (pg->size > pgBufSize - 1) { if (pgBuf) diff --git a/src/hyper/htinp.c b/src/hyper/htinp.c index 7799c194..b44047f8 100644 --- a/src/hyper/htinp.c +++ b/src/hyper/htinp.c @@ -439,7 +439,7 @@ send_command(char *command,int com_type) } else { FILE *f; - char name[512], str[512]/*, *c*/; + char name[512], str[1024]/*, *c*/; sprintf(name, "/tmp/hyper%s.input", oa_getenv("SPADNUM")); f = fopen(name, "w"); diff --git a/src/hyper/initx.c b/src/hyper/initx.c index 0ee4afa0..c69c2071 100644 --- a/src/hyper/initx.c +++ b/src/hyper/initx.c @@ -1018,7 +1018,7 @@ is_it_850(XFontStruct *fontarg) /* return 1 if it is 850 */ s = XGetAtomName(gXDisplay,(Atom)fontarg->properties[i].card32); - val = !( strcmp("850",s) * strcmp("ibm-850",s)); + val = !( strcmp("850",s) && strcmp("ibm-850",s)); XFree(s); return( val ); } diff --git a/src/hyper/keyin.c b/src/hyper/keyin.c index eef07e7b..fa8af8de 100644 --- a/src/hyper/keyin.c +++ b/src/hyper/keyin.c @@ -82,7 +82,7 @@ unsigned int UnsupportedModMask = LockMask | ControlMask static unsigned int get_modifier_mask(KeySym sym) { - unsigned int i, mask; + unsigned int mask; XModifierKeymap *mod; KeyCode kcode; const int masks[8] = { @@ -94,7 +94,7 @@ get_modifier_mask(KeySym sym) kcode = XKeysymToKeycode(gXDisplay,sym); if (mod) { - for (i = 0; i < (8 * mod->max_keypermod); i++){ + for (int i = 0; i < (8 * mod->max_keypermod); i++){ if (!mod->modifiermap[i]) continue; else if (kcode == mod->modifiermap[i]){ mask = masks[i / mod->max_keypermod]; diff --git a/src/hyper/lex.c b/src/hyper/lex.c index d571e6cd..ed281403 100644 --- a/src/hyper/lex.c +++ b/src/hyper/lex.c @@ -435,7 +435,7 @@ AGAIN: input_string = sock_buf; goto AGAIN; default: - fprintf(stderr, "Get Char: Unknown type of input: %d\n", input_type); + fprintf(stderr, "Get Char: Unknown type of input: %d\n", (int)input_type); return -1; } } diff --git a/src/hyper/macro.c b/src/hyper/macro.c index 0b0d1889..7bf0f77b 100644 --- a/src/hyper/macro.c +++ b/src/hyper/macro.c @@ -101,7 +101,6 @@ number(const char *str) static char * load_macro(MacroStore *macro) { - int ret_val; long start_fpos; int size = 0; char *trace; @@ -158,7 +157,7 @@ load_macro(MacroStore *macro) } start_fpos = fpos; scan_HyperDoc(); - ret_val = fseek(cfile, macro->fpos.pos + start_fpos, 0); + fseek(cfile, macro->fpos.pos + start_fpos, 0); size = fpos - start_fpos; macro_buff = (char *) halloc((size + 1) * sizeof(char), "Macro_buf"); for (size = 0, trace = macro_buff; size < fpos - (start_fpos) - 1; size++) diff --git a/src/hyper/parse-aux.c b/src/hyper/parse-aux.c index 4c7600b9..24efcf89 100644 --- a/src/hyper/parse-aux.c +++ b/src/hyper/parse-aux.c @@ -512,7 +512,6 @@ int get_filename() { int c, ws; - static int seen_white = 0; /*UNUSED */ static char buffer[256]; char *buf = buffer; @@ -524,8 +523,6 @@ get_filename() keyword_fpos = fpos; c = get_char(); ws = whitespace(c); - if (ws) - seen_white = 1; } while (ws); switch (c) { case EOF: @@ -545,7 +542,6 @@ get_filename() *buf = '\0'; token.type = openaxiom_Word_token; token.id = buffer; - seen_white = 0; break; } return 1; diff --git a/src/hyper/parse-input.c b/src/hyper/parse-input.c index 1c619151..727acc9d 100644 --- a/src/hyper/parse-input.c +++ b/src/hyper/parse-input.c @@ -562,9 +562,9 @@ parse_radioboxes() /* quick search for the name in the current list */ if (already_there(newrb->name)) { + fprintf(stderr, "Tried to redefine radioboxes %s\n", newrb->name); free(newrb->name); free(newrb); - fprintf(stderr, "Tried to redefine radioboxes %s\n", newrb->name); print_page_and_filename(); jump(); } diff --git a/src/hyper/parse-types.c b/src/hyper/parse-types.c index f5a42cd9..e42d93f9 100644 --- a/src/hyper/parse-types.c +++ b/src/hyper/parse-types.c @@ -196,9 +196,9 @@ parse_condnode() break; default: { - char eb[128]; + char eb[160]; token_name(token.type); - sprintf(eb, "Unexpected Token %s\n", eb); + sprintf(eb, "Unexpected Token %s\n", ebuffer); htperror(eb, HTCONDNODE); } break; diff --git a/src/hyper/parse.c b/src/hyper/parse.c index 1ca0f77e..cddaa8ae 100644 --- a/src/hyper/parse.c +++ b/src/hyper/parse.c @@ -298,8 +298,8 @@ parse_header(HyperDocPage *page) static void init_parse_page(HyperDocPage *page) { - gEndedPage = gInDesc = gStringValueOk = gInIf = - gInButton = gInOptional = gInVerbatim = gInPaste = gInItems = + gEndedPage = false; gInDesc = false; gStringValueOk = false; gInIf = false; + gInButton = false; gInOptional = false; gInVerbatim = false; gInPaste = false; gInItems = false; gInSpadsrc = false; example_number = 1; cur_page = page; @@ -325,8 +325,8 @@ init_parse_page(HyperDocPage *page) void init_parse_patch(HyperDocPage *page) { - gEndedPage = gInDesc = gStringValueOk = gInIf = - gInButton = gInOptional = gInVerbatim = gInPaste = gInItems = + gEndedPage = false; gInDesc = false; gStringValueOk = false; gInIf = false; + gInButton = false; gInOptional = false; gInVerbatim = false; gInPaste = false; gInItems = false; gInSpadsrc = false; gParserMode = AllMode; gParserRegion = Scrolling; diff --git a/src/hyper/show-types.c b/src/hyper/show-types.c index 1942901b..e34498d8 100644 --- a/src/hyper/show-types.c +++ b/src/hyper/show-types.c @@ -464,10 +464,8 @@ show_input(TextNode *node) /*Window root, child;*/ /*int root_x, root_y, win_x, win_y, buttons;*/ InputItem *item; - char *inpbuffer; item = node->link->reference.string; - inpbuffer = item->curr_line->buffer; wc.border_width = 0; wc.x = node->x; diff --git a/src/hyper/spadint.c b/src/hyper/spadint.c index aa381ba0..df2cd526 100644 --- a/src/hyper/spadint.c +++ b/src/hyper/spadint.c @@ -137,7 +137,7 @@ static void send_pile(openaxiom_sio *sock,char * str) { FILE *f; - char name[512], command[512]; + char name[512], command[532]; sprintf(name, "/tmp/hyper%s.input", oa_getenv("SPADNUM")); f = fopen(name, "w"); @@ -218,7 +218,7 @@ start_user_buffer(HyperDocPage *page) SPAD = (char *) oa_getenv("AXIOM"); if (SPAD == NULL) { - sprintf(SPAD, "/spad/mnt/rios"); + SPAD = "/spad/mnt/rios"; } sprintf(spadbuf, "%s/lib/spadbuf", SPAD); sprintf(complfile, "%s/lib/command.list", SPAD); @@ -542,16 +542,18 @@ print_to_string1(TextNode *command,int * sizeBuf) case openaxiom_StringValue_token: item = return_item(node->data.text); if (item != NULL) { - if (node->space) + if (node->space) { storeChar(' '); + } curr_line = item->lines; while (curr_line != NULL) { for (lcount = 0, s = curr_line->buffer; *s && lcount < item->size; s++, lcount++) { storeChar(funnyUnescape(*s)); } - if (curr_line->len <= item->size && curr_line->next) + if (curr_line->len <= item->size && curr_line->next) { storeChar('\n'); + } curr_line = curr_line->next; } } @@ -1032,8 +1034,9 @@ print_source_to_string1(TextNode *command,int * sizeBuf) s++, lcount++) { storeChar(funnyUnescape(*s)); } - if (curr_line->len <= item->size && curr_line->next) + if (curr_line->len <= item->size && curr_line->next) { storeChar('\n'); + } curr_line = curr_line->next; } } |