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
This commit is contained in:
parent
7e6d51aa6f
commit
eb68948c43
@ -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++;
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user