Skip to content

Commit

Permalink
Compilation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Dec 20, 2018
1 parent 2503912 commit 8545c78
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 188 deletions.
44 changes: 22 additions & 22 deletions src/LuaEngine.cpp
Expand Up @@ -43,16 +43,16 @@ static std::list<char*> new_custom_categories, custom_categories_to_purge;
/* ******************************* */

struct ntopngLuaContext* getUserdata(struct lua_State *vm) {
if(vm) {
struct ntopngLuaContext *userdata;
if(vm) {
struct ntopngLuaContext *userdata;

lua_getglobal(vm, "userdata");
userdata = (struct ntopngLuaContext*) lua_touserdata(vm, lua_gettop(vm));
lua_pop(vm, 1); // undo the push done by lua_getglobal
lua_getglobal(vm, "userdata");
userdata = (struct ntopngLuaContext*) lua_touserdata(vm, lua_gettop(vm));
lua_pop(vm, 1); // undo the push done by lua_getglobal

return(userdata);
} else
return(NULL);
return(userdata);
} else
return(NULL);
}

/* ******************************* */
Expand Down Expand Up @@ -304,7 +304,7 @@ static int ntop_set_active_interface_id(lua_State* vm) {

static inline bool matches_allowed_ifname(char *allowed_ifname, char *iface) {
return (((allowed_ifname == NULL) || (allowed_ifname[0] == '\0')) /* Periodic script / unrestricted user */
|| (!strncmp(allowed_ifname, iface, strlen(allowed_ifname))));
|| (!strncmp(allowed_ifname, iface, strlen(allowed_ifname))));
}

