Skip to content

Commit

Permalink
librz: add nullable pointer modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
createyourpersonalaccount authored and XVilka committed Oct 13, 2023
1 parent d501790 commit 6eec2fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions librz/include/rz_util/rz_base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
extern "C" {
#endif

RZ_API size_t rz_base64_encode(char *bout, const ut8 *bin, size_t sz);
RZ_API st64 rz_base64_decode(ut8 *bout, const char *bin, st64 len);
RZ_API RZ_OWN ut8 *rz_base64_decode_dyn(const char *in, st64 len);
RZ_API RZ_OWN char *rz_base64_encode_dyn(const ut8 *bin, size_t sz);
RZ_API size_t rz_base64_encode(RZ_OUT RZ_NULLABLE char *bout, RZ_NULLABLE const ut8 *bin, size_t sz);
RZ_API st64 rz_base64_decode(RZ_OUT RZ_NULLABLE ut8 *bout, RZ_NULLABLE const char *bin, st64 len);
RZ_API RZ_OWN ut8 *rz_base64_decode_dyn(RZ_NULLABLE const char *in, st64 len);
RZ_API RZ_OWN char *rz_base64_encode_dyn(RZ_NULLABLE const ut8 *bin, size_t sz);
#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 4 additions & 4 deletions librz/util/ubase64.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static size_t calculate_dest_length(const ut8 *src, size_t len) {
* free(enc);
* \endcode
*/
RZ_API size_t rz_base64_encode(char *dest, const ut8 *src, size_t n) {
RZ_API size_t rz_base64_encode(RZ_OUT RZ_NULLABLE char *dest, RZ_NULLABLE const ut8 *src, size_t n) {
ut8 final_group[3] = { 0 };
size_t ret;
rz_return_val_if_fail(src, 0);
Expand Down Expand Up @@ -250,7 +250,7 @@ RZ_API size_t rz_base64_encode(char *dest, const ut8 *src, size_t n) {
* free(bin_dec);
* \endcode
*/
RZ_API RZ_OWN char *rz_base64_encode_dyn(const ut8 *src, size_t n) {
RZ_API RZ_OWN char *rz_base64_encode_dyn(RZ_NULLABLE const ut8 *src, size_t n) {
size_t ret_size;
char *ret;
rz_return_val_if_fail(src, NULL);
Expand Down Expand Up @@ -309,7 +309,7 @@ RZ_API RZ_OWN char *rz_base64_encode_dyn(const ut8 *src, size_t n) {
* free(msg);
* \endcode
*/
RZ_API st64 rz_base64_decode(ut8 *dest, const char *src, st64 n) {
RZ_API st64 rz_base64_decode(RZ_OUT RZ_NULLABLE ut8 *dest, RZ_NULLABLE const char *src, st64 n) {
char buf[4], tmp[3];
int c;
size_t i, j;
Expand Down Expand Up @@ -389,7 +389,7 @@ RZ_API st64 rz_base64_decode(ut8 *dest, const char *src, st64 n) {
*
* See \a rz_base64_encode_dyn for an example.
*/
RZ_API RZ_OWN ut8 *rz_base64_decode_dyn(const char *src, st64 len) {
RZ_API RZ_OWN ut8 *rz_base64_decode_dyn(RZ_NULLABLE const char *src, st64 len) {
ut8 *ret, *tmp;
st64 ret_size;
rz_return_val_if_fail(src, NULL);
Expand Down

0 comments on commit 6eec2fe

Please sign in to comment.