C++/MSVC compatibility, indenting, for #4

This commit is contained in:
Steven G. Johnson 2014-07-18 11:47:24 -04:00
parent 48645e36e4
commit dd35a8530d
2 changed files with 11 additions and 9 deletions

View File

@ -536,7 +536,7 @@ ssize_t utf8proc_map(
*dstptr = NULL; *dstptr = NULL;
result = utf8proc_decompose(str, strlen, NULL, 0, options); result = utf8proc_decompose(str, strlen, NULL, 0, options);
if (result < 0) return result; if (result < 0) return result;
buffer = malloc(result * sizeof(int32_t) + 1); buffer = (int32_t *) malloc(result * sizeof(int32_t) + 1);
if (!buffer) return UTF8PROC_ERROR_NOMEM; if (!buffer) return UTF8PROC_ERROR_NOMEM;
result = utf8proc_decompose(str, strlen, buffer, result, options); result = utf8proc_decompose(str, strlen, buffer, result, options);
if (result < 0) { if (result < 0) {
@ -550,7 +550,7 @@ ssize_t utf8proc_map(
} }
{ {
int32_t *newptr; int32_t *newptr;
newptr = realloc(buffer, (size_t)result+1); newptr = (int32_t *) realloc(buffer, (size_t)result+1);
if (newptr) buffer = newptr; if (newptr) buffer = newptr;
} }
*dstptr = (uint8_t *)buffer; *dstptr = (uint8_t *)buffer;

View File

@ -60,16 +60,18 @@ typedef unsigned char uint8_t;
typedef short int16_t; typedef short int16_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef int int32_t; typedef int int32_t;
#ifdef _WIN64 # ifdef _WIN64
#define ssize_t __int64 # define ssize_t __int64
#else # else
#define ssize_t int # define ssize_t int
#endif # endif
# ifndef __cplusplus
typedef unsigned char bool; typedef unsigned char bool;
enum {false, true}; enum {false, true};
# endif
#else #else
#include <stdbool.h> # include <stdbool.h>
#include <inttypes.h> # include <inttypes.h>
#endif #endif
#include <limits.h> #include <limits.h>