From b3e8d16e19576c6cf7cbf766cce0e671f3452d81 Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 10 Dec 2016 10:29:46 +0100 Subject: [PATCH] compiler warnings --- src/ebusd/main.cpp | 4 ++-- src/ebusd/main.h | 4 ++-- src/lib/utils/rotatefile.cpp | 1 - src/lib/utils/rotatefile.h | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index 4946ee45..41112808 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -426,7 +426,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) opt->logRawFile = arg; break; case O_RAWSIZ: // --lograwdatasize=100 - opt->logRawSize = parseInt(arg, 10, 1, 1000000, result); + opt->logRawSize = (unsigned int)parseInt(arg, 10, 1, 1000000, result); if (result != RESULT_OK) { argp_error(state, "invalid dumpsize"); return EINVAL; @@ -446,7 +446,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) opt->dumpFile = arg; break; case O_DMPSIZ: // --dumpsize=100 - opt->dumpSize = parseInt(arg, 10, 1, 1000000, result); + opt->dumpSize = (unsigned int)parseInt(arg, 10, 1, 1000000, result); if (result != RESULT_OK) { argp_error(state, "invalid dumpsize"); return EINVAL; diff --git a/src/ebusd/main.h b/src/ebusd/main.h index b9a5ba6e..4a926376 100644 --- a/src/ebusd/main.h +++ b/src/ebusd/main.h @@ -62,11 +62,11 @@ struct options bool logRaw; //!< raw log each received/sent byte on the bus const char* logRawFile; //!< name of raw log file [/var/log/ebusd.log] - int logRawSize; //!< maximum size of raw log file in kB [100] + unsigned int logRawSize; //!< maximum size of raw log file in kB [100] bool dump; //!< binary dump received bytes const char* dumpFile; //!< name of dump file [/tmp/ebusd_dump.bin] - int dumpSize; //!< maximum size of dump file in kB [100] + unsigned int dumpSize; //!< maximum size of dump file in kB [100] }; /** diff --git a/src/lib/utils/rotatefile.cpp b/src/lib/utils/rotatefile.cpp index a3acd035..bd391150 100644 --- a/src/lib/utils/rotatefile.cpp +++ b/src/lib/utils/rotatefile.cpp @@ -67,7 +67,6 @@ void RotateFile::write(unsigned char* value, unsigned int size, bool received) struct tm* tm; clockGettime(&ts); tm = localtime(&ts.tv_sec); - char* buf; fprintf(m_stream, "%04d-%02d-%02d %02d:%02d:%02d.%03ld %c", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, ts.tv_nsec/1000000, diff --git a/src/lib/utils/rotatefile.h b/src/lib/utils/rotatefile.h index ffdc5158..3e0aa7ea 100644 --- a/src/lib/utils/rotatefile.h +++ b/src/lib/utils/rotatefile.h @@ -41,7 +41,7 @@ public: * @param maxSize the maximum size of the file to write to. * @param textMode whether to write each byte with prefixed timestamp and direction as text. */ - RotateFile(const string fileName, const long maxSize, const bool textMode=false) + RotateFile(const string fileName, const unsigned long maxSize, const bool textMode=false) : m_enabled(false), m_fileName(fileName), m_maxSize(maxSize), m_textMode(textMode), m_stream(), m_fileSize(0) {} /** @@ -78,7 +78,7 @@ private: const string m_fileName; /** the maximum size of @a m_file, or 0 for infinite. */ - const long m_maxSize; + const unsigned long m_maxSize; /** whether to write each byte with prefixed timestamp and direction as text. */ const bool m_textMode;