summaryrefslogtreecommitdiff
path: root/absl/debugging/internal
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-07-28 07:45:06 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-07-28 07:46:07 -0700
commit7f51ef5ed2740dab2bbf53c4dd5931b6e8ec6a5b (patch)
tree72096ff69ed2b4dac6db4e1bcc5d85d3ecb0ef8d /absl/debugging/internal
parentc7e60ccfcd708a73008ed2df040162c66697bc18 (diff)
Fix "unsafe narrowing" warnings in absl, 1/n.
Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL focuses on .h and win32 .inc files.) Bug: chromium:1292951 PiperOrigin-RevId: 463835431 Change-Id: If8e5f7f651d5cd96035e23e4623bdb08a7fedabe
Diffstat (limited to 'absl/debugging/internal')
-rw-r--r--absl/debugging/internal/stacktrace_win32-inl.inc9
1 files changed, 5 insertions, 4 deletions
diff --git a/absl/debugging/internal/stacktrace_win32-inl.inc b/absl/debugging/internal/stacktrace_win32-inl.inc
index 1c666c8b..ef2b973e 100644
--- a/absl/debugging/internal/stacktrace_win32-inl.inc
+++ b/absl/debugging/internal/stacktrace_win32-inl.inc
@@ -63,11 +63,12 @@ static RtlCaptureStackBackTrace_Function* const RtlCaptureStackBackTrace_fn =
template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT>
static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
const void*, int* min_dropped_frames) {
- int n = 0;
- if (!RtlCaptureStackBackTrace_fn) {
- // can't find a stacktrace with no function to call
+ USHORT n = 0;
+ if (!RtlCaptureStackBackTrace_fn || skip_count < 0 || max_depth < 0) {
+ // can't get a stacktrace with no function/invalid args
} else {
- n = (int)RtlCaptureStackBackTrace_fn(skip_count + 2, max_depth, result, 0);
+ n = RtlCaptureStackBackTrace_fn(static_cast<ULONG>(skip_count) + 2,
+ static_cast<ULONG>(max_depth), result, 0);
}
if (IS_STACK_FRAMES) {
// No implementation for finding out the stack frame sizes yet.