diff options
author | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2014-11-14 14:45:40 -0800 |
---|---|---|
committer | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2014-11-14 14:45:40 -0800 |
commit | d5f966fd2a4a79369ea8d1df37846a5228c6a4e5 (patch) | |
tree | 255d4cc37f4cbefe8bf9643dc09ddb61a015a47f /src/core/rfc822 | |
parent | 40cd8b05df153b2ae08758f346b7262a55ce5692 (diff) |
Port to win32
Diffstat (limited to 'src/core/rfc822')
-rw-r--r-- | src/core/rfc822/MCAttachment.cc | 13 | ||||
-rw-r--r-- | src/core/rfc822/MCMessageBuilder.cc | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/core/rfc822/MCAttachment.cc b/src/core/rfc822/MCAttachment.cc index 71eea11d..cbc66a39 100644 --- a/src/core/rfc822/MCAttachment.cc +++ b/src/core/rfc822/MCAttachment.cc @@ -1,3 +1,5 @@ +#include "MCWin32.h" // should be included first. + #include "MCAttachment.h" #include "MCMultipart.h" @@ -9,7 +11,9 @@ #include <stdlib.h> #include <string.h> +#ifndef _MSC_VER #include <unistd.h> +#endif #include <sys/stat.h> #include <libetpan/libetpan.h> @@ -487,10 +491,17 @@ static char * get_content_type_str(struct mailmime_content * content) if (subtype == NULL) subtype = "unknown"; - result = (char *) malloc(strlen(str) + strlen(subtype) + 2); + size_t len = strlen(str) + strlen(subtype) + 2; + result = (char *) malloc(len); +#ifndef _MSC_VER strcpy(result, str); strcat(result, "/"); strcat(result, subtype); +#else + strcpy_s(result, len, str); + strcat_s(result, len, "/"); + strcat_s(result, len, subtype); +#endif return result; } diff --git a/src/core/rfc822/MCMessageBuilder.cc b/src/core/rfc822/MCMessageBuilder.cc index efccbee0..a98cefd1 100644 --- a/src/core/rfc822/MCMessageBuilder.cc +++ b/src/core/rfc822/MCMessageBuilder.cc @@ -1,3 +1,5 @@ +#include "MCWin32.h" // Should be included first. + #include "MCMessageBuilder.h" #include "MCMessageHeader.h" @@ -5,7 +7,9 @@ #include "MCMessageParser.h" #include <stdlib.h> +#ifndef _MSC_VER #include <unistd.h> +#endif #include <string.h> #include <libetpan/libetpan.h> |