/* ****************************************** */
Expand All @@ -320,9 +320,9 @@ static int ntop_get_interface_names(lua_State* vm) {
for(int i=0; i<ntop->get_num_interfaces(); i++) {
NetworkInterface *iface;
/*
We should not call ntop->getInterfaceAtId() as it
manipulates the vm that has been already modified with
lua_newtable(vm) a few lines above.
We should not call ntop->getInterfaceAtId() as it
manipulates the vm that has been already modified with
lua_newtable(vm) a few lines above.
*/

if((iface = ntop->getInterface(i)) != NULL) {
Expand Down Expand Up @@ -808,7 +808,7 @@ static int ntop_get_batched_interface_hosts(lua_State* vm, LocationPolicy locati
network_filter, pool_filter, filtered_hosts, blacklisted_hosts, hide_top_hidden,
ipver_filter, proto_filter,
traffic_type_filter, tsLua /* host->tsLua | host->lua */,
anomalousOnly, sortColumn, maxHits,
anomalousOnly, sortColumn, maxHits,
toSkip, a2zSortOrder) < 0)
return(CONST_LUA_ERROR);

Expand Down Expand Up @@ -1535,7 +1535,7 @@ static int ntop_get_file_dir_exists(lua_State* vm) {
#ifdef WIN32
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif
int rc;

Expand All @@ -1559,7 +1559,7 @@ static int ntop_get_file_last_change(lua_State* vm) {
#ifdef WIN32
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif

ntop->getTrace()->traceEvent(TRACE_DEBUG, "%s() called", __FUNCTION__);
Expand Down Expand Up @@ -1629,7 +1629,7 @@ static int ntop_is_windows(lua_State* vm) {
#else
0
#endif
);
);

return(CONST_LUA_OK);
}
Expand Down Expand Up @@ -1880,7 +1880,7 @@ static int non_blocking_connect(int sock, struct sockaddr_in *sa, int timeout) {
return -1;
}

done:
done:
#ifdef WIN32
f = 0;

Expand Down Expand Up @@ -2405,7 +2405,7 @@ static inline int concat_table_fields(lua_State *L, int index, char *buf, int si

while(lua_next(L, index) != 0) {
int l = snprintf(buf, size, "%s%s=%s", first ? "" : ",",
lua_tostring(L, -2), lua_tostring(L, -1));
lua_tostring(L, -2), lua_tostring(L, -1));
buf += l;
size -= l;
first = false;
Expand Down Expand Up @@ -3125,7 +3125,7 @@ static int ntop_get_interface_flow_key(lua_State* vm) {
|| (ntop_lua_check(vm, __FUNCTION__, 3, LUA_TSTRING) != CONST_LUA_OK) /* srv_host@srv_vlan */
|| (ntop_lua_check(vm, __FUNCTION__, 4, LUA_TNUMBER) != CONST_LUA_OK) /* srv port */
|| (ntop_lua_check(vm, __FUNCTION__, 5, LUA_TNUMBER) != CONST_LUA_OK) /* protocol */
) return(CONST_LUA_ERROR);
) return(CONST_LUA_ERROR);

get_host_vlan_info((char*)lua_tostring(vm, 1), &cli_name, &cli_vlan, cli_buf, sizeof(cli_buf));
cli_port = htons((u_int16_t)lua_tonumber(vm, 2));
Expand Down Expand Up @@ -4294,7 +4294,7 @@ static int ntop_rrd_update(lua_State* vm) {
#ifdef WIN32
struct _stat64 s;
#else
struct s;
struct stat s;
#endif

if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING) != CONST_LUA_OK) return(CONST_LUA_PARAM_ERROR);
Expand Down Expand Up @@ -6191,7 +6191,7 @@ static int ntop_sqlite_exec_query(lua_State* vm) {
#ifdef WIN32
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif

ntop->getTrace()->traceEvent(TRACE_DEBUG, "%s() called", __FUNCTION__);
Expand Down Expand Up @@ -6827,7 +6827,7 @@ static int ntop_list_reports(lua_State* vm) {
#ifdef WIN32
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif

snprintf(filepath, sizeof(filepath), "%s/%s", fullpath, ent->d_name);
Expand Down
10 changes: 5 additions & 5 deletions src/MacManufacturers.cpp
@@ -1,4 +1,4 @@
/*
/*
*
* (C) 2013-18 - ntop.org
*
Expand Down Expand Up @@ -42,9 +42,9 @@ MacManufacturers::MacManufacturers(const char * const home) {

void MacManufacturers::init() {
#ifdef WIN32
struct _stat64 buf;
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif
FILE *fd;
char line[256], *cr;
Expand Down Expand Up @@ -88,13 +88,13 @@ void MacManufacturers::init() {
/* Lines are like:
00:05:02 Apple # Apple, Inc.
So it is possible to use '# ' as the full manufacturer name separator
*/
*/
tmp = strstr(manuf, "# ");
if(tmp)
manuf = &tmp[2];

if((cr = strchr(manuf, '\n')))
*cr = '\0';
*cr = '\0';

mac[0] = (u_int8_t)_mac[0], mac[1] = (u_int8_t)_mac[1], mac[2] = (u_int8_t)_mac[2];
HASH_FIND(hh, mac_manufacturers, mac, 3, s);
Expand Down
6 changes: 3 additions & 3 deletions src/Ntop.cpp
Expand Up @@ -238,9 +238,9 @@ Ntop::~Ntop() {

void Ntop::registerPrefs(Prefs *_prefs, bool quick_registration) {
#ifdef WIN32
struct _stat64 buf;
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif

prefs = _prefs;
Expand Down Expand Up @@ -1791,7 +1791,7 @@ char* Ntop::getValidPath(char *__path) {
#ifdef WIN32
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif
#ifdef WIN32
const char *install_dir = (const char *)get_install_dir();
Expand Down
2 changes: 1 addition & 1 deletion src/PcapInterface.cpp
Expand Up @@ -34,7 +34,7 @@ PcapInterface::PcapInterface(const char *name) : NetworkInterface(name) {
#ifdef WIN32
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif

pcap_handle = NULL, pcap_list = NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/PeriodicActivities.cpp
Expand Up @@ -62,9 +62,9 @@ void PeriodicActivities::sendShutdownSignal() {

void PeriodicActivities::startPeriodicActivitiesLoop() {
#ifdef WIN32
struct _stat64 buf;
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif
ThreadedActivity *startup_activity;
static u_int8_t num_threads = DEFAULT_THREAD_POOL_SIZE;
Expand Down
6 changes: 3 additions & 3 deletions src/ThreadedActivity.cpp
Expand Up @@ -137,9 +137,9 @@ void ThreadedActivity::run() {
/* Run a one-shot script / accurate (e.g. second) periodic script */
void ThreadedActivity::runScript() {
#ifdef WIN32
struct _stat64 buf;
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif
char script_path[MAX_PATH];

Expand Down Expand Up @@ -263,7 +263,7 @@ void ThreadedActivity::schedulePeriodicActivity(ThreadPool *pool) {
#ifdef WIN32
struct _stat64 buf;
#else
struct buf;
struct stat buf;
#endif

if(!systemTaskRunning) {
Expand Down

0 comments on commit 8545c78

Please sign in to comment.