mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-26 02:51:16 -03:00
Change C casts to C++ ones
Some were kept for compatibility. Found with -Wold-style-cast Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
committed by
ridiculousfish
parent
f36c82ce86
commit
0668513138
@@ -35,16 +35,18 @@ static CharT **make_null_terminated_array_helper(
|
||||
const std::basic_string<CharT> &str = argv.at(i);
|
||||
*pointers++ = strings; // store the current string pointer into self
|
||||
strings = std::copy(str.begin(), str.end(), strings); // copy the string into strings
|
||||
*strings++ = (CharT)(0); // each string needs a null terminator
|
||||
*strings++ = static_cast<CharT>(0); // each string needs a null terminator
|
||||
}
|
||||
*pointers++ = nullptr; // array of pointers needs a null terminator
|
||||
|
||||
// Make sure we know what we're doing.
|
||||
assert((unsigned char *)pointers - base == (std::ptrdiff_t)pointers_allocation_len);
|
||||
assert((unsigned char *)strings - (unsigned char *)pointers ==
|
||||
(std::ptrdiff_t)strings_allocation_len);
|
||||
assert((unsigned char *)strings - base ==
|
||||
(std::ptrdiff_t)(pointers_allocation_len + strings_allocation_len));
|
||||
assert(reinterpret_cast<unsigned char *>(pointers) - base ==
|
||||
static_cast<std::ptrdiff_t>(pointers_allocation_len));
|
||||
assert(reinterpret_cast<unsigned char *>(strings) -
|
||||
reinterpret_cast<unsigned char *>(pointers) ==
|
||||
static_cast<std::ptrdiff_t>(strings_allocation_len));
|
||||
assert(reinterpret_cast<unsigned char *>(strings) - base ==
|
||||
static_cast<std::ptrdiff_t>(pointers_allocation_len + strings_allocation_len));
|
||||
|
||||
return reinterpret_cast<CharT **>(base);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user