Browse Source

Make some type conversions explicit.

Fixes a bunch of MSVC warnings.
pull/34/head
Vladimír Vondruš 13 years ago
parent
commit
ee045d261a
  1. 2
      src/Color.h
  2. 8
      src/Math/Functions.h
  3. 2
      src/Math/Unit.h
  4. 8
      src/Math/Vector.h
  5. 2
      src/MeshTools/RemoveDuplicates.h
  6. 4
      src/Platform/Sdl2Application.cpp
  7. 6
      src/Plugins/TgaImageConverter/TgaImageConverter.cpp
  8. 4
      src/Primitives/Capsule.cpp
  9. 4
      src/Primitives/Circle.cpp
  10. 8
      src/Primitives/Implementation/Spheroid.cpp
  11. 6
      src/Primitives/Implementation/WireframeSpheroid.cpp
  12. 4
      src/SceneGraph/Object.hpp
  13. 2
      src/Shader.cpp
  14. 2
      src/Text/AbstractFont.cpp
  15. 2
      src/Text/AbstractFontConverter.cpp
  16. 4
      src/Text/Renderer.cpp
  17. 4
      src/Timeline.cpp
  18. 2
      src/Trade/AbstractImporter.cpp
  19. 4
      src/Trade/Test/AbstractImageConverterTest.cpp

2
src/Color.h

@ -45,7 +45,7 @@ template<class T> typename std::enable_if<std::is_floating_point<T>::value, Basi
std::tie(hue, saturation, value) = hsv; std::tie(hue, saturation, value) = hsv;
/* Remove repeats */ /* Remove repeats */
hue -= int(T(hue)/T(360))*Math::Deg<T>(360); hue -= Math::floor(T(hue)/T(360))*Math::Deg<T>(360);
if(hue < Math::Deg<T>(0)) hue += Math::Deg<T>(360); if(hue < Math::Deg<T>(0)) hue += Math::Deg<T>(360);
int h = int(T(hue)/T(60)) % 6; int h = int(T(hue)/T(60)) % 6;

8
src/Math/Functions.h

