Commit 8b53de8e authored by Aurelio Colosimo's avatar Aurelio Colosimo

INT_MAX now included from limits.h file

parent 0ab63175
...@@ -2,12 +2,10 @@ ...@@ -2,12 +2,10 @@
* FIXME header * FIXME header
*/ */
#include <limits.h>
#include <pptp/pptp.h> #include <pptp/pptp.h>
#include <pptp/diag.h> #include <pptp/diag.h>
/* FIXME: This is a temp workaround. How to define it? */
#define PP_INT_MAX 2147483647
void int64_to_TimeInternal(Integer64 bigint, TimeInternal *internal) void int64_to_TimeInternal(Integer64 bigint, TimeInternal *internal)
{ {
uint64_t bigint_val; uint64_t bigint_val;
...@@ -35,8 +33,8 @@ void from_TimeInternal(TimeInternal *internal, Timestamp *external) ...@@ -35,8 +33,8 @@ void from_TimeInternal(TimeInternal *internal, Timestamp *external)
* so there is no problem here. * so there is no problem here.
*/ */
if ((internal->seconds & ~PP_INT_MAX) || if ((internal->seconds & ~INT_MAX) ||
(internal->nanoseconds & ~PP_INT_MAX)) { (internal->nanoseconds & ~INT_MAX)) {
/* FIXME diag /* FIXME diag
* DBG("Negative value cannot be converted into timestamp \n"); * DBG("Negative value cannot be converted into timestamp \n");
*/ */
...@@ -51,7 +49,7 @@ void from_TimeInternal(TimeInternal *internal, Timestamp *external) ...@@ -51,7 +49,7 @@ void from_TimeInternal(TimeInternal *internal, Timestamp *external)
void to_TimeInternal(TimeInternal *internal, Timestamp *external) void to_TimeInternal(TimeInternal *internal, Timestamp *external)
{ {
/* Program will not run after 2038... */ /* Program will not run after 2038... */
if (external->secondsField.lsb < PP_INT_MAX) { if (external->secondsField.lsb < INT_MAX) {
internal->seconds = external->secondsField.lsb; internal->seconds = external->secondsField.lsb;
internal->nanoseconds = external->nanosecondsField; internal->nanoseconds = external->nanosecondsField;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment