Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (some) compiler warnings #37

Merged
merged 2 commits into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/cel3ds/3dsread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ void indent()
cout << " ";
}

void logChunk(uint16 chunkType/*, int chunkSize*/)
void logChunk(uint16 /*chunkType*/ /*, int chunkSize*/)
{
#if 0
const char* name = NULL;

switch (chunkType)
Expand Down Expand Up @@ -193,7 +194,7 @@ void logChunk(uint16 chunkType/*, int chunkSize*/)
default:
break;
}
#if 0

indent();

if (name == NULL)
Expand Down
15 changes: 6 additions & 9 deletions src/celengine/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,24 +703,21 @@ CommandCapture::CommandCapture(const std::string& _type,
void CommandCapture::process(ExecutionEnvironment&)
{
#ifndef TARGET_OS_MAC
bool success = false;


// Get the dimensions of the current viewport
int viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);

if (compareIgnoringCase(type, "jpeg") == 0)
{
success = CaptureGLBufferToJPEG(filename,
viewport[0], viewport[1],
viewport[2], viewport[3]);
CaptureGLBufferToJPEG(filename,
viewport[0], viewport[1],
viewport[2], viewport[3]);
}
if (compareIgnoringCase(type, "png") == 0)
{
success = CaptureGLBufferToPNG(filename,
viewport[0], viewport[1],
viewport[2], viewport[3]);
CaptureGLBufferToPNG(filename,
viewport[0], viewport[1],
viewport[2], viewport[3]);
}
#endif
}
Expand Down
8 changes: 4 additions & 4 deletions src/celengine/observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void Observer::update(double dt, double timeScale)
UniversalCoord origin = centerObj.getPosition(simTime);

Vector3d v0 = ufrom.offsetFromKm(origin);
Vector3d v1 = uto.offsetFromKm(origin);
//Vector3d v1 = uto.offsetFromKm(origin);

if (jv.norm() == 0.0)
{
Expand Down Expand Up @@ -629,7 +629,7 @@ void Observer::computeGotoParameters(const Selection& destination,
}

UniversalCoord targetPosition = destination.getPosition(getTime());
Vector3d v = targetPosition.offsetFromKm(getPosition()).normalized();
//Vector3d v = targetPosition.offsetFromKm(getPosition()).normalized();

jparams.traj = Linear;
jparams.duration = gotoTime;
Expand Down Expand Up @@ -694,7 +694,7 @@ void Observer::computeGotoParametersGC(const Selection& destination,
setFrame(frame->getCoordinateSystem(), destination);

UniversalCoord targetPosition = destination.getPosition(getTime());
Vector3d v = targetPosition.offsetFromKm(getPosition()).normalized();
//Vector3d v = targetPosition.offsetFromKm(getPosition()).normalized();

jparams.traj = GreatCircle;
jparams.duration = gotoTime;
Expand Down Expand Up @@ -791,7 +791,7 @@ void Observer::computeCenterCOParameters(const Selection& destination,

Selection centerObj = frame->getRefObject();
UniversalCoord centerPos = centerObj.getPosition(getTime());
UniversalCoord targetPosition = destination.getPosition(getTime());
//UniversalCoord targetPosition = destination.getPosition(getTime());

Quaterniond q;
q.setFromTwoVectors(v, w);
Expand Down
4 changes: 3 additions & 1 deletion src/celengine/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7662,7 +7662,7 @@ void Renderer::renderPlanet(Body& body,


// Add ring shadow records for each light
if (body.getRings() && ShowRingShadows)
if (body.getRings() && (renderFlags & ShowRingShadows) != 0)
{
for (unsigned int li = 0; li < lights.nLights; li++)
{
Expand Down Expand Up @@ -8033,8 +8033,10 @@ void Renderer::renderCometTail(const Body& body,
{
Vector3f cometPoints[MaxCometTailPoints];
Vector3d pos0 = body.getOrbit(now)->positionAtTime(now);
#if 0
Vector3d pos1 = body.getOrbit(now)->positionAtTime(now - 0.01);
Vector3d vd = pos1 - pos0;
#endif
double t = now;

float distanceFromSun, irradiance_max = 0.0f;
Expand Down
2 changes: 1 addition & 1 deletion src/celengine/renderglsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ void renderGeometryShadow_GLSL(Geometry* geometry,
int lightIndex = 0;
Vector3f viewDir = -ls.lights[lightIndex].direction_obj;
Vector3f upDir = viewDir.unitOrthogonal();
Vector3f rightDir = upDir.cross(viewDir);
/*Vector3f rightDir = */upDir.cross(viewDir);


glUseProgramObjectARB(0);
Expand Down
2 changes: 1 addition & 1 deletion src/celengine/star.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ StarDetails::StarDetails() :
bolometricCorrection(0.0f),
knowledge(0u),
visible(true),
texture(texture),
texture(texture), // warning: ‘StarDetails::texture’ is initialized with itself [-Winit-self]
geometry(InvalidResource),
orbit(NULL),
orbitalRadius(0.0f),
Expand Down
9 changes: 4 additions & 5 deletions src/celestia/glutmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ static void MouseButton(int button, int state, int x, int y)
lastY = y;
}


static void KeyPress(unsigned char c, int x, int y)
static void KeyPress(unsigned char c, int /*x*/, int /*y*/)
{
// Ctrl-Q exits
if (c == '\021')
Expand All @@ -167,7 +166,7 @@ static void KeyPress(unsigned char c, int x, int y)
}


static void KeyUp(unsigned char c, int x, int y)
static void KeyUp(unsigned char c, int /*x*/, int /*y*/)
{
appCore->keyUp((int) c);
}
Expand Down Expand Up @@ -237,13 +236,13 @@ static void HandleSpecialKey(int key, bool down)
}


static void SpecialKeyPress(int key, int x, int y)
static void SpecialKeyPress(int key, int /*x*/, int /*y*/)
{
HandleSpecialKey(key, true);
}


static void SpecialKeyUp(int key, int x, int y)
static void SpecialKeyUp(int key, int /*x*/, int /*y*/)
{
HandleSpecialKey(key, false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/celestia/qt/qtmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using namespace std;

extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
static const char *description = "Celestia";
//static const char *description = "Celestia";

// Command line options
static bool startFullscreen = false;
Expand Down
3 changes: 1 addition & 2 deletions src/celutil/bigfix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,10 @@ std::string BigFix::toString()

// Conversion using code from the original BigFix class.
std::string encoded("");
int bits, c, char_count, started, i, j;
int bits, c, char_count, i, j;

char_count = 0;
bits = 0;
started = 0;

// Find first significant (non null) byte
i = 16;
Expand Down