From dc0ac7b30430243c0ab9e83bb58435c3b9936f8a Mon Sep 17 00:00:00 2001 From: Yan Jun Date: Mon, 6 Jun 2016 23:31:19 +0800 Subject: [PATCH] rgw/basic_type: use the standard usage of string string::find() returns a value of size_t type, we'd better use the std::string::npos when it find nothing. Signed-off-by: Yan Jun --- src/rgw/rgw_basic_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_basic_types.h b/src/rgw/rgw_basic_types.h index 00ad16e50aa7..d1c06d1bac78 100644 --- a/src/rgw/rgw_basic_types.h +++ b/src/rgw/rgw_basic_types.h @@ -52,8 +52,8 @@ struct rgw_user { } void from_str(const std::string& str) { - ssize_t pos = str.find('$'); - if (pos >= 0) { + size_t pos = str.find('$'); + if (pos != std::string::npos) { tenant = str.substr(0, pos); id = str.substr(pos + 1); } else { -- 2.47.3