[Pkg-gnupg-commit] [gpgme] 34/62: core: Non-zero values should set _armor, _textmode, and _online.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Nov 19 04:03:34 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gpgme.

commit da035768bd9a880becee5d0d553dfe12299f96eb
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Thu Nov 10 15:47:48 2016 -0800

    core: Non-zero values should set _armor, _textmode, and _online.
    
    * src/gpgme.c (gpgme_set_armor, gpgme_set_textmode,
    gpgme_set_offline): Ensure that non-zero values actually set the
    appropriate internal bit.
    
    --
    
    The documentation for these functions says things like "disabled if
    YES is zero, and enabled otherwise", where YES is an integer.
    However, if you pass an even integer, it will be aliased back to 0
    because the context member variables are declared as single bits.
    
    This should make the implementation match the documentation.
    
    Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
 src/gpgme.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gpgme.c b/src/gpgme.c
index 6d0dbff..443cb76 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -504,7 +504,7 @@ gpgme_set_armor (gpgme_ctx_t ctx, int use_armor)
   if (!ctx)
     return;
 
-  ctx->use_armor = use_armor;
+  ctx->use_armor = !!use_armor;
 }
 
 
@@ -531,7 +531,7 @@ gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode)
   if (!ctx)
     return;
 
-  ctx->use_textmode = use_textmode;
+  ctx->use_textmode = !!use_textmode;
 }
 
 /* Return the state of the textmode flag.  */
@@ -555,7 +555,7 @@ gpgme_set_offline (gpgme_ctx_t ctx, int offline)
   if (!ctx)
     return;
 
-  ctx->offline = offline;
+  ctx->offline = !!offline;
 }
 
 /* Return the state of the offline flag.  */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list