Commit fbdc5aa2 authored by Kapp Arnaud's avatar Kapp Arnaud

Add const qualifier to source parameters in zmq_z85_decode and zmq_z85_encode

parent fadb2a38
...@@ -9,7 +9,7 @@ zmq_z85_decode - decode a binary key from Z85 printable text ...@@ -9,7 +9,7 @@ zmq_z85_decode - decode a binary key from Z85 printable text
SYNOPSIS SYNOPSIS
-------- --------
*uint8_t *zmq_z85_decode (uint8_t *dest, char *string);* *uint8_t *zmq_z85_decode (uint8_t *dest, const char *string);*
DESCRIPTION DESCRIPTION
...@@ -31,7 +31,7 @@ EXAMPLE ...@@ -31,7 +31,7 @@ EXAMPLE
------- -------
.Decoding a CURVE key .Decoding a CURVE key
---- ----
char decoded [] = "rq:rM>}U?@Lns47E1%kR.o@n%FcmmsL/@{H8]yf7"; const char decoded [] = "rq:rM>}U?@Lns47E1%kR.o@n%FcmmsL/@{H8]yf7";
uint8_t public_key [32]; uint8_t public_key [32];
zmq_z85_decode (public_key, decoded); zmq_z85_decode (public_key, decoded);
---- ----
......
...@@ -9,7 +9,7 @@ zmq_z85_encode - encode a binary key as Z85 printable text ...@@ -9,7 +9,7 @@ zmq_z85_encode - encode a binary key as Z85 printable text
SYNOPSIS SYNOPSIS
-------- --------
*char *zmq_z85_encode (char *dest, uint8_t *data, size_t size);* *char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size);*
DESCRIPTION DESCRIPTION
......
...@@ -420,10 +420,10 @@ ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); ...@@ -420,10 +420,10 @@ ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags);
/******************************************************************************/ /******************************************************************************/
/* Encode data with Z85 encoding. Returns encoded data */ /* Encode data with Z85 encoding. Returns encoded data */
ZMQ_EXPORT char *zmq_z85_encode (char *dest, uint8_t *data, size_t size); ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size);
/* Decode data with Z85 encoding. Returns decoded data */ /* Decode data with Z85 encoding. Returns decoded data */
ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, char *string); ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string);
/* Generate z85-encoded public and private keypair with libsodium. */ /* Generate z85-encoded public and private keypair with libsodium. */
/* Returns 0 on success. */ /* Returns 0 on success. */
......
...@@ -111,7 +111,7 @@ static uint8_t decoder [96] = { ...@@ -111,7 +111,7 @@ static uint8_t decoder [96] = {
// dest. Size must be a multiple of 4. // dest. Size must be a multiple of 4.
// Returns NULL and sets errno = EINVAL for invalid input. // Returns NULL and sets errno = EINVAL for invalid input.
char *zmq_z85_encode (char *dest, uint8_t *data, size_t size) char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size)
{ {
if (size % 4 != 0) { if (size % 4 != 0) {
errno = EINVAL; errno = EINVAL;
...@@ -145,7 +145,7 @@ char *zmq_z85_encode (char *dest, uint8_t *data, size_t size) ...@@ -145,7 +145,7 @@ char *zmq_z85_encode (char *dest, uint8_t *data, size_t size)
// must be a multiple of 5. // must be a multiple of 5.
// Returns NULL and sets errno = EINVAL for invalid input. // Returns NULL and sets errno = EINVAL for invalid input.
uint8_t *zmq_z85_decode (uint8_t *dest, char *string) uint8_t *zmq_z85_decode (uint8_t *dest, const char *string)
{ {
if (strlen (string) % 5 != 0) { if (strlen (string) % 5 != 0) {
errno = EINVAL; errno = EINVAL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment