Remove warnings

This commit is contained in:
Alexander Bock
2015-05-24 00:09:52 +02:00
parent fed0095196
commit 98024ca29d
8 changed files with 42 additions and 30 deletions

View File

@@ -31,19 +31,21 @@ namespace openspace {
class ProgressBar {
public:
ProgressBar(int end, int width = 70);
ProgressBar(int end, int width, std::ostream& stream);
ProgressBar(int end, int width = 70, std::ostream& stream = std::cout);
~ProgressBar();
ProgressBar& operator=(const ProgressBar& rhs) = delete;
void print(int current);
private:
int _width;
int _previous;
int _end;
std::ostream& _stream;
}; // class ProgressBar
};
} // namespace opensapce
} // namespace openspace
#endif
#endif // __PROGRESSBAR_H__

View File

@@ -21,11 +21,12 @@ void *updatedx(void * arg) {
//printf("Hello world!\n");
*dx = *dx + 0.5;
// random sleep time
int diff = rand() % 200;
#ifndef __WIN32__
usleep(10000*diff);
// random sleep time
int diff = rand() % 200;
usleep(10000*diff);
#endif
}
delete p;

View File

@@ -48,7 +48,7 @@ namespace {
namespace openspace {
NetworkEngine::NetworkEngine()
: _lastAssignedIdentifier(-1) // -1 is okay as we assign one identifier in this ctor
: _lastAssignedIdentifier(MessageIdentifier(-1)) // -1 is okay as we assign one identifier in this ctor
, _shouldPublishStatusMessage(true)
{
static_assert(

View File

@@ -386,16 +386,15 @@ void RenderEngine::render(const glm::mat4 &projectionMatrix, const glm::mat4 &vi
#define PrintColorText(__i__, __format__, __size__, __color__) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __color__, __format__);
if (_onScreenInformation._node != -1) {
int thisId = sgct_core::ClusterManager::instance()->getThisNodeId();
//int thisId = sgct_core::ClusterManager::instance()->getThisNodeId();
if (thisId == _onScreenInformation._node) {
const unsigned int font_size_mono = _onScreenInformation._size;
int x1, xSize, y1, ySize;
const sgct_text::Font* font = sgct_text::FontManager::instance()->getFont(constants::fonts::keyMono, font_size_mono);
sgct::Engine::instance()->getActiveWindowPtr()->getCurrentViewportPixelCoords(x1, y1, xSize, ySize);
int startY = ySize - 2 * font_size_mono;
}
//if (thisId == _onScreenInformation._node) {
//const unsigned int font_size_mono = _onScreenInformation._size;
//int x1, xSize, y1, ySize;
//const sgct_text::Font* font = sgct_text::FontManager::instance()->getFont(constants::fonts::keyMono, font_size_mono);
//sgct::Engine::instance()->getActiveWindowPtr()->getCurrentViewportPixelCoords(x1, y1, xSize, ySize);
//int startY = ySize - 2 * font_size_mono;
//}
}
// Print some useful information on the master viewport
@@ -413,14 +412,14 @@ void RenderEngine::render(const glm::mat4 &projectionMatrix, const glm::mat4 &vi
int x1, xSize, y1, ySize;
sgct::Engine::instance()->getActiveWindowPtr()->getCurrentViewportPixelCoords(x1, y1, xSize, ySize);
int startY = ySize - 2 * font_size_mono;
const glm::vec2& scaling = _mainCamera->scaling();
const glm::vec3& viewdirection = _mainCamera->viewDirection();
const psc& position = _mainCamera->position();
const psc& origin = OsEng.interactionHandler()->focusNode()->worldPosition();
const PowerScaledScalar& pssl = (position - origin).length();
//const glm::vec2& scaling = _mainCamera->scaling();
//const glm::vec3& viewdirection = _mainCamera->viewDirection();
//const psc& position = _mainCamera->position();
//const psc& origin = OsEng.interactionHandler()->focusNode()->worldPosition();
//const PowerScaledScalar& pssl = (position - origin).length();
// Next 2 lines neccesary for instrument switching to work.
double currentTime = Time::ref().currentTime();
//double currentTime = Time::ref().currentTime();
// GUI PRINT
// Using a macro to shorten line length and increase readability
@@ -837,7 +836,11 @@ void RenderEngine::storePerformanceMeasurements() {
SceneGraphNode* node = scene()->allSceneGraphNodes()[i];
memset(layout->entries[i].name, 0, lengthName);
strcpy(layout->entries[i].name, node->name().c_str());
#ifdef _MSC_VER
strcpy_s(layout->entries[i].name, node->name().length() + 1, node->name().c_str());
#else
strcpy(layout->entries[i].name, node->name().c_str());
#endif
layout->entries[i].currentRenderTime = 0;
layout->entries[i].currentUpdateRenderable = 0;

View File

@@ -81,7 +81,12 @@ PowerScaledCoordinate
// find out how many digits
// TODO: profile the next two lines and replace with something more efficient (ab)
#ifdef _MSC_VER
sprintf_s(buff, 600, "%.0f", max);
//sprintf(buff, "%.0f", max);
#else
sprintf(buff, "%.0f", max);
#endif
size_t digits = strlen(buff);
//digits += 3;

View File

@@ -56,7 +56,11 @@ PowerScaledScalar PowerScaledScalar::CreatePSS(double d1) {
double ad1 = std::abs(d1);
// find out how many digits
sprintf ( buff, "%.0f", ad1);
#ifdef _MSC_VER
sprintf_s(buff, 30, "%.0f", ad1);
#else
sprintf(buff, "%.0f", ad1);
#endif
size_t digits = strlen(buff)-1;
// rescale and return

View File

@@ -27,9 +27,6 @@
#include <iomanip>
namespace openspace {
ProgressBar::ProgressBar(int end, int width)
: ProgressBar(end, width, std::cout)
{}
ProgressBar::ProgressBar(int end, int width, std::ostream& stream)
: _width(width)