Mercurial > vim
comparison src/buffer.c @ 15543:dd725a8ab112 v8.1.0779
patch 8.1.0779: argument for message functions is inconsistent
commit https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 19 17:43:09 2019 +0100
patch 8.1.0779: argument for message functions is inconsistent
Problem: Argument for message functions is inconsistent.
Solution: Make first argument to msg() "char *".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 19 Jan 2019 17:45:07 +0100 |
parents | 41fbbcea0f1b |
children | d89c5b339c2a |
comparison
equal
deleted
inserted
replaced
15542:5baedae7ca7a | 15543:dd725a8ab112 |
---|---|
1081 # endif | 1081 # endif |
1082 | 1082 |
1083 /* User selected Recover at ATTENTION prompt. */ | 1083 /* User selected Recover at ATTENTION prompt. */ |
1084 msg_scroll = TRUE; | 1084 msg_scroll = TRUE; |
1085 ml_recover(); | 1085 ml_recover(); |
1086 MSG_PUTS("\n"); /* don't overwrite the last message */ | 1086 msg_puts("\n"); /* don't overwrite the last message */ |
1087 cmdline_row = msg_row; | 1087 cmdline_row = msg_row; |
1088 do_modelines(0); | 1088 do_modelines(0); |
1089 | 1089 |
1090 # if defined(FEAT_EVAL) | 1090 # if defined(FEAT_EVAL) |
1091 /* Restore the error/interrupt/exception state if not discarded by a | 1091 /* Restore the error/interrupt/exception state if not discarded by a |
3447 int shorthelp, | 3447 int shorthelp, |
3448 int dont_truncate) | 3448 int dont_truncate) |
3449 { | 3449 { |
3450 char_u *name; | 3450 char_u *name; |
3451 int n; | 3451 int n; |
3452 char_u *p; | 3452 char *p; |
3453 char_u *buffer; | 3453 char *buffer; |
3454 size_t len; | 3454 size_t len; |
3455 | 3455 |
3456 buffer = alloc(IOSIZE); | 3456 buffer = (char *)alloc(IOSIZE); |
3457 if (buffer == NULL) | 3457 if (buffer == NULL) |
3458 return; | 3458 return; |
3459 | 3459 |
3460 if (fullname > 1) /* 2 CTRL-G: include buffer number */ | 3460 if (fullname > 1) /* 2 CTRL-G: include buffer number */ |
3461 { | 3461 { |
3462 vim_snprintf((char *)buffer, IOSIZE, "buf %d: ", curbuf->b_fnum); | 3462 vim_snprintf(buffer, IOSIZE, "buf %d: ", curbuf->b_fnum); |
3463 p = buffer + STRLEN(buffer); | 3463 p = buffer + STRLEN(buffer); |
3464 } | 3464 } |
3465 else | 3465 else |
3466 p = buffer; | 3466 p = buffer; |
3467 | 3467 |
3468 *p++ = '"'; | 3468 *p++ = '"'; |
3469 if (buf_spname(curbuf) != NULL) | 3469 if (buf_spname(curbuf) != NULL) |
3470 vim_strncpy(p, buf_spname(curbuf), IOSIZE - (p - buffer) - 1); | 3470 vim_strncpy((char_u *)p, buf_spname(curbuf), IOSIZE - (p - buffer) - 1); |
3471 else | 3471 else |
3472 { | 3472 { |
3473 if (!fullname && curbuf->b_fname != NULL) | 3473 if (!fullname && curbuf->b_fname != NULL) |
3474 name = curbuf->b_fname; | 3474 name = curbuf->b_fname; |
3475 else | 3475 else |
3476 name = curbuf->b_ffname; | 3476 name = curbuf->b_ffname; |
3477 home_replace(shorthelp ? curbuf : NULL, name, p, | 3477 home_replace(shorthelp ? curbuf : NULL, name, (char_u *)p, |
3478 (int)(IOSIZE - (p - buffer)), TRUE); | 3478 (int)(IOSIZE - (p - buffer)), TRUE); |
3479 } | 3479 } |
3480 | 3480 |
3481 vim_snprintf_add((char *)buffer, IOSIZE, "\"%s%s%s%s%s%s", | 3481 vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s", |
3482 curbufIsChanged() ? (shortmess(SHM_MOD) | 3482 curbufIsChanged() ? (shortmess(SHM_MOD) |
3483 ? " [+]" : _(" [Modified]")) : " ", | 3483 ? " [+]" : _(" [Modified]")) : " ", |
3484 (curbuf->b_flags & BF_NOTEDITED) | 3484 (curbuf->b_flags & BF_NOTEDITED) |
3485 #ifdef FEAT_QUICKFIX | 3485 #ifdef FEAT_QUICKFIX |
3486 && !bt_dontwrite(curbuf) | 3486 && !bt_dontwrite(curbuf) |
3504 ((long)curbuf->b_ml.ml_line_count / 100L)); | 3504 ((long)curbuf->b_ml.ml_line_count / 100L)); |
3505 else | 3505 else |
3506 n = (int)(((long)curwin->w_cursor.lnum * 100L) / | 3506 n = (int)(((long)curwin->w_cursor.lnum * 100L) / |
3507 (long)curbuf->b_ml.ml_line_count); | 3507 (long)curbuf->b_ml.ml_line_count); |
3508 if (curbuf->b_ml.ml_flags & ML_EMPTY) | 3508 if (curbuf->b_ml.ml_flags & ML_EMPTY) |
3509 vim_snprintf_add((char *)buffer, IOSIZE, "%s", _(no_lines_msg)); | 3509 vim_snprintf_add(buffer, IOSIZE, "%s", _(no_lines_msg)); |
3510 #ifdef FEAT_CMDL_INFO | 3510 #ifdef FEAT_CMDL_INFO |
3511 else if (p_ru) | 3511 else if (p_ru) |
3512 /* Current line and column are already on the screen -- webb */ | 3512 /* Current line and column are already on the screen -- webb */ |
3513 vim_snprintf_add((char *)buffer, IOSIZE, | 3513 vim_snprintf_add(buffer, IOSIZE, |
3514 NGETTEXT("%ld line --%d%%--", "%ld lines --%d%%--", | 3514 NGETTEXT("%ld line --%d%%--", "%ld lines --%d%%--", |
3515 curbuf->b_ml.ml_line_count), | 3515 curbuf->b_ml.ml_line_count), |
3516 (long)curbuf->b_ml.ml_line_count, n); | 3516 (long)curbuf->b_ml.ml_line_count, n); |
3517 #endif | 3517 #endif |
3518 else | 3518 else |
3519 { | 3519 { |
3520 vim_snprintf_add((char *)buffer, IOSIZE, | 3520 vim_snprintf_add(buffer, IOSIZE, |
3521 _("line %ld of %ld --%d%%-- col "), | 3521 _("line %ld of %ld --%d%%-- col "), |
3522 (long)curwin->w_cursor.lnum, | 3522 (long)curwin->w_cursor.lnum, |
3523 (long)curbuf->b_ml.ml_line_count, | 3523 (long)curbuf->b_ml.ml_line_count, |
3524 n); | 3524 n); |
3525 validate_virtcol(); | 3525 validate_virtcol(); |
3526 len = STRLEN(buffer); | 3526 len = STRLEN(buffer); |
3527 col_print(buffer + len, IOSIZE - len, | 3527 col_print((char_u *)buffer + len, IOSIZE - len, |
3528 (int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1); | 3528 (int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1); |
3529 } | 3529 } |
3530 | 3530 |
3531 (void)append_arg_number(curwin, buffer, IOSIZE, !shortmess(SHM_FILE)); | 3531 (void)append_arg_number(curwin, (char_u *)buffer, IOSIZE, |
3532 !shortmess(SHM_FILE)); | |
3532 | 3533 |
3533 if (dont_truncate) | 3534 if (dont_truncate) |
3534 { | 3535 { |
3535 /* Temporarily set msg_scroll to avoid the message being truncated. | 3536 /* Temporarily set msg_scroll to avoid the message being truncated. |
3536 * First call msg_start() to get the message in the right place. */ | 3537 * First call msg_start() to get the message in the right place. */ |
3540 msg(buffer); | 3541 msg(buffer); |
3541 msg_scroll = n; | 3542 msg_scroll = n; |
3542 } | 3543 } |
3543 else | 3544 else |
3544 { | 3545 { |
3545 p = msg_trunc_attr(buffer, FALSE, 0); | 3546 p = (char *)msg_trunc_attr(buffer, FALSE, 0); |
3546 if (restart_edit != 0 || (msg_scrolled && !need_wait_return)) | 3547 if (restart_edit != 0 || (msg_scrolled && !need_wait_return)) |
3547 /* Need to repeat the message after redrawing when: | 3548 /* Need to repeat the message after redrawing when: |
3548 * - When restart_edit is set (otherwise there will be a delay | 3549 * - When restart_edit is set (otherwise there will be a delay |
3549 * before redrawing). | 3550 * before redrawing). |
3550 * - When the screen was scrolled but there is no wait-return | 3551 * - When the screen was scrolled but there is no wait-return |
3551 * prompt. */ | 3552 * prompt. */ |
3552 set_keep_msg(p, 0); | 3553 set_keep_msg((char_u *)p, 0); |
3553 } | 3554 } |
3554 | 3555 |
3555 vim_free(buffer); | 3556 vim_free(buffer); |
3556 } | 3557 } |
3557 | 3558 |