ENGINE-109: fixed uninitialised vars.
authorKrista Grothoff <krista@pep-project.org>
Tue, 18 Oct 2016 09:56:26 +0200
changeset 1300976804e13602
parent 1299 6f0594ac5f08
child 1301 16c1adcfaed3
child 1302 ea2739aadf09
ENGINE-109: fixed uninitialised vars.
src/pEpEngine.c
src/pEpEngine.h
test/trustwords_test.cc
     1.1 --- a/src/pEpEngine.c	Tue Oct 18 01:32:05 2016 +0200
     1.2 +++ b/src/pEpEngine.c	Tue Oct 18 09:56:26 2016 +0200
     1.3 @@ -877,7 +877,7 @@
     1.4      return PEP_STATUS_OK;
     1.5  }
     1.6  
     1.7 -DYNAMIC_API PEP_STATUS trustwords_for_id_pair(
     1.8 +DYNAMIC_API PEP_STATUS get_trustwords(
     1.9      PEP_SESSION session, pEp_identity* id1, pEp_identity* id2,
    1.10      const char* lang, char **words, size_t *wsize, int max_words_per_id
    1.11  )
    1.12 @@ -905,7 +905,9 @@
    1.13      char* second_set = NULL;
    1.14      size_t first_wsize = 0;
    1.15      size_t second_wsize = 0;
    1.16 -    PEP_STATUS status;
    1.17 +    PEP_STATUS status = PEP_UNKNOWN_ERROR;
    1.18 +
    1.19 +    char* _retstr = NULL;
    1.20      
    1.21      if (source1 > source2) {
    1.22          status = trustwords(session, source2, lang, &first_set, &first_wsize, max_words_per_id);
    1.23 @@ -925,7 +927,7 @@
    1.24      }
    1.25      size_t _wsize = first_wsize + second_wsize;
    1.26      
    1.27 -    char* _retstr = calloc(1, _wsize + 1);
    1.28 +    _retstr = calloc(1, _wsize + 1);
    1.29  
    1.30      size_t len = strlcpy(_retstr, first_set, _wsize);
    1.31      if (len >= _wsize) {
     2.1 --- a/src/pEpEngine.h	Tue Oct 18 01:32:05 2016 +0200
     2.2 +++ b/src/pEpEngine.h	Tue Oct 18 09:56:26 2016 +0200
     2.3 @@ -530,7 +530,7 @@
     2.4          PEP_SESSION session, const pEp_identity *identity
     2.5      );
     2.6  
     2.7 -// trustwords_for_id_pair() - get full trustwords string for a *pair* of identities
     2.8 +// get_trustwords() - get full trustwords string for a *pair* of identities
     2.9  //
    2.10  //    parameters:
    2.11  //        session (in)        session handle
    2.12 @@ -562,7 +562,7 @@
    2.13  //  return a list of trustwords.
    2.14  //  This function is provided for being used by C and C++ programs only.
    2.15  
    2.16 -DYNAMIC_API PEP_STATUS trustwords_for_id_pair(
    2.17 +DYNAMIC_API PEP_STATUS get_trustwords(
    2.18      PEP_SESSION session, pEp_identity* id1, pEp_identity* id2,
    2.19      const char* lang, char **words, size_t *wsize, int max_words_per_id
    2.20  );
     3.1 --- a/test/trustwords_test.cc	Tue Oct 18 01:32:05 2016 +0200
     3.2 +++ b/test/trustwords_test.cc	Tue Oct 18 09:56:26 2016 +0200
     3.3 @@ -6,7 +6,7 @@
     3.4  using namespace std;
     3.5  
     3.6  int main() {
     3.7 -    cout << "\n*** trustwords_for_id_pair test ***\n\n";
     3.8 +    cout << "\n*** get_trustwords test ***\n\n";
     3.9  
    3.10      PEP_SESSION session;
    3.11      
    3.12 @@ -48,7 +48,7 @@
    3.13      cout << words2 << "\n";
    3.14  
    3.15      cout << "\nfinding German trustwords for " << identity1->address << " and " << identity2->address << "...\n";
    3.16 -    trustwords_for_id_pair(session, identity1, identity2, "de", &full_wordlist, &wsize_full, 5);
    3.17 +    get_trustwords(session, identity1, identity2, "de", &full_wordlist, &wsize_full, 5);
    3.18      assert(full_wordlist);
    3.19      cout << full_wordlist << "\n";
    3.20