Skip to content

Commit

Permalink
ccstruct/polyblk.cpp: Fix compiler warnings
Browse files Browse the repository at this point in the history
Compiler warnings from clang:

src/ccstruct/polyblk.cpp:194:16: warning:
 use of old-style cast [-Wold-style-cast]
src/ccstruct/polyblk.cpp:195:16: warning:
 use of old-style cast [-Wold-style-cast]
src/ccstruct/polyblk.cpp:292:45: warning:
 use of old-style cast [-Wold-style-cast]
src/ccstruct/polyblk.cpp:30:9: warning:
 macro is not used [-Wunused-macros]
src/ccstruct/polyblk.cpp:348:8: warning:
 use of old-style cast [-Wold-style-cast]
src/ccstruct/polyblk.cpp:358:12: warning:
 use of old-style cast [-Wold-style-cast]
src/ccstruct/polyblk.cpp:362:26: warning:
 use of old-style cast [-Wold-style-cast]
src/ccstruct/polyblk.cpp:383:21: warning:
 use of old-style cast [-Wold-style-cast]
src/ccstruct/polyblk.cpp:383:36: warning:
 cast from 'const void *' to 'ICOORDELT **' drops const qualifier [-Wcast-qual]
src/ccstruct/polyblk.cpp:384:21: warning:
 use of old-style cast [-Wold-style-cast]
src/ccstruct/polyblk.cpp:384:36:
 warning: cast from 'const void *' to 'ICOORDELT **' drops const qualifier [-Wcast-qual]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Sep 3, 2018
1 parent 4f32b8f commit 4934b2e
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/ccstruct/polyblk.cpp
Expand Up @@ -27,7 +27,6 @@
#include "config_auto.h"
#endif

#define PBLOCK_LABEL_SIZE 150
#define INTERSECTING INT16_MAX

int lessthan(const void *first, const void *second);
Expand Down Expand Up @@ -191,8 +190,8 @@ void POLY_BLOCK::rotate(FCOORD rotation) {
pos.set_x (pt->x ());
pos.set_y (pt->y ());
pos.rotate (rotation);
pt->set_x ((int16_t) (floor (pos.x () + 0.5)));
pt->set_y ((int16_t) (floor (pos.y () + 0.5)));
pt->set_x(static_cast<int16_t>(floor(pos.x() + 0.5)));
pt->set_y(static_cast<int16_t>(floor(pos.y() + 0.5)));
pts.forward ();
}
while (!pts.at_first ());
Expand Down Expand Up @@ -289,7 +288,7 @@ void POLY_BLOCK::fill(ScrollView* window, ScrollView::Color colour) {
// Last pixel is start pixel + length.
width = s_it.data ()->y ();
window->SetCursor(s_it.data ()->x (), y);
window->DrawTo(s_it.data ()->x () + (float) width, y);
window->DrawTo(s_it.data()->x() + static_cast<float>(width), y);
}
}
}
Expand Down Expand Up @@ -343,9 +342,7 @@ ICOORDELT_LIST *PB_LINE_IT::get_line(int16_t y) {
ICOORDELT_IT v, r;
ICOORDELT_LIST *result;
ICOORDELT *x, *current, *previous;
float fy, fx;

fy = (float) (y + 0.5);
float fy = y + 0.5f;
result = new ICOORDELT_LIST ();
r.set_to_list (result);
v.set_to_list (block->points ());
Expand All @@ -355,11 +352,10 @@ ICOORDELT_LIST *PB_LINE_IT::get_line(int16_t y) {
|| ((v.data_relative (-1)->y () <= y) && (v.data ()->y () > y))) {
previous = v.data_relative (-1);
current = v.data ();
fx = (float) (0.5 + previous->x () +
(current->x () - previous->x ()) * (fy -
previous->y ()) /
(current->y () - previous->y ()));
x = new ICOORDELT ((int16_t) fx, 0);
float fx = 0.5f + previous->x() +
(current->x() - previous->x()) * (fy - previous->y()) /
(current->y() - previous->y());
x = new ICOORDELT(static_cast<int16_t>(fx), 0);
r.add_to_end (x);
}
}
Expand All @@ -380,8 +376,8 @@ ICOORDELT_LIST *PB_LINE_IT::get_line(int16_t y) {


int lessthan(const void *first, const void *second) {
ICOORDELT *p1 = (*(ICOORDELT **) first);
ICOORDELT *p2 = (*(ICOORDELT **) second);
const ICOORDELT *p1 = *reinterpret_cast<const ICOORDELT* const*>(first);
const ICOORDELT *p2 = *reinterpret_cast<const ICOORDELT* const*>(second);

if (p1->x () < p2->x ())
return (-1);
Expand Down

0 comments on commit 4934b2e

Please sign in to comment.