realnc / qtads

A cross-platform, multimedia interpreter for TADS adventure games.
https://realnc.github.io/qtads
GNU General Public License v3.0
49 stars 15 forks source link

Xcode 9 build failure for 2.1.7 #7

Closed ilovezfs closed 5 years ago

ilovezfs commented 6 years ago
tads3/vmtz.cpp:1987:30: error: ordered comparison between pointer and zero ('vmtz_trans *' and 'int')
            result->set(tcur > 0 ? tcur - 1 : tcur);
                        ~~~~ ^ ~
1 error generated.

I can work around it with

diff --git a/tads3/vmtz.cpp b/tads3/vmtz.cpp
index 525c781..6d3acf0 100644
--- a/tads3/vmtz.cpp
+++ b/tads3/vmtz.cpp
@@ -1984,7 +1984,7 @@ void CVmTimeZone::query(vmtzquery *result, int32_t dayno, int32_t daytime,
              *   the transition in terms of the local time that was in effect
              *   up until that moment
              */
-            result->set(tcur > 0 ? tcur - 1 : tcur);
+            result->set(tcur != NULL ? tcur - 1 : tcur);
             return;
         }
     }

This doesn't appear to affect master, so a new release might be worthwhile at this point.

realnc commented 6 years ago

Thanks. Until a new version is out, the correct fix for this is:

result->set(cur > 0 ? tcur - 1 : tcur);
ilovezfs commented 6 years ago

Thanks @realnc. I'll update the patch.