mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
deconstify functions which write to pool
several functions appear to have recently been marked as accepting a const ncplane, despite potentially writing into that plane's egcpool. in such cases, the ncplane argument cannot be marked constant, as indicated by compiler warnings. all have been rectified.
This commit is contained in:
parent
9578e4c969
commit
2316c7e646
@ -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(const struct ncplane* n, nccell* targ, const nccell* c);
|
||||
API int nccell_duplicate(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(const struct ncplane* n, nccell* c);
|
||||
API int ncplane_base(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().
|
||||
@ -2015,7 +2015,7 @@ API char* ncplane_at_cursor(const struct ncplane* n, uint16_t* stylemask, uint64
|
||||
// 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(const struct ncplane* n, nccell* c)
|
||||
API int ncplane_at_cursor_cell(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(const struct ncplane* n, int y, int x, nccell* c)
|
||||
API int ncplane_at_yx_cell(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(const 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(const struct ncplane* n, int begy, int begx,
|
||||
API char* ncplane_contents(struct ncplane* n, int begy, int begx,
|
||||
unsigned leny, unsigned lenx)
|
||||
__attribute__ ((nonnull (1)));
|
||||
|
||||
|
@ -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(const ncplane* n, nccell* c){
|
||||
int ncplane_at_cursor_cell(ncplane* n, nccell* c){
|
||||
return ncplane_at_yx_cell(n, n->y, n->x, c);
|
||||
}
|
||||
|
||||
int ncplane_at_yx_cell(const ncplane* n, int y, int x, nccell* c){
|
||||
int ncplane_at_yx_cell(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(const ncplane* ncp, nccell* c){
|
||||
int ncplane_base(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(const ncplane* nc, int begy, int begx, unsigned leny, unsigned lenx){
|
||||
char* ncplane_contents(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(const ncplane* n, nccell* targ, const nccell* c){
|
||||
int nccell_duplicate(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