Skip to content

Commit

Permalink
ncplane_new_internal: don't check for negative rows/cols, use unsigne…
Browse files Browse the repository at this point in the history
…d spec #2763
  • Loading branch information
dankamongmen committed Feb 27, 2024
1 parent 43c81ed commit fdd3344
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/lib/notcurses.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,14 +557,10 @@ ncplane* ncplane_new_internal(notcurses* nc, ncplane* n,
}
if(nopts->flags & NCPLANE_OPTION_MARGINALIZED){
if(nopts->rows != 0 || nopts->cols != 0){
logerror("geometry specified with margins (r=%d, c=%d)",
logerror("geometry specified with margins (r=%u, c=%u)",
nopts->rows, nopts->cols);
return NULL;
}
}else if(nopts->rows <= 0 || nopts->cols <= 0){
logerror("won't create denormalized plane (r=%d, c=%d)",
nopts->rows, nopts->cols);
return NULL;
}
ncplane* p = malloc(sizeof(*p));
if(p == NULL){
Expand Down Expand Up @@ -596,7 +592,7 @@ ncplane* ncplane_new_internal(notcurses* nc, ncplane* n,
}
size_t fbsize = sizeof(*p->fb) * (p->leny * p->lenx);
if((p->fb = malloc(fbsize)) == NULL){
logerror("error allocating cellmatrix (r=%d, c=%d)",
logerror("error allocating cellmatrix (r=%u, c=%u)",
p->leny, p->lenx);
free(p);
return NULL;
Expand Down Expand Up @@ -669,7 +665,7 @@ ncplane* ncplane_new_internal(notcurses* nc, ncplane* n,
pthread_mutex_unlock(&nc->stats.lock);
pthread_mutex_unlock(&nc->pilelock);
}
loginfo("created new %dx%d plane \"%s\" @ %dx%d",
loginfo("created new %ux%u plane \"%s\" @ %dx%d",
p->leny, p->lenx, p->name ? p->name : "", p->absy, p->absx);
return p;
}
Expand Down

0 comments on commit fdd3344

Please sign in to comment.