From 133553e630efd5319000d79514159feba5a7e7ca Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 27 Feb 2022 14:05:14 -0500 Subject: [PATCH] Revert "Merge pull request #3119 from Carbenium/fmt" This reverts commit 90d930c7c38a29af03106365bf9fd18a4b45043c, reversing changes made to 0bcb9d276feba2e7edd3a0221cc4d0904efaf6dc. --- .cirrus.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 4 +--- CMakeLists.txt | 2 -- distros/redhat/zoneminder.spec | 2 -- distros/ubuntu2004/control | 4 ---- src/CMakeLists.txt | 2 -- src/zm_logger.cpp | 4 ++-- src/zm_logger.h | 4 ++-- src/zmc.cpp | 18 +++++++++--------- src/zms.cpp | 12 +++++------- 10 files changed, 21 insertions(+), 35 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 7b1effe31..3f2182f9c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,8 +6,8 @@ task: - image_family: freebsd-13-0 prepare_script: - - pkg install -yq git cmake pkgconf jpeg-turbo mysql80-client ffmpeg libvncserver libjwt libfmt catch p5-DBI p5-DBD-mysql p5-Date-Manip p5-Test-LWP-UserAgent p5-Sys-Mmap v4l_compat - + - pkg install -yq git cmake pkgconf jpeg-turbo mysql80-client ffmpeg libvncserver libjwt catch p5-DBI p5-DBD-mysql p5-Date-Manip p5-Test-LWP-UserAgent p5-Sys-Mmap v4l_compat + configure_script: - git submodule update --init --recursive - mkdir build diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9406c40c0..d25aa3710 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -52,11 +52,9 @@ jobs: git submodule init git submodule update --init --recursive sudo apt-get update - sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libjwt-gnutls-dev sudo apt-get install libbz2-dev libcurl4-gnutls-dev libjpeg-turbo8-dev libturbojpeg0-dev - sudo apt-get install default-libmysqlclient-dev libpcre3-dev libpolkit-gobject-1-dev libv4l-dev libvlc-dev libfmt-dev - + sudo apt-get install default-libmysqlclient-dev libpcre3-dev libpolkit-gobject-1-dev libv4l-dev libvlc-dev sudo apt-get install libdate-manip-perl libdbd-mysql-perl libphp-serialization-perl libsys-mmap-perl sudo apt-get install libwww-perl libdata-uuid-perl libssl-dev libcrypt-eksblowfish-perl libdata-entropy-perl diff --git a/CMakeLists.txt b/CMakeLists.txt index c78c4ee3c..6337e50c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -536,8 +536,6 @@ else() set(HAVE_RTSP_SERVER 0) endif() -find_package(fmt REQUIRED) - # # *** END OF LIBRARY CHECKS *** diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index 3cd8aceaf..042eeb7c3 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -93,7 +93,6 @@ BuildRequires: libv4l-devel BuildRequires: desktop-file-utils BuildRequires: gzip BuildRequires: zlib-devel -BuildRequires: fmt-devel # ZoneMinder looks for and records the location of the ffmpeg binary during build BuildRequires: ffmpeg @@ -142,7 +141,6 @@ Requires: perl(Net::FTP) Requires: perl(LWP::Protocol::https) Requires: ca-certificates Requires: zip -Requires: fmt %{?systemd_requires} Requires(post): %{_bindir}/gpasswd diff --git a/distros/ubuntu2004/control b/distros/ubuntu2004/control index 76f8f43e0..a73713976 100644 --- a/distros/ubuntu2004/control +++ b/distros/ubuntu2004/control @@ -29,10 +29,8 @@ Build-Depends: debhelper (>= 11), sphinx-doc, python3-sphinx, dh-linktree, dh-ap ,libcrypt-eksblowfish-perl ,libdata-entropy-perl ,libvncserver-dev - ,libfmt-dev ,libjwt-gnutls-dev|libjwt-dev ,libgsoap-dev - Standards-Version: 4.5.0 Homepage: https://www.zoneminder.com/ @@ -76,10 +74,8 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} ,libcrypt-eksblowfish-perl ,libdata-entropy-perl ,libvncclient1|libvncclient0 - ,libfmt ,libjwt-gnutls0|libjwt0 ,libgsoap-2.8.104|libgsoap-2.8.91|libgsoap-2.8.75|libgsoap-2.8.60|libgsoap10 - Recommends: ${misc:Recommends} ,libapache2-mod-php | php-fpm ,default-mysql-server | mariadb-server | virtual-mysql-server diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 274ed07dd..6943a102a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -192,7 +192,6 @@ target_link_libraries(zmc PRIVATE zm-core-interface zm - fmt::fmt ${ZM_EXTRA_LIBS} ${CMAKE_DL_LIBS}) @@ -214,7 +213,6 @@ target_link_libraries(zmbenchmark PRIVATE zm-core-interface zm - fmt::fmt ${ZM_EXTRA_LIBS} ${CMAKE_DL_LIBS}) diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index 6f122d4fc..f43ea6f30 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -547,14 +547,14 @@ void Logger::logPrint(bool hex, const char *filepath, int line, int level, const } } // end logPrint -void logInit(const std::string &id, const Logger::Options &options) { +void logInit(const char *name, const Logger::Options &options) { if (Logger::smInstance) { delete Logger::smInstance; Logger::smInstance = nullptr; } Logger::smInstance = new Logger(); - Logger::smInstance->initialise(id, options); + Logger::smInstance->initialise(name, options); } void logTerm() { diff --git a/src/zm_logger.h b/src/zm_logger.h index b437f7b55..d5a01be39 100644 --- a/src/zm_logger.h +++ b/src/zm_logger.h @@ -137,7 +137,7 @@ private: static void usrHandler(int sig); public: - friend void logInit(const std::string &id, const Options &options); + friend void logInit(const char *name, const Options &options); friend void logTerm(); static Logger *fetch() { @@ -182,7 +182,7 @@ private: ...) __attribute__((format(printf, 6, 7))); }; -void logInit(const std::string &id, const Logger::Options &options=Logger::Options()); +void logInit(const char *name, const Logger::Options &options=Logger::Options()); void logTerm(); inline const std::string &logId() { return Logger::fetch()->id(); diff --git a/src/zmc.cpp b/src/zmc.cpp index 0030292aa..29e9886fd 100644 --- a/src/zmc.cpp +++ b/src/zmc.cpp @@ -63,7 +63,6 @@ possible, this should run at more or less constant speed. #include "zm_signal.h" #include "zm_time.h" #include "zm_utils.h" -#include #include void Usage() { @@ -169,24 +168,24 @@ int main(int argc, char *argv[]) { exit(0); } - std::string logId; + char log_id_string[32] = ""; if ( device[0] ) { const char *slash_ptr = strrchr(device, '/'); - logId = fmt::format("zmc_d{}", slash_ptr ? slash_ptr + 1 : device); + snprintf(log_id_string, sizeof(log_id_string), "zmc_d%s", slash_ptr?slash_ptr+1:device); } else if ( host[0] ) { - logId = fmt::format("zmc_h{}", host); + snprintf(log_id_string, sizeof(log_id_string), "zmc_h%s", host); } else if ( file[0] ) { const char *slash_ptr = strrchr(file, '/'); - logId = fmt::format("zmc_f{}", slash_ptr ? slash_ptr + 1 : file); + snprintf(log_id_string, sizeof(log_id_string), "zmc_f%s", slash_ptr?slash_ptr+1:file); } else { - logId = fmt::format("zmc_m{}", monitor_id); + snprintf(log_id_string, sizeof(log_id_string), "zmc_m%d", monitor_id); } - logInit(logId); + logInit(log_id_string); zmLoadStaticConfig(); zmDbConnect(); zmLoadDBConfig(); - logInit(logId); + logInit(log_id_string); HwCapsDetect(); @@ -354,7 +353,8 @@ int main(int argc, char *argv[]) { monitor->Reload(); } logTerm(); - logInit(logId); + logInit(log_id_string); + zm_reload = false; } // end if zm_reload } // end while ! zm_terminate outer connection loop diff --git a/src/zms.cpp b/src/zms.cpp index 34d390b4c..e22fd1ae1 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -24,8 +24,6 @@ #include "zm_monitorstream.h" #include "zm_eventstream.h" #include "zm_fifo_stream.h" -#include - #include #include @@ -85,7 +83,8 @@ int main(int argc, const char *argv[], char **envp) { nph = true; } - logInit("zms"); + char log_id_string[32] = "zms"; + logInit(log_id_string); zmLoadStaticConfig(); zmDbConnect(); zmLoadDBConfig(); @@ -192,13 +191,12 @@ int main(int argc, const char *argv[], char **envp) { } // end if possible parameter names } // end foreach parm - std::string logId; if ( monitor_id ) { - logId = fmt::format("zms_m{}", monitor_id); + snprintf(log_id_string, sizeof(log_id_string), "zms_m%d", monitor_id); } else { - logId = fmt::format("zms_e{}", event_id); + snprintf(log_id_string, sizeof(log_id_string), "zms_e%" PRIu64, event_id); } - logInit(logId); + logInit(log_id_string); if ( config.opt_use_auth ) { User *user = nullptr;