(svn r8374) -Fix (r8367): LLONG_MAX isn't always defined, and INT64_MAX describes the
authormaedhros
Tue, 23 Jan 2007 15:47:28 +0000
changeset 5812 9b4a245e4fbe
parent 5811 23edb87425bc
child 5813 8e36eb2f5d64
(svn r8374) -Fix (r8367): LLONG_MAX isn't always defined, and INT64_MAX describes the
required value better anyway. However, INT64_MAX comes from stdint.h which
doesn't seem to exist on MSVC or MorphOS, so it's defined manually for them.
src/graph_gui.cpp
src/stdafx.h
--- a/src/graph_gui.cpp	Tue Jan 23 14:58:10 2007 +0000
+++ b/src/graph_gui.cpp	Tue Jan 23 15:47:28 2007 +0000
@@ -39,7 +39,7 @@
 };
 
 /* Apparently these don't play well with enums. */
-static const int64 INVALID_DATAPOINT     = LLONG_MAX; // Value used for a datapoint that shouldn't be drawn.
+static const int64 INVALID_DATAPOINT     = INT64_MAX; // Value used for a datapoint that shouldn't be drawn.
 static const uint  INVALID_DATAPOINT_POS = UINT_MAX;  // Used to determine if the previous point was drawn.
 
 typedef struct GraphDrawer {
--- a/src/stdafx.h	Tue Jan 23 14:58:10 2007 +0000
+++ b/src/stdafx.h	Tue Jan 23 15:47:28 2007 +0000
@@ -316,4 +316,14 @@
 # define Point OTTD_AMIGA_POINT
 #endif
 
+// We need INT64_MAX, which for most systems comes from stdint.h. However, MSVC
+// does not have stdint.h and apparently neither does MorphOS, so define
+// INT64_MAX for them ourselves.
+#if !defined(_MSC_VER) && !defined( __MORPHOS__)
+# define __STDC_LIMIT_MACROS
+# include <stdint.h>
+#else
+# define INT64_MAX 9223372036854775807LL
+#endif
+
 #endif /* STDAFX_H */