From 901e8cb224c7b55f74d1c55453dde25af5b8429f Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 3 Feb 2018 23:13:05 +0300 Subject: [PATCH] Fix narrowing conversion. GitOrigin-RevId: c9f9fe9be4285b82e875140900065e328b8df32f --- tdutils/td/utils/StringBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tdutils/td/utils/StringBuilder.cpp b/tdutils/td/utils/StringBuilder.cpp index a36f5e574..93fb20f05 100644 --- a/tdutils/td/utils/StringBuilder.cpp +++ b/tdutils/td/utils/StringBuilder.cpp @@ -81,7 +81,7 @@ StringBuilder &StringBuilder::operator<<(double x) { auto left = end_ptr_ + reserved_size - current_ptr_; if (unlikely(len >= left)) { error_flag_ = true; - len = left - 1; + len = left ? narrow_cast(left - 1) : 0; } ss->read(current_ptr_, len); current_ptr_ += len;