Merge pull request #1826 from eehrich/master

Reviewed compiler warnings: fixed some bugs and formal stuff. (2nd try)
This commit is contained in:
Juan Linietsky 2015-05-07 20:02:54 -03:00
commit c99813dc38
23 changed files with 50 additions and 45 deletions

View File

@ -1850,7 +1850,7 @@ void ResourceFormatSaverXMLInstance::escape(String& p_str) {
p_str=p_str.replace(">","<"); p_str=p_str.replace(">","<");
p_str=p_str.replace("'","'"); p_str=p_str.replace("'","'");
p_str=p_str.replace("\"","""); p_str=p_str.replace("\"",""");
for (int i=1;i<32;i++) { for (char i=1;i<32;i++) {
char chr[2]={i,0}; char chr[2]={i,0};
const char hexn[16]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; const char hexn[16]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};

View File

@ -36,8 +36,9 @@ uint32_t Math::default_seed=1;
#define PHI 0x9e3779b9 #define PHI 0x9e3779b9
static uint32_t Q[4096], c = 362436; #if 0
static uint32_t Q[4096];
#endif
uint32_t Math::rand_from_seed(uint32_t *seed) { uint32_t Math::rand_from_seed(uint32_t *seed) {
@ -269,7 +270,7 @@ bool Math::is_inf(double p_val) {
uint32_t Math::larger_prime(uint32_t p_val) { uint32_t Math::larger_prime(uint32_t p_val) {
static const int primes[] = { static const uint32_t primes[] = {
5, 5,
13, 13,
23, 23,

View File

@ -36,6 +36,7 @@
#include <mpc/reader.h> #include <mpc/reader.h>
#include "internal.h" #include "internal.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> // memset()
#define STDIO_MAGIC 0xF34B963C ///< Just a random safe-check value... #define STDIO_MAGIC 0xF34B963C ///< Just a random safe-check value...
typedef struct mpc_reader_stdio_t { typedef struct mpc_reader_stdio_t {

View File

@ -11,21 +11,21 @@ public:
ColorRgb() ColorRgb()
: r(0) : b(0)
, g(0) , g(0)
, b(0) { , r(0) {
} }
ColorRgb(T red, T green, T blue) ColorRgb(T red, T green, T blue)
: r(red) : b(blue)
, g(green) , g(green)
, b(blue) { , r(red) {
} }
ColorRgb(const ColorRgb<T> &x) ColorRgb(const ColorRgb<T> &x)
: r(x.r) : b(x.b)
, g(x.g) , g(x.g)
, b(x.b) { , r(x.r) {
} }
ColorRgb<int> operator *(int x) { ColorRgb<int> operator *(int x) {

View File

@ -1160,7 +1160,7 @@ void _vp_couple_quantize_normalize(int blobno,
However, this is a temporary patch. However, this is a temporary patch.
by Aoyumi @ 2004/04/18 by Aoyumi @ 2004/04/18
*/ */
/*float derate = (1.0 - de*((float)(j-limit+i) / (float)(n-limit))); /*float derate = (1.0 - de*((float)(j-limit+i) / (float)(n-limit))); */
/* elliptical /* elliptical
if(reM[j]+reA[j]<0){ if(reM[j]+reA[j]<0){
reM[j] = - (qeM[j] = (fabs(reM[j])+fabs(reA[j]))*derate*derate); reM[j] = - (qeM[j] = (fabs(reM[j])+fabs(reA[j]))*derate*derate);

View File

@ -317,8 +317,8 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
/* set the name and class hints for the window manager to use */ /* set the name and class hints for the window manager to use */
classHint = XAllocClassHint(); classHint = XAllocClassHint();
if (classHint) { if (classHint) {
classHint->res_name = "Godot"; classHint->res_name = (char *)"Godot";
classHint->res_class = "Godot"; classHint->res_class = (char *)"Godot";
} }
XSetClassHint(x11_display, x11_window, classHint); XSetClassHint(x11_display, x11_window, classHint);
XFree(classHint); XFree(classHint);

View File

@ -132,8 +132,7 @@ Matrix32 Camera2D::get_camera_transform() {
} }
Point2 screen_offset = (centered ? (screen_size * 0.5 * zoom) : Point2());; Point2 screen_offset = (centered ? (screen_size * 0.5 * zoom) : Point2());
screen_offset;
float angle = get_global_transform().get_rotation(); float angle = get_global_transform().get_rotation();
if(rotating){ if(rotating){

View File

@ -285,18 +285,18 @@ namespace cubic {
namespace circ { namespace circ {
static real_t in(real_t t, real_t b, real_t c, real_t d) static real_t in(real_t t, real_t b, real_t c, real_t d)
{ {
return -c * (sqrt(1 - (t /= d) * t) - 1) + b; return -c * (sqrt(1 - (t /= d) * t) - 1) + b; // TODO: ehrich: operation with t is undefined
} }
static real_t out(real_t t, real_t b, real_t c, real_t d) static real_t out(real_t t, real_t b, real_t c, real_t d)
{ {
return c * sqrt(1 - (t = t / d - 1) * t) + b; return c * sqrt(1 - (t = t / d - 1) * t) + b; // TODO: ehrich: operation with t is undefined
} }
static real_t in_out(real_t t, real_t b, real_t c, real_t d) static real_t in_out(real_t t, real_t b, real_t c, real_t d)
{ {
if ((t /= d / 2) < 1) return -c / 2 * (sqrt(1 - t * t) - 1) + b; if ((t /= d / 2) < 1) return -c / 2 * (sqrt(1 - t * t) - 1) + b;
return c / 2 * (sqrt(1 - t * (t -= 2)) + 1) + b; return c / 2 * (sqrt(1 - t * (t -= 2)) + 1) + b; // TODO: ehrich: operation with t is undefined
} }
static real_t out_in(real_t t, real_t b, real_t c, real_t d) static real_t out_in(real_t t, real_t b, real_t c, real_t d)
@ -364,15 +364,15 @@ namespace back {
static real_t out(real_t t, real_t b, real_t c, real_t d) static real_t out(real_t t, real_t b, real_t c, real_t d)
{ {
float s = 1.70158f; float s = 1.70158f;
return c * ((t = t / d- 1) * t * ((s + 1) * t + s) + 1) + b; return c * ((t = t / d- 1) * t * ((s + 1) * t + s) + 1) + b; // TODO: ehrich: operation with t is undefined
} }
static real_t in_out(real_t t, real_t b, real_t c, real_t d) static real_t in_out(real_t t, real_t b, real_t c, real_t d)
{ {
float s = 1.70158f; float s = 1.70158f;
if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525f)) + 1) * t - s)) + b; if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525f)) + 1) * t - s)) + b; // TODO: ehrich: operation with s is undefined
float postFix = t -= 2; float postFix = t -= 2;
return c / 2 * ((postFix) * t * (((s *= (1.525f)) + 1) * t + s) + 2) + b; return c / 2 * ((postFix) * t * (((s *= (1.525f)) + 1) * t + s) + 2) + b; // TODO: ehrich: operation with s is undefined
} }
static real_t out_in(real_t t, real_t b, real_t c, real_t d) static real_t out_in(real_t t, real_t b, real_t c, real_t d)

View File

@ -433,7 +433,7 @@ void Label::regenerate_word_cache() {
} }
if ((autowrap && line_width>=width && (last && last->char_pos >= 0 || not_latin)) || insert_newline) { if ((autowrap && (line_width >= width) && ((last && last->char_pos >= 0) || not_latin)) || insert_newline) {
if (not_latin) { if (not_latin) {
if (current_word_size>0) { if (current_word_size>0) {
WordCache *wc = memnew( WordCache ); WordCache *wc = memnew( WordCache );

View File

@ -272,7 +272,7 @@ void LineEdit::_input_event(InputEvent p_event) {
if (editable) { if (editable) {
selection_delete(); selection_delete();
CharType ucodestr[2]={k.unicode,0}; CharType ucodestr[2]={(CharType)k.unicode,0};
append_at_cursor(ucodestr); append_at_cursor(ucodestr);
emit_signal("text_changed",text); emit_signal("text_changed",text);
_change_notify("text"); _change_notify("text");

View File

@ -1440,7 +1440,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
} else { } else {
//different char, go back //different char, go back
const CharType chr[2] = {k.unicode, 0}; const CharType chr[2] = {(CharType)k.unicode, 0};
if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) { if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) {
_consume_pair_symbol(chr[0]); _consume_pair_symbol(chr[0]);
} else { } else {
@ -2062,7 +2062,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
if (readonly) if (readonly)
break; break;
const CharType chr[2] = {k.unicode, 0}; const CharType chr[2] = {(CharType)k.unicode, 0};
if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) { if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) {
_consume_pair_symbol(chr[0]); _consume_pair_symbol(chr[0]);

View File

@ -34,8 +34,10 @@
#include "self_list.h" #include "self_list.h"
#include "broad_phase_sw.h" #include "broad_phase_sw.h"
#define MAX_OBJECT_DISTANCE 10000000 #ifdef DEBUG_ENABLED
#define MAX_OBJECT_DISTANCE 10000000.0
#define MAX_OBJECT_DISTANCE_X2 (MAX_OBJECT_DISTANCE*MAX_OBJECT_DISTANCE) #define MAX_OBJECT_DISTANCE_X2 (MAX_OBJECT_DISTANCE*MAX_OBJECT_DISTANCE)
#endif
class SpaceSW; class SpaceSW;

View File

@ -551,7 +551,7 @@ bool PhysicsServerSW::body_is_shape_set_as_trigger(RID p_body, int p_shape_idx)
ERR_FAIL_COND_V(!body,false); ERR_FAIL_COND_V(!body,false);
ERR_FAIL_INDEX_V(p_shape_idx,body->get_shape_count(),false); ERR_FAIL_INDEX_V(p_shape_idx,body->get_shape_count(),false);
body->is_shape_set_as_trigger(p_shape_idx); return body->is_shape_set_as_trigger(p_shape_idx);
} }

View File

@ -863,17 +863,17 @@ public:
if (polygon->indices != NULL) { if (polygon->indices != NULL) {
r.pos=polygon->points[polygon->indices[0]]; r.pos=polygon->points[polygon->indices[0]];
for (int i=1; i<polygon->count; i++) { for (int i=1; i<l; i++) {
r.expand_to(polygon->points[polygon->indices[i]]); r.expand_to(polygon->points[polygon->indices[i]]);
}; }
} else { } else {
r.pos=polygon->points[0]; r.pos=polygon->points[0];
for (int i=1; i<polygon->count; i++) { for (int i=1; i<l; i++) {
r.expand_to(polygon->points[i]); r.expand_to(polygon->points[i]);
}; }
}; }
} break; } break;
case CanvasItem::Command::TYPE_CIRCLE: { case CanvasItem::Command::TYPE_CIRCLE: {

View File

@ -7281,7 +7281,7 @@ void VisualServerRaster::_draw_viewports() {
if (r.size.width==0) if (r.size.width==0)
r.size.width=window_w; r.size.width=window_w;
if (r.size.height==0) if (r.size.height==0)
r.size.height=window_w; r.size.height=window_h;
_draw_viewport(vp,r.pos.x,r.pos.y,r.size.width,r.size.height); _draw_viewport(vp,r.pos.x,r.pos.y,r.size.width,r.size.height);

View File

@ -65,7 +65,7 @@ static String _escape_string(const String& p_str) {
ret=ret.replace(">","&lt;"); ret=ret.replace(">","&lt;");
ret=ret.replace("'","&apos;"); ret=ret.replace("'","&apos;");
ret=ret.replace("\"","&quot;"); ret=ret.replace("\"","&quot;");
for (int i=1;i<32;i++) { for (char i=1;i<32;i++) {
char chr[2]={i,0}; char chr[2]={i,0};
ret=ret.replace(chr,"&#"+String::num(i)+";"); ret=ret.replace(chr,"&#"+String::num(i)+";");

View File

@ -1375,7 +1375,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
if (p_input.is_action("ui_up")) if (p_input.is_action("ui_up"))
selected_track--; selected_track--;
if (v_scroll->is_visible() && p_input.is_action("ui_page_up")) if (v_scroll->is_visible() && p_input.is_action("ui_page_up"))
selected_track--;; selected_track--;
if (selected_track<0) if (selected_track<0)
selected_track=0; selected_track=0;

View File

@ -940,19 +940,19 @@ String EditorFileSystem::get_file_type(const String& p_file) const {
EditorFileSystemDirectory *EditorFileSystem::get_path(const String& p_path) { EditorFileSystemDirectory *EditorFileSystem::get_path(const String& p_path) {
if (!filesystem || scanning) if (!filesystem || scanning)
return false; return NULL;
String f = Globals::get_singleton()->localize_path(p_path); String f = Globals::get_singleton()->localize_path(p_path);
if (!f.begins_with("res://")) if (!f.begins_with("res://"))
return false; return NULL;
f=f.substr(6,f.length()); f=f.substr(6,f.length());
f=f.replace("\\","/"); f=f.replace("\\","/");
if (f==String()) if (f==String())
return filesystem; return filesystem;
if (f.ends_with("/")) if (f.ends_with("/"))
f=f.substr(0,f.length()-1); f=f.substr(0,f.length()-1);
@ -960,7 +960,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_path(const String& p_path) {
Vector<String> path = f.split("/"); Vector<String> path = f.split("/");
if (path.size()==0) if (path.size()==0)
return false; return NULL;
EditorFileSystemDirectory *fs=filesystem; EditorFileSystemDirectory *fs=filesystem;

View File

@ -51,6 +51,7 @@ static const char *flag_names[]={
NULL NULL
}; };
#if 0 // not used
static const char *flag_short_names[]={ static const char *flag_short_names[]={
"Stream", "Stream",
"FixBorder", "FixBorder",
@ -65,6 +66,7 @@ static const char *flag_short_names[]={
"Anisoropic", "Anisoropic",
NULL NULL
}; };
#endif
void EditorImportTextureOptions::set_format(EditorTextureImportPlugin::ImageFormat p_format) { void EditorImportTextureOptions::set_format(EditorTextureImportPlugin::ImageFormat p_format) {

View File

@ -539,7 +539,6 @@ void GraphCurveMapEdit::_plot_curve(const Vector2& p_a,const Vector2& p_b,const
if ((lastx != newx) || (lasty != newy)) if ((lastx != newx) || (lasty != newy))
{ {
#if 0 #if 0
/*
if(fix255) if(fix255)
{ {
/* use fixed array size (for the curve graph) */ /* use fixed array size (for the curve graph) */

View File

@ -3172,11 +3172,11 @@ void SpatialEditor::_init_indicators() {
int arrow_sides=6; int arrow_sides=6;
for(int i = 0; i < 7 ; i++) { for(int k = 0; k < 7 ; k++) {
Matrix3 ma(ivec,Math_PI*2*float(i)/arrow_sides); Matrix3 ma(ivec,Math_PI*2*float(k)/arrow_sides);
Matrix3 mb(ivec,Math_PI*2*float(i+1)/arrow_sides); Matrix3 mb(ivec,Math_PI*2*float(k+1)/arrow_sides);
for(int j=0;j<arrow_points-1;j++) { for(int j=0;j<arrow_points-1;j++) {

View File

@ -1257,7 +1257,8 @@ void SkeletonSpatialGizmo::redraw() {
//find closest axis //find closest axis
int closest=-1; int closest=-1;
float closest_d; float closest_d = 0.0;
for(int j=0;j<3;j++) { for(int j=0;j<3;j++) {
float dp = Math::abs(grests[parent].basis[j].normalized().dot(d)); float dp = Math::abs(grests[parent].basis[j].normalized().dot(d));
if (j==0 || dp>closest_d) if (j==0 || dp>closest_d)

View File

@ -136,7 +136,7 @@ Error PCKPacker::flush(bool p_verbose) {
count += 1; count += 1;
if (p_verbose) { if (p_verbose) {
if (count % 100 == 0) { if (count % 100 == 0) {
printf("%i/%i (%.2f\%)\r", count, files.size(), float(count) / files.size() * 100); printf("%i/%i (%.2f)\r", count, files.size(), float(count) / files.size() * 100);
fflush(stdout); fflush(stdout);
}; };
}; };