diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-03 10:19:24 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-03 10:19:24 +0800 |
commit | dd2bd13cacbe4827f9823f955cb77f8c86a74aea (patch) | |
tree | 7b89ea201471d3181855e389311f1a0b9f1c0004 /mbbsd/edit.c | |
parent | cbfcf574f76b32105c654ea5d5d1c94f41a03a9a (diff) | |
download | pttbbs-dd2bd13cacbe4827f9823f955cb77f8c86a74aea.tar pttbbs-dd2bd13cacbe4827f9823f955cb77f8c86a74aea.tar.gz pttbbs-dd2bd13cacbe4827f9823f955cb77f8c86a74aea.tar.bz2 pttbbs-dd2bd13cacbe4827f9823f955cb77f8c86a74aea.tar.lz pttbbs-dd2bd13cacbe4827f9823f955cb77f8c86a74aea.tar.xz pttbbs-dd2bd13cacbe4827f9823f955cb77f8c86a74aea.tar.zst pttbbs-dd2bd13cacbe4827f9823f955cb77f8c86a74aea.zip |
Remove rarely used function block_shift_left and block_shift_right,
which causes buffer overflow.
Fix typo in user.c
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2742 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/edit.c')
-rw-r--r-- | mbbsd/edit.c | 58 |
1 files changed, 2 insertions, 56 deletions
diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 584f3abc..7b828631 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1801,54 +1801,6 @@ block_select(void) curr_buf->blockline = curr_buf->currline; } -static void -block_shift_left(void) -{ - textline_t *p, *end; - - setup_block_begin_end(&p, &end); - - while (1) { - if (p->len) { - raw_shift_left(p->data, p->len); - --p->len; - } - if (p == end) - break; - else - p = p->next; - } - if (curr_buf->currpnt > curr_buf->currline->len) - curr_buf->currpnt = curr_buf->currline->len; - curr_buf->redraw_everything = YEA; -} - -/** - * Shift the selected block right. If insert_mode is on, put a ' ' in each - * new place, otherwise, put insert_c instead. - */ -static void -block_shift_right(void) -{ - textline_t *p, *end; - - setup_block_begin_end(&p, &end); - - while (1) { - if (p->len < WRAPMARGIN) { - raw_shift_right(p->data, ++p->len); - p->data[0] = curr_buf->insert_mode ? ' ' : curr_buf->insert_c; - } - if (p == end) - break; - else - p = p->next; - } - if (curr_buf->currpnt > curr_buf->currline->len) - curr_buf->currpnt = curr_buf->currline->len; - curr_buf->redraw_everything = YEA; -} - static inline void display_textline_internal(textline_t *p, int i, int min, int max) { @@ -2706,16 +2658,10 @@ vedit(char *fpath, int saveheader, int *islocal) curr_buf->indent_mode ^= 1; break; case 'j': - if (has_block_selection()) - block_shift_left(); - else - currline_shift_left(); + currline_shift_left(); break; case 'k': - if (has_block_selection()) - block_shift_right(); - else - currline_shift_right(); + currline_shift_right(); break; case 'f': cursor_to_next_word(); |