Fix some compiler warnings by making use of necessaryTimeUnits.

This commit is contained in:
mmdolze
2013-01-19 10:25:04 +00:00
parent 66a860d551
commit 4ba9de40b1
+11 -11
View File
@@ -491,11 +491,11 @@ render_scroller(Widget *w, int left, int top, int right, int bottom, long timer)
if (w->speed > 0) { if (w->speed > 0) {
necessaryTimeUnits = length * w->speed; necessaryTimeUnits = length * w->speed;
offset = (timer % (length * w->speed)) / w->speed; offset = (timer % necessaryTimeUnits) / w->speed;
} }
else if (w->speed < 0) { else if (w->speed < 0) {
necessaryTimeUnits = length / (w->speed * -1); necessaryTimeUnits = length / (w->speed * -1);
offset = (timer % (length / (w->speed * -1))) * w->speed * -1; offset = (timer % necessaryTimeUnits) * w->speed * -1;
} }
else { else {
offset = 0; offset = 0;
@@ -532,7 +532,7 @@ render_scroller(Widget *w, int left, int top, int right, int bottom, long timer)
if (w->speed > 0) { if (w->speed > 0) {
necessaryTimeUnits = effLength * w->speed; necessaryTimeUnits = effLength * w->speed;
if (((timer / (effLength * w->speed)) % 2) == 0) { if (((timer / necessaryTimeUnits) % 2) == 0) {
/* wiggle one way */ /* wiggle one way */
offset = (timer % (effLength * w->speed)) offset = (timer % (effLength * w->speed))
/ w->speed; / w->speed;
@@ -546,7 +546,7 @@ render_scroller(Widget *w, int left, int top, int right, int bottom, long timer)
} }
else if (w->speed < 0) { else if (w->speed < 0) {
necessaryTimeUnits = effLength / (w->speed * -1); necessaryTimeUnits = effLength / (w->speed * -1);
if (((timer / (effLength / (w->speed * -1))) % 2) == 0) { if (((timer / necessaryTimeUnits) % 2) == 0) {
offset = (timer % (effLength / (w->speed * -1))) offset = (timer % (effLength / (w->speed * -1)))
* w->speed * -1; * w->speed * -1;
} }
@@ -603,26 +603,26 @@ render_scroller(Widget *w, int left, int top, int right, int bottom, long timer)
/*debug(RPT_DEBUG, "length: %d sw: %d lines req: %d avail lines: %d effLines: %d ",length,screen_width,lines_required,available_lines,effLines);*/ /*debug(RPT_DEBUG, "length: %d sw: %d lines req: %d avail lines: %d effLines: %d ",length,screen_width,lines_required,available_lines,effLines);*/
if (w->speed > 0) { if (w->speed > 0) {
necessaryTimeUnits = effLines * w->speed; necessaryTimeUnits = effLines * w->speed;
if (((timer / (effLines * w->speed)) % 2) == 0) { if (((timer / necessaryTimeUnits) % 2) == 0) {
/*debug(RPT_DEBUG, "up ");*/ /*debug(RPT_DEBUG, "up ");*/
begin = (timer % (effLines * w->speed)) begin = (timer % (necessaryTimeUnits))
/ w->speed; / w->speed;
} }
else { else {
/*debug(RPT_DEBUG, "down ");*/ /*debug(RPT_DEBUG, "down ");*/
begin = (((timer % (effLines * w->speed)) begin = (((timer % necessaryTimeUnits)
- (effLines * w->speed) + 1) / w->speed) - necessaryTimeUnits + 1) / w->speed)
* -1; * -1;
} }
} }
else if (w->speed < 0) { else if (w->speed < 0) {
necessaryTimeUnits = effLines / (w->speed * -1); necessaryTimeUnits = effLines / (w->speed * -1);
if (((timer / (effLines / (w->speed * -1))) % 2) == 0) { if (((timer / necessaryTimeUnits) % 2) == 0) {
begin = (timer % (effLines / (w->speed * -1))) begin = (timer % necessaryTimeUnits)
* w->speed * -1; * w->speed * -1;
} }
else { else {
begin = (((timer % (effLines / (w->speed * -1))) begin = (((timer % necessaryTimeUnits)
* w->speed * -1) - effLines + 1) * w->speed * -1) - effLines + 1)
* -1; * -1;
} }