From a86c5f7cae7ec9a3398300555a0b644689d946a1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:14:53 +0200 Subject: Merging upstream version 4.4.0. Signed-off-by: Daniel Baumann --- epan/wslua/wslua_nstime.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'epan/wslua/wslua_nstime.c') diff --git a/epan/wslua/wslua_nstime.c b/epan/wslua/wslua_nstime.c index b3012e71..94db190a 100644 --- a/epan/wslua/wslua_nstime.c +++ b/epan/wslua/wslua_nstime.c @@ -54,9 +54,7 @@ WSLUA_METAMETHOD NSTime__call(lua_State* L) { /* Creates a NSTime object. */ } WSLUA_METHOD NSTime_tonumber(lua_State* L) { - /* Returns a Lua number of the `NSTime` representing seconds from epoch - @since 2.4.0 - */ + /* Returns a Lua number of the `NSTime` representing seconds from epoch. */ NSTime nstime = checkNSTime(L,1); lua_pushnumber(L, (lua_Number)nstime_to_sec(nstime)); WSLUA_RETURN(1); /* The Lua number. */ @@ -64,10 +62,10 @@ WSLUA_METHOD NSTime_tonumber(lua_State* L) { WSLUA_METAMETHOD NSTime__tostring(lua_State* L) { NSTime nstime = checkNSTime(L,1); - gchar *str; + char *str; long secs = (long)nstime->secs; - gint nsecs = nstime->nsecs; - gboolean negative_zero = FALSE; + int nsecs = nstime->nsecs; + bool negative_zero = false; /* Time is defined as sec + nsec/10^9, both parts can be negative. * Translate this into the more familiar sec.nsec notation instead. */ @@ -133,10 +131,10 @@ WSLUA_METAMETHOD NSTime__unm(lua_State* L) { /* Calculates the negative NSTime. WSLUA_METAMETHOD NSTime__eq(lua_State* L) { /* Compares two NSTimes. */ NSTime time1 = checkNSTime(L,1); NSTime time2 = checkNSTime(L,2); - gboolean result = FALSE; + bool result = false; if (nstime_cmp(time1, time2) == 0) - result = TRUE; + result = true; lua_pushboolean(L,result); @@ -146,10 +144,10 @@ WSLUA_METAMETHOD NSTime__eq(lua_State* L) { /* Compares two NSTimes. */ WSLUA_METAMETHOD NSTime__le(lua_State* L) { /* Compares two NSTimes. */ NSTime time1 = checkNSTime(L,1); NSTime time2 = checkNSTime(L,2); - gboolean result = FALSE; + bool result = false; if (nstime_cmp(time1, time2) <= 0) - result = TRUE; + result = true; lua_pushboolean(L,result); @@ -159,10 +157,10 @@ WSLUA_METAMETHOD NSTime__le(lua_State* L) { /* Compares two NSTimes. */ WSLUA_METAMETHOD NSTime__lt(lua_State* L) { /* Compares two NSTimes. */ NSTime time1 = checkNSTime(L,1); NSTime time2 = checkNSTime(L,2); - gboolean result = FALSE; + bool result = false; if (nstime_cmp(time1, time2) < 0) - result = TRUE; + result = true; lua_pushboolean(L,result); @@ -171,12 +169,12 @@ WSLUA_METAMETHOD NSTime__lt(lua_State* L) { /* Compares two NSTimes. */ /* WSLUA_ATTRIBUTE NSTime_secs RW The NSTime seconds. */ -WSLUA_ATTRIBUTE_NUMBER_GETTER(NSTime,secs); -WSLUA_ATTRIBUTE_NUMBER_SETTER(NSTime,secs,time_t); +WSLUA_ATTRIBUTE_INTEGER_GETTER(NSTime,secs); +WSLUA_ATTRIBUTE_INTEGER_SETTER(NSTime,secs,time_t); /* WSLUA_ATTRIBUTE NSTime_nsecs RW The NSTime nano seconds. */ -WSLUA_ATTRIBUTE_NUMBER_GETTER(NSTime,nsecs); -WSLUA_ATTRIBUTE_NUMBER_SETTER(NSTime,nsecs,int); +WSLUA_ATTRIBUTE_INTEGER_GETTER(NSTime,nsecs); +WSLUA_ATTRIBUTE_INTEGER_SETTER(NSTime,nsecs,int); /* Gets registered as metamethod automatically by WSLUA_REGISTER_CLASS/META */ static int NSTime__gc(lua_State* L) { -- cgit v1.2.3