some normalizing
authorvb
Wed, 04 Mar 2015 13:32:07 +0100
changeset 88ac617f70bd7f
parent 87 060a95de62a8
child 89 aef5a4bc78f3
some normalizing
src/mime.c
     1.1 --- a/src/mime.c	Wed Mar 04 10:39:29 2015 +0100
     1.2 +++ b/src/mime.c	Wed Mar 04 13:32:07 2015 +0100
     1.3 @@ -25,7 +25,7 @@
     1.4      FILE *file = NULL;
     1.5      size_t size;
     1.6      char *buf = NULL;
     1.7 -    PEP_STATUS error;
     1.8 +    PEP_STATUS status;
     1.9  
    1.10      assert(plaintext);
    1.11      assert(mimetext);
    1.12 @@ -175,7 +175,6 @@
    1.13      errno = 0;
    1.14      rewind(file);
    1.15      assert(errno == 0);
    1.16 -#ifdef NDEBUG
    1.17      switch (errno) {
    1.18          case 0:
    1.19              break;
    1.20 @@ -184,7 +183,6 @@
    1.21          default:
    1.22              goto err_file;
    1.23      }
    1.24 -#endif
    1.25  
    1.26      buf = calloc(1, size + 1);
    1.27      assert(buf);
    1.28 @@ -203,17 +201,17 @@
    1.29      return PEP_STATUS_OK;
    1.30  
    1.31  err_buffer:
    1.32 -    error = PEP_BUFFER_TOO_SMALL;
    1.33 -    goto release;
    1.34 +    status = PEP_BUFFER_TOO_SMALL;
    1.35 +    goto pep_error;
    1.36  
    1.37  err_file:
    1.38 -    error = PEP_CANNOT_CREATE_TEMP_FILE;
    1.39 -    goto release;
    1.40 +    status = PEP_CANNOT_CREATE_TEMP_FILE;
    1.41 +    goto pep_error;
    1.42  
    1.43  enomem:
    1.44 -    error = PEP_OUT_OF_MEMORY;
    1.45 +    status = PEP_OUT_OF_MEMORY;
    1.46  
    1.47 -release:
    1.48 +pep_error:
    1.49      free(buf);
    1.50      free(template);
    1.51  
    1.52 @@ -231,5 +229,33 @@
    1.53      if (submime)
    1.54          mailmime_free(submime);
    1.55  
    1.56 -    return error;
    1.57 +    return status;
    1.58  }
    1.59 +
    1.60 +DYNAMIC_API PEP_STATUS mime_decode_text(
    1.61 +        const char *mimetext,
    1.62 +        char **plaintext,
    1.63 +        char **htmltext,
    1.64 +        bloblist_t **attachments
    1.65 +    )
    1.66 +{
    1.67 +    PEP_STATUS status = PEP_STATUS_OK;
    1.68 +
    1.69 +    assert(mimetext);
    1.70 +    assert(plaintext);
    1.71 +    assert(htmltext);
    1.72 +    assert(attachments);
    1.73 +
    1.74 +    *plaintext = NULL;
    1.75 +    *htmltext = NULL;
    1.76 +    *attachments = NULL;
    1.77 +
    1.78 +    return status;
    1.79 +
    1.80 +enomem:
    1.81 +    status = PEP_OUT_OF_MEMORY;
    1.82 +
    1.83 +pep_error:
    1.84 +    return status;
    1.85 +}
    1.86 +