Skip to content

Commit 981e37c

Browse files
authored
Fix type conversions errors reported by GCC (#175)
This commit fixes errors when compiling with: -Wall -Werror -Wextra -Wconversion -Wsign-conversion Signed-off-by: Jarosław Pelczar <[email protected]>
1 parent cbf0df7 commit 981e37c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

include/boost/stacktrace/detail/addr2line_impls.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ inline std::string addr2line(const char* flag, const void* addr) {
123123
res = loc.name();
124124
} else {
125125
res.resize(16);
126-
int rlin_size = ::readlink("/proc/self/exe", &res[0], res.size() - 1);
127-
while (rlin_size == static_cast<int>(res.size() - 1)) {
126+
ssize_t rlin_size = ::readlink("/proc/self/exe", &res[0], res.size() - 1);
127+
while (rlin_size == static_cast<ssize_t>(res.size() - 1)) {
128128
res.resize(res.size() * 4);
129129
rlin_size = ::readlink("/proc/self/exe", &res[0], res.size() - 1);
130130
}
131131
if (rlin_size == -1) {
132132
res.clear();
133133
return res;
134134
}
135-
res.resize(rlin_size);
135+
res.resize(static_cast<std::size_t>(rlin_size));
136136
}
137137

138138
addr2line_pipe p(flag, res.c_str(), to_hex_array(addr).data());

include/boost/stacktrace/detail/collect_unwind.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ std::size_t this_thread_frames::collect(native_frame_ptr_t* out_frames, std::siz
8888
#else
8989
boost::stacktrace::detail::unwind_state state = { skip, out_frames, out_frames + max_frames_count };
9090
::_Unwind_Backtrace(&boost::stacktrace::detail::unwind_callback, &state);
91-
frames_count = state.current - out_frames;
91+
frames_count = static_cast<std::size_t>(state.current - out_frames);
9292
#endif //defined(BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION)
9393

9494
if (frames_count && out_frames[frames_count - 1] == 0) {

include/boost/stacktrace/detail/libbacktrace_impls.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ inline int libbacktrace_full_callback(void *data, uintptr_t /*pc*/, const char *
5252
if (d.function && function) {
5353
*d.function = function;
5454
}
55-
d.line = lineno;
55+
d.line = static_cast<std::size_t>(lineno);
5656
return 0;
5757
}
5858

0 commit comments

Comments
 (0)