aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2024-06-10 09:48:05 +0000
committerIngo Klöcker <[email protected]>2024-06-10 12:54:48 +0000
commit4136928f0d894e873eb0ecb0bc79931a023ba32c (patch)
treef74008b20a2cbefb5557d09ca774aa9ae12ceef9
parentdoc: Extend description for GPGME_CREATE_ADSK (diff)
downloadgpgme-4136928f0d894e873eb0ecb0bc79931a023ba32c.tar.gz
gpgme-4136928f0d894e873eb0ecb0bc79931a023ba32c.zip
cpp: Remove commented out and disabled code
* lang/cpp/src/configuration.cpp: Remove disabled, abandoned code. * lang/cpp/src/context.cpp: Remove commented out, obsolete code. --
-rw-r--r--lang/cpp/src/configuration.cpp152
-rw-r--r--lang/cpp/src/context.cpp4
2 files changed, 0 insertions, 156 deletions
diff --git a/lang/cpp/src/configuration.cpp b/lang/cpp/src/configuration.cpp
index 33c812f7..b3b62d6f 100644
--- a/lang/cpp/src/configuration.cpp
+++ b/lang/cpp/src/configuration.cpp
@@ -257,158 +257,6 @@ Type Option::alternateType() const
return isNull() ? NoType : static_cast<Type>(opt->alt_type) ;
}
-#if 0
-static Option::Variant argument_to_variant(gpgme_conf_type_t type, bool list, gpgme_conf_arg_t arg)
-{
- assert(arg);
- switch (type) {
- case GPGME_CONF_NONE:
- if (list) {
- // return the count (number of times set):
- return arg->value.count;
- } else {
- return none;
- }
- case GPGME_CONF_INT32:
- if (list) {
- std::vector<int> result;
- for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
- result.push_back(a->value.int32);
- }
- return result;
- } else {
- return arg->value.int32;
- }
- case GPGME_CONF_UINT32:
- if (list) {
- std::vector<unsigned int> result;
- for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
- result.push_back(a->value.uint32);
- }
- return result;
- } else {
- return arg->value.uint32;
- }
- case GPGME_CONF_FILENAME:
- case GPGME_CONF_LDAP_SERVER:
- case GPGME_CONF_KEY_FPR:
- case GPGME_CONF_PUB_KEY:
- case GPGME_CONF_SEC_KEY:
- case GPGME_CONF_ALIAS_LIST:
- // these should not happen in alt_type, but fall through
- case GPGME_CONF_STRING:
- if (list) {
- std::vector<const char *> result;
- for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
- result.push_back(a->value.string);
- }
- return result;
- } else {
- return arg->value.string;
- }
- }
- assert(!"Option: unknown alt_type!");
- return Option::Variant();
-}
-
-namespace
-{
-inline const void *to_void_star(const char *s)
-{
- return s;
-}
-inline const void *to_void_star(const std::string &s)
-{
- return s.c_str();
-}
-inline const void *to_void_star(const int &i)
-{
- return &i; // const-&: sic!
-}
-inline const void *to_void_star(const unsigned int &i)
-{
- return &i; // const-&: sic!
-}
-
-struct VariantToArgumentVisitor : boost::static_visitor<gpgme_conf_arg_t> {
- static gpgme_conf_arg_t make_argument(gpgme_conf_type_t type, const void *value)
- {
- gpgme_conf_arg_t arg = 0;
-#ifdef HAVE_GPGME_CONF_ARG_NEW_WITH_CONST_VALUE
- if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, value)) {
- return 0;
- }
-#else
- if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, const_cast<void *>(value))) {
- return 0;
- }
-#endif
- else {
- return arg;
- }
- }
-
- gpgme_conf_arg_t operator()(bool v) const
- {
- return v ? make_argument(0) : 0 ;
- }
-
- gpgme_conf_arg_t operator()(const char *s) const
- {
- return make_argument(s ? s : "");
- }
-
- gpgme_conf_arg_t operator()(const std::string &s) const
- {
- return operator()(s.c_str());
- }
-
- gpgme_conf_arg_t operator()(int i) const
- {
- return make_argument(&i);
- }
-
- gpgme_conf_arg_t operator()(unsigned int i) const
- {
- return make_argument(&i);
- }
-
- template <typename T>
- gpgme_conf_arg_t operator()(const std::vector<T> &value) const
- {
- gpgme_conf_arg_t result = 0;
- gpgme_conf_arg_t last = 0;
- for (typename std::vector<T>::const_iterator it = value.begin(), end = value.end() ; it != end ; ++it) {
- if (gpgme_conf_arg_t arg = make_argument(to_void_star(*it))) {
- if (last) {
- last = last->next = arg;
- } else {
- result = last = arg;
- }
- }
- }
- return result;
- }
-
-};
-}
-
-static gpgme_conf_arg_t variant_to_argument(const Option::Variant &value)
-{
- VariantToArgumentVisitor v;
- return apply_visitor(v, value);
-}
-
-optional<Option::Variant> Option::defaultValue() const
-{
- if (isNull()) {
- return optional<Variant>();
- } else {
- return argument_to_variant(opt->alt_type, opt->flags & GPGME_CONF_LIST, opt->default_value);
- }
-}
-#endif
-
Argument Option::defaultValue() const
{
if (isNull()) {
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 57f92394..99e354df 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -147,11 +147,7 @@ bool Error::isCanceled() const
int Error::toErrno() const
{
-//#ifdef HAVE_GPGME_GPG_ERROR_WRAPPERS
return gpgme_err_code_to_errno(static_cast<gpgme_err_code_t>(code()));
-//#else
-// return gpg_err_code_to_errno( static_cast<gpg_err_code_t>( code() ) );
-//#endif
}
// static