Skip to content

Commit

Permalink
fix warnings (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
minggo committed Jun 23, 2017
1 parent c5ee004 commit 5abc4ce
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Box2D/Collision/b2CollideCircle.cpp
Expand Up @@ -138,7 +138,7 @@ void b2CollidePolygonAndCircle(
else
{
b2Vec2 faceCenter = 0.5f * (v1 + v2);
float32 separation = b2Dot(cLocal - faceCenter, normals[vertIndex1]);
separation = b2Dot(cLocal - faceCenter, normals[vertIndex1]);
if (separation > radius)
{
return;
Expand Down
4 changes: 2 additions & 2 deletions Box2D/Dynamics/Joints/b2WheelJoint.cpp
Expand Up @@ -141,14 +141,14 @@ void b2WheelJoint::InitVelocityConstraints(const b2SolverData& data)
float32 omega = 2.0f * b2_pi * m_frequencyHz;

// Damping coefficient
float32 d = 2.0f * m_springMass * m_dampingRatio * omega;
float32 d2 = 2.0f * m_springMass * m_dampingRatio * omega;

// Spring stiffness
float32 k = m_springMass * omega * omega;

// magic formulas
float32 h = data.step.dt;
m_gamma = h * (d + h * k);
m_gamma = h * (d2 + h * k);
if (m_gamma > 0.0f)
{
m_gamma = 1.0f / m_gamma;
Expand Down
2 changes: 1 addition & 1 deletion Box2D/Dynamics/b2Island.cpp
Expand Up @@ -312,7 +312,7 @@ void b2Island::Solve(b2Profile* profile, const b2TimeStep& step, const b2Vec2& g
bool contactsOkay = contactSolver.SolvePositionConstraints();

bool jointsOkay = true;
for (int32 i = 0; i < m_jointCount; ++i)
for (int32 j = 0; j < m_jointCount; ++j)
{
bool jointOkay = m_joints[i]->SolvePositionConstraints(solverData);
jointsOkay = jointsOkay && jointOkay;
Expand Down
2 changes: 1 addition & 1 deletion clipper/clipper.cpp
Expand Up @@ -3242,7 +3242,7 @@ void Clipper::BuildResult(Paths &polys)
int cnt = PointCount(p);
if (cnt < 2) continue;
pg.reserve(cnt);
for (int i = 0; i < cnt; ++i)
for (int j = 0; j < cnt; ++j)
{
pg.push_back(p->Pt);
p = p->Prev;
Expand Down
1 change: 1 addition & 0 deletions flatbuffers/flatbuffers.h
Expand Up @@ -297,6 +297,7 @@ struct String : public Vector<char> {
// with custom allocation (see the FlatBufferBuilder constructor).
class simple_allocator {
public:
virtual ~simple_allocator(){}
virtual uint8_t *allocate(size_t size) const { return new uint8_t[size]; }
virtual void deallocate(uint8_t *p) const { delete[] p; }
};
Expand Down
6 changes: 3 additions & 3 deletions flatbuffers/flatc.cpp
Expand Up @@ -152,9 +152,9 @@ int main(int argc, const char *argv[]) {
proto_mode = true;
any_generator = true;
} else {
for (size_t i = 0; i < num_generators; ++i) {
if(opt == generators[i].opt) {
generator_enabled[i] = true;
for (size_t j = 0; j < num_generators; ++j) {
if(opt == generators[j].opt) {
generator_enabled[j] = true;
any_generator = true;
goto found;
}
Expand Down
4 changes: 2 additions & 2 deletions flatbuffers/idl.h
Expand Up @@ -203,8 +203,8 @@ struct StructDef : public Definition {
bytesize(0)
{}

void PadLastField(size_t minalign) {
auto padding = PaddingBytes(bytesize, minalign);
void PadLastField(size_t _minalign) {
auto padding = PaddingBytes(bytesize, _minalign);
bytesize += padding;
if (fields.vec.size()) fields.vec.back()->padding = padding;
}
Expand Down
12 changes: 6 additions & 6 deletions flatbuffers/idl_gen_fbs.cpp
Expand Up @@ -63,9 +63,9 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name,
EnumDef &enum_def = **it;
schema += "enum " + enum_def.name + " : ";
schema += GenType(enum_def.underlying_type) + " {\n";
for (auto it = enum_def.vals.vec.begin();
it != enum_def.vals.vec.end(); ++it) {
auto &ev = **it;
for (auto it2 = enum_def.vals.vec.begin();
it2 != enum_def.vals.vec.end(); ++it2) {
auto &ev = **it2;
schema += " " + ev.name + " = " + NumToString(ev.value) + ",\n";
}
schema += "}\n\n";
Expand All @@ -75,9 +75,9 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name,
it != parser.structs_.vec.end(); ++it) {
StructDef &struct_def = **it;
schema += "table " + struct_def.name + " {\n";
for (auto it = struct_def.fields.vec.begin();
it != struct_def.fields.vec.end(); ++it) {
auto &field = **it;
for (auto it2 = struct_def.fields.vec.begin();
it2 != struct_def.fields.vec.end(); ++it2) {
auto &field = **it2;
schema += " " + field.name + ":" + GenType(field.value.type);
if (field.value.constant != "0") schema += " = " + field.value.constant;
if (field.required) schema += " (required)";
Expand Down
12 changes: 6 additions & 6 deletions flatbuffers/idl_parser.cpp
Expand Up @@ -745,8 +745,8 @@ void Parser::ParseEnum(bool is_union) {
Expect('{');
if (is_union) enum_def.vals.Add("NONE", new EnumVal("NONE", 0));
do {
std::string name = attribute_;
std::vector<std::string> dc = doc_comment_;
name = attribute_;
dc = doc_comment_;
Expect(kTokenIdentifier);
auto prevsize = enum_def.vals.vec.size();
auto value = enum_def.vals.vec.size()
Expand Down Expand Up @@ -1105,10 +1105,10 @@ bool Parser::Parse(const char *source, const char **include_paths,
for (auto it = enums_.vec.begin(); it != enums_.vec.end(); ++it) {
auto &enum_def = **it;
if (enum_def.is_union) {
for (auto it = enum_def.vals.vec.begin();
it != enum_def.vals.vec.end();
++it) {
auto &val = **it;
for (auto it2 = enum_def.vals.vec.begin();
it2 != enum_def.vals.vec.end();
++it2) {
auto &val = **it2;
if (val.struct_def && val.struct_def->fixed)
Error("only tables can be union elements: " + val.name);
}
Expand Down
11 changes: 5 additions & 6 deletions poly2tri/sweep/sweep.cc
Expand Up @@ -49,13 +49,12 @@ void Sweep::Triangulate(SweepContext& tcx)

void Sweep::SweepPoints(SweepContext& tcx)
{
for (size_t i = 1; i < tcx.point_count(); i++) {
Point& point = *tcx.GetPoint(i);
Node* node = &PointEvent(tcx, point);
for (unsigned int i = 0; i < point.edge_list.size(); i++) {
EdgeEvent(tcx, point.edge_list[i], node);
for (size_t i = 1; i < tcx.point_count(); i++) {
Point& point = *tcx.GetPoint(i);
Node* node = &PointEvent(tcx, point);
for (auto&& edge : point.edge_list)
EdgeEvent(tcx, edge, node);
}
}
}

void Sweep::FinalizationPolygon(SweepContext& tcx)
Expand Down
10 changes: 0 additions & 10 deletions rapidxml/rapidxml_sax3.hpp
Expand Up @@ -569,9 +569,6 @@ namespace rapidxml
return;// return 0; // Do not produce comment node
}

// Remember value start
Ch *value = text;

// Skip until end of comment
while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>'))
{
Expand All @@ -596,9 +593,6 @@ namespace rapidxml
template<int Flags>
void parse_doctype(Ch *&text)
{
// Remember value start
Ch *value = text;

// Skip to >
while (*text != Ch('>'))
{
Expand Down Expand Up @@ -681,9 +675,6 @@ namespace rapidxml
// Skip whitespace between pi target and pi
skip<whitespace_pred, Flags>(text, endptr_);

// Remember start of pi
Ch *value = text;

// Skip to '?>'
while (text[0] != Ch('?') || text[1] != Ch('>'))
{
Expand Down Expand Up @@ -807,7 +798,6 @@ namespace rapidxml
}

// Skip until end of cdata
Ch *value = text;
while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>'))
{
if (!text[0])
Expand Down
1 change: 0 additions & 1 deletion recast/DetourCrowd/DetourObstacleAvoidance.cpp
Expand Up @@ -528,7 +528,6 @@ int dtObstacleAvoidanceQuery::sampleVelocityAdaptive(const float* pos, const flo

const int nd = dtClamp(ndivs, 1, DT_MAX_PATTERN_DIVS);
const int nr = dtClamp(nrings, 1, DT_MAX_PATTERN_RINGS);
const int nd2 = nd / 2;
const float da = (1.0f/nd) * DT_PI*2;
const float ca = cosf(da);
const float sa = sinf(da);
Expand Down
10 changes: 5 additions & 5 deletions recast/fastlz/fastlz.c
Expand Up @@ -231,7 +231,7 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
ref = htab[hval];

/* calculate distance to the match */
distance = anchor - ref;
distance = (int)(anchor - ref);

/* update hash table */
*hslot = anchor;
Expand Down Expand Up @@ -301,7 +301,7 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*

/* length is biased, '1' means a match of 3 bytes */
ip -= 3;
len = ip - anchor;
len = (int)(ip - anchor);

/* encode the match */
#if FASTLZ_LEVEL==2
Expand Down Expand Up @@ -414,7 +414,7 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
*(flzuint8*)output |= (1 << 5);
#endif

return op - (flzuint8*)output;
return (int)(op - (flzuint8*)output);
}

static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout)
Expand Down Expand Up @@ -538,14 +538,14 @@ static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void
for(--ctrl; ctrl; ctrl--)
*op++ = *ip++;

loop = FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit);
loop = (int)FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit);
if(loop)
ctrl = *ip++;
}
}
while(FASTLZ_EXPECT_CONDITIONAL(loop));

return op - (flzuint8*)output;
return (int)(op - (flzuint8*)output);
}

#endif /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */

0 comments on commit 5abc4ce

Please sign in to comment.