From 6c2ecfd61a1b2e67c5b53c23664e37ce47952f0e Mon Sep 17 00:00:00 2001 From: marty1885 Date: Fri, 9 Dec 2022 00:55:51 +0800 Subject: [PATCH] fix GNUnet 0.19.0 compatiablity --- gnunetpp/gnunetpp-crypto.hpp | 5 ++--- gnunetpp/gnunetpp-dht.hpp | 3 +-- gnunetpp/gnunetpp-fs.cpp | 13 ++++++++----- gnunetpp/gnunetpp-fs.hpp | 3 +-- gnunetpp/gnunetpp-identity.cpp | 8 ++++---- gnunetpp/gnunetpp-identity.hpp | 5 ++--- gnunetpp/gnunetpp-scheduler.cpp | 3 +-- gnunetpp/gnunetpp.hpp | 1 - gnunetpp/inner/Infra.hpp | 1 - gnunetpp/pch.hpp | 2 +- 10 files changed, 20 insertions(+), 24 deletions(-) diff --git a/gnunetpp/gnunetpp-crypto.hpp b/gnunetpp/gnunetpp-crypto.hpp index 6d46c4c..88b89d9 100644 --- a/gnunetpp/gnunetpp-crypto.hpp +++ b/gnunetpp/gnunetpp-crypto.hpp @@ -1,7 +1,6 @@ #pragma once -#include "gnunet/platform.h" -#include +#include #include #include @@ -38,4 +37,4 @@ std::string to_string(const GNUNET_CRYPTO_EddsaPrivateKey& key); std::string to_string(const GNUNET_CRYPTO_EddsaPublicKey& key); GNUNET_CRYPTO_EcdsaPublicKey get_public_key(const GNUNET_CRYPTO_EcdsaPrivateKey& key); -} \ No newline at end of file +} diff --git a/gnunetpp/gnunetpp-dht.hpp b/gnunetpp/gnunetpp-dht.hpp index 7f9bd05..0de50a7 100644 --- a/gnunetpp/gnunetpp-dht.hpp +++ b/gnunetpp/gnunetpp-dht.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include @@ -93,4 +92,4 @@ struct DHT : public Service std::set get_handles; }; -} \ No newline at end of file +} diff --git a/gnunetpp/gnunetpp-fs.cpp b/gnunetpp/gnunetpp-fs.cpp index 067bb6b..391c886 100644 --- a/gnunetpp/gnunetpp-fs.cpp +++ b/gnunetpp/gnunetpp-fs.cpp @@ -4,6 +4,9 @@ #include #include +#include +#include + namespace gnunetpp::FS { namespace detail @@ -75,8 +78,8 @@ GNUNET_FS_FileInformation * get_file_information (GNUNET_FS_Handle* fsh, GNUNET_ if (GNUNET_YES == item->is_directory) { if (item->meta == NULL) - item->meta = GNUNET_CONTAINER_meta_data_create (); - GNUNET_CONTAINER_meta_data_delete (item->meta, EXTRACTOR_METATYPE_MIMETYPE, NULL, 0); + item->meta = GNUNET_FS_meta_data_create (); + GNUNET_FS_meta_data_delete (item->meta, EXTRACTOR_METATYPE_MIMETYPE, NULL, 0); GNUNET_FS_meta_data_make_directory (item->meta); if (item->ksk_uri == NULL) { const char *mime = GNUNET_FS_DIRECTORY_MIME; @@ -100,7 +103,7 @@ GNUNET_FS_FileInformation * get_file_information (GNUNET_FS_Handle* fsh, GNUNET_ } static int publish_inspector (void *cls, GNUNET_FS_FileInformation *fi, uint64_t length, - GNUNET_CONTAINER_MetaData *m, GNUNET_FS_Uri **uri, GNUNET_FS_BlockOptions *bo, + GNUNET_FS_MetaData *m, GNUNET_FS_Uri **uri, GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) { char *fn; @@ -126,7 +129,7 @@ static int publish_inspector (void *cls, GNUNET_FS_FileInformation *fi, uint64_t data->keywords.clear(); } if (/*enable_creation_time*/ true) - GNUNET_CONTAINER_meta_data_add_publication_date (m); + GNUNET_FS_meta_data_add_publication_date (m); if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory(m)) { data->fi = fi; GNUNET_FS_file_information_inspect(fi, &publish_inspector, data); @@ -172,7 +175,7 @@ GNUNET_FS_SearchContext* search( else if(info->status != GNUNET_FS_STATUS_SEARCH_RESULT) return; char* uri = GNUNET_FS_uri_to_string(info->value.search.specifics.result.uri); - char* filename = GNUNET_CONTAINER_meta_data_get_by_type ( + char* filename = GNUNET_FS_meta_data_get_by_type ( info->value.search.specifics.result.meta, (EXTRACTOR_MetaType)EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME); bool keep_running = fn(uri, filename); diff --git a/gnunetpp/gnunetpp-fs.hpp b/gnunetpp/gnunetpp-fs.hpp index be440bf..6aa57b0 100644 --- a/gnunetpp/gnunetpp-fs.hpp +++ b/gnunetpp/gnunetpp-fs.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include "inner/UniqueData.hpp" @@ -98,4 +97,4 @@ GNUNET_FS_UnindexContext* unindex( UnindexCallbackFunctor fn); void cancel(GNUNET_FS_SearchContext* sc); -} \ No newline at end of file +} diff --git a/gnunetpp/gnunetpp-identity.cpp b/gnunetpp/gnunetpp-identity.cpp index 6ef5e9f..9e88513 100644 --- a/gnunetpp/gnunetpp-identity.cpp +++ b/gnunetpp/gnunetpp-identity.cpp @@ -7,18 +7,18 @@ namespace gnunetpp::identity { namespace detail { -static void identity_create_trampline(void* cls, const struct GNUNET_IDENTITY_PrivateKey* id, const char* emsg) +static void identity_create_trampline(void* cls, const struct GNUNET_IDENTITY_PrivateKey* id, GNUNET_ErrorCode ec) { auto cb = reinterpret_cast*>(cls); - std::string err_msg = emsg ? emsg : ""; + std::string err_msg = GNUNET_ErrorCode_get_hint(ec); (*cb)(*id, err_msg); delete cb; } -static void identity_delete_trampline(void* cls, const char* emsg) +static void identity_delete_trampline(void* cls, GNUNET_ErrorCode ec) { auto cb = reinterpret_cast*>(cls); - std::string err_msg = emsg ? emsg : ""; + std::string err_msg = GNUNET_ErrorCode_get_hint(ec); (*cb)(err_msg); delete cb; } diff --git a/gnunetpp/gnunetpp-identity.hpp b/gnunetpp/gnunetpp-identity.hpp index 8e0683a..97f688a 100644 --- a/gnunetpp/gnunetpp-identity.hpp +++ b/gnunetpp/gnunetpp-identity.hpp @@ -1,7 +1,6 @@ #pragma once -#include #include -#include +#include #include "inner/Infra.hpp" @@ -41,4 +40,4 @@ const GNUNET_IDENTITY_PrivateKey* get_private_key(const GNUNET_IDENTITY_Ego* ego GNUNET_IDENTITY_Ego* anonymous_ego(); GNUNET_IDENTITY_KeyType get_key_type(GNUNET_IDENTITY_Ego* ego); -} \ No newline at end of file +} diff --git a/gnunetpp/gnunetpp-scheduler.cpp b/gnunetpp/gnunetpp-scheduler.cpp index 2e57444..3afb3d4 100644 --- a/gnunetpp/gnunetpp-scheduler.cpp +++ b/gnunetpp/gnunetpp-scheduler.cpp @@ -1,5 +1,4 @@ #include "gnunetpp-scheduler.hpp" -#include "gnunet/platform.h" #include #include "inner/UniqueData.hpp" @@ -93,4 +92,4 @@ void shutdown() running = false; } -} \ No newline at end of file +} diff --git a/gnunetpp/gnunetpp.hpp b/gnunetpp/gnunetpp.hpp index 487f8b0..7cf0a5f 100644 --- a/gnunetpp/gnunetpp.hpp +++ b/gnunetpp/gnunetpp.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include diff --git a/gnunetpp/inner/Infra.hpp b/gnunetpp/inner/Infra.hpp index 213e852..e998e91 100644 --- a/gnunetpp/inner/Infra.hpp +++ b/gnunetpp/inner/Infra.hpp @@ -2,7 +2,6 @@ #include -#include #include namespace gnunetpp diff --git a/gnunetpp/pch.hpp b/gnunetpp/pch.hpp index b54a9dc..35ff0f4 100644 --- a/gnunetpp/pch.hpp +++ b/gnunetpp/pch.hpp @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include #include