summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriel Manzur <ariel@godotengine.org>2018-01-18 19:10:07 -0300
committerAriel Manzur <ariel@godotengine.org>2018-01-18 19:16:34 -0300
commite2b50e1abbc6cab58410a2ef4155bdcadf73efcf (patch)
tree65ffde2dc1e3919cbc998165fbb4a80c1bd470ae
parent7369b0075e430f30a32b848e8a60c85f0b2ce8f2 (diff)
improves portability with some compilers
-rw-r--r--core/ustring.cpp2
-rw-r--r--servers/visual_server.cpp14
2 files changed, 8 insertions, 8 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 7aa2b012de..d445e4ed47 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3167,7 +3167,7 @@ String String::http_unescape() const {
if ((ord1 >= '0' && ord1 <= '9') || (ord1 >= 'A' && ord1 <= 'Z')) {
CharType ord2 = ord_at(i + 2);
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);
i += 2;
}
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index c689fda17c..faa8c50837 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -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++) {
int8_t vector[4] = {
- CLAMP(src[i].x * 127, -128, 127),
- CLAMP(src[i].y * 127, -128, 127),
- CLAMP(src[i].z * 127, -128, 127),
+ (int8_t)CLAMP(src[i].x * 127, -128, 127),
+ (int8_t)CLAMP(src[i].y * 127, -128, 127),
+ (int8_t)CLAMP(src[i].z * 127, -128, 127),
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++) {
uint8_t xyzw[4] = {
- CLAMP(src[i * 4 + 0] * 127, -128, 127),
- CLAMP(src[i * 4 + 1] * 127, -128, 127),
- CLAMP(src[i * 4 + 2] * 127, -128, 127),
- CLAMP(src[i * 4 + 3] * 127, -128, 127)
+ (uint8_t)CLAMP(src[i * 4 + 0] * 127, -128, 127),
+ (uint8_t)CLAMP(src[i * 4 + 1] * 127, -128, 127),
+ (uint8_t)CLAMP(src[i * 4 + 2] * 127, -128, 127),
+ (uint8_t)CLAMP(src[i * 4 + 3] * 127, -128, 127)
};
copymem(&vw[p_offsets[ai] + i * p_stride], xyzw, 4);