summaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2026-08-03 14:52:39 +0200
committerIngo Klöcker <[email protected]>2026-08-03 14:52:39 +0200
commit667ced56862ec5d50dd17e98aa26155cc2330ac3 (patch)
treee47372d76ab69a013ec28aa221228f1c22768927 /src/util.h
parentHandle new SIGINFO status line (diff)
downloadgpgme-667ced56862ec5d50dd17e98aa26155cc2330ac3.tar.gz
gpgme-667ced56862ec5d50dd17e98aa26155cc2330ac3.zip
Add helper to decode percent-plus encoded strings
* src/conversion.c (do_decode_percent_or_percent_plus): New. (_gpgme_decode_percent_string): Move its code to new file-static do_decode_percent_or_percent_plus and call it with disabled decoding of '+'. * src/conversion.c, src/util.h (_gpgme_decode_percent_plus_string): New. -- GnuPG-bug-id: 8369
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index d805373a..b7462ea5 100644
--- a/src/util.h
+++ b/src/util.h
@@ -131,6 +131,16 @@ gpgme_error_t _gpgme_decode_c_string (const char *src, char **destp,
gpgme_error_t _gpgme_decode_percent_string (const char *src, char **destp,
size_t len, int binary);
+/* Decode the percent-plus escaped string SRC and store the result in the
+ buffer *DESTP which is LEN bytes long. If LEN is zero, then a
+ large enough buffer is allocated with malloc and *DESTP is set to
+ the result. Currently, LEN is only used to specify if allocation
+ is desired or not, the caller is expected to make sure that *DESTP
+ is large enough if LEN is not zero. If BINARY is 1, then '\0'
+ characters are allowed in the output. */
+gpgme_error_t _gpgme_decode_percent_plus_string (const char *src, char **destp,
+ size_t len, int binary);
+
gpgme_error_t _gpgme_encode_percent_string (const char *src, char **destp,
size_t len);