Merge pull request #5920 from 29jm/fix-warnings

Fix some more warnings
This commit is contained in:
Juan Linietsky 2016-09-10 12:21:02 -03:00 committed by GitHub
commit fc61eb37ce
25 changed files with 60 additions and 61 deletions

View File

@ -222,6 +222,7 @@ static String _parser_expr(const GDParser::Node *p_expr) {
case GDParser::OperatorNode::OP_BIT_AND: { txt=_parser_expr(c_node->arguments[0])+"&"+_parser_expr(c_node->arguments[1]); } break;;
case GDParser::OperatorNode::OP_BIT_OR: { txt=_parser_expr(c_node->arguments[0])+"|"+_parser_expr(c_node->arguments[1]); } break;
case GDParser::OperatorNode::OP_BIT_XOR: { txt=_parser_expr(c_node->arguments[0])+"^"+_parser_expr(c_node->arguments[1]); } break;
default: {}
}

View File

@ -431,7 +431,7 @@ public:
RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL );
//vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
//vs->light_set_shadow( lightaux, true );
RID light = vs->instance_create2( lightaux,scenario );
vs->instance_create2( lightaux,scenario );
//rot_a=Transform(Matrix3(Vector3(1,0,0),Math_PI/2.0),Vector3());
rot_b=Transform(Matrix3(),Vector3(2,0,0));

View File

@ -609,7 +609,7 @@ public:
//t.basis.rotate(Vector3(-1,0,0),Math_PI/4*i);
RID b = create_body(type,PhysicsServer::BODY_MODE_RIGID,t);
create_body(type,PhysicsServer::BODY_MODE_RIGID,t);
//RID b = create_body(type,i==0?PhysicsServer::BODY_MODE_STATIC:PhysicsServer::BODY_MODE_RIGID,t);
}

View File

@ -410,7 +410,7 @@ public:
Physics2DServer::ShapeType type = types[i%4];
// type=Physics2DServer::SHAPE_SEGMENT;
RID b = _add_body(type,Matrix32(i*0.8,Point2(152+i*40,100-40*i)));
_add_body(type,Matrix32(i*0.8,Point2(152+i*40,100-40*i)));
//if (i==0)
// ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC);
}

View File

@ -2052,6 +2052,7 @@ Error Image::_decompress_bc() {
ht/=2;
} break;
default: {}
}
}

View File

@ -157,7 +157,10 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour,Vector<int> &result
m++;
/* remove v from remaining polygon */
for(s=v,t=v+1;t<nv;s++,t++) V[s] = V[t]; nv--;
for(s=v,t=v+1;t<nv;s++,t++)
V[s] = V[t];
nv--;
/* resest error detection counter */
count = 2*nv;

View File

@ -1644,6 +1644,7 @@ void Object::_clear_internal_resource_paths(const Variant &p_var) {
_clear_internal_resource_paths(d[E->get()]);
}
} break;
default: {}
}
}

View File

@ -866,21 +866,14 @@ MethodBind* ObjectTypeDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , c
Vector<Variant> defvals;
#define PARSE_DEFVAL(m_defval)\
if (d##m_defval.used) defvals.insert(0,d##m_defval.val);\
else goto set_defvals;
defvals.resize(p_defcount);
for(int i=0;i<p_defcount;i++) {
defvals[i]=*p_defs[p_defcount-i-1];
}
set_defvals:
p_bind->set_default_arguments(defvals);
p_bind->set_hint_flags(p_flags);
#undef PARSE_DEFVAL
return p_bind;
}

View File

