refactor: replace char_u variables and functions with char

Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
Dundar Goc
2022-05-04 18:27:22 +02:00
parent 82c7a82c35
commit 9a671e6a24
47 changed files with 569 additions and 576 deletions

View File

@@ -1035,8 +1035,8 @@ void ml_recover(bool checkext)
semsg(_("E309: Unable to read block 1 from %s"), mfp->mf_fname);
goto theend;
}
++error;
ml_append(lnum++, (char_u *)_("???MANY LINES MISSING"),
error++;
ml_append(lnum++, _("???MANY LINES MISSING"),
(colnr_T)0, true);
} else { // there is a block
pp = hp->bh_data;
@@ -1047,14 +1047,14 @@ void ml_recover(bool checkext)
line_count -= pp->pb_pointer[i].pe_line_count;
}
if (line_count != 0) {
++error;
ml_append(lnum++, (char_u *)_("???LINE COUNT WRONG"),
error++;
ml_append(lnum++, _("???LINE COUNT WRONG"),
(colnr_T)0, true);
}
}
if (pp->pb_count == 0) {
ml_append(lnum++, (char_u *)_("???EMPTY BLOCK"),
ml_append(lnum++, _("???EMPTY BLOCK"),
(colnr_T)0, true);
error++;
} else if (idx < (int)pp->pb_count) { // go a block deeper
@@ -1075,8 +1075,8 @@ void ml_recover(bool checkext)
}
}
if (cannot_open) {
++error;
ml_append(lnum++, (char_u *)_("???LINES MISSING"),
error++;
ml_append(lnum++, _("???LINES MISSING"),
(colnr_T)0, true);
}
++idx; // get same block again for next index
@@ -1105,8 +1105,8 @@ void ml_recover(bool checkext)
mfp->mf_fname);
goto theend;
}
++error;
ml_append(lnum++, (char_u *)_("???BLOCK MISSING"),
error++;
ml_append(lnum++, _("???BLOCK MISSING"),
(colnr_T)0, true);
} else {
// it is a data block
@@ -1116,8 +1116,7 @@ void ml_recover(bool checkext)
// if wrong, use length in pointer block
if (page_count * mfp->mf_page_size != dp->db_txt_end) {
ml_append(lnum++,
(char_u *)_("??? from here until ???END lines"
" may be messed up"),
_("??? from here until ???END lines" " may be messed up"),
(colnr_T)0, true);
error++;
has_error = true;
@@ -1133,8 +1132,8 @@ void ml_recover(bool checkext)
*/
if (line_count != dp->db_line_count) {
ml_append(lnum++,
(char_u *)_("??? from here until ???END lines"
" may have been inserted/deleted"),
_("??? from here until ???END lines"
" may have been inserted/deleted"),
(colnr_T)0, true);
error++;
has_error = true;
@@ -1149,10 +1148,10 @@ void ml_recover(bool checkext)
} else {
p = (char_u *)dp + txt_start;
}
ml_append(lnum++, p, (colnr_T)0, true);
ml_append(lnum++, (char *)p, (colnr_T)0, true);
}
if (has_error) {
ml_append(lnum++, (char_u *)_("???END"), (colnr_T)0, true);
ml_append(lnum++, _("???END"), (colnr_T)0, true);
}
}
}
@@ -1924,7 +1923,7 @@ int ml_line_alloced(void)
/// @param newfile flag, see above
///
/// @return FAIL for failure, OK otherwise
int ml_append(linenr_T lnum, char_u *line, colnr_T len, bool newfile)
int ml_append(linenr_T lnum, char *line, colnr_T len, bool newfile)
{
// When starting up, we might still need to create the memfile
if (curbuf->b_ml.ml_mfp == NULL && open_buffer(FALSE, NULL, 0) == FAIL) {
@@ -1934,7 +1933,7 @@ int ml_append(linenr_T lnum, char_u *line, colnr_T len, bool newfile)
if (curbuf->b_ml.ml_line_lnum != 0) {
ml_flush_line(curbuf);
}
return ml_append_int(curbuf, lnum, line, len, newfile, FALSE);
return ml_append_int(curbuf, lnum, (char_u *)line, len, newfile, false);
}
/// Like ml_append() but for an arbitrary buffer. The buffer must already have
@@ -2448,9 +2447,9 @@ void ml_add_deleted_len_buf(buf_T *buf, char_u *ptr, ssize_t len)
}
int ml_replace(linenr_T lnum, char_u *line, bool copy)
int ml_replace(linenr_T lnum, char *line, bool copy)
{
return ml_replace_buf(curbuf, lnum, line, copy);
return ml_replace_buf(curbuf, lnum, (char_u *)line, copy);
}
/// Replace line "lnum", with buffering, in current buffer.
@@ -2546,7 +2545,7 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, bool message)
set_keep_msg(_(no_lines_msg), 0);
}
i = ml_replace((linenr_T)1, (char_u *)"", true);
i = ml_replace((linenr_T)1, "", true);
buf->b_ml.ml_flags |= ML_EMPTY;
return i;