Taking the absolute value of the difference of two things doesn't work

if the difference is unsigned. Do something else instead. (It is
backup logic for the clock going backwards while fading out the splash
screen, so it's not exactly critical.) Caught by the Solaris C++
compiler, which warns if you try to pass an unsigned value to abs().
PKGREVISION++.
This commit is contained in:
dholland 2014-01-02 06:45:47 +00:00
parent 0e11bd5e15
commit 05a036ce52
3 changed files with 31 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.5 2013/02/09 22:11:33 ryoon Exp $
# $NetBSD: Makefile,v 1.6 2014/01/02 06:45:47 dholland Exp $
#
DISTNAME= milkytracker-0.90.80
PKGREVISION= 1
PKGREVISION= 2
CATEGORIES= audio
MASTER_SITES= http://milkytracker.org/files/
EXTRACT_SUFX= .tar.bz2

View file

@ -1,7 +1,8 @@
$NetBSD: distinfo,v 1.4 2012/03/15 20:16:24 hans Exp $
$NetBSD: distinfo,v 1.5 2014/01/02 06:45:47 dholland Exp $
SHA1 (milkytracker-0.90.80.tar.bz2) = e6adedee56a6a1bf096b5311c319954ea54977dc
RMD160 (milkytracker-0.90.80.tar.bz2) = cb535a50c29b8d722617007054921065e71c1615
Size (milkytracker-0.90.80.tar.bz2) = 1799270 bytes
SHA1 (patch-aa) = 8e0a8d58c54995483f639b7f2d936b0b1ffd1a8f
SHA1 (patch-src_compression_zziplib_generic_fseeko.cpp) = 002754ec91a5d3b986fabe9266cc8999ac148c82
SHA1 (patch-src_tracker_TrackerStartup.cpp) = fadcc814e328cf805423e9ab282913b2fd1bd0f2

View file

@ -0,0 +1,27 @@
$NetBSD: patch-src_tracker_TrackerStartup.cpp,v 1.1 2014/01/02 06:45:48 dholland Exp $
Taking the absolute value of the difference of two values doesn't work
if the difference is unsigned. Do something else semi-reasonable
instead for the case when the clock goes backwards.
--- src/tracker/TrackerStartUp.cpp~ 2008-02-23 16:32:45.000000000 +0000
+++ src/tracker/TrackerStartUp.cpp
@@ -134,14 +134,16 @@ void Tracker::hideSplash()
pp_int32 deltaT = 100;
while (shade >= 0.0f)
{
- pp_int32 startTime = ::PPGetTickCount();
+ pp_uint32 startTime = ::PPGetTickCount();
#if defined(__EXCLUDE_BIGLOGO__) || defined(__LOWRES__)
screen->paintSplash(LogoSmall::rawData, LogoSmall::width, LogoSmall::height, LogoSmall::width*4, 4, (int)shade);
#else
screen->paintSplash(LogoBig::rawData, LogoBig::width, LogoBig::height, LogoBig::width*3, 3, (int)shade);
#endif
shade-=deltaT * (1.0f/6.25f);
- deltaT = abs(::PPGetTickCount() - startTime);
+ pp_uint32 nowTime = ::PPGetTickCount();
+ /* just in case the clock goes backwards */
+ deltaT = nowTime > startTime ? nowTime - startTime : 0;
if (!deltaT) deltaT++;
}
screen->clear();