aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/data.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/data.c b/src/data.c
index 87b619e4..6964246a 100644
--- a/src/data.c
+++ b/src/data.c
@@ -243,6 +243,28 @@ gpgme_data_get_file_name (gpgme_data_t dh)
return dh->file_name;
}
+
+/* Set a flag for the data object DH. See the manual for details. */
+gpg_error_t
+gpgme_data_set_flag (gpgme_data_t dh, const char *name, const char *value)
+{
+ TRACE_BEG2 (DEBUG_DATA, "gpgme_data_set_flag", dh,
+ "%s=%s", name, value);
+
+ if (!dh)
+ return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
+
+ if (!strcmp (name, "size-hint"))
+ {
+ dh->size_hint= value? _gpgme_string_to_off (value) : 0;
+ }
+ else
+ return gpg_error (GPG_ERR_UNKNOWN_NAME);
+
+ return 0;
+}
+
+
/* Functions to support the wait interface. */
@@ -334,3 +356,11 @@ _gpgme_data_get_fd (gpgme_data_t dh)
return -1;
return (*dh->cbs->get_fd) (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)
+{
+ return dh ? dh->size_hint : 0;
+}