commit fa9f0a4ee2d3cf9414d37a252ef6b408b1c88f14
parent 3ccd1326fe4f77ac66746c84f2ad64a8fbc1ec62
Author: Jacki <jacki@thejackimonster.de>
Date: Mon, 22 Apr 2024 02:57:03 +0200
Adjust return values of functions
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
@@ -782,6 +782,9 @@ GNUNET_CHAT_request_file (struct GNUNET_CHAT_Handle *handle,
uri->fs.uri
);
+ if (!hash)
+ return NULL;
+
struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get(
handle->files,
hash
diff --git a/src/gnunet_chat_util.c b/src/gnunet_chat_util.c
@@ -45,7 +45,8 @@ util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member,
}
void
-util_set_name_field (const char *name, char **field)
+util_set_name_field (const char *name,
+ char **field)
{
GNUNET_assert(field);
@@ -58,8 +59,9 @@ util_set_name_field (const char *name, char **field)
*field = NULL;
}
-int
-util_hash_file (const char *filename, struct GNUNET_HashCode *hash)
+enum GNUNET_GenericReturnValue
+util_hash_file (const char *filename,
+ struct GNUNET_HashCode *hash)
{
GNUNET_assert((filename) && (hash));
@@ -105,7 +107,7 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash)
return GNUNET_OK;
}
-int
+enum GNUNET_GenericReturnValue
util_encrypt_file (const char *filename,
const struct GNUNET_HashCode *hash,
const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
@@ -189,7 +191,7 @@ skip_encryption:
return GNUNET_OK;
}
-int
+enum GNUNET_GenericReturnValue
util_decrypt_file (const char *filename,
const struct GNUNET_HashCode *hash,
const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
diff --git a/src/gnunet_chat_util.h b/src/gnunet_chat_util.h
@@ -71,7 +71,8 @@ util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member,
* @param[out] field String field
*/
void
-util_set_name_field (const char *name, char **field);
+util_set_name_field (const char *name,
+ char **field);
/**
* Generates the <i>hash</i> of a file under a given
@@ -81,8 +82,9 @@ util_set_name_field (const char *name, char **field);
* @param[out] hash Hash of file
* @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR
*/
-int
-util_hash_file (const char *filename, struct GNUNET_HashCode *hash);
+enum GNUNET_GenericReturnValue
+util_hash_file (const char *filename,
+ struct GNUNET_HashCode *hash);
/**
* Encrypts a file inplace under a given <i>filename</i>
@@ -94,7 +96,7 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash);
* @param[in] key Symmetric key
* @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR
*/
-int
+enum GNUNET_GenericReturnValue
util_encrypt_file (const char *filename,
const struct GNUNET_HashCode *hash,
const struct GNUNET_CRYPTO_SymmetricSessionKey *key);
@@ -110,7 +112,7 @@ util_encrypt_file (const char *filename,
* @param[in] key Symmetric key
* @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR
*/
-int
+enum GNUNET_GenericReturnValue
util_decrypt_file (const char *filename,
const struct GNUNET_HashCode *hash,
const struct GNUNET_CRYPTO_SymmetricSessionKey *key);