mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
Various compiler warning fixes
This commit is contained in:
parent
fa23c199ec
commit
b88bd99704
@ -103,11 +103,6 @@ RenameSet methodRenameDictionary[] = {
|
||||
{ nullptr, nullptr, -1 }
|
||||
};
|
||||
|
||||
RenameSet classRenameDictionary[] = {
|
||||
// No longer used, now empty.
|
||||
{ nullptr, nullptr, -1 }
|
||||
};
|
||||
|
||||
const char *pythonKeywords[] = {
|
||||
"and",
|
||||
"as",
|
||||
@ -193,12 +188,6 @@ classNameFromCppName(const std::string &cppName, bool mangle) {
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; classRenameDictionary[x]._from != nullptr; x++) {
|
||||
if (cppName == classRenameDictionary[x]._from) {
|
||||
className = classRenameDictionary[x]._to;
|
||||
}
|
||||
}
|
||||
|
||||
if (className.empty()) {
|
||||
std::string text = "** ERROR ** Renaming class: " + cppName + " to empty string";
|
||||
printf("%s", text.c_str());
|
||||
@ -253,15 +242,6 @@ methodNameFromCppName(const std::string &cppName, const std::string &className,
|
||||
}
|
||||
}
|
||||
|
||||
if (className.size() > 0) {
|
||||
string lookup_name = className + '.' + cppName;
|
||||
for (int x = 0; classRenameDictionary[x]._from != nullptr; x++) {
|
||||
if (lookup_name == methodRenameDictionary[x]._from) {
|
||||
methodName = methodRenameDictionary[x]._to;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// # Mangle names that happen to be python keywords so they are not anymore
|
||||
methodName = checkKeyword(methodName);
|
||||
return methodName;
|
||||
|
@ -34,6 +34,7 @@ PUBLISHED:
|
||||
explicit CharacterSlider(PartGroup *parent, const std::string &name);
|
||||
virtual ~CharacterSlider();
|
||||
|
||||
public:
|
||||
virtual PartGroup *make_copy() const;
|
||||
|
||||
virtual bool update_internals(PartBundle *root, PartGroup *parent,
|
||||
|
@ -33,7 +33,7 @@
|
||||
* This class exists for name scoping only. Don't use the constructor
|
||||
* directly; use one of the make_* methods.
|
||||
*/
|
||||
class EXPCL_PANDA_DISPLAY NativeWindowHandle : public WindowHandle {
|
||||
class EXPCL_PANDA_DISPLAY NativeWindowHandle final : public WindowHandle {
|
||||
private:
|
||||
INLINE NativeWindowHandle();
|
||||
INLINE NativeWindowHandle(const NativeWindowHandle ©);
|
||||
|
@ -57,7 +57,7 @@ get_shading() const {
|
||||
if (!first_component->has_normal()) {
|
||||
first_component = this;
|
||||
}
|
||||
for (int i = 1; i < get_num_components(); i++) {
|
||||
for (size_t i = 1; i < get_num_components(); ++i) {
|
||||
const EggAttributes *component = get_component(i);
|
||||
if (!component->has_normal()) {
|
||||
component = this;
|
||||
@ -74,7 +74,7 @@ get_shading() const {
|
||||
if (!first_component->has_color()) {
|
||||
first_component = this;
|
||||
}
|
||||
for (int i = 1; i < get_num_components(); i++) {
|
||||
for (size_t i = 1; i < get_num_components(); ++i) {
|
||||
const EggAttributes *component = get_component(i);
|
||||
if (!component->has_color()) {
|
||||
component = this;
|
||||
@ -295,7 +295,7 @@ apply_last_attribute() {
|
||||
// The first component gets applied to the third vertex, and so on from
|
||||
// there.
|
||||
int num_lead_vertices = get_num_lead_vertices();
|
||||
for (int i = 0; i < get_num_components(); i++) {
|
||||
for (size_t i = 0; i < get_num_components(); ++i) {
|
||||
EggAttributes *component = get_component(i);
|
||||
do_apply_flat_attribute(i + num_lead_vertices, component);
|
||||
}
|
||||
@ -313,7 +313,7 @@ void EggCompositePrimitive::
|
||||
apply_first_attribute() {
|
||||
// The first component gets applied to the first vertex, and so on from
|
||||
// there.
|
||||
for (int i = 0; i < get_num_components(); i++) {
|
||||
for (size_t i = 0; i < get_num_components(); ++i) {
|
||||
EggAttributes *component = get_component(i);
|
||||
do_apply_flat_attribute(i, component);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ get_shading() const {
|
||||
if (!first_vertex->has_normal()) {
|
||||
first_vertex = this;
|
||||
}
|
||||
for (int i = 1; i < get_num_vertices(); i++) {
|
||||
for (size_t i = 1; i < get_num_vertices(); ++i) {
|
||||
const EggAttributes *vertex = get_vertex(i);
|
||||
if (!vertex->has_normal()) {
|
||||
vertex = this;
|
||||
@ -244,7 +244,7 @@ get_shading() const {
|
||||
if (!first_vertex->has_color()) {
|
||||
first_vertex = this;
|
||||
}
|
||||
for (int i = 1; i < get_num_vertices(); i++) {
|
||||
for (size_t i = 1; i < get_num_vertices(); ++i) {
|
||||
const EggAttributes *vertex = get_vertex(i);
|
||||
if (!vertex->has_color()) {
|
||||
vertex = this;
|
||||
@ -461,9 +461,7 @@ apply_first_attribute() {
|
||||
void EggPrimitive::
|
||||
post_apply_flat_attribute() {
|
||||
if (!empty()) {
|
||||
for (int i = 0; i < (int)size(); i++) {
|
||||
EggVertex *vertex = get_vertex(i);
|
||||
|
||||
for (EggVertex *vertex : _vertices) {
|
||||
// Use set_normal() instead of copy_normal(), to avoid getting the
|
||||
// morphs--we don't want them here, since we're just putting a bogus
|
||||
// value on the normal anyway.
|
||||
|
@ -57,7 +57,7 @@ apply_first_attribute() {
|
||||
// In the case of a triangle fan, the first vertex of the fan is the common
|
||||
// vertex, so we consider the second vertex to be the key vertex of the
|
||||
// first triangle, and move from there.
|
||||
for (int i = 0; i < get_num_components(); i++) {
|
||||
for (size_t i = 0; i < get_num_components(); ++i) {
|
||||
EggAttributes *component = get_component(i);
|
||||
do_apply_flat_attribute(i + 1, component);
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path,
|
||||
// Get an arbitrary vector on the plane by taking the cross product
|
||||
// with any vector, as long as it is different.
|
||||
LVector3 vec1;
|
||||
if (abs(normal[2]) > abs(normal[1])) {
|
||||
if (std::fabs(normal[2]) > std::fabs(normal[1])) {
|
||||
vec1 = normal.cross(LVector3(0, 1, 0));
|
||||
} else {
|
||||
vec1 = normal.cross(LVector3(0, 0, 1));
|
||||
@ -626,7 +626,7 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path,
|
||||
// Also get an arbitrary vector perpendicular to the tube.
|
||||
LVector3 axis = point_b - point_a;
|
||||
LVector3 sideways;
|
||||
if (abs(axis[2]) > abs(axis[1])) {
|
||||
if (std::fabs(axis[2]) > std::fabs(axis[1])) {
|
||||
sideways = axis.cross(LVector3(0, 1, 0));
|
||||
} else {
|
||||
sideways = axis.cross(LVector3(0, 0, 1));
|
||||
|
@ -34,7 +34,7 @@ get_repeat_count() const {
|
||||
* Returns the index of the task within the sequence that is currently being
|
||||
* executed (or that will be executed at the next epoch).
|
||||
*/
|
||||
INLINE int AsyncTaskSequence::
|
||||
INLINE size_t AsyncTaskSequence::
|
||||
get_current_task_index() const {
|
||||
return _task_index;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ PUBLISHED:
|
||||
INLINE void set_repeat_count(int repeat_count);
|
||||
INLINE int get_repeat_count() const;
|
||||
|
||||
INLINE int get_current_task_index() const;
|
||||
INLINE size_t get_current_task_index() const;
|
||||
|
||||
protected:
|
||||
virtual bool is_runnable();
|
||||
@ -51,7 +51,7 @@ private:
|
||||
void set_current_task(AsyncTask *task, bool clean_exit);
|
||||
|
||||
int _repeat_count;
|
||||
int _task_index;
|
||||
size_t _task_index;
|
||||
PT(AsyncTask) _current_task;
|
||||
|
||||
public:
|
||||
|
@ -3007,7 +3007,7 @@ reset() {
|
||||
|
||||
#ifndef OPENGLES_1
|
||||
_enabled_vertex_attrib_arrays.clear();
|
||||
memset(_vertex_attrib_divisors, 0, sizeof(GLint) * 32);
|
||||
memset(_vertex_attrib_divisors, 0, sizeof(GLuint) * 32);
|
||||
#endif
|
||||
|
||||
// Dither is on by default in GL; let's turn it off
|
||||
|
@ -661,7 +661,7 @@ protected:
|
||||
|
||||
#ifndef OPENGLES_1
|
||||
BitMask32 _enabled_vertex_attrib_arrays;
|
||||
GLint _vertex_attrib_divisors[32];
|
||||
GLuint _vertex_attrib_divisors[32];
|
||||
|
||||
PT(Shader) _current_shader;
|
||||
ShaderContext *_current_shader_context;
|
||||
|
@ -374,7 +374,7 @@ void MeshDrawer::geometry(NodePath draw_node) {
|
||||
CPT(GeomVertexData) v_data = geom->get_vertex_data();
|
||||
GeomVertexReader *prim_vertex_reader = new GeomVertexReader(v_data, "vertex");
|
||||
GeomVertexReader *prim_uv_reader = new GeomVertexReader(v_data, "texcoord");
|
||||
for(int k=0; k <geom->get_num_primitives(); k++) {
|
||||
for (size_t k = 0; k < geom->get_num_primitives(); ++k) {
|
||||
CPT(GeomPrimitive) prim1 = geom->get_primitive(k);
|
||||
CPT(GeomPrimitive) _prim = prim1->decompose();
|
||||
|
||||
|
@ -288,6 +288,17 @@ do_load_one(Texture::CData *cdata_tex,
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loading a static image into a MovieTexture is an error.
|
||||
*/
|
||||
bool MovieTexture::
|
||||
do_load_one(Texture::CData *cdata_tex,
|
||||
const PfmFile &pfm, const std::string &name, int z, int n,
|
||||
const LoaderOptions &options) {
|
||||
grutil_cat.error() << "You cannot load a static image into a MovieTexture\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called internally by do_reconsider_z_size() to allocate new memory in
|
||||
* _ram_images[0] for the new number of pages.
|
||||
|
@ -102,6 +102,9 @@ protected:
|
||||
virtual bool do_load_one(Texture::CData *cdata,
|
||||
const PNMImage &pnmimage, const std::string &name,
|
||||
int z, int n, const LoaderOptions &options);
|
||||
virtual bool do_load_one(Texture::CData *cdata,
|
||||
const PfmFile &pfm, const std::string &name,
|
||||
int z, int n, const LoaderOptions &options);
|
||||
bool do_load_one(Texture::CData *cdata,
|
||||
PT(MovieVideoCursor) color, PT(MovieVideoCursor) alpha,
|
||||
int z, const LoaderOptions &options);
|
||||
|
@ -328,7 +328,9 @@ static drflac* drflac_open_memory(const void* data, size_t dataSize);
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
|
@ -1242,7 +1242,7 @@ apply_collect_changes() {
|
||||
*/
|
||||
void GeomTransformer::NewCollectedData::
|
||||
append_vdata(const GeomVertexData *vdata, int vertex_offset) {
|
||||
for (int i = 0; i < vdata->get_num_arrays(); ++i) {
|
||||
for (size_t i = 0; i < vdata->get_num_arrays(); ++i) {
|
||||
PT(GeomVertexArrayDataHandle) new_handle = _new_data->modify_array_handle(i);
|
||||
CPT(GeomVertexArrayDataHandle) old_handle = vdata->get_array_handle(i);
|
||||
size_t stride = (size_t)_new_format->get_array(i)->get_stride();
|
||||
|
@ -188,8 +188,8 @@ get_path(int index) const {
|
||||
* get_path(), but it may be a more convenient way to access it.
|
||||
*/
|
||||
NodePath NodePathCollection::
|
||||
operator [] (int index) const {
|
||||
nassertr(index >= 0 && index < (int)_node_paths.size(), NodePath());
|
||||
operator [] (size_t index) const {
|
||||
nassertr(index < _node_paths.size(), NodePath());
|
||||
|
||||
return _node_paths[index];
|
||||
}
|
||||
@ -198,7 +198,7 @@ operator [] (int index) const {
|
||||
* Returns the number of paths in the collection. This is the same thing as
|
||||
* get_num_paths().
|
||||
*/
|
||||
int NodePathCollection::
|
||||
size_t NodePathCollection::
|
||||
size() const {
|
||||
return _node_paths.size();
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ PUBLISHED:
|
||||
int get_num_paths() const;
|
||||
NodePath get_path(int index) const;
|
||||
MAKE_SEQ(get_paths, get_num_paths, get_path);
|
||||
NodePath operator [] (int index) const;
|
||||
int size() const;
|
||||
NodePath operator [] (size_t index) const;
|
||||
size_t size() const;
|
||||
INLINE void operator += (const NodePathCollection &other);
|
||||
INLINE NodePathCollection operator + (const NodePathCollection &other) const;
|
||||
|
||||
|
@ -404,6 +404,9 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
|
||||
info._flags |= ShaderKey::TF_uses_last_saved_result;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// In fact, perhaps this stage should be disabled altogether?
|
||||
@ -438,6 +441,8 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
|
||||
skip = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// We can't just drop a disabled slot from the list, since then the
|
||||
// indices for the texture stages will no longer match up. So we keep it,
|
||||
|
@ -2381,7 +2381,7 @@ assign_append_to(GeomCollectorMap &geom_collector_map,
|
||||
|
||||
PT(Geom) geom = _glyph->get_geom(GeomEnums::UH_static);
|
||||
|
||||
int p, sp, s, e, i;
|
||||
int sp, s, e, i;
|
||||
|
||||
const GeomVertexData *vdata = geom->get_vertex_data();
|
||||
CPT(RenderState) rs = _glyph->get_state()->compose(state);
|
||||
@ -2398,7 +2398,7 @@ assign_append_to(GeomCollectorMap &geom_collector_map,
|
||||
// that we don't needlessly duplicate vertices into our output vertex data.
|
||||
VertexIndexMap vimap;
|
||||
|
||||
for (p = 0; p < geom->get_num_primitives(); p++) {
|
||||
for (size_t p = 0; p < geom->get_num_primitives(); ++p) {
|
||||
CPT(GeomPrimitive) primitive = geom->get_primitive(p)->decompose();
|
||||
|
||||
// Get a new GeomPrimitive of the corresponding type.
|
||||
|
@ -14,7 +14,7 @@
|
||||
int error, derror;
|
||||
int x1, dxdy_min, dxdy_max;
|
||||
/* warning: x2 is multiplied by 2^16 */
|
||||
int x2, dx2dy2;
|
||||
UNUSED int x2, dx2dy2;
|
||||
|
||||
#ifdef INTERP_Z
|
||||
int z1 = 0, dzdx = 0, dzdy = 0, dzdl_min = 0, dzdl_max = 0;
|
||||
|
@ -32,7 +32,7 @@ FNAME(flat_untextured) (ZBuffer *zb,
|
||||
ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
|
||||
{
|
||||
UNUSED int color;
|
||||
int or0, og0, ob0, oa0;
|
||||
UNUSED int or0, og0, ob0, oa0;
|
||||
|
||||
#define INTERP_Z
|
||||
|
||||
@ -160,7 +160,7 @@ FNAME(flat_textured) (ZBuffer *zb,
|
||||
ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
|
||||
{
|
||||
ZTextureDef *texture_def;
|
||||
int or0, og0, ob0, oa0;
|
||||
UNUSED int or0, og0, ob0, oa0;
|
||||
|
||||
#define INTERP_Z
|
||||
#define INTERP_ST
|
||||
@ -399,7 +399,7 @@ FNAME(flat_perspective) (ZBuffer *zb,
|
||||
{
|
||||
ZTextureDef *texture_def;
|
||||
PN_stdfloat fdzdx,fndzdx,ndszdx,ndtzdx;
|
||||
int or0, og0, ob0, oa0;
|
||||
UNUSED int or0, og0, ob0, oa0;
|
||||
|
||||
#define INTERP_Z
|
||||
#define INTERP_STZ
|
||||
@ -456,7 +456,7 @@ FNAME(flat_perspective) (ZBuffer *zb,
|
||||
PIXEL *pp; \
|
||||
int s,t,z,zz; \
|
||||
int n,dsdx,dtdx; \
|
||||
int or1,og1,ob1,oa1; \
|
||||
UNUSED int or1,og1,ob1,oa1; \
|
||||
PN_stdfloat sz,tz,fz,zinv; \
|
||||
n=(x2>>16)-x1; \
|
||||
fz=(PN_stdfloat)z1; \
|
||||
@ -596,7 +596,7 @@ FNAME(smooth_perspective) (ZBuffer *zb,
|
||||
PIXEL *pp; \
|
||||
int s,t,z,zz; \
|
||||
int n,dsdx,dtdx; \
|
||||
int or1,og1,ob1,oa1; \
|
||||
UNUSED int or1,og1,ob1,oa1; \
|
||||
PN_stdfloat sz,tz,fz,zinv; \
|
||||
n=(x2>>16)-x1; \
|
||||
fz=(PN_stdfloat)z1; \
|
||||
@ -727,7 +727,7 @@ FNAME(smooth_multitex2) (ZBuffer *zb,
|
||||
PIXEL *pp; \
|
||||
int s,t,sa,ta,z,zz; \
|
||||
int n,dsdx,dtdx,dsadx,dtadx; \
|
||||
int or1,og1,ob1,oa1; \
|
||||
UNUSED int or1,og1,ob1,oa1; \
|
||||
PN_stdfloat sz,tz,sza,tza,fz,zinv; \
|
||||
n=(x2>>16)-x1; \
|
||||
fz=(PN_stdfloat)z1; \
|
||||
@ -888,7 +888,7 @@ FNAME(smooth_multitex3) (ZBuffer *zb,
|
||||
PIXEL *pp; \
|
||||
int s,t,sa,ta,sb,tb,z,zz; \
|
||||
int n,dsdx,dtdx,dsadx,dtadx,dsbdx,dtbdx; \
|
||||
int or1,og1,ob1,oa1; \
|
||||
UNUSED int or1,og1,ob1,oa1; \
|
||||
PN_stdfloat sz,tz,sza,tza,szb,tzb,fz,zinv; \
|
||||
n=(x2>>16)-x1; \
|
||||
fz=(PN_stdfloat)z1; \
|
||||
|
Loading…
x
Reference in New Issue
Block a user