@ -270,7 +270,7 @@ static void user_read_data(png_structp png_ptr,png_bytep data, png_size_t p_leng
PNGReadStatus *rstatus;
rstatus=(PNGReadStatus*)png_get_io_ptr(png_ptr);
int to_read=p_length;
png_size_t to_read=p_length;
if (rstatus->size>=0) {
to_read = MIN( p_length, rstatus->size - rstatus->offset);
}

View File

@ -175,8 +175,8 @@ void AudioDriverPulseAudio::finish() {
exit_thread = true;
Thread::wait_to_finish(thread);
if (pulse)
pa_simple_free(pulse);
if (pulse)
pa_simple_free(pulse);
if (samples_in) {
memdelete_arr(samples_in);

View File

@ -390,7 +390,7 @@ Error OS_Unix::execute(const String& p_path, const List<String>& p_arguments,boo
if (p_blocking) {
int status;
pid_t rpid = waitpid(pid,&status,0);
waitpid(pid,&status,0);
if (r_exitcode)
*r_exitcode=WEXITSTATUS(status);
} else {

View File

@ -2094,7 +2094,7 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
GDParser p;
Error err = p.parse(p_code,p_base_path,false,"",true);
p.parse(p_code,p_base_path,false,"",true);
bool isfunction=false;
Set<String> options;

View File

@ -1332,7 +1332,7 @@ StringName GDTokenizerBuffer::get_token_identifier(int p_offset) const{
ERR_FAIL_INDEX_V(offset,tokens.size(),StringName());
uint32_t identifier = tokens[offset]>>TOKEN_BITS;
ERR_FAIL_INDEX_V(identifier,identifiers.size(),StringName());
ERR_FAIL_INDEX_V(identifier,(uint32_t)identifiers.size(),StringName());
return identifiers[identifier];
}
@ -1391,7 +1391,7 @@ const Variant& GDTokenizerBuffer::get_token_constant(int p_offset) const{
int offset = token+p_offset;
ERR_FAIL_INDEX_V(offset,tokens.size(),nil);
uint32_t constant = tokens[offset]>>TOKEN_BITS;
ERR_FAIL_INDEX_V(constant,constants.size(),nil);
ERR_FAIL_INDEX_V(constant,(uint32_t)constants.size(),nil);
return constants[constant];
}

View File

@ -495,7 +495,7 @@ static String _parse_string(const uint8_t *p_bytes,bool p_utf8) {
Vector<uint8_t> str8;
str8.resize(len+1);
for(int i=0;i<len;i++) {
for(uint32_t i=0;i<len;i++) {
str8[i]=p_bytes[offset+i];
}
str8[len]=0;
@ -505,7 +505,7 @@ static String _parse_string(const uint8_t *p_bytes,bool p_utf8) {
} else {
String str;
for(int i=0;i<len;i++) {
for(uint32_t i=0;i<len;i++) {
CharType c = decode_uint16(&p_bytes[offset+i*2]);
if (c==0)
break;
@ -535,7 +535,7 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) {
printf("stirng count: %i\n",string_count);
printf("flags: %x\n",string_flags);
for(int i=0;i<string_count;i++) {
for(uint32_t i=0;i<string_count;i++) {
uint32_t offset = decode_uint32(&p_manifest[string_table_begins+i*4]);
offset+=string_table_begins+string_count*4;
@ -569,7 +569,7 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) {
Vector<uint8_t> ret;
ret.resize(string_table_begins+string_table.size()*4);
for(int i=0;i<string_table_begins;i++) {
for(uint32_t i=0;i<string_table_begins;i++) {
ret[i]=p_manifest[i];
}
@ -660,7 +660,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
uint32_t filesize = decode_uint32(&p_manifest[ofs+4]);
ofs+=8;
// print_line("FILESIZE: "+itos(filesize)+" ACTUAL: "+itos(p_manifest.size()));
//print_line("FILESIZE: "+itos(filesize)+" ACTUAL: "+itos(p_manifest.size()));
uint32_t string_count;
uint32_t styles_count;
@ -672,7 +672,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
uint32_t string_table_ends;
Vector<uint8_t> stable_extra;
while(ofs < p_manifest.size()) {
while(ofs < (uint32_t)p_manifest.size()) {
uint32_t chunk = decode_uint32(&p_manifest[ofs]);
uint32_t size = decode_uint32(&p_manifest[ofs+4]);
@ -687,7 +687,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
string_count=decode_uint32(&p_manifest[iofs]);
styles_count=decode_uint32(&p_manifest[iofs+4]);
uint32_t string_flags=decode_uint32(&p_manifest[iofs+8]);
string_flags=decode_uint32(&p_manifest[iofs+8]);
string_data_offset=decode_uint32(&p_manifest[iofs+12]);
styles_offset=decode_uint32(&p_manifest[iofs+16]);
/*
@ -703,7 +703,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
string_table_begins=st_offset;
for(int i=0;i<string_count;i++) {
for(uint32_t i=0;i<string_count;i++) {
uint32_t string_at = decode_uint32(&p_manifest[st_offset+i*4]);
string_at+=st_offset+string_count*4;
@ -719,7 +719,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
uint32_t len = decode_uint16(&p_manifest[string_at]);
Vector<CharType> ucstring;
ucstring.resize(len+1);
for(int j=0;j<len;j++) {
for(uint32_t j=0;j<len;j++) {
uint16_t c=decode_uint16(&p_manifest[string_at+2+2*j]);
ucstring[j]=c;
}
@ -732,7 +732,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
// print_line("String "+itos(i)+": "+string_table[i]);
}
for(int i=string_end;i<(ofs+size);i++) {
for(uint32_t i=string_end;i<(ofs+size);i++) {
stable_extra.push_back(p_manifest[i]);
}
@ -758,7 +758,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
uint32_t attrcount=decode_uint32(&p_manifest[iofs+20]);
iofs+=28;
//printf("ATTRCOUNT: %x\n",attrcount);
for(int i=0;i<attrcount;i++) {
for(uint32_t i=0;i<attrcount;i++) {
uint32_t attr_nspace=decode_uint32(&p_manifest[iofs]);
uint32_t attr_name=decode_uint32(&p_manifest[iofs+4]);
uint32_t attr_value=decode_uint32(&p_manifest[iofs+8]);
@ -883,7 +883,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
Vector<uint8_t> ret;
ret.resize(string_table_begins+string_table.size()*4);
for(int i=0;i<string_table_begins;i++) {
for(uint32_t i=0;i<string_table_begins;i++) {
ret[i]=p_manifest[i];
}
@ -927,7 +927,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
uint32_t extra = (p_manifest.size()-string_table_ends);
ret.resize(new_stable_end + extra);
for(int i=0;i<extra;i++)
for(uint32_t i=0;i<extra;i++)
ret[new_stable_end+i]=p_manifest[string_table_ends+i];
while(ret.size()%4)
@ -1355,7 +1355,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.push_back(unaligned_path);
args.push_back(user);
int retval;
int err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
if (retval) {
EditorNode::add_io_error("'jarsigner' returned with error #"+itos(retval));
return ERR_CANT_CREATE;
@ -1368,7 +1368,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.push_back(unaligned_path);
args.push_back("-verbose");
err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
if (retval) {
EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6.");
return ERR_CANT_CREATE;
@ -1515,7 +1515,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
List<String> args;
args.push_back("devices");
int ec;
Error err = OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec);
OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec);
Vector<String> ds = devices.split("\n");
Vector<String> ldevices;
for(int i=1;i<ds.size();i++) {
@ -1574,7 +1574,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
int ec;
String dp;
Error err = OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec);
OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec);
Vector<String> props = dp.split("\n");
String vendor;

View File

@ -445,7 +445,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
{
//write datapack
int err = zipOpenNewFileInZip(dpkg,
zipOpenNewFileInZip(dpkg,
(pkg_name+".app/Contents/Resources/data.pck").utf8().get_data(),
NULL,
NULL,

View File

@ -41,13 +41,13 @@ void update_material(Ref<CanvasItemMaterial>mat,const Color& p_color,float h,flo
if (!sdr.is_valid())
return;
mat->set_shader_param("R",p_color.r);
mat->set_shader_param("G",p_color.g);
mat->set_shader_param("B",p_color.b);
mat->set_shader_param("H",h);
mat->set_shader_param("S",s);
mat->set_shader_param("V",v);
mat->set_shader_param("A",p_color.a);
mat->set_shader_param("R",p_color.r);
mat->set_shader_param("G",p_color.g);
mat->set_shader_param("B",p_color.b);
mat->set_shader_param("H",h);
mat->set_shader_param("S",s);
mat->set_shader_param("V",v);
mat->set_shader_param("A",p_color.a);
}
void ColorPicker::_notification(int p_what) {
@ -397,9 +397,10 @@ void ColorPicker::_screen_input(const InputEvent &ev)
if (!r->get_rect().has_point(Point2(mev.global_x,mev.global_y)))
return;
Image img =r->get_screen_capture();
if (!img.empty())
if (!img.empty()) {
last_capture=img;
r->queue_screen_capture();
}
if (!last_capture.empty())
set_color(last_capture.get_pixel(mev.global_x,mev.global_y));
}

View File

@ -290,9 +290,6 @@ RID Rasterizer::_create_shader(const FixedMaterialShaderKey& p_key) {
//print_line("**VERTEX SHADER GENERATED code: \n"+vcode);
double tf = (OS::get_singleton()->get_ticks_usec()-t)/1000.0;
// print_line("generate: "+rtos(tf));
shader_set_code(fms.shader,vcode,code,lcode,0,0);
fixed_material_shaders[p_key]=fms;

View File

@ -1441,7 +1441,7 @@ bool EditorExportPlatformPC::can_export(String *r_error) const {
String err;
bool valid=true;
if (use64 && (!exists_export_template(debug_binary64)) || !exists_export_template(release_binary64)) {
if (use64 && (!exists_export_template(debug_binary64) || !exists_export_template(release_binary64))) {
valid=false;
err="No 64 bits export templates found.\nDownload and install export templates.\n";
}

View File

@ -785,7 +785,7 @@ bool EditorNode::_find_and_save_resource(RES res,Map<RES,bool>& processed,int32_
if (changed || subchanged) {
//save
print_line("Also saving modified external resource: "+res->get_path());
Error err = ResourceSaver::save(res->get_path(),res,flags);
ResourceSaver::save(res->get_path(),res,flags);
}
processed[res]=false; //because it's a file

View File

@ -147,7 +147,7 @@ public:
dst = dst.plus_file(bitmasks[i].get_file().basename() + ".pbm");
Error err = plugin->import(dst, imd);
plugin->import(dst, imd);
}
hide();

View File

@ -298,7 +298,7 @@ public:
dst = dst.plus_file(samples[i].get_file().basename()+".smp");
Error err = plugin->import(dst,imd);
plugin->import(dst,imd);
}
hide();

View File

@ -1447,6 +1447,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag
}
} break;
default: {}
}
@ -2325,7 +2326,7 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text)
if (!scene->has_node(String("AnimationPlayer")))
return;
Node* n = scene->get_node(String("AnimationPlayer"));
Node* n = scene->get_node(String("AnimationPlayer"));
ERR_FAIL_COND(!n);
AnimationPlayer *anim = n->cast_to<AnimationPlayer>();
ERR_FAIL_COND(!anim);
@ -2443,7 +2444,7 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_
if (!scene->has_node(String("AnimationPlayer")))
return;
Node* n = scene->get_node(String("AnimationPlayer"));
Node* n = scene->get_node(String("AnimationPlayer"));
ERR_FAIL_COND(!n);
AnimationPlayer *anim = n->cast_to<AnimationPlayer>();
ERR_FAIL_COND(!anim);
@ -2842,7 +2843,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
}
}
Error err = EditorTextureImportPlugin::get_singleton()->import(target_path,imd);
EditorTextureImportPlugin::get_singleton()->import(target_path,imd);
}
}

View File

@ -1177,8 +1177,6 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c
diffuse_at_point.g=res_light.g*diffuse_at_point.g;
diffuse_at_point.b=res_light.b*diffuse_at_point.b;
float ret=1e6;
if (p_bounces>0) {
@ -1220,7 +1218,7 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c
#endif
ret=_throw_ray(thread_stack,p_bake_direct,r_point,r_point+rn*p_rest,p_rest,diffuse_at_point,p_att_curve,p_att_pos,p_att_curve_len,p_bounces-1);
_throw_ray(thread_stack,p_bake_direct,r_point,r_point+rn*p_rest,p_rest,diffuse_at_point,p_att_curve,p_att_pos,p_att_curve_len,p_bounces-1);
}
if (use_specular && (specular_at_point.r>CMP_EPSILON || specular_at_point.g>CMP_EPSILON || specular_at_point.b>CMP_EPSILON)) {

View File

@ -901,6 +901,7 @@ void ShaderGraphView::_variant_edited() {
case Variant::COLOR:
v2=Color();
break;
default: {}
}
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Change Default Value"));
@ -1321,6 +1322,7 @@ void ShaderGraphView::_default_changed(int p_id, Node *p_button, int p_param, in
h=PROPERTY_HINT_COLOR_NO_ALPHA;
v=Color();
break;
default: {}
}
ped_popup->edit(NULL,"",vt,v,h,p_hint);
@ -1347,6 +1349,8 @@ ToolButton *ShaderGraphView::make_label(String text, Variant::Type v_type) {
break;
case Variant::COLOR:
l->set_icon(ped_popup->get_icon("Color", "EditorIcons"));
break;
default: {}
}
return l;
}
@ -1372,7 +1376,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int
case Variant::TRANSFORM:
edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons"));
break;
case Variant::COLOR:
case Variant::COLOR: {
Image icon_color = Image(15,15,false,Image::FORMAT_RGB);
Color c = graph->default_get_value(type,p_id,param);
for (int x=1;x<14;x++)
@ -1382,7 +1386,8 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int
t.instance();
t->create_from_image(icon_color);
edit->set_icon(t);
break;
} break;
default: {}
}
return edit;
}

View File

@ -422,8 +422,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
if (billboard_handle) {
t.set_look_at(t.origin,t.origin+p_camera->get_transform().basis.get_axis(2),p_camera->get_transform().basis.get_axis(1));
}
Transform ti=t.affine_inverse();
float min_d=1e20;
int idx=-1;