aboutsummaryrefslogtreecommitdiffstats
path: root/src/conversion.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversion.c')
-rw-r--r--src/conversion.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/conversion.c b/src/conversion.c
index c2b27a16..3df8fe59 100644
--- a/src/conversion.c
+++ b/src/conversion.c
@@ -364,6 +364,25 @@ _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
+_gpgme_string_to_off (const char *string)
+{
+ gpgme_off_t value = 0;
+
+ while (*string == ' ' || *string == '\t')
+ string++;
+ for (; *string >= '0' && *string <= '9'; string++)
+ {
+ value *= 10;
+ value += atoi_1 (string);
+ }
+ return value;
+}
+
+
#ifdef HAVE_W32_SYSTEM
static time_t
_gpgme_timegm (struct tm *tm)