diff options
author | Maxim Pimenov <m@maps.me> | 2019-05-20 17:47:33 +0300 |
---|---|---|
committer | Maxim Pimenov <m@maps.me> | 2019-05-20 17:53:16 +0300 |
commit | b4f84e419740a20a68f779bed67cde4fe72fdee0 (patch) | |
tree | e3a082bbdea01c8e2475138637ff6bac7e97e436 /coding | |
parent | 020e73b851fb78365723a8679e4c76cb26fb10d9 (diff) |
Fixed some warnings.
Diffstat (limited to 'coding')
-rw-r--r-- | coding/coding_tests/reader_writer_ops_test.cpp | 3 | ||||
-rw-r--r-- | coding/coding_tests/uri_test.cpp | 3 | ||||
-rw-r--r-- | coding/file_container.cpp | 3 | ||||
-rw-r--r-- | coding/internal/file_data.cpp | 8 |
4 files changed, 9 insertions, 8 deletions
diff --git a/coding/coding_tests/reader_writer_ops_test.cpp b/coding/coding_tests/reader_writer_ops_test.cpp index 38837e6779..020afb6f73 100644 --- a/coding/coding_tests/reader_writer_ops_test.cpp +++ b/coding/coding_tests/reader_writer_ops_test.cpp @@ -64,9 +64,8 @@ UNIT_TEST(Reverse_Smoke) TEST(equal(arr, arr + ARRAY_SIZE(arr), buffer.begin()), ()); } - char const * tmpFile = "random_file.tmp"; - { + char const * tmpFile = "random_file.tmp"; { FillRandFile(tmpFile, 10 * 1024 + 527); FileReader reader(tmpFile); diff --git a/coding/coding_tests/uri_test.cpp b/coding/coding_tests/uri_test.cpp index 2e7619b216..e2116b571f 100644 --- a/coding/coding_tests/uri_test.cpp +++ b/coding/coding_tests/uri_test.cpp @@ -19,7 +19,8 @@ namespace class TestUri { public: - explicit TestUri(string const & uri) { m_uri = uri; } + explicit TestUri(string const & uri) : m_uri(uri) {} + TestUri & Scheme(string const &scheme) { m_scheme = scheme; return *this; } TestUri & Path(string const & path) { m_path = path; return *this; } TestUri & KV(string const & key, string const & value) diff --git a/coding/file_container.cpp b/coding/file_container.cpp index 05135ae18a..7b8447bd03 100644 --- a/coding/file_container.cpp +++ b/coding/file_container.cpp @@ -188,7 +188,8 @@ MappedFile::Handle MappedFile::Map(uint64_t offset, uint64_t size, string const if (pMap == NULL) MYTHROW(Reader::OpenException, ("Can't map section:", tag, "with [offset, size]:", offset, size, "win last error:", GetLastError())); #else - void * pMap = mmap(0, static_cast<size_t>(length), PROT_READ, MAP_SHARED, m_fd, alignedOffset); + void * pMap = mmap(0, static_cast<size_t>(length), PROT_READ, MAP_SHARED, m_fd, + static_cast<off_t>(alignedOffset)); if (pMap == MAP_FAILED) MYTHROW(Reader::OpenException, ("Can't map section:", tag, "with [offset, size]:", offset, size, "errno:", strerror(errno))); #endif diff --git a/coding/internal/file_data.cpp b/coding/internal/file_data.cpp index 238896c99c..4f8241db36 100644 --- a/coding/internal/file_data.cpp +++ b/coding/internal/file_data.cpp @@ -111,7 +111,7 @@ uint64_t FileData::Size() const if (size == INVALID_POS) MYTHROW(Reader::SizeException, (GetErrorProlog(), size)); - if (fseek64(m_File, pos, SEEK_SET)) + if (fseek64(m_File, static_cast<off_t>(pos), SEEK_SET)) MYTHROW(Reader::SizeException, (GetErrorProlog(), pos)); ASSERT_GREATER_OR_EQUAL(size, 0, ()); @@ -130,7 +130,7 @@ void FileData::Read(uint64_t pos, void * p, size_t size) if (static_cast<size_t>(bytesRead) != size || IsFailed(error)) MYTHROW(Reader::ReadException, (m_FileName, m_Op, error, bytesRead, pos, size)); #else - if (fseek64(m_File, pos, SEEK_SET)) + if (fseek64(m_File, static_cast<off_t>(pos), SEEK_SET)) MYTHROW(Reader::ReadException, (GetErrorProlog(), pos)); size_t const bytesRead = fread(p, 1, size, m_File); @@ -165,7 +165,7 @@ void FileData::Seek(uint64_t pos) if (IsFailed(error)) MYTHROW(Writer::SeekException, (m_FileName, m_Op, error, pos)); #else - if (fseek64(m_File, pos, SEEK_SET)) + if (fseek64(m_File, static_cast<off_t>(pos), SEEK_SET)) MYTHROW(Writer::SeekException, (GetErrorProlog(), pos)); #endif } @@ -202,7 +202,7 @@ void FileData::Truncate(uint64_t sz) #elif defined OMIM_OS_TIZEN result res = m_File->Truncate(sz); #else - int const res = ftruncate(fileno(m_File), sz); + int const res = ftruncate(fileno(m_File), static_cast<off_t>(sz)); #endif if (res) |