Replace magic number in `CFE_SB_IncrBufUseCnt`
Is your feature request related to a problem? Please describe.
The 0x7FFF limit on an uint16 doesn't seem to make sense, looks like int16 max instead of uint16 max?
https://github.com/nasa/cFE/blob/c8b5e00bb722d8f59787ae8f82634feba5d39f60/modules/sb/fsw/src/cfe_sb_buf.c#L200
Describe the solution you'd like Use a defined max, add a comment if the max choice isn't obvious.
Describe alternatives you've considered None
Additional context Code review
Requester Info Jacob Hageman - NASA/GSFC
~Actually, limiting the maximum value silently just leads to the queue being released before all users are done. This really should create an error on subscribe or similar to avoid potential issues/strange behavior. Maybe this case is protected somewhere else, but until confirmed to not be an issue, marking as bug since in theory this could cause pretty strange results.. Not immediately critical since there aren't 0x7FFF subscribers in any currently realistic system.~
EDIT - number of subscriptions is limited by CFE_PLATFORM_SB_MAX_DEST_PER_PKT, so as long as that's less than the limit here the UseCount exceeded case will never be reached (avoiding strange behavior). Really this is unreachable "defensive" code, and probably should use the same limit and document it if we really want to leave it in. Could add a test that max UseCount value is > CFE_PLATFORM_SB_MAX_DEST_PER_PKT or similar.
Given that no event is generated, nor an error returned, the check is almost pointless (no one will ever know if it was triggered). Also, as you mention, it seems unlikely/impossible for it to be called given the limitations set by CFE_PLATFORM_SB_MAX_DEST_PER_PKT anyway.