summaryrefslogtreecommitdiff
path: root/pico
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2021-05-08 21:01:02 -0600
committerEduardo Chappa <chappa@washington.edu>2021-05-08 21:01:02 -0600
commitb5eb45a153202d72aeb48de1149e7c74aef979fd (patch)
tree1fbc156a717e7963cd0c02fd7352bc801949c550 /pico
parent2f953255a8c494e3033015eb064c6ecace9ffeda (diff)
downloadalpine-b5eb45a153202d72aeb48de1149e7c74aef979fd.tar.xz
* Clear out some gcc warnings, and code improvement. Work in progress.
Diffstat (limited to 'pico')
-rw-r--r--pico/browse.c22
-rw-r--r--pico/display.c6
-rw-r--r--pico/osdep/color.c2
-rw-r--r--pico/random.c4
-rw-r--r--pico/search.c2
5 files changed, 18 insertions, 18 deletions
diff --git a/pico/browse.c b/pico/browse.c
index 8113e4dc..7f59274d 100644
--- a/pico/browse.c
+++ b/pico/browse.c
@@ -333,7 +333,7 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen,
int row, col, crow, ccol;
int flags;
int add_file;
- char *p, *envp, child[NLINE], tmp[NLINE];
+ char *p, *envp, child[2*NLINE+2], tmp[2*NLINE+1];
struct bmaster *mp;
struct fcell *tp;
EML eml;
@@ -721,8 +721,8 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen,
case 'e': /* exit or edit */
case 'E':
if(gmode&MDBRONLY){ /* run "pico" */
- snprintf(child, sizeof(child), "%s%c%s", gmp->dname, C_FILESEP,
- gmp->current->fname);
+ snprintf(child, sizeof(child), "%.*s%c%.*s", NLINE, gmp->dname, C_FILESEP,
+ NLINE, gmp->current->fname);
/* make sure selected isn't a directory or executable */
if(!LikelyASCII(child)){
emlwrite(_("Can't edit non-text file. Try Launch."), NULL);
@@ -812,8 +812,8 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen,
tmp[0] = '\0';
i = 0;
- snprintf(child, sizeof(child), "%s%c%s", gmp->dname, C_FILESEP,
- gmp->current->fname);
+ snprintf(child, sizeof(child), "%.*s%c%.*s", NLINE, gmp->dname, C_FILESEP,
+ NLINE, gmp->current->fname);
while(!i){
static EXTRAKEYS opts[] = {
{"^X", N_("Add Name"), CTRL|'X', KS_NONE},
@@ -1306,8 +1306,8 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen,
break;
}
- snprintf(tmp, sizeof(tmp), "%s%c%s", gmp->dname, C_FILESEP,
- gmp->current->fname);
+ snprintf(tmp, sizeof(tmp), "%.*s%c%.*s", NLINE, gmp->dname, C_FILESEP,
+ NLINE, gmp->current->fname);
if(copy(tmp, child) < 0){
/* copy() will report any error messages */
@@ -1424,8 +1424,8 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen,
}
}
- snprintf(tmp, sizeof(tmp), "%s%c%s", gmp->dname, C_FILESEP,
- gmp->current->fname);
+ snprintf(tmp, sizeof(tmp), "%.*s%c%.*s", NLINE, gmp->dname, C_FILESEP,
+ NLINE, gmp->current->fname);
if(our_rename(tmp, child) < 0){
eml.s = errstr(errno);
@@ -1581,8 +1581,8 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen,
break;
}
else if(gmode&MDBRONLY){
- snprintf(child, sizeof(child), "%s%c%s", gmp->dname, C_FILESEP,
- gmp->current->fname);
+ snprintf(child, sizeof(child), "%.*s%c%.*s", NLINE, gmp->dname, C_FILESEP,
+ NLINE, gmp->current->fname);
if(LikelyASCII(child)){
snprintf(tmp, sizeof(tmp), "%s \'%s\'",
diff --git a/pico/display.c b/pico/display.c
index e8472a06..cde70b57 100644
--- a/pico/display.c
+++ b/pico/display.c
@@ -375,7 +375,7 @@ int
window_signature_block(WINDOW *wp)
{
LINE *lp, *llp;
- int in_sig, is_sig_start;
+ int in_sig, is_sig_start = 0;
int change = 0;
llp = wp->w_linep;
@@ -1393,7 +1393,7 @@ modeline(WINDOW *wp)
bp = wp->w_bufp;
if(bp->b_fname[0]) /* File name? */
- snprintf(t2, sizeof(t2), "File: %s", bp->b_fname);
+ snprintf(t2, sizeof(t2), "File: %.*s", (int) sizeof(t2) - 7, bp->b_fname);
else{
strncpy(t2, PICO_NEWBUF_MSG, sizeof(t2));
t2[sizeof(t2)-1] = '\0';
@@ -1430,7 +1430,7 @@ modeline(WINDOW *wp)
w2_to_3 = term.t_ncol - (ALLBUTSPACE + w1_to_2);
else{
if(bp->b_fname[0]){
- snprintf(t2, sizeof(t2), "%s", bp->b_fname);
+ snprintf(t2, sizeof(t2), "%.*s", (int) sizeof(t2) - 1, bp->b_fname);
w2 = utf8_width(t2);
}
diff --git a/pico/osdep/color.c b/pico/osdep/color.c
index 6fef6254..312348c1 100644
--- a/pico/osdep/color.c
+++ b/pico/osdep/color.c
@@ -527,7 +527,7 @@ init_color_table(void)
{
struct color_table *ct = NULL, *t;
int i, count;
- char colorname[12];
+ char colorname[22];
count = pico_count_in_color_table();
diff --git a/pico/random.c b/pico/random.c
index 4d40911a..e26cd653 100644
--- a/pico/random.c
+++ b/pico/random.c
@@ -47,8 +47,8 @@ showcpos(int f, int n)
register int cbo;
register long nbc;
register int lines;
- register int thisline;
- char buffer[80];
+ register int thisline = 0;
+ char buffer[100];
clp = lforw(curbp->b_linep); /* Grovel the data. */
cbo = 0;
diff --git a/pico/search.c b/pico/search.c
index 276be60c..1f8b292f 100644
--- a/pico/search.c
+++ b/pico/search.c
@@ -1206,7 +1206,7 @@ forscan(int *wrapt, /* boolean indicating search wrapped */
UCS *patptr; /* pointer into pattern */
int stopoff; /* offset to stop search */
LINE *stopline; /* line to stop search */
- int ftest; /* position of first character of test */
+ int ftest = 0; /* position of first character of test */
int bsearch;
int bol;
int eol;