dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.63k stars 115 forks source link

fixing stylemask related functions parameter & return type #2200

Closed joseluis closed 3 years ago

joseluis commented 3 years ago

I started fixing ncdirect_styles parameter to be const, like the analogous ncplane_styles function, but then I've found more related things I could fix a little. So I changed the return type to uint16_t for the public API functions that return a stylemask. Those are nccell_styles, ncdirect_styles, ncdirect_supported_styles and notcurses_supported_styles.

What I've not dared to change are the private unsigned supported_styles field from the tinfo structure in the termdesc.h file, nor the term_supported_styles return type, but maybe they ought to be updated too.

dankamongmen commented 3 years ago

whooooooa there homie; why are you exporting anything from termdesc.h? that's not installed, and is not suitable for external inclusion.

joseluis commented 3 years ago

whooooooa there homie; why are you exporting anything from termdesc.h? that's not installed, and is not suitable for external inclusion.

not exporting that, just diving into the rabbit hole from the public api to see the root of the declared types... I wasn't sure whether just casting to u16 was enough.

Is what I actually did in the commits ok?

dankamongmen commented 3 years ago

Is what I actually did in the commits ok?

no. you've broken ABI compatibility, i believe.

a program already compiled against notcurses will be expected an unsigned to be returned. without a recompile, it will handle the new, likely smaller return value improperly.

also, whenever you change public function signatures, they need be updated in the USAGE.md and man pages in doc/man/man3.

joseluis commented 3 years ago

I'm sorry, I've reverted the changes.

dankamongmen commented 3 years ago

I'm sorry, I've reverted the changes.

no problem, man, thanks!

joseluis commented 3 years ago

Would you like to leave this open to tackle this somewhen in the future?

dankamongmen commented 3 years ago

I've gone ahead and added this to #1777, where I'm listing all the things to change upon movement to ABI3. I'l go ahead and close this one up. In the meantime, you may assume that no values greater than 0xffff will be returned from these functions.