From bbab6b2fdcfeafef192f99080d2e44bb3398e942 Mon Sep 17 00:00:00 2001 From: lledey Date: Sat, 23 Feb 2013 21:47:10 +0100 Subject: [PATCH] Fix compilation by using std::ptrdiff_t instead of ptrdiff_t Signed-off-by: lledey --- common.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/common.cpp b/common.cpp index c2068b5c6..e5b298ee8 100644 --- a/common.cpp +++ b/common.cpp @@ -2176,16 +2176,16 @@ template static CharType_t **make_null_terminated_array_helper(const std::vector > &argv) { size_t count = argv.size(); - + /* We allocate everything in one giant block. First compute how much space we need. */ /* N + 1 pointers */ size_t pointers_allocation_len = (count + 1) * sizeof(CharType_t *); - + /* In the very unlikely event that CharType_t has stricter alignment requirements than does a pointer, round us up to the size of a CharType_t */ pointers_allocation_len += sizeof(CharType_t) - 1; pointers_allocation_len -= pointers_allocation_len % sizeof(CharType_t); - + /* N null terminated strings */ size_t strings_allocation_len = 0; for (size_t i=0; i < count; i++) @@ -2193,22 +2193,22 @@ static CharType_t **make_null_terminated_array_helper(const std::vector(malloc(pointers_allocation_len + strings_allocation_len)); if (! base) return NULL; - + /* Divvy it up into the pointers and strings */ CharType_t **pointers = reinterpret_cast(base); CharType_t *strings = reinterpret_cast(base + pointers_allocation_len); - + /* Start copying */ for (size_t i=0; i < count; i++) { const std::basic_string &str = argv.at(i); // store the current string pointer into self *pointers++ = strings; - + // copy the string into strings strings = std::copy(str.begin(), str.end(), strings); // each string needs a null terminator @@ -2216,12 +2216,12 @@ static CharType_t **make_null_terminated_array_helper(const std::vector(base); } @@ -2235,4 +2235,3 @@ char **make_null_terminated_array(const std::vector &lst) { return make_null_terminated_array_helper(lst); } -