Skip to content

Commit

Permalink
Fixes bullet-related warnings on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
thepianoboy committed Mar 1, 2017
1 parent db1ad88 commit 063e0d3
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ btBarrelShape::btBarrelShape(btScalar sY_low, btScalar sY_high, btScalar sR_vert

// suppport point on the lathed ellipse?
btScalar pY = vec0.y();
btScalar pR = sqrt (vec0.z()*vec0.z() + vec0.x()*vec0.x() );
btScalar pR = std::sqrt (vec0.z()*vec0.z() + vec0.x()*vec0.x() );
btScalar pH = pR;
btScalar dX = vec0.x()/pR;
btScalar dZ = vec0.z()/pR;
btScalar tpar = atan((pY*R_vert)/(pH*R_hor));
btScalar tpar = std::atan((pY*R_vert)/(pH*R_hor));
btScalar sY = R_vert * sin(tpar);
btScalar sH = R_hor * cos(tpar);
btScalar sR = sH + R_offset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ subject to the following restrictions:

//#define NOMINMAX
#include <algorithm>

#define BT_USE_DOUBLE_PRECISION
#include "btCEtriangleShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ subject to the following restrictions:
#include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "LinearMath/btSerializer.h"

#include <stdint.h>

btCompoundShape::btCompoundShape(bool enableDynamicAabbTree)
: m_localAabbMin(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)),
m_localAabbMax(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)),
Expand Down Expand Up @@ -78,7 +80,7 @@ void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
{
const btDbvtVolume bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
int index = m_children.size();
child.m_node = m_dynamicAabbTree->insert(bounds,(void*)(long)index);
child.m_node = m_dynamicAabbTree->insert(bounds,(void*)(uint64_t)index);
}

m_children.push_back(child);
Expand Down Expand Up @@ -307,7 +309,7 @@ void btCompoundShape::createAabbTreeFromChildren()
child.m_childShape->getAabb(child.m_transform,localAabbMin,localAabbMax);

const btDbvtVolume bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
child.m_node = m_dynamicAabbTree->insert(bounds,(void*)(long)index);
child.m_node = m_dynamicAabbTree->insert(bounds,(void*)(uint64_t)index);
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/chrono/collision/bullet/BulletFileLoader/bDNA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ subject to the following restrictions:
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>

//this define will force traversal of structures, to check backward (and forward) compatibility
//#define TEST_BACKWARD_FORWARD_COMPATIBILITY
Expand Down Expand Up @@ -275,7 +276,7 @@ void bDNA::initCmpFlags(bDNA *memDNA)


static int name_is_array(char* name, int* dim1, int* dim2) {
int len = strlen(name);
size_t len = strlen(name);
/*fprintf(stderr,"[%s]",name);*/
/*if (len >= 1) {
if (name[len-1] != ']')
Expand Down Expand Up @@ -349,7 +350,7 @@ void bDNA::init(char *data, int len, bool swap)
{
//printf("swap = %d\n",swap); ***ALEX***
int *intPtr=0;short *shtPtr=0;
char *cp = 0;int dataLen =0;long nr=0;
char *cp = 0;int dataLen =0;uint64_t nr=0;
intPtr = (int*)data;

/*
Expand Down Expand Up @@ -388,7 +389,7 @@ void bDNA::init(char *data, int len, bool swap)


{
nr= (long)cp;
nr= (uint64_t)cp;
//long mask=3;
nr= ((nr+3)&~3)-nr;
while (nr--)
Expand Down Expand Up @@ -421,7 +422,7 @@ void bDNA::init(char *data, int len, bool swap)
}

{
nr= (long)cp;
nr= (uint64_t)cp;
// long mask=3;
nr= ((nr+3)&~3)-nr;
while (nr--)
Expand Down Expand Up @@ -515,7 +516,7 @@ void bDNA::init(char *data, int len, bool swap)
int bDNA::getArraySize(char* string)
{
int ret = 1;
int len = strlen(string);
size_t len = strlen(string);


char* next = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/chrono/collision/bullet/BulletFileLoader/bFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ subject to the following restrictions:
#include "bCommon.h"
#include "bChunk.h"
#include "bDNA.h"
#include <math.h>
#include <cmath>
#include <string.h>
#include <stdlib.h>
#include "bDefines.h"
Expand Down
5 changes: 3 additions & 2 deletions src/chrono/collision/bullet/LinearMath/btAlignedAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ subject to the following restrictions:
*/

#include "btAlignedAllocator.h"
#include <stdint.h>

int gNumAlignedAllocs = 0;
int gNumAlignedFree = 0;
Expand Down Expand Up @@ -62,11 +63,11 @@ static inline void *btAlignedAllocDefault(size_t size, int alignment)
{
void *ret;
char *real;
unsigned long offset;
uint64_t offset;

real = (char *)sAllocFunc(size + sizeof(void *) + (alignment-1));
if (real) {
offset = (alignment - (unsigned long)(real + sizeof(void *))) & (alignment-1);
offset = (alignment - (uint64_t)(real + sizeof(void *))) & (alignment-1);
ret = (void *)((real + sizeof(void *)) + offset);
*((void **)(ret)-1) = (void *)(real);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/chrono/collision/bullet/LinearMath/btScalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ subject to the following restrictions:
#endif


#include <math.h>
#include <cmath>
#include <stdlib.h>//size_t for MSVC 6.0
#include <cstdlib>
#include <cfloat>
Expand Down
10 changes: 6 additions & 4 deletions src/chrono/collision/bullet/LinearMath/btSerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ subject to the following restrictions:
#include <memory.h>
#endif
#include <string.h>

#include <stdint.h>


///only the 32bit versions for now
Expand Down Expand Up @@ -210,7 +210,9 @@ class btDefaultSerializer : public btSerializer

int *intPtr=0;
short *shtPtr=0;
char *cp = 0;int dataLen =0;long nr=0;
char *cp = 0;int dataLen =0;
uint64_t nr=0; // long was replaced with uint64_t for cross-platform compatibility

intPtr = (int*)m_dna;

/*
Expand Down Expand Up @@ -244,7 +246,7 @@ class btDefaultSerializer : public btSerializer
cp++;
}
{
nr= (long)cp;
nr= (uint64_t)cp;
// long mask=3;
nr= ((nr+3)&~3)-nr;
while (nr--)
Expand Down Expand Up @@ -279,7 +281,7 @@ class btDefaultSerializer : public btSerializer
}

{
nr= (long)cp;
nr= (uint64_t)cp;
// long mask=3;
nr= ((nr+3)&~3)-nr;
while (nr--)
Expand Down

0 comments on commit 063e0d3

Please sign in to comment.