Ver código fonte

improves portability with some compilers

Ariel Manzur 7 anos atrás
pai
commit
e2b50e1abb
2 arquivos alterados com 8 adições e 8 exclusões
  1. 1 1
      core/ustring.cpp
  2. 7 7
      servers/visual_server.cpp

+ 1 - 1
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;
 				}

+ 7 - 7
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);