Fixed MSVC warnings, all inocuous
This commit is contained in:
+17
-17
@@ -17,11 +17,11 @@
|
||||
#ifndef TEST_CHRONO
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include "chrono.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "chrono.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifndef CLOCK_REALTIME
|
||||
@@ -31,19 +31,19 @@ typedef int clockid_t;
|
||||
|
||||
|
||||
#define SECONDS(TS1, TS2) \
|
||||
(float((TS2).tv_sec - (TS1).tv_sec) + \
|
||||
float((TS2).tv_nsec - (TS1).tv_nsec) * 1e-9)
|
||||
(double((TS2).tv_sec - (TS1).tv_sec) + \
|
||||
double((TS2).tv_nsec - (TS1).tv_nsec) * 1e-9)
|
||||
|
||||
#define MILLIS(TS1, TS2) \
|
||||
((long long)((TS2).tv_sec - (TS1).tv_sec) * 1000LL + \
|
||||
((int64_t)((TS2).tv_sec - (TS1).tv_sec) * 1000LL + \
|
||||
((TS2).tv_nsec - (TS1).tv_nsec) / 1000000)
|
||||
|
||||
#define MICROS(TS1, TS2) \
|
||||
((long long)((TS2).tv_sec - (TS1).tv_sec) * 1000000LL + \
|
||||
((int64_t)((TS2).tv_sec - (TS1).tv_sec) * 1000000LL + \
|
||||
((TS2).tv_nsec - (TS1).tv_nsec) / 1000)
|
||||
|
||||
#define NANOS(TS1, TS2) \
|
||||
((long long)((TS2).tv_sec - (TS1).tv_sec) * 1000000000LL + \
|
||||
((int64_t)((TS2).tv_sec - (TS1).tv_sec) * 1000000000LL + \
|
||||
((TS2).tv_nsec - (TS1).tv_nsec))
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ typedef struct timeval {
|
||||
long tv_usec;
|
||||
} timeval;
|
||||
|
||||
int gettimeofday(struct timeval * tp, struct timezone * tzp)
|
||||
int gettimeofday(struct timeval * tp, struct timezone * /*tzp*/)
|
||||
{
|
||||
// Note: some broken versions only have 8 trailing zero's, the
|
||||
// correct epoch has 9 trailing zero's
|
||||
@@ -136,26 +136,26 @@ Chrono::Chrono()
|
||||
}
|
||||
|
||||
// Reset and return value before rest in milliseconds
|
||||
long Chrono::restart()
|
||||
int64_t Chrono::restart()
|
||||
{
|
||||
TimeSpec now;
|
||||
gettime(CLOCK_REALTIME, &now);
|
||||
long ret = MILLIS(m_orig, now);
|
||||
int64_t ret = MILLIS(m_orig, now);
|
||||
m_orig = now;
|
||||
return ret;
|
||||
}
|
||||
|
||||
long Chrono::urestart()
|
||||
int64_t Chrono::urestart()
|
||||
{
|
||||
TimeSpec now;
|
||||
gettime(CLOCK_REALTIME, &now);
|
||||
long ret = MICROS(m_orig, now);
|
||||
int64_t ret = MICROS(m_orig, now);
|
||||
m_orig = now;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Get current timer value, milliseconds
|
||||
long Chrono::millis(bool frozen)
|
||||
int64_t Chrono::millis(bool frozen)
|
||||
{
|
||||
if (frozen) {
|
||||
return MILLIS(m_orig, o_now);
|
||||
@@ -167,7 +167,7 @@ long Chrono::millis(bool frozen)
|
||||
}
|
||||
|
||||
//
|
||||
long Chrono::micros(bool frozen)
|
||||
int64_t Chrono::micros(bool frozen)
|
||||
{
|
||||
if (frozen) {
|
||||
return MICROS(m_orig, o_now);
|
||||
@@ -178,7 +178,7 @@ long Chrono::micros(bool frozen)
|
||||
}
|
||||
}
|
||||
|
||||
long long Chrono::amicros() const
|
||||
int64_t Chrono::amicros() const
|
||||
{
|
||||
TimeSpec ts;
|
||||
ts.tv_sec = 0;
|
||||
@@ -187,7 +187,7 @@ long long Chrono::amicros() const
|
||||
}
|
||||
|
||||
//
|
||||
long long Chrono::nanos(bool frozen)
|
||||
int64_t Chrono::nanos(bool frozen)
|
||||
{
|
||||
if (frozen) {
|
||||
return NANOS(m_orig, o_now);
|
||||
@@ -198,7 +198,7 @@ long long Chrono::nanos(bool frozen)
|
||||
}
|
||||
}
|
||||
|
||||
float Chrono::secs(bool frozen)
|
||||
double Chrono::secs(bool frozen)
|
||||
{
|
||||
if (frozen) {
|
||||
return SECONDS(m_orig, o_now);
|
||||
|
||||
+8
-7
@@ -19,6 +19,7 @@
|
||||
#define _CHRONO_H_INCLUDED_
|
||||
|
||||
#include <time.h>
|
||||
#include <cstdint>
|
||||
|
||||
/** Easy interface to measuring time intervals */
|
||||
class Chrono {
|
||||
@@ -27,9 +28,9 @@ public:
|
||||
Chrono();
|
||||
|
||||
/** Re-store current time and return mS since init or last call */
|
||||
long restart();
|
||||
int64_t restart();
|
||||
/** Re-store current time and return uS since init or last call */
|
||||
long urestart();
|
||||
int64_t urestart();
|
||||
|
||||
/** Snapshot current time to static storage */
|
||||
static void refnow();
|
||||
@@ -41,13 +42,13 @@ public:
|
||||
values from many chrono objects, like when examining timeouts
|
||||
in a queue
|
||||
*/
|
||||
long long nanos(bool frozen = false);
|
||||
long micros(bool frozen = false);
|
||||
long millis(bool frozen = false);
|
||||
float secs(bool frozen = false);
|
||||
int64_t nanos(bool frozen = false);
|
||||
int64_t micros(bool frozen = false);
|
||||
int64_t millis(bool frozen = false);
|
||||
double secs(bool frozen = false);
|
||||
|
||||
/** Return the absolute value of the current origin */
|
||||
long long amicros() const;
|
||||
int64_t amicros() const;
|
||||
|
||||
struct TimeSpec {
|
||||
time_t tv_sec; /* Time in seconds */
|
||||
|
||||
@@ -455,8 +455,9 @@ public:
|
||||
m_reason << "CirCache::weh: erase requested but not empty";
|
||||
return false;
|
||||
}
|
||||
string buf(d.padsize, ' ');
|
||||
if (write(m_fd, buf.c_str(), d.padsize) != (ssize_t)d.padsize) {
|
||||
string buf((size_t)d.padsize, ' ');
|
||||
if (write(m_fd, buf.c_str(), (size_t)d.padsize) !=
|
||||
(ssize_t)d.padsize) {
|
||||
m_reason << "CirCache::weh: write failed. errno " << errno;
|
||||
return false;
|
||||
}
|
||||
@@ -675,7 +676,7 @@ public:
|
||||
CCScanHookRecord()
|
||||
: headoffs(0), padsize(0) {
|
||||
}
|
||||
virtual status takeone(int64_t offs, const string& udi,
|
||||
virtual status takeone(int64_t offs, const string&,
|
||||
const EntryHeaderData& d) {
|
||||
headoffs = offs;
|
||||
padsize = d.padsize;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
Canceler(int tmsecs)
|
||||
: m_timeosecs(tmsecs) {}
|
||||
|
||||
virtual void newData(int cnt) {
|
||||
virtual void newData(int) {
|
||||
if (m_starttime && (time(0) - m_starttime) > m_timeosecs) {
|
||||
throw TimeoutExcept();
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
#error dlib.cpp not ported on this system
|
||||
#endif
|
||||
|
||||
void *dlib_open(const std::string& libname, int flags)
|
||||
void *dlib_open(const std::string& libname, int)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return LoadLibraryA(libname.c_str());
|
||||
|
||||
@@ -534,7 +534,7 @@ int64_t fsTreeBytes(const string& topdir)
|
||||
{
|
||||
class bytesCB : public FsTreeWalkerCB {
|
||||
public:
|
||||
FsTreeWalker::Status processone(const string &path,
|
||||
FsTreeWalker::Status processone(const string &,
|
||||
const struct PathStat *st,
|
||||
FsTreeWalker::CbFlag flg) {
|
||||
if (flg == FsTreeWalker::FtwDirEnter ||
|
||||
|
||||
@@ -710,6 +710,7 @@ bool path_makepath(const string& ipath, int mode)
|
||||
path = "/";
|
||||
for (const auto& elem : elems) {
|
||||
#ifdef _WIN32
|
||||
PRETEND_USE(mode);
|
||||
if (path == "/" && path_strlookslikedrive(elem)) {
|
||||
path = "";
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ static const string& path_wingetrcltmpdir()
|
||||
return tdir;
|
||||
}
|
||||
|
||||
static bool path_gettempfilename(string& filename, string& reason)
|
||||
static bool path_gettempfilename(string& filename, string&)
|
||||
{
|
||||
string tdir = path_wingetrcltmpdir();
|
||||
wchar_t dbuf[MAX_PATH + 1];
|
||||
@@ -245,6 +245,7 @@ const string& path_pkgdatadir()
|
||||
bool printableUrl(const string& fcharset, const string& in, string& out)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
PRETEND_USE(fcharset);
|
||||
// On windows our paths are always utf-8
|
||||
out = in;
|
||||
#else
|
||||
|
||||
@@ -68,9 +68,9 @@ public:
|
||||
// usage almost by 2 on both linux i586 and macosx (compared to
|
||||
// just append()) Also tried a version with mmap, but it's
|
||||
// actually slower on the mac and not faster on linux.
|
||||
virtual bool init(int64_t size, string *reason) {
|
||||
virtual bool init(int64_t size, string *) {
|
||||
if (size > 0) {
|
||||
m_data.reserve(size);
|
||||
m_data.reserve((size_t)size);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -264,10 +264,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static voidpf alloc_func(voidpf opaque, uInt items, uInt size) {
|
||||
static voidpf alloc_func(voidpf, uInt items, uInt size) {
|
||||
return malloc(items * size);
|
||||
}
|
||||
static void free_func(voidpf opaque, voidpf address) {
|
||||
static void free_func(voidpf, voidpf address) {
|
||||
free(address);
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
}
|
||||
|
||||
if (m_cnttoread != -1) {
|
||||
toread = MIN(toread, (uint64_t)(m_cnttoread - totread));
|
||||
toread = (size_t)MIN(toread, (uint64_t)(m_cnttoread - totread));
|
||||
}
|
||||
ssize_t n = static_cast<ssize_t>(read(fd, buf, toread));
|
||||
if (n < 0) {
|
||||
@@ -491,6 +491,7 @@ public:
|
||||
static size_t write_cb(void *pOpaque, mz_uint64 file_ofs,
|
||||
const void *pBuf, size_t n) {
|
||||
const char *cp = (const char*)pBuf;
|
||||
PRETEND_USE(file_ofs);
|
||||
LOGDEB1("write_cb: ofs " << file_ofs << " cnt " << n << " data: " <<
|
||||
string(cp, n) << endl);
|
||||
FileScanSourceZip *ths = (FileScanSourceZip *)pOpaque;
|
||||
|
||||
@@ -1290,7 +1290,7 @@ bool SimpleRegexp::simpleMatch(const string& val) const
|
||||
return regex_search(val, m->res, m->expr);
|
||||
}
|
||||
|
||||
string SimpleRegexp::getMatch(const string& val, int i) const
|
||||
string SimpleRegexp::getMatch(const string&, int i) const
|
||||
{
|
||||
return m->res.str(i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user