merge default into my branch roker-linux
authorRoker <roker@pep-project.org>
Thu, 23 Jun 2016 16:15:10 +0200
branchroker-linux
changeset 76036d65f41170c
parent 758 9679c776ff5e
parent 759 d7efa7b697bd
child 761 04fc0f0a3dc3
merge default into my branch
     1.1 --- a/test/message_api_test.cc	Thu Jun 23 16:04:29 2016 +0200
     1.2 +++ b/test/message_api_test.cc	Thu Jun 23 16:15:10 2016 +0200
     1.3 @@ -15,7 +15,7 @@
     1.4      PEP_SESSION session;
     1.5      
     1.6      cout << "calling init()\n";
     1.7 -    PEP_STATUS status1 = init(&session);   
     1.8 +    PEP_STATUS status1 = init(&session);
     1.9      assert(status1 == PEP_STATUS_OK);
    1.10      assert(session);
    1.11      cout << "init() completed.\n";
    1.12 @@ -36,7 +36,7 @@
    1.13      msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
    1.14      cout << "message created.\n";
    1.15  
    1.16 -    char *text2;
    1.17 +    char *text2 = nullptr;
    1.18      PEP_STATUS status2 = mime_encode_message(msg2, false, &text2);
    1.19      assert(status2 == PEP_STATUS_OK);
    1.20      assert(text2);
    1.21 @@ -47,9 +47,10 @@
    1.22      free(text2);
    1.23  
    1.24      cout << "encrypting message as MIME multipart…\n";
    1.25 -    message *enc_msg2;
    1.26 +    message *enc_msg2 = nullptr;
    1.27      cout << "calling encrypt_message()\n";
    1.28      status2 = encrypt_message(session, msg2, NULL, &enc_msg2, PEP_enc_PGP_MIME);
    1.29 +    cout << "encrypt_message() returns " << status2 << '.' << endl;
    1.30      assert(status2 == PEP_STATUS_OK);
    1.31      assert(enc_msg2);
    1.32      cout << "message encrypted.\n";
    1.33 @@ -61,10 +62,10 @@
    1.34      cout << "encrypted:\n\n";
    1.35      cout << text2 << "\n";
    1.36  
    1.37 -    message *msg3;
    1.38 +    message *msg3 = nullptr;
    1.39      PEP_STATUS status3 = mime_decode_message(text2, strlen(text2), &msg3);
    1.40      assert(status3 == PEP_STATUS_OK);
    1.41 -    string string3 = text2;
    1.42 +    const string string3 = text2;
    1.43      //free(text2);
    1.44  
    1.45      unlink("msg4.asc");
    1.46 @@ -72,8 +73,8 @@
    1.47      outFile3.write(string3.c_str(), string3.size());
    1.48      outFile3.close();
    1.49  
    1.50 -    message *msg4;
    1.51 -    stringlist_t *keylist4;
    1.52 +    message *msg4 = nullptr;
    1.53 +    stringlist_t *keylist4 = nullptr;
    1.54      PEP_color color;
    1.55      PEP_decrypt_flags_t flags;
    1.56      
    1.57 @@ -84,9 +85,10 @@
    1.58      assert(color);
    1.59  
    1.60      cout << "keys used:";
    1.61 -    stringlist_t *kl4;
    1.62 -    for (kl4 = keylist4; kl4 && kl4->value; kl4 = kl4->next)
    1.63 +    for (stringlist_t* kl4 = keylist4; kl4 && kl4->value; kl4 = kl4->next)
    1.64 +    {
    1.65          cout << " " << kl4->value;
    1.66 +    }
    1.67      cout << "\n\n";
    1.68  
    1.69      free_stringlist(keylist4);
    1.70 @@ -105,12 +107,12 @@
    1.71      }
    1.72      inFile3.close();
    1.73  
    1.74 -    message *msg5;
    1.75 +    message *msg5 = nullptr;
    1.76      PEP_STATUS status5 = mime_decode_message(text3.c_str(), text3.length(), &msg5);
    1.77      assert(status5 == PEP_STATUS_OK);
    1.78  
    1.79 -    message *msg6;
    1.80 -    stringlist_t *keylist5;
    1.81 +    message *msg6 = nullptr;
    1.82 +    stringlist_t *keylist5 = nullptr;
    1.83      PEP_color color2;
    1.84      PEP_decrypt_flags_t flags2;
    1.85      PEP_STATUS status6 = decrypt_message(session, msg5, &msg6, &keylist5, &color2, &flags2);
    1.86 @@ -134,4 +136,3 @@
    1.87      release(session);
    1.88      return 0;
    1.89  }
    1.90 -