aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-06-15 08:58:57 +0000
committerWerner Koch <[email protected]>2023-06-15 09:01:46 +0000
commiteb68948c438814b99b81adf44b674738d0b1be34 (patch)
treeb5b6e7a6591d7d2fff22f49262b9b2343a612428
parentFix definition of GPG_ERR_ENABLE_GETTEXT_MACROS (diff)
downloadgpgme-eb68948c438814b99b81adf44b674738d0b1be34.tar.gz
gpgme-eb68948c438814b99b81adf44b674738d0b1be34.zip
core: Use 64 bit instead of gpgme_off_t for some internal functions.
* src/conversion.c (_gpgme_string_to_off): Return an u64 value. * src/data.c (_gpgme_data_get_size_hint): Ditto. (gpgme_data_set_flag): Use u64 for io-buffer-size due to string_to_off change. * src/data.h (struct gpgme_data): Change size_hint to u64. * src/engine-gpg.c (add_input_size_hint): Replace gpgme_off_t by u64. -- GnuPG-bug-id: 6534
-rw-r--r--src/conversion.c4
-rw-r--r--src/data.c4
-rw-r--r--src/data.h4
-rw-r--r--src/engine-gpg.c2
-rw-r--r--src/util.h4
5 files changed, 10 insertions, 8 deletions
diff --git a/src/conversion.c b/src/conversion.c
index 17dce7f3..f5dd7ea2 100644
--- a/src/conversion.c
+++ b/src/conversion.c
@@ -434,10 +434,10 @@ _gpgme_strtoul_field (const char *string, unsigned long *result)
/* Convert STRING into an offset value. Note that this functions only
* allows for a base-10 length. This function is similar to atoi()
* and thus there is no error checking. */
-gpgme_off_t
+uint64_t
_gpgme_string_to_off (const char *string)
{
- gpgme_off_t value = 0;
+ uint64_t value = 0;
while (*string == ' ' || *string == '\t')
string++;
diff --git a/src/data.c b/src/data.c
index e2de9f67..1bb334c9 100644
--- a/src/data.c
+++ b/src/data.c
@@ -572,7 +572,7 @@ gpgme_data_set_flag (gpgme_data_t dh, const char *name, const char *value)
}
else if (!strcmp (name, "io-buffer-size"))
{
- gpgme_off_t val;
+ uint64_t val;
/* We may set this only once. */
if (dh->io_buffer_size)
@@ -744,7 +744,7 @@ _gpgme_data_get_fd (gpgme_data_t dh)
/* Get the size-hint value for DH or 0 if not available. */
-gpgme_off_t
+uint64_t
_gpgme_data_get_size_hint (gpgme_data_t dh)
{
return dh ? dh->size_hint : 0;
diff --git a/src/data.h b/src/data.h
index 648d976f..3e063943 100644
--- a/src/data.h
+++ b/src/data.h
@@ -96,7 +96,7 @@ struct gpgme_data
char *file_name;
/* Hint on the to be expected total size of the data. */
- gpgme_off_t size_hint;
+ uint64_t size_hint;
/* If no 0 the size of an allocated inbound or outpund buffers. The
* value is at least BUFFER_SIZE and capped at 1MiB. */
@@ -189,7 +189,7 @@ void _gpgme_data_release (gpgme_data_t dh);
int _gpgme_data_get_fd (gpgme_data_t dh);
/* Get the size-hint value for DH or 0 if not available. */
-gpgme_off_t _gpgme_data_get_size_hint (gpgme_data_t dh);
+uint64_t _gpgme_data_get_size_hint (gpgme_data_t dh);
#endif /* DATA_H */
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 75e375d7..03e648f3 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -1774,7 +1774,7 @@ start (engine_gpg_t gpg)
static gpgme_error_t
add_input_size_hint (engine_gpg_t gpg, gpgme_data_t data)
{
- gpgme_off_t value = _gpgme_data_get_size_hint (data);
+ uint64_t value = _gpgme_data_get_size_hint (data);
char numbuf[50]; /* Large enough for even 2^128 in base-10. */
char *p;
diff --git a/src/util.h b/src/util.h
index 90213b10..d3b982e7 100644
--- a/src/util.h
+++ b/src/util.h
@@ -35,6 +35,8 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#include <stdint.h>
+
#include "gpgme.h"
@@ -143,7 +145,7 @@ int _gpgme_split_fields (char *string, char **array, int arraysize);
gpgme_error_t _gpgme_strtoul_field (const char *string, unsigned long *result);
/* Convert STRING into an offset value similar to atoi(). */
-gpgme_off_t _gpgme_string_to_off (const char *string);
+uint64_t _gpgme_string_to_off (const char *string);
/* Parse the string TIMESTAMP into a time_t. The string may either be
seconds since Epoch or in the ISO 8601 format like