do_browser()
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
consistency. (DLR)
+ - When displaying "(dir)" in the available screen space, make
+ sure that the string it's stored in is always null-terminated.
+ (DLR)
save_history()
- Properly save history when in view mode. (DLR)
- global.c:
since the first line in the file is 1. (DLR)
- Start the search for a line from fileage instead of current
(again). (DLR)
+ replace_line()
+ - Make new_line_size and search_match_count size_t's, for
+ consistency. (DLR)
- utils.c:
num_of_digits()
- Use a size_t instead of an int, and rename to digits(). (DLR)
if (num_matches == 1 && is_dir(mzero)) {
mzero[common_len] = '/';
common_len++;
+
assert(common_len > *place);
}
wmove(edit, editline, (longest_name + 2) *
(match % columns));
- if (match % columns == 0 && editline == editwinrows - 1
- && num_matches - match > columns) {
+ if (match % columns == 0 &&
+ editline == editwinrows - 1 &&
+ num_matches - match > columns) {
waddstr(edit, _("(more)"));
break;
}
{
for (; len > 0; len--)
free(array[len - 1]);
+
free(array);
}
assert(path != NULL);
tmp = strrchr(path, '/');
+
if (tmp != NULL)
*tmp = '\0';
}
foo[foo_len] = '\0';
} else
strcpy(foo, "--");
- } else if (S_ISDIR(st.st_mode))
+ } else if (S_ISDIR(st.st_mode)) {
strncpy(foo, _("(dir)"), foo_len);
- else if (st.st_size < (1 << 10)) /* less than 1 k. */
+ foo[foo_len] = '\0';
+ } else if (st.st_size < (1 << 10)) /* less than 1 k. */
sprintf(foo, "%4u B", (unsigned int)st.st_size);
else if (st.st_size < (1 << 20)) /* less than 1 meg. */
sprintf(foo, "%4u KB",
char *replace_line(const char *needle)
{
char *copy;
- int new_line_size;
- int search_match_count;
+ size_t new_line_size, search_match_count;
/* Calculate the size of the new line. */
#ifdef HAVE_REGEX_H
/* The tail of the original line. */
assert(current_x + search_match_count <= strlen(current->data));
+
strcat(copy, current->data + current_x + search_match_count);
return copy;