Module: kamailio
Branch: master
Commit: c7217d147b615da6ebf3841a3915055aa529dd70
URL:
https://github.com/kamailio/kamailio/commit/c7217d147b615da6ebf3841a3915055…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-02-13T09:51:51+01:00
mtree: cast to uint64_t when using time_t value
---
Modified: src/modules/mtree/mtree.c
Modified: src/modules/mtree/mtree.h
Modified: src/modules/mtree/mtree_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c7217d147b615da6ebf3841a3915055…
Patch:
https://github.com/kamailio/kamailio/commit/c7217d147b615da6ebf3841a3915055…
---
diff --git a/src/modules/mtree/mtree.c b/src/modules/mtree/mtree.c
index 7ee303749a..ef1dd54ae5 100644
--- a/src/modules/mtree/mtree.c
+++ b/src/modules/mtree/mtree.c
@@ -122,7 +122,7 @@ m_tree_t* mt_init_tree(str* tname, str *dbtable, str *scols, int
type,
pt->type = type;
pt->multi = multi;
- pt->reload_time = (unsigned int)time(NULL);
+ pt->reload_time = (uint64_t)time(NULL);
pt->tname.s = (char*)shm_malloc((1+tname->len)*sizeof(char));
if(pt->tname.s==NULL)
{
diff --git a/src/modules/mtree/mtree.h b/src/modules/mtree/mtree.h
index acc8ef0706..1d5c665f47 100644
--- a/src/modules/mtree/mtree.h
+++ b/src/modules/mtree/mtree.h
@@ -25,6 +25,8 @@
#ifndef _MTREE_H_
#define _MTREE_H_
+#include <stdint.h>
+
#include "../../core/str.h"
#include "../../core/parser/msg_parser.h"
#include "../../core/rpc.h"
@@ -76,7 +78,7 @@ typedef struct _m_tree
unsigned int nritems;
unsigned int memsize;
unsigned int reload_count;
- unsigned int reload_time;
+ uint64_t reload_time;
mt_node_t *head;
struct _m_tree *next;
} m_tree_t;
diff --git a/src/modules/mtree/mtree_mod.c b/src/modules/mtree/mtree_mod.c
index 66f72bbd02..b8a0ee5722 100644
--- a/src/modules/mtree/mtree_mod.c
+++ b/src/modules/mtree/mtree_mod.c
@@ -560,7 +560,7 @@ static int mt_load_db(m_tree_t *pt)
new_tree.nritems = 0;
new_tree.memsize = 0;
new_tree.reload_count++;
- new_tree.reload_time = (unsigned int)time(NULL);
+ new_tree.reload_time = (uint64_t)time(NULL);
if (mt_dbf.use_table(db_con, &old_tree->dbtable) < 0)
@@ -888,13 +888,13 @@ void rpc_mtree_summary(rpc_t* rpc, void* c)
rpc->fault(c, 500, "Internal error adding items");
return;
}
- if(rpc->struct_add(ih, "d", "reload_count",
- (int)pt->reload_count) < 0 ) {
+ if(rpc->struct_add(ih, "j", "reload_count",
+ pt->reload_count) < 0 ) {
rpc->fault(c, 500, "Internal error adding items");
return;
}
- if(rpc->struct_add(ih, "d", "reload_time",
- (int)pt->reload_time) < 0 ) {
+ if(rpc->struct_add(ih, "J", "reload_time",
+ pt->reload_time) < 0 ) {
rpc->fault(c, 500, "Internal error adding items");
return;
}