improves portability with some compilers

This commit is contained in:
Ariel Manzur 2018-01-18 19:10:07 -03:00
parent 7369b0075e
commit e2b50e1abb
2 changed files with 8 additions and 8 deletions

View file

@ -3167,7 +3167,7 @@ String String::http_unescape() const {
if ((ord1 >= '0' && ord1 <= '9') || (ord1 >= 'A' && ord1 <= 'Z')) { if ((ord1 >= '0' && ord1 <= '9') || (ord1 >= 'A' && ord1 <= 'Z')) {
CharType ord2 = ord_at(i + 2); CharType ord2 = ord_at(i + 2);
if ((ord2 >= '0' && ord2 <= '9') || (ord2 >= 'A' && ord2 <= 'Z')) { if ((ord2 >= '0' && ord2 <= '9') || (ord2 >= 'A' && ord2 <= 'Z')) {
char bytes[2] = { ord1, ord2 }; char bytes[2] = { (char)ord1, (char)ord2 };
res += (char)strtol(bytes, NULL, 16); res += (char)strtol(bytes, NULL, 16);
i += 2; i += 2;
} }

View file

@ -441,9 +441,9 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
for (int i = 0; i < p_vertex_array_len; i++) { for (int i = 0; i < p_vertex_array_len; i++) {
int8_t vector[4] = { int8_t vector[4] = {
CLAMP(src[i].x * 127, -128, 127), (int8_t)CLAMP(src[i].x * 127, -128, 127),
CLAMP(src[i].y * 127, -128, 127), (int8_t)CLAMP(src[i].y * 127, -128, 127),
CLAMP(src[i].z * 127, -128, 127), (int8_t)CLAMP(src[i].z * 127, -128, 127),
0, 0,
}; };
@ -476,10 +476,10 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
for (int i = 0; i < p_vertex_array_len; i++) { for (int i = 0; i < p_vertex_array_len; i++) {
uint8_t xyzw[4] = { uint8_t xyzw[4] = {
CLAMP(src[i * 4 + 0] * 127, -128, 127), (uint8_t)CLAMP(src[i * 4 + 0] * 127, -128, 127),
CLAMP(src[i * 4 + 1] * 127, -128, 127), (uint8_t)CLAMP(src[i * 4 + 1] * 127, -128, 127),
CLAMP(src[i * 4 + 2] * 127, -128, 127), (uint8_t)CLAMP(src[i * 4 + 2] * 127, -128, 127),
CLAMP(src[i * 4 + 3] * 127, -128, 127) (uint8_t)CLAMP(src[i * 4 + 3] * 127, -128, 127)
}; };
copymem(&vw[p_offsets[ai] + i * p_stride], xyzw, 4); copymem(&vw[p_offsets[ai] + i * p_stride], xyzw, 4);