ncpalette_get: can't return -1 on uint32_t erp

pull/2569/head
nick black 2 years ago
parent 72678835f2
commit 60158a19cf
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -27,7 +27,7 @@ typedef struct ncpalette {
**int ncpalette_set(ncpalette* ***p***, int ***idx***, unsigned ***rgb***);**
**uint32_t ncpalette_get(const ncpalette* ***p***, int ***idx***);**
**int ncpalette_get(const ncpalette* ***p***, int ***idx***, uint32_t* ***palent***);**
**int ncpalette_get_rgb8(const ncpalette* ***p***, int ***idx***, int* restrict ***r***, int* restrict ***g***, int* restrict ***b***);**

@ -1550,12 +1550,13 @@ ncpalette_set(ncpalette* p, int idx, unsigned rgb){
return ncchannel_set(&p->chans[idx], rgb);
}
static inline uint32_t
ncpalette_get(const ncpalette* p, int idx){
static inline int
ncpalette_get(const ncpalette* p, int idx, uint32_t* palent){
if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){
return -1;
}
return ncchannel_rgb(p->chans[idx]);
*palent = ncchannel_rgb(p->chans[idx]);
return 0;
}
static inline int

Loading…
Cancel
Save