mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
use const references in several fns; fix #2658
This commit is contained in:
parent
63a8573cef
commit
c3ace47939
@ -759,7 +759,7 @@ nccell_prime(struct ncplane* n, nccell* c, const char* gcluster,
|
||||
|
||||
// Duplicate 'c' into 'targ'; both must be/will be bound to 'n'. Returns -1 on
|
||||
// failure, and 0 on success.
|
||||
API int nccell_duplicate(struct ncplane* n, nccell* targ, const nccell* c);
|
||||
API int nccell_duplicate(const struct ncplane* n, nccell* targ, const nccell* c);
|
||||
|
||||
// Release resources held by the nccell 'c'.
|
||||
API void nccell_release(struct ncplane* n, nccell* c);
|
||||
@ -1876,7 +1876,7 @@ API int ncplane_set_base(struct ncplane* n, const char* egc,
|
||||
|
||||
// Extract the ncplane's base nccell into 'c'. The reference is invalidated if
|
||||
// 'ncp' is destroyed.
|
||||
API int ncplane_base(struct ncplane* n, nccell* c);
|
||||
API int ncplane_base(const struct ncplane* n, nccell* c);
|
||||
|
||||
// Get the origin of plane 'n' relative to its bound plane, or pile (if 'n' is
|
||||
// a root plane). To get absolute coordinates, use ncplane_abs_yx().
|
||||
@ -2009,13 +2009,13 @@ API int ncplane_rotate_ccw(struct ncplane* n)
|
||||
// Retrieve the current contents of the cell under the cursor. The EGC is
|
||||
// returned, or NULL on error. This EGC must be free()d by the caller. The
|
||||
// stylemask and channels are written to 'stylemask' and 'channels', respectively.
|
||||
API char* ncplane_at_cursor(struct ncplane* n, uint16_t* stylemask, uint64_t* channels)
|
||||
API char* ncplane_at_cursor(const struct ncplane* n, uint16_t* stylemask, uint64_t* channels)
|
||||
__attribute__ ((nonnull (1)));
|
||||
|
||||
// Retrieve the current contents of the cell under the cursor into 'c'. This
|
||||
// cell is invalidated if the associated plane is destroyed. Returns the number
|
||||
// of bytes in the EGC, or -1 on error.
|
||||
API int ncplane_at_cursor_cell(struct ncplane* n, nccell* c)
|
||||
API int ncplane_at_cursor_cell(const struct ncplane* n, nccell* c)
|
||||
__attribute__ ((nonnull (1, 2)));
|
||||
|
||||
// Retrieve the current contents of the specified cell. The EGC is returned, or
|
||||
@ -2036,7 +2036,7 @@ API char* ncplane_at_yx(const struct ncplane* n, int y, int x,
|
||||
// the secondary columns of a wide glyph, the return can be distinguished from
|
||||
// the primary column (nccell_wide_right_p(c) will return true). It is an
|
||||
// error to call this on a sprixel plane (unlike ncplane_at_yx()).
|
||||
API int ncplane_at_yx_cell(struct ncplane* n, int y, int x, nccell* c)
|
||||
API int ncplane_at_yx_cell(const struct ncplane* n, int y, int x, nccell* c)
|
||||
__attribute__ ((nonnull (1, 4)));
|
||||
|
||||
// Create a flat string from the EGCs of the selected region of the ncplane
|
||||
@ -2044,7 +2044,7 @@ API int ncplane_at_yx_cell(struct ncplane* n, int y, int x, nccell* c)
|
||||
// plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and
|
||||
// 'lenx' can be specified as 0 to go through the boundary of the plane.
|
||||
// -1 can be specified for 'begx'/'begy' to use the current cursor location.
|
||||
API char* ncplane_contents(struct ncplane* n, int begy, int begx,
|
||||
API char* ncplane_contents(const struct ncplane* n, int begy, int begx,
|
||||
unsigned leny, unsigned lenx)
|
||||
__attribute__ ((nonnull (1)));
|
||||
|
||||
|
@ -207,7 +207,7 @@ cursor_invalid_p(const ncplane* n){
|
||||
return false;
|
||||
}
|
||||
|
||||
char* ncplane_at_cursor(ncplane* n, uint16_t* stylemask, uint64_t* channels){
|
||||
char* ncplane_at_cursor(const ncplane* n, uint16_t* stylemask, uint64_t* channels){
|
||||
return ncplane_at_yx(n, n->y, n->x, stylemask, channels);
|
||||
}
|
||||
|
||||
@ -263,11 +263,11 @@ char* ncplane_at_yx(const ncplane* n, int y, int x, uint16_t* stylemask, uint64_
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ncplane_at_cursor_cell(ncplane* n, nccell* c){
|
||||
int ncplane_at_cursor_cell(const ncplane* n, nccell* c){
|
||||
return ncplane_at_yx_cell(n, n->y, n->x, c);
|
||||
}
|
||||
|
||||
int ncplane_at_yx_cell(ncplane* n, int y, int x, nccell* c){
|
||||
int ncplane_at_yx_cell(const ncplane* n, int y, int x, nccell* c){
|
||||
if(n->sprite){
|
||||
logerror("invoked on a sprixel plane");
|
||||
return -1;
|
||||
@ -1535,7 +1535,7 @@ int ncplane_set_base(ncplane* ncp, const char* egc, uint16_t stylemask, uint64_t
|
||||
return nccell_prime(ncp, &ncp->basecell, egc, stylemask, channels);
|
||||
}
|
||||
|
||||
int ncplane_base(ncplane* ncp, nccell* c){
|
||||
int ncplane_base(const ncplane* ncp, nccell* c){
|
||||
return nccell_duplicate(ncp, c, &ncp->basecell);
|
||||
}
|
||||
|
||||
@ -3196,7 +3196,7 @@ uint32_t* ncplane_as_rgba(const ncplane* nc, ncblitter_e blit,
|
||||
}
|
||||
|
||||
// return a heap-allocated copy of the contents
|
||||
char* ncplane_contents(ncplane* nc, int begy, int begx, unsigned leny, unsigned lenx){
|
||||
char* ncplane_contents(const ncplane* nc, int begy, int begx, unsigned leny, unsigned lenx){
|
||||
unsigned ystart, xstart;
|
||||
if(check_geometry_args(nc, begy, begx, &leny, &lenx, &ystart, &xstart)){
|
||||
return NULL;
|
||||
|
@ -130,7 +130,7 @@ void nccell_release(ncplane* n, nccell* c){
|
||||
}
|
||||
|
||||
// Duplicate one cell onto another when they share a plane. Convenience wrapper.
|
||||
int nccell_duplicate(ncplane* n, nccell* targ, const nccell* c){
|
||||
int nccell_duplicate(const ncplane* n, nccell* targ, const nccell* c){
|
||||
if(cell_duplicate_far(&n->pool, targ, n, c) < 0){
|
||||
logerror("failed duplicating cell");
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user