ENGINE-320: Phase one, alpha renaming complete. ENGINE-320
authorKrista Bennett <krista@pep-project.org>
Thu, 14 Dec 2017 08:51:26 +0100
branchENGINE-320
changeset 2312b078c7c38b51
parent 2296 1a12f577ac71
child 2313 5bd778fe7bf8
ENGINE-320: Phase one, alpha renaming complete.
src/bloblist.c
src/bloblist.h
src/message_api.c
src/mime.c
src/sync_impl.c
     1.1 --- a/src/bloblist.c	Wed Dec 06 18:26:13 2017 +0100
     1.2 +++ b/src/bloblist.c	Thu Dec 14 08:51:26 2017 +0100
     1.3 @@ -36,7 +36,7 @@
     1.4      }               
     1.5      
     1.6      if (blob) {
     1.7 -        bloblist->value = blob;
     1.8 +        bloblist->value_ref = blob;
     1.9          bloblist->size = size;
    1.10      }
    1.11      
    1.12 @@ -65,7 +65,7 @@
    1.13  
    1.14      while (curr) {
    1.15          bloblist_t *next = curr->next;
    1.16 -        free(curr->value);
    1.17 +        free(curr->value_ref);
    1.18          free(curr->mime_type);
    1.19          free(curr->filename);
    1.20          free(curr);
    1.21 @@ -87,7 +87,7 @@
    1.22      if (blob2 == NULL)
    1.23          goto enomem;
    1.24  
    1.25 -    memcpy(blob2, src->value, src->size);
    1.26 +    memcpy(blob2, src->value_ref, src->size);
    1.27  
    1.28      bloblist = new_bloblist(blob2, src->size, src->mime_type, src->filename);
    1.29      if (bloblist == NULL)
    1.30 @@ -105,7 +105,7 @@
    1.31          if (blob2 == NULL)
    1.32              goto enomem;
    1.33  
    1.34 -        memcpy(blob2, src_curr->value, src_curr->size);
    1.35 +        memcpy(blob2, src_curr->value_ref, src_curr->size);
    1.36          *dst_curr_ptr = new_bloblist(blob2, src_curr->size, src_curr->mime_type, src_curr->filename);
    1.37          if (*dst_curr_ptr == NULL)
    1.38              goto enomem;
    1.39 @@ -132,7 +132,7 @@
    1.40      if (bloblist == NULL)
    1.41          return new_bloblist(blob, size, mime_type, filename);
    1.42  
    1.43 -    if (bloblist->value == NULL) { // empty list
    1.44 +    if (bloblist->value_ref == NULL) { // empty list
    1.45          if (bloblist->next != NULL)
    1.46              return NULL; // invalid list
    1.47              
    1.48 @@ -163,7 +163,7 @@
    1.49  {
    1.50      int len = 0;
    1.51  
    1.52 -    for (const bloblist_t *_bl = bloblist; _bl && _bl->value; _bl = _bl->next)
    1.53 +    for (const bloblist_t *_bl = bloblist; _bl && _bl->value_ref; _bl = _bl->next)
    1.54          len++;
    1.55  
    1.56      return len;
     2.1 --- a/src/bloblist.h	Wed Dec 06 18:26:13 2017 +0100
     2.2 +++ b/src/bloblist.h	Thu Dec 14 08:51:26 2017 +0100
     2.3 @@ -17,7 +17,7 @@
     2.4  } content_disposition_type;
     2.5  
     2.6  typedef struct _bloblist_t {
     2.7 -    char *value;                    // blob
     2.8 +    char *value_ref;                // blob
     2.9      size_t size;                    // size of blob
    2.10      char *mime_type;                // UTF-8 string of MIME type of blob or
    2.11                                      // NULL if unknown
     3.1 --- a/src/message_api.c	Wed Dec 06 18:26:13 2017 +0100
     3.2 +++ b/src/message_api.c	Thu Dec 14 08:51:26 2017 +0100
     3.3 @@ -1232,7 +1232,7 @@
     3.4  static void free_bl_entry(bloblist_t *bl)
     3.5  {
     3.6      if (bl) {
     3.7 -        free(bl->value);
     3.8 +        free(bl->value_ref);
     3.9          free(bl->mime_type);
    3.10          free(bl->filename);
    3.11          free(bl);
    3.12 @@ -1262,7 +1262,7 @@
    3.13  {
    3.14      if (msg) {
    3.15          bloblist_t *last = NULL;
    3.16 -        for (bloblist_t *bl = msg->attachments; bl && bl->value; ) {
    3.17 +        for (bloblist_t *bl = msg->attachments; bl && bl->value_ref; ) {
    3.18              bloblist_t *next = bl->next;
    3.19  
    3.20              if (is_key(bl)) {
    3.21 @@ -1297,14 +1297,14 @@
    3.22      bool remove = false;
    3.23  
    3.24      int i = 0;
    3.25 -    for (bloblist_t *bl = msg->attachments; i < MAX_KEYS_TO_IMPORT && bl && bl->value;
    3.26 +    for (bloblist_t *bl = msg->attachments; i < MAX_KEYS_TO_IMPORT && bl && bl->value_ref;
    3.27              bl = bl->next, i++)
    3.28      {
    3.29 -        if (bl && bl->value && bl->size && bl->size < MAX_KEY_SIZE
    3.30 +        if (bl && bl->value_ref && bl->size && bl->size < MAX_KEY_SIZE
    3.31                  && is_key(bl))
    3.32          {
    3.33              identity_list *local_private_idents = NULL;
    3.34 -            import_key(session, bl->value, bl->size, &local_private_idents);
    3.35 +            import_key(session, bl->value_ref, bl->size, &local_private_idents);
    3.36              remove = true;
    3.37              if (private_idents && *private_idents == NULL && local_private_idents != NULL)
    3.38                  *private_idents = local_private_idents;
    3.39 @@ -1380,14 +1380,14 @@
    3.40      }
    3.41      else if (msg->attachments && msg->attachments->next &&
    3.42              is_mime_type(msg->attachments, "application/pgp-encrypted") &&
    3.43 -            is_PGP_message_text(msg->attachments->next->value)
    3.44 +            is_PGP_message_text(msg->attachments->next->value_ref)
    3.45          ) {
    3.46          msg->enc_format = PEP_enc_PGP_MIME;
    3.47          return PEP_crypt_OpenPGP;
    3.48      }
    3.49      else if (msg->attachments && msg->attachments->next &&
    3.50              is_mime_type(msg->attachments->next, "application/pgp-encrypted") &&
    3.51 -            is_PGP_message_text(msg->attachments->value)
    3.52 +            is_PGP_message_text(msg->attachments->value_ref)
    3.53          ) {
    3.54          msg->enc_format = PEP_enc_PGP_MIME_Outlook1;
    3.55          return PEP_crypt_OpenPGP;
    3.56 @@ -1979,20 +1979,20 @@
    3.57              const char* inner_mime_type = satt->mime_type;
    3.58              if (strcasecmp(inner_mime_type, "text/plain") == 0) {
    3.59                  free(slong); /* in case of "" */
    3.60 -                src->longmsg = strndup(satt->value, satt->size); 
    3.61 +                src->longmsg = strndup(satt->value_ref, satt->size); 
    3.62                  
    3.63                  bloblist_t* next_node = satt->next;
    3.64                  if (next_node) {
    3.65                      inner_mime_type = next_node->mime_type;
    3.66                      if (strcasecmp(inner_mime_type, "text/html") == 0) {
    3.67                          free(sform);
    3.68 -                        src->longmsg_formatted = strndup(next_node->value, next_node->size);
    3.69 +                        src->longmsg_formatted = strndup(next_node->value_ref, next_node->size);
    3.70                      }
    3.71                  }
    3.72              }
    3.73              else if (strcasecmp(inner_mime_type, "text/html") == 0) {
    3.74                  free(sform);
    3.75 -                src->longmsg_formatted = strndup(satt->value, satt->size);
    3.76 +                src->longmsg_formatted = strndup(satt->value_ref, satt->size);
    3.77              }
    3.78          }
    3.79          return true;
    3.80 @@ -2100,12 +2100,12 @@
    3.81                      
    3.82      switch (src->enc_format) {
    3.83          case PEP_enc_PGP_MIME:
    3.84 -            *crypto_text = src->attachments->next->value;
    3.85 +            *crypto_text = src->attachments->next->value_ref;
    3.86              *text_size = src->attachments->next->size;
    3.87              break;
    3.88  
    3.89          case PEP_enc_PGP_MIME_Outlook1:
    3.90 -            *crypto_text = src->attachments->value;
    3.91 +            *crypto_text = src->attachments->value_ref;
    3.92              *text_size = src->attachments->size;
    3.93              break;
    3.94  
    3.95 @@ -2146,7 +2146,7 @@
    3.96      
    3.97      
    3.98      if (detached_sig) {
    3.99 -        char* dsig_text = detached_sig->value;
   3.100 +        char* dsig_text = detached_sig->value_ref;
   3.101          size_t dsig_size = detached_sig->size;
   3.102          size_t ssize = 0;
   3.103          char* stext = NULL;
   3.104 @@ -2207,14 +2207,14 @@
   3.105      ptext = NULL;
   3.106  
   3.107      bloblist_t *_m = msg->attachments;
   3.108 -    if (_m == NULL && src->attachments && src->attachments->value) {
   3.109 +    if (_m == NULL && src->attachments && src->attachments->value_ref) {
   3.110          msg->attachments = new_bloblist(NULL, 0, NULL, NULL);
   3.111          _m = msg->attachments;
   3.112      }
   3.113  
   3.114      bloblist_t *_s;
   3.115      for (_s = src->attachments; _s; _s = _s->next) {
   3.116 -        if (_s->value == NULL && _s->size == 0){
   3.117 +        if (_s->value_ref == NULL && _s->size == 0){
   3.118              _m = bloblist_add(_m, NULL, 0, _s->mime_type, _s->filename);
   3.119              if (_m == NULL)
   3.120                  return PEP_OUT_OF_MEMORY;
   3.121 @@ -2222,7 +2222,7 @@
   3.122          }
   3.123          else if (is_encrypted_attachment(_s)) {
   3.124              stringlist_t *_keylist = NULL;
   3.125 -            char *attctext  = _s->value;
   3.126 +            char *attctext  = _s->value_ref;
   3.127              size_t attcsize = _s->size;
   3.128  
   3.129              free(ptext);
   3.130 @@ -2263,7 +2263,7 @@
   3.131                  assert(copy);
   3.132                  if (copy == NULL)
   3.133                      return PEP_OUT_OF_MEMORY;
   3.134 -                memcpy(copy, _s->value, _s->size);
   3.135 +                memcpy(copy, _s->value_ref, _s->size);
   3.136                  _m = bloblist_add(_m, copy, _s->size, _s->mime_type, _s->filename);
   3.137                  if (_m == NULL)
   3.138                      return PEP_OUT_OF_MEMORY;
   3.139 @@ -2274,7 +2274,7 @@
   3.140              assert(copy);
   3.141              if (copy == NULL)
   3.142                  return PEP_OUT_OF_MEMORY;
   3.143 -            memcpy(copy, _s->value, _s->size);
   3.144 +            memcpy(copy, _s->value_ref, _s->size);
   3.145              _m = bloblist_add(_m, copy, _s->size, _s->mime_type, _s->filename);
   3.146              if (_m == NULL)
   3.147                  return PEP_OUT_OF_MEMORY;
   3.148 @@ -2369,7 +2369,7 @@
   3.149      size_t dsig_size = 0;
   3.150      status = _get_detached_signature(src, &detached_sig);
   3.151      if (detached_sig) {
   3.152 -        dsig_text = detached_sig->value;
   3.153 +        dsig_text = detached_sig->value_ref;
   3.154          dsig_size = detached_sig->size;
   3.155      }
   3.156      /*** End get detached signatures that are attached to the encrypted message ***/
   3.157 @@ -2490,7 +2490,7 @@
   3.158                              if (strcmp("message/rfc822", mime_type) == 0 ||
   3.159                                  strcmp("text/rfc822", mime_type) == 0) {
   3.160                                      
   3.161 -                                status = mime_decode_message(actual_message->value, 
   3.162 +                                status = mime_decode_message(actual_message->value_ref, 
   3.163                                                               actual_message->size, 
   3.164                                                               &inner_message);
   3.165                                  if (status != PEP_STATUS_OK)
     4.1 --- a/src/mime.c	Wed Dec 06 18:26:13 2017 +0100
     4.2 +++ b/src/mime.c	Thu Dec 14 08:51:26 2017 +0100
     4.3 @@ -122,7 +122,7 @@
     4.4          mime_type = blob->mime_type;
     4.5  
     4.6      pEp_rid_list_t* resource = parse_uri(blob->filename);
     4.7 -    mime = get_file_part(resource, mime_type, blob->value, blob->size, transport_encode);
     4.8 +    mime = get_file_part(resource, mime_type, blob->value_ref, blob->size, transport_encode);
     4.9      free_rid_list(resource);
    4.10      
    4.11      assert(mime);
    4.12 @@ -848,9 +848,9 @@
    4.13      size_t plaintext_size;
    4.14  
    4.15      assert(msg->attachments && msg->attachments->next &&
    4.16 -            msg->attachments->next->value);
    4.17 +            msg->attachments->next->value_ref);
    4.18  
    4.19 -    plaintext = msg->attachments->next->value;
    4.20 +    plaintext = msg->attachments->next->value_ref;
    4.21      plaintext_size = msg->attachments->next->size;
    4.22  
    4.23      mime = part_multiple_new("multipart/encrypted");
     5.1 --- a/src/sync_impl.c	Wed Dec 06 18:26:13 2017 +0100
     5.2 +++ b/src/sync_impl.c	Thu Dec 14 08:51:26 2017 +0100
     5.3 @@ -426,12 +426,12 @@
     5.4      bool discard = false;
     5.5      bool force_keep_msg = false;
     5.6  
     5.7 -    for (bloblist_t *bl = src->attachments; bl && bl->value; bl = bl->next) {
     5.8 +    for (bloblist_t *bl = src->attachments; bl && bl->value_ref; bl = bl->next) {
     5.9          if (bl->mime_type && strcasecmp(bl->mime_type, "application/pEp.sync") == 0
    5.10                  && bl->size) {
    5.11              DeviceGroup_Protocol_t *msg = NULL;
    5.12              uper_decode_complete(NULL, &asn_DEF_DeviceGroup_Protocol, (void **)
    5.13 -                    &msg, bl->value, bl->size);
    5.14 +                    &msg, bl->value_ref, bl->size);
    5.15  
    5.16              if (msg) {
    5.17                  PEP_STATUS status = PEP_STATUS_OK;
    5.18 @@ -687,7 +687,7 @@
    5.19  
    5.20      if (!session->keep_sync_msg) {
    5.21          bloblist_t *last = NULL;
    5.22 -        for (bloblist_t *bl = src->attachments; bl && bl->value; ) {
    5.23 +        for (bloblist_t *bl = src->attachments; bl && bl->value_ref; ) {
    5.24              if (bl->mime_type && strcasecmp(bl->mime_type, "application/pEp.sync") == 0) {
    5.25                  bloblist_t *b = bl;
    5.26                  bl = bl->next;
    5.27 @@ -697,7 +697,7 @@
    5.28                      last->next = bl;
    5.29                  free(b->mime_type);
    5.30                  free(b->filename);
    5.31 -                free(b->value);
    5.32 +                free(b->value_ref);
    5.33                  free(b);
    5.34              }
    5.35              else {