Skip to content

Commit f0f5ec7

Browse files
committed
Add implicit signed/unsigned conversion casts
1 parent cc267ee commit f0f5ec7

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/bitstream/DefaultInputBitStream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ namespace kanzi {
136136
}
137137

138138
// Regular processing, buffer length is multiple of 8
139-
_current = BigEndian::readLong64(&_buffer[_position]);
139+
_current = uint64(BigEndian::readLong64(&_buffer[_position]));
140140
_position += 8;
141141
return 64;
142142
}

src/bitstream/DefaultOutputBitStream.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace kanzi
120120
// Push 64 bits of current value into buffer.
121121
inline void DefaultOutputBitStream::pushCurrent()
122122
{
123-
BigEndian::writeLong64(&_buffer[_position], _current);
123+
BigEndian::writeLong64(&_buffer[_position], int64(_current));
124124
_availBits = 64;
125125
_current = 0;
126126
_position += 8;
@@ -151,7 +151,7 @@ namespace kanzi
151151

152152
// Flush buffer
153153
// Round down to byte alignment
154-
const uint a = _availBits & -8;
154+
const uint a = _availBits & ~7;
155155

156156
for (uint i = 56; i >= a; i -= 8) {
157157
_buffer[_position++] = byte(_current >> i);

src/concurrent.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Task {
7878
#ifdef CONCURRENCY_ENABLED
7979
class ThreadPool FINAL {
8080
public:
81-
ThreadPool(uint32_t threads = 8);
81+
ThreadPool(int threads = 8);
8282
template<class F, class... Args>
8383
#if __cplusplus >= 201703L // result_of deprecated from C++17
8484
std::future<typename std::invoke_result_t<F, Args...>> schedule(F&& f, Args&&... args);
@@ -96,14 +96,14 @@ class Task {
9696
};
9797

9898

99-
inline ThreadPool::ThreadPool(uint32_t threads)
99+
inline ThreadPool::ThreadPool(int threads)
100100
: _stop(false)
101101
{
102102
if ((threads == 0) || (threads > 1024))
103103
throw std::invalid_argument("The number of threads must be in [1..1024]");
104104

105105
// Start and run threads
106-
for (uint32_t i = 0; i < threads; i++)
106+
for (int i = 0; i < threads; i++)
107107
_workers.emplace_back(
108108
[this]
109109
{

src/io/CompressedOutputStream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ namespace kanzi {
208208
if (_bufferId + 1 < nbTasks) {
209209
_bufferId++;
210210
const int bSize = _blockSize + (_blockSize >> 6);
211-
const int bufSize = (bSize > 65536) ? bSize : 65536;
211+
const size_t bufSize = (bSize > 65536) ? bSize : 65536;
212212

213213
if (_buffers[_bufferId]->_length == 0) {
214214
delete[] _buffers[_bufferId]->_array;

src/util/strings.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ inline int tokenizeCSV(std::string& s, std::vector<std::string>& tokens, char de
115115
if (tk.size() > 0)
116116
tokens.push_back(tk);
117117

118-
return tokens.size();
118+
return int(tokens.size());
119119
}
120120

121121
inline std::string formatSize(const std::string& input)

0 commit comments

Comments
 (0)