@ -285,12 +285,12 @@ template<std::size_t size, class T> Vector<size, T> ceil(const Vector<size, T>&
template<class T> inline T sqrt(const T& a); template<class T> inline T sqrt(const T& a);
#else #else
template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sqrt(T a) { template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sqrt(T a) {
return std::sqrt(a); return T(std::sqrt(a));
} }
template<std::size_t size, class T> Vector<size, T> sqrt(const Vector<size, T>& a) { template<std::size_t size, class T> Vector<size, T> sqrt(const Vector<size, T>& a) {
Vector<size, T> out; Vector<size, T> out;
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
out[i] = std::sqrt(a[i]); out[i] = T(std::sqrt(a[i]));
return out; return out;
} }
#endif #endif
@ -349,7 +349,7 @@ The interpolation for vectors is done as in following, similarly for scalars: @f
template<class T, class U> inline T lerp(const T& a, const T& b, U t); template<class T, class U> inline T lerp(const T& a, const T& b, U t);
#else #else
template<class T, class U> inline T lerp(T a, T b, U t) { template<class T, class U> inline T lerp(T a, T b, U t) {
return (U(1) - t)*a + t*b; return T((U(1) - t)*a + t*b);
} }
template<std::size_t size, class T, class U> inline Vector<size, T> lerp(const Vector<size, T>& a, const Vector<size, T>& b, U t) { template<std::size_t size, class T, class U> inline Vector<size, T> lerp(const Vector<size, T>& a, const Vector<size, T>& b, U t) {
return (U(1) - t)*a + t*b; return (U(1) - t)*a + t*b;
@ -471,7 +471,7 @@ template<class Integral, class FloatingPoint> inline Integral denormalize(const
template<class Integral, class FloatingPoint> inline typename std::enable_if<std::is_arithmetic<FloatingPoint>::value, Integral>::type denormalize(FloatingPoint value) { template<class Integral, class FloatingPoint> inline typename std::enable_if<std::is_arithmetic<FloatingPoint>::value, Integral>::type denormalize(FloatingPoint value) {
static_assert(std::is_floating_point<FloatingPoint>::value && std::is_integral<Integral>::value, static_assert(std::is_floating_point<FloatingPoint>::value && std::is_integral<Integral>::value,
"Math::denormalize(): denormalization must be done from floating-point to integral type"); "Math::denormalize(): denormalization must be done from floating-point to integral type");
return value*std::numeric_limits<Integral>::max(); return Integral(value*std::numeric_limits<Integral>::max());
} }
template<class Integral, class FloatingPoint> inline typename std::enable_if<std::is_arithmetic<typename Integral::Type>::value, Integral>::type denormalize(const FloatingPoint& value) { template<class Integral, class FloatingPoint> inline typename std::enable_if<std::is_arithmetic<typename Integral::Type>::value, Integral>::type denormalize(const FloatingPoint& value) {
static_assert(std::is_floating_point<typename FloatingPoint::Type>::value && std::is_integral<typename Integral::Type>::value, static_assert(std::is_floating_point<typename FloatingPoint::Type>::value && std::is_integral<typename Integral::Type>::value,

2
src/Math/Unit.h

@ -51,7 +51,7 @@ template<template<class> class Derived, class T> class Unit {
constexpr explicit Unit(T value): value(value) {} constexpr explicit Unit(T value): value(value) {}
/** @brief Construct from another underlying type */ /** @brief Construct from another underlying type */
template<class U> constexpr explicit Unit(Unit<Derived, U> value): value(value.value) {} template<class U> constexpr explicit Unit(Unit<Derived, U> value): value(T(value.value)) {}
/** @brief Explicit conversion to underlying type */ /** @brief Explicit conversion to underlying type */
constexpr explicit operator T() const { return value; } constexpr explicit operator T() const { return value; }

8
src/Math/Vector.h

@ -857,7 +857,7 @@ typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_po
#endif #endif
operator*=(Vector<size, Integral>& vector, FloatingPoint number) { operator*=(Vector<size, Integral>& vector, FloatingPoint number) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
vector[i] *= number; vector[i] = Integral(vector[i]*number);
return vector; return vector;
} }
@ -908,7 +908,7 @@ typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_po
#endif #endif
operator/=(Vector<size, Integral>& vector, FloatingPoint number) { operator/=(Vector<size, Integral>& vector, FloatingPoint number) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
vector[i] /= number; vector[i] = Integral(vector[i]/number);
return vector; return vector;
} }
@ -944,7 +944,7 @@ typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_po
#endif #endif
operator*=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) { operator*=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
a[i] *= b[i]; a[i] = Integral(a[i]*b[i]);
return a; return a;
} }
@ -997,7 +997,7 @@ typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_po
#endif #endif
operator/=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) { operator/=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
a[i] /= b[i]; a[i] = Integral(a[i]/b[i]);
return a; return a;
} }

2
src/MeshTools/RemoveDuplicates.h

@ -121,7 +121,7 @@ template<class Vertex, std::size_t vertexSize> void RemoveDuplicates<Vertex, ver
/* Index of a vertex in vertexSize-dimensional table */ /* Index of a vertex in vertexSize-dimensional table */
std::size_t index[vertexSize]; std::size_t index[vertexSize];
for(std::size_t ii = 0; ii != vertexSize; ++ii) for(std::size_t ii = 0; ii != vertexSize; ++ii)
index[ii] = (vertices[*it][ii]+moved[ii]-min[ii])/epsilon; index[ii] = std::size_t((vertices[*it][ii]+moved[ii]-min[ii])/epsilon);
/* Try inserting the vertex into table, if it already /* Try inserting the vertex into table, if it already
exists, change vertex pointer of the face to already exists, change vertex pointer of the face to already

4
src/Platform/Sdl2Application.cpp

@ -254,13 +254,13 @@ Sdl2Application::Configuration::~Configuration() = default;
Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseEvent::modifiers() { Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseEvent::modifiers() {
if(modifiersLoaded) return _modifiers; if(modifiersLoaded) return _modifiers;
modifiersLoaded = true; modifiersLoaded = true;
return _modifiers = fixedModifiers(SDL_GetModState()); return _modifiers = fixedModifiers(Uint16(SDL_GetModState()));
} }
Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseMoveEvent::modifiers() { Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseMoveEvent::modifiers() {
if(modifiersLoaded) return _modifiers; if(modifiersLoaded) return _modifiers;
modifiersLoaded = true; modifiersLoaded = true;
return _modifiers = fixedModifiers(SDL_GetModState()); return _modifiers = fixedModifiers(Uint16(SDL_GetModState()));
} }
template class BasicScreen<Sdl2Application>; template class BasicScreen<Sdl2Application>;

6
src/Plugins/TgaImageConverter/TgaImageConverter.cpp

@ -70,15 +70,15 @@ Containers::Array<unsigned char> TgaImageConverter::doExportToData(const ImageRe
} }
/* Initialize data buffer */ /* Initialize data buffer */
const UnsignedByte pixelSize = image.pixelSize(); const auto pixelSize = UnsignedByte(image.pixelSize());
auto data = Containers::Array<unsigned char>::zeroInitialized(sizeof(TgaHeader) + pixelSize*image.size().product()); auto data = Containers::Array<unsigned char>::zeroInitialized(sizeof(TgaHeader) + pixelSize*image.size().product());
/* Fill header */ /* Fill header */
auto header = reinterpret_cast<TgaHeader*>(data.begin()); auto header = reinterpret_cast<TgaHeader*>(data.begin());
header->imageType = image.format() == ColorFormat::Red ? 3 : 2; header->imageType = image.format() == ColorFormat::Red ? 3 : 2;
header->bpp = pixelSize*8; header->bpp = pixelSize*8;
header->width = Utility::Endianness::littleEndian(image.size().x()); header->width = UnsignedShort(Utility::Endianness::littleEndian(image.size().x()));
header->height = Utility::Endianness::littleEndian(image.size().y()); header->height = UnsignedShort(Utility::Endianness::littleEndian(image.size().y()));
/* Fill data */ /* Fill data */
std::copy(image.data(), image.data()+pixelSize*image.size().product(), data.begin()+sizeof(TgaHeader)); std::copy(image.data(), image.data()+pixelSize*image.size().product(), data.begin()+sizeof(TgaHeader));

4
src/Primitives/Capsule.cpp

@ -46,7 +46,7 @@ Trade::MeshData2D Capsule2D::wireframe(UnsignedInt hemisphereRings, UnsignedInt
/* Bottom hemisphere */ /* Bottom hemisphere */
for(UnsignedInt i = 0; i != hemisphereRings; ++i) { for(UnsignedInt i = 0; i != hemisphereRings; ++i) {
const Rad angle((i+1)*angleIncrement); const Rad angle(Float(i+1)*angleIncrement);
const Float x = Math::sin(angle); const Float x = Math::sin(angle);
const Float y = -Math::cos(angle)-halfLength; const Float y = -Math::cos(angle)-halfLength;
positions.insert(positions.end(), {{-x, y}, {x, y}}); positions.insert(positions.end(), {{-x, y}, {x, y}});
@ -60,7 +60,7 @@ Trade::MeshData2D Capsule2D::wireframe(UnsignedInt hemisphereRings, UnsignedInt
/* Top hemisphere */ /* Top hemisphere */
for(UnsignedInt i = 0; i != hemisphereRings; ++i) { for(UnsignedInt i = 0; i != hemisphereRings; ++i) {
const Rad angle(i*angleIncrement); const Rad angle(Float(i)*angleIncrement);
const Float x = Math::cos(angle); const Float x = Math::cos(angle);
const Float y = Math::sin(angle)+halfLength; const Float y = Math::sin(angle)+halfLength;
positions.insert(positions.end(), {{-x, y}, {x, y}}); positions.insert(positions.end(), {{-x, y}, {x, y}});

4
src/Primitives/Circle.cpp

@ -43,7 +43,7 @@ Trade::MeshData2D Circle::solid(UnsignedInt segments) {
/* Points on circle */ /* Points on circle */
const Rad angleIncrement(2*Constants::pi()/segments); const Rad angleIncrement(2*Constants::pi()/segments);
for(UnsignedInt i = 0; i != segments; ++i) { for(UnsignedInt i = 0; i != segments; ++i) {
const Rad angle(i*angleIncrement); const Rad angle(Float(i)*angleIncrement);
positions.emplace_back(Math::cos(angle), Math::sin(angle)); positions.emplace_back(Math::cos(angle), Math::sin(angle));
} }
@ -60,7 +60,7 @@ Trade::MeshData2D Circle::wireframe(UnsignedInt segments) {
/* Points on circle */ /* Points on circle */
const Rad angleIncrement(2*Constants::pi()/segments); const Rad angleIncrement(2*Constants::pi()/segments);
for(UnsignedInt i = 0; i != segments; ++i) { for(UnsignedInt i = 0; i != segments; ++i) {
const Rad angle(i*angleIncrement); const Rad angle(Float(i)*angleIncrement);
positions.emplace_back(Math::cos(angle), Math::sin(angle)); positions.emplace_back(Math::cos(angle), Math::sin(angle));
} }

8
src/Primitives/Implementation/Spheroid.cpp

@ -44,12 +44,12 @@ void Spheroid::hemisphereVertexRings(UnsignedInt count, Float centerY, Rad start
Rad segmentAngleIncrement(2*Constants::pi()/segments); Rad segmentAngleIncrement(2*Constants::pi()/segments);
Float x, y, z; Float x, y, z;
for(UnsignedInt i = 0; i != count; ++i) { for(UnsignedInt i = 0; i != count; ++i) {
Rad ringAngle = startRingAngle + i*ringAngleIncrement; Rad ringAngle = startRingAngle + Float(i)*ringAngleIncrement;
x = z = Math::cos(ringAngle); x = z = Math::cos(ringAngle);
y = Math::sin(ringAngle); y = Math::sin(ringAngle);
for(UnsignedInt j = 0; j != segments; ++j) { for(UnsignedInt j = 0; j != segments; ++j) {
Rad segmentAngle = j*segmentAngleIncrement; Rad segmentAngle = Float(j)*segmentAngleIncrement;
positions.push_back({x*Math::sin(segmentAngle), centerY+y, z*Math::cos(segmentAngle)}); positions.push_back({x*Math::sin(segmentAngle), centerY+y, z*Math::cos(segmentAngle)});
normals.push_back({x*Math::sin(segmentAngle), y, z*Math::cos(segmentAngle)}); normals.push_back({x*Math::sin(segmentAngle), y, z*Math::cos(segmentAngle)});
@ -70,7 +70,7 @@ void Spheroid::cylinderVertexRings(UnsignedInt count, Float startY, Float yIncre
Rad segmentAngleIncrement(2*Constants::pi()/segments); Rad segmentAngleIncrement(2*Constants::pi()/segments);
for(UnsignedInt i = 0; i != count; ++i) { for(UnsignedInt i = 0; i != count; ++i) {
for(UnsignedInt j = 0; j != segments; ++j) { for(UnsignedInt j = 0; j != segments; ++j) {
Rad segmentAngle = j*segmentAngleIncrement; Rad segmentAngle = Float(j)*segmentAngleIncrement;
positions.push_back({Math::sin(segmentAngle), startY, Math::cos(segmentAngle)}); positions.push_back({Math::sin(segmentAngle), startY, Math::cos(segmentAngle)});
normals.push_back({Math::sin(segmentAngle), 0.0f, Math::cos(segmentAngle)}); normals.push_back({Math::sin(segmentAngle), 0.0f, Math::cos(segmentAngle)});
@ -144,7 +144,7 @@ void Spheroid::capVertexRing(Float y, Float textureCoordsV, const Vector3& norma
Rad segmentAngleIncrement(2*Constants::pi()/segments); Rad segmentAngleIncrement(2*Constants::pi()/segments);
for(UnsignedInt i = 0; i != segments; ++i) { for(UnsignedInt i = 0; i != segments; ++i) {
Rad segmentAngle = i*segmentAngleIncrement; Rad segmentAngle = Float(i)*segmentAngleIncrement;
positions.push_back({Math::sin(segmentAngle), y, Math::cos(segmentAngle)}); positions.push_back({Math::sin(segmentAngle), y, Math::cos(segmentAngle)});
normals.push_back(normal); normals.push_back(normal);

6
src/Primitives/Implementation/WireframeSpheroid.cpp

@ -45,7 +45,7 @@ void WireframeSpheroid::bottomHemisphere(const Float endY, const UnsignedInt rin
/* Hemisphere vertices and indices */ /* Hemisphere vertices and indices */
const Rad ringAngleIncrement(Constants::pi()/(2*rings)); const Rad ringAngleIncrement(Constants::pi()/(2*rings));
for(UnsignedInt j = 0; j != rings-1; ++j) { for(UnsignedInt j = 0; j != rings-1; ++j) {
const Rad angle = (j+1)*ringAngleIncrement; const Rad angle = Float(j+1)*ringAngleIncrement;
_positions.emplace_back(0.0f, endY - Math::cos(angle), Math::sin(angle)); _positions.emplace_back(0.0f, endY - Math::cos(angle), Math::sin(angle));
_positions.emplace_back(Math::sin(angle), endY - Math::cos(angle), 0.0f); _positions.emplace_back(Math::sin(angle), endY - Math::cos(angle), 0.0f);
@ -66,7 +66,7 @@ void WireframeSpheroid::topHemisphere(const Float startY, const UnsignedInt ring
/* Hemisphere vertices and indices */ /* Hemisphere vertices and indices */
const Rad ringAngleIncrement(Constants::pi()/(2*rings)); const Rad ringAngleIncrement(Constants::pi()/(2*rings));
for(UnsignedInt j = 0; j != rings-1; ++j) { for(UnsignedInt j = 0; j != rings-1; ++j) {
const Rad angle = (j+1)*ringAngleIncrement; const Rad angle = Float(j+1)*ringAngleIncrement;
/* Connect previous hemisphere ring to current vertices */ /* Connect previous hemisphere ring to current vertices */
if(j != 0) for(UnsignedInt i = 0; i != 4; ++i) if(j != 0) for(UnsignedInt i = 0; i != 4; ++i)
@ -91,7 +91,7 @@ void WireframeSpheroid::ring(const Float y) {
const Rad segmentAngleIncrement(Constants::pi()/(2*_segments)); const Rad segmentAngleIncrement(Constants::pi()/(2*_segments));
for(UnsignedInt j = 0; j != _segments; ++j) { for(UnsignedInt j = 0; j != _segments; ++j) {
for(UnsignedInt i = 0; i != 4; ++i) { for(UnsignedInt i = 0; i != 4; ++i) {
const Rad segmentAngle = Rad(i*Constants::pi()/2) + j*segmentAngleIncrement; const Rad segmentAngle = Rad(Float(i)*Constants::pi()/2) + Float(j)*segmentAngleIncrement;
if(j != 0) _indices.insert(_indices.end(), {UnsignedInt(_positions.size()-4), UnsignedInt(_positions.size())}); if(j != 0) _indices.insert(_indices.end(), {UnsignedInt(_positions.size()-4), UnsignedInt(_positions.size())});
_positions.emplace_back(Math::sin(segmentAngle), y, Math::cos(segmentAngle)); _positions.emplace_back(Math::sin(segmentAngle), y, Math::cos(segmentAngle));
} }

4
src/SceneGraph/Object.hpp

@ -212,7 +212,7 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
with different counter */ with different counter */
if(objects[i]->counter != 0xFFFFu) continue; if(objects[i]->counter != 0xFFFFu) continue;
objects[i]->counter = i; objects[i]->counter = UnsignedShort(i);
objects[i]->flags |= Flag::Joint; objects[i]->flags |= Flag::Joint;
} }
std::vector<Object<Transformation>*> jointObjects(objects); std::vector<Object<Transformation>*> jointObjects(objects);
@ -252,7 +252,7 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
CORRADE_ASSERT(jointObjects.size() < 0xFFFFu, CORRADE_ASSERT(jointObjects.size() < 0xFFFFu,
"SceneGraph::Object::transformations(): too large scene", std::vector<typename Transformation::DataType>{}); "SceneGraph::Object::transformations(): too large scene", std::vector<typename Transformation::DataType>{});
CORRADE_INTERNAL_ASSERT(parent->counter == 0xFFFFu); CORRADE_INTERNAL_ASSERT(parent->counter == 0xFFFFu);
parent->counter = jointObjects.size(); parent->counter = UnsignedShort(jointObjects.size());
parent->flags |= Flag::Joint; parent->flags |= Flag::Joint;
jointObjects.push_back(parent); jointObjects.push_back(parent);
} }

2
src/Shader.cpp

@ -610,7 +610,7 @@ Shader& Shader::addFile(const std::string& filename) {
/* Get size of shader and initialize buffer */ /* Get size of shader and initialize buffer */
file.seekg(0, std::ios::end); file.seekg(0, std::ios::end);
std::string source(file.tellg(), '\0'); std::string source(std::size_t(file.tellg()), '\0');
/* Read data, close */ /* Read data, close */
file.seekg(0, std::ios::beg); file.seekg(0, std::ios::beg);

2
src/Text/AbstractFont.cpp

@ -94,7 +94,7 @@ std::pair<Float, Float> AbstractFont::doOpenFile(const std::string& filename, co
/* Create array to hold file contents */ /* Create array to hold file contents */
in.seekg(0, std::ios::end); in.seekg(0, std::ios::end);
Containers::Array<unsigned char> data(in.tellg()); Containers::Array<unsigned char> data(std::size_t(in.tellg()));
/* Read data, close */ /* Read data, close */
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);

2
src/Text/AbstractFontConverter.cpp

@ -221,7 +221,7 @@ std::unique_ptr<GlyphCache> AbstractFontConverter::doImportGlyphCacheFromFile(co
/* Create array to hold file contents */ /* Create array to hold file contents */
in.seekg(0, std::ios::end); in.seekg(0, std::ios::end);
Containers::Array<unsigned char> data(in.tellg()); Containers::Array<unsigned char> data(std::size_t(in.tellg()));
/* Read data, close */ /* Read data, close */
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);

4
src/Text/Renderer.cpp

@ -43,8 +43,8 @@ template<class T> void createIndices(void* output, const UnsignedInt glyphCount)
| | |/ / | | | |/ / |
1---3 1 3---4 */ 1---3 1 3---4 */
const T vertex = i*4; const T vertex = T(i)*4;
const T pos = i*6; const T pos = T(i)*6;
out[pos] = vertex; out[pos] = vertex;
out[pos+1] = vertex+1; out[pos+1] = vertex+1;
out[pos+2] = vertex+2; out[pos+2] = vertex+2;

4
src/Timeline.cpp

@ -51,11 +51,11 @@ void Timeline::nextFrame() {
if(!running) return; if(!running) return;
auto now = high_resolution_clock::now(); auto now = high_resolution_clock::now();
UnsignedInt duration = duration_cast<microseconds>(now-_previousFrameTime).count(); auto duration = UnsignedInt(duration_cast<microseconds>(now-_previousFrameTime).count());
_previousFrameDuration = duration/1e6f; _previousFrameDuration = duration/1e6f;
if(_previousFrameDuration < _minimalFrameTime) { if(_previousFrameDuration < _minimalFrameTime) {
Utility::sleep(_minimalFrameTime*1000 - duration/1000); Utility::sleep(std::size_t(_minimalFrameTime*1000) - duration/1000);
now = high_resolution_clock::now(); now = high_resolution_clock::now();
_previousFrameDuration = duration_cast<microseconds>(now-_previousFrameTime).count()/1e6f; _previousFrameDuration = duration_cast<microseconds>(now-_previousFrameTime).count()/1e6f;
} }

2
src/Trade/AbstractImporter.cpp

@ -76,7 +76,7 @@ void AbstractImporter::doOpenFile(const std::string& filename) {
/* Create array to hold file contents */ /* Create array to hold file contents */
in.seekg(0, std::ios::end); in.seekg(0, std::ios::end);
Containers::Array<unsigned char> data(in.tellg()); Containers::Array<unsigned char> data(std::size_t(in.tellg()));
/* Read data, close */ /* Read data, close */
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);

4
src/Trade/Test/AbstractImageConverterTest.cpp

@ -53,8 +53,8 @@ void AbstractImageConverterTest::exportToFile() {
Containers::Array<unsigned char> doExportToData(const ImageReference2D& image) const override { Containers::Array<unsigned char> doExportToData(const ImageReference2D& image) const override {
Containers::Array<unsigned char> out(2); Containers::Array<unsigned char> out(2);
out[0] = image.size().x(); out[0] = static_cast<unsigned char>(image.size().x());
out[1] = image.size().y(); out[1] = static_cast<unsigned char>(image.size().y());
return out; return out;
}; };
}; };

Loading…
Cancel
Save