double pointer not needed

APPLEMAIL-24
Volker Birk 3 years ago
parent a5e2c45653
commit 95460a0131
  1. 6
      HTTPSStream.cc
  2. 6
      HTTPSStream.hh
  3. 2
      UpdateStream.cc
  4. 2
      UpdateStream.hh
  5. 4
      downloadclient.cc
  6. 4
      downloadclient.hh
  7. 9
      test_noupdate.cc
  8. 2
      test_updater.cc

@ -65,7 +65,7 @@ namespace pEp {
close();
}
void HTTPSDevice::open(string url, notifyRead_t *notifyRead)
void HTTPSDevice::open(string url, notifyRead_t notifyRead)
{
if (url == "") {
if (_url != "")
@ -126,7 +126,7 @@ namespace pEp {
get(u.path, notifyRead);
}
void HTTPSDevice::get(string path, notifyRead_t *notifyRead)
void HTTPSDevice::get(string path, notifyRead_t notifyRead)
{
if (path == "")
throw invalid_argument("path needed for GET");
@ -152,7 +152,7 @@ namespace pEp {
http::read_header(*_stream, b, _parser);
if (header()["Content-Length"] != "0" && notifyRead)
(*notifyRead)();
notifyRead();
http::read(*_stream, b, _parser);

@ -48,15 +48,15 @@ namespace pEp {
string _filename;
public:
notifyRead_t *notifyRead;
notifyRead_t notifyRead;
HTTPSDevice(string url = "", string user_agent="pEp/1.0", int
version=11);
HTTPSDevice(const HTTPSDevice& second);
~HTTPSDevice();
void open(string url = "", notifyRead_t *notifyRead = nullptr);
void get(string path, notifyRead_t *notifyRead = nullptr);
void open(string url = "", notifyRead_t notifyRead = nullptr);
void get(string path, notifyRead_t notifyRead = nullptr);
void close();
const http::fields& header() const { return _parser.get(); }

@ -32,7 +32,7 @@ namespace pEp {
delete _str;
}
void UpdateDevice::open(CryptoPP::RSA::PublicKey update_key, notifyRead_t *notifyRead)
void UpdateDevice::open(CryptoPP::RSA::PublicKey update_key, notifyRead_t notifyRead)
{
CryptoPP::RSAES< CryptoPP::OAEP<CryptoPP::SHA256> >::Encryptor update_encryptor(update_key);

@ -41,7 +41,7 @@ namespace pEp {
streamsize read(char* s, streamsize n);
void open(PublicKey update_key, notifyRead_t *notifyRead = nullptr);
void open(PublicKey update_key, notifyRead_t notifyRead = nullptr);
void close();
string filename() { return _https->filename(); }

@ -26,7 +26,7 @@ namespace pEp {
return key;
}
string update(product p, PublicKey update_key, notifyRead_t *notifyRead)
string update(product p, PublicKey update_key, notifyRead_t notifyRead)
{
UpdateStream us { UpdateDevice(p) };
@ -41,7 +41,7 @@ namespace pEp {
return us->filename();
}
string update(product p, string keyfile, notifyRead_t *notifyRead)
string update(product p, string keyfile, notifyRead_t notifyRead)
{
PublicKey update_key = load_key(keyfile);
return update(p, update_key, notifyRead);

@ -56,11 +56,11 @@ namespace pEp {
//
// see sample in test_updater.cc
string update(product p, PublicKey update_key, notifyRead_t *notifyRead = nullptr);
string update(product p, PublicKey update_key, notifyRead_t notifyRead = nullptr);
// update() - convenience function doing load_key() and update()
string update(product p, string keyfile, notifyRead_t *notifyRead = nullptr);
string update(product p, string keyfile, notifyRead_t notifyRead = nullptr);
}
}

@ -8,13 +8,6 @@
using namespace std;
using namespace pEp::UpdateClient;
void notifyRead()
{
cout << "notify: read\n";
// we expect no update
exit(1);
}
int main()
{
cout << "trying to download...\n";
@ -24,7 +17,7 @@ int main()
try {
pEp::notifyRead_t notifyRead = [=]()->void{cout << "notify: read\n";exit(1);};
string filename = update(p, "public.der", &notifyRead);
string filename = update(p, "public.der", notifyRead);
cout << "downloaded " << filename << "\n";
return 1;
}

@ -17,7 +17,7 @@ int main()
try {
pEp::notifyRead_t notifyRead = [=]()->void{cout << "notify: read\n";};
string filename = update(p, "public.der", &notifyRead);
string filename = update(p, "public.der", notifyRead);
cout << "downloaded " << filename << "\n";
return 0;
}

Loading…
Cancel
Save