From 559fe15e3faf42d360ef22c71599e72438e444a9 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 23 Jul 2020 19:32:25 -0400 Subject: [PATCH] fix use of int or unsigned long instead of int for monitor id --- src/zm_eventstream.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/zm_eventstream.cpp b/src/zm_eventstream.cpp index 3bcce223e..f9938bb22 100644 --- a/src/zm_eventstream.cpp +++ b/src/zm_eventstream.cpp @@ -187,13 +187,13 @@ bool EventStream::loadEventData(uint64_t event_id) { if ( storage_path[0] == '/' ) snprintf(event_data->path, sizeof(event_data->path), - "%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", + "%s/%d/%02d/%02d/%02d/%02d/%02d/%02d", storage_path, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec); else snprintf(event_data->path, sizeof(event_data->path), - "%s/%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", + "%s/%s/%d/%02d/%02d/%02d/%02d/%02d/%02d", staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec); @@ -201,23 +201,23 @@ bool EventStream::loadEventData(uint64_t event_id) { struct tm *event_time = localtime(&event_data->start_time); if ( storage_path[0] == '/' ) snprintf(event_data->path, sizeof(event_data->path), - "%s/%ld/%04d-%02d-%02d/%" PRIu64, + "%s/%d/%04d-%02d-%02d/%" PRIu64, storage_path, event_data->monitor_id, event_time->tm_year+1900, event_time->tm_mon+1, event_time->tm_mday, event_data->event_id); else snprintf(event_data->path, sizeof(event_data->path), - "%s/%s/%ld/%04d-%02d-%02d/%" PRIu64, + "%s/%s/%d/%04d-%02d-%02d/%" PRIu64, staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_time->tm_year+1900, event_time->tm_mon+1, event_time->tm_mday, event_data->event_id); } else { if ( storage_path[0] == '/' ) - snprintf(event_data->path, sizeof(event_data->path), "%s/%ld/%" PRIu64, + snprintf(event_data->path, sizeof(event_data->path), "%s/%d/%" PRIu64, storage_path, event_data->monitor_id, event_data->event_id); else - snprintf(event_data->path, sizeof(event_data->path), "%s/%s/%ld/%" PRIu64, + snprintf(event_data->path, sizeof(event_data->path), "%s/%s/%d/%" PRIu64, staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_data->event_id); } @@ -566,11 +566,11 @@ bool EventStream::checkEventLoaded() { if ( curr_frame_id <= 0 ) { snprintf(sql, sizeof(sql), - "SELECT `Id` FROM `Events` WHERE `MonitorId` = %ld AND `Id` < %" PRIu64 " ORDER BY `Id` DESC LIMIT 1", + "SELECT `Id` FROM `Events` WHERE `MonitorId` = %d AND `Id` < %" PRIu64 " ORDER BY `Id` DESC LIMIT 1", event_data->monitor_id, event_data->event_id); } else if ( (unsigned int)curr_frame_id > event_data->frame_count ) { snprintf(sql, sizeof(sql), - "SELECT `Id` FROM `Events` WHERE `MonitorId` = %ld AND `Id` > %" PRIu64 " ORDER BY `Id` ASC LIMIT 1", + "SELECT `Id` FROM `Events` WHERE `MonitorId` = %d AND `Id` > %" PRIu64 " ORDER BY `Id` ASC LIMIT 1", event_data->monitor_id, event_data->event_id); } else { // No event change required