mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2024-11-22 14:27:09 +00:00
More cleanup based on patch from fedora at famillecollet dot com in bug #60915
This commit is contained in:
parent
71d97801e9
commit
7bba784b63
2 changed files with 9 additions and 7 deletions
11
gnupg.c
11
gnupg.c
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "php.h"
|
#include "php.h"
|
||||||
#include "php_ini.h"
|
#include "php_ini.h"
|
||||||
|
#include "zend_exceptions.h"
|
||||||
#include "ext/standard/info.h"
|
#include "ext/standard/info.h"
|
||||||
#include "php_gnupg.h"
|
#include "php_gnupg.h"
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ static zend_object_handlers gnupg_object_handlers;
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, (char*)error); \
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, (char*)error); \
|
||||||
break; \
|
break; \
|
||||||
case 2: \
|
case 2: \
|
||||||
zend_throw_exception(zend_exception_get_default(), (char*) error, 0 TSRMLS_CC); \
|
zend_throw_exception(zend_exception_get_default(TSRMLS_C), (char*) error, 0 TSRMLS_CC); \
|
||||||
break; \
|
break; \
|
||||||
default: \
|
default: \
|
||||||
intern->errortxt = (char*)error; \
|
intern->errortxt = (char*)error; \
|
||||||
|
@ -170,7 +171,9 @@ static void gnupg_obj_dtor(gnupg_object *intern TSRMLS_DC){
|
||||||
/* {{{ objects_new */
|
/* {{{ objects_new */
|
||||||
zend_object_value gnupg_obj_new(zend_class_entry *class_type TSRMLS_DC){
|
zend_object_value gnupg_obj_new(zend_class_entry *class_type TSRMLS_DC){
|
||||||
gnupg_object *intern;
|
gnupg_object *intern;
|
||||||
|
#if PHP_VERSION_ID < 50399
|
||||||
zval *tmp;
|
zval *tmp;
|
||||||
|
#endif
|
||||||
zend_object_value retval;
|
zend_object_value retval;
|
||||||
|
|
||||||
intern = ecalloc(1, sizeof(gnupg_object));
|
intern = ecalloc(1, sizeof(gnupg_object));
|
||||||
|
@ -383,7 +386,7 @@ PHP_MINFO_FUNCTION(gnupg)
|
||||||
/* {{{ callback func for setting the passphrase */
|
/* {{{ callback func for setting the passphrase */
|
||||||
|
|
||||||
gpgme_error_t passphrase_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){
|
gpgme_error_t passphrase_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){
|
||||||
char uid[16];
|
char uid[17];
|
||||||
int idx;
|
int idx;
|
||||||
char *passphrase = NULL;
|
char *passphrase = NULL;
|
||||||
zval *return_value = NULL;
|
zval *return_value = NULL;
|
||||||
|
@ -411,7 +414,7 @@ gpgme_error_t passphrase_cb (gnupg_object *intern, const char *uid_hint, const c
|
||||||
}
|
}
|
||||||
|
|
||||||
gpgme_error_t passphrase_decrypt_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){
|
gpgme_error_t passphrase_decrypt_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){
|
||||||
char uid[16];
|
char uid[17];
|
||||||
int idx;
|
int idx;
|
||||||
char *passphrase = NULL;
|
char *passphrase = NULL;
|
||||||
zval *return_value = NULL;
|
zval *return_value = NULL;
|
||||||
|
@ -1248,7 +1251,6 @@ PHP_FUNCTION(gnupg_decryptverify){
|
||||||
gpgme_data_t in, out;
|
gpgme_data_t in, out;
|
||||||
gpgme_decrypt_result_t decrypt_result;
|
gpgme_decrypt_result_t decrypt_result;
|
||||||
gpgme_verify_result_t verify_result;
|
gpgme_verify_result_t verify_result;
|
||||||
gpgme_signature_t gpg_signatures;
|
|
||||||
|
|
||||||
GNUPG_GETOBJ();
|
GNUPG_GETOBJ();
|
||||||
|
|
||||||
|
@ -1482,7 +1484,6 @@ PHP_FUNCTION(gnupg_listsignatures){
|
||||||
zval *sig_arr;
|
zval *sig_arr;
|
||||||
|
|
||||||
gpgme_key_t gpgme_key;
|
gpgme_key_t gpgme_key;
|
||||||
gpgme_subkey_t gpgme_subkey;
|
|
||||||
gpgme_user_id_t gpgme_userid;
|
gpgme_user_id_t gpgme_userid;
|
||||||
gpgme_key_sig_t gpgme_signature;
|
gpgme_key_sig_t gpgme_signature;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "php_ini.h"
|
#include "php_ini.h"
|
||||||
#include "ext/standard/info.h"
|
#include "ext/standard/info.h"
|
||||||
#include "zend_interfaces.h"
|
#include "zend_interfaces.h"
|
||||||
|
#include "zend_exceptions.h"
|
||||||
#include "php_gnupg.h"
|
#include "php_gnupg.h"
|
||||||
#include "php_gnupg_keylistiterator.h"
|
#include "php_gnupg_keylistiterator.h"
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ PHP_METHOD(gnupg_keylistiterator,next){
|
||||||
gpgme_key_release(intern->gpgkey);
|
gpgme_key_release(intern->gpgkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(intern->err = gpgme_op_keylist_next(intern->ctx, &intern->gpgkey)){
|
if((intern->err = gpgme_op_keylist_next(intern->ctx, &intern->gpgkey))){
|
||||||
gpgme_key_release(intern->gpgkey);
|
gpgme_key_release(intern->gpgkey);
|
||||||
intern->gpgkey = NULL;
|
intern->gpgkey = NULL;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +160,7 @@ PHP_METHOD(gnupg_keylistiterator,rewind){
|
||||||
GNUPG_GET_ITERATOR();
|
GNUPG_GET_ITERATOR();
|
||||||
|
|
||||||
if((intern->err = gpgme_op_keylist_start(intern->ctx, Z_STRVAL(intern->pattern), 0)) != GPG_ERR_NO_ERROR){
|
if((intern->err = gpgme_op_keylist_start(intern->ctx, Z_STRVAL(intern->pattern), 0)) != GPG_ERR_NO_ERROR){
|
||||||
zend_throw_exception(zend_exception_get_default(),gpg_strerror(intern->err),1 TSRMLS_CC);
|
zend_throw_exception(zend_exception_get_default(TSRMLS_C),gpg_strerror(intern->err),1 TSRMLS_CC);
|
||||||
}
|
}
|
||||||
if((intern->err = gpgme_op_keylist_next(intern->ctx, &intern->gpgkey))!=GPG_ERR_NO_ERROR){
|
if((intern->err = gpgme_op_keylist_next(intern->ctx, &intern->gpgkey))!=GPG_ERR_NO_ERROR){
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
|
Loading…
Reference in a new issue