From: Tao <34903089+sleepinging@users.noreply.github.com> Date: Tue, 29 Mar 2022 14:13:30 +0000 (+0800) Subject: test/fio/fio_ceph_messenger: fix str_to_ptr() crash at windows X-Git-Tag: v18.0.0~675^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f6fc581f59e31eba92147150dc903731fa49dcea;p=ceph.git test/fio/fio_ceph_messenger: fix str_to_ptr() crash at windows I compiled a "fio_ceph_messenger. DLL" running on windows for FIO testing, but the original code is Linux, and the default size of long is 64 bits, but it is 32 bits on windows, resulting in a crash during pointer conversion. Now it has been running well in my computer Signed-off-by: wt.tao --- diff --git a/src/test/fio/fio_ceph_messenger.cc b/src/test/fio/fio_ceph_messenger.cc index cab2d3db698d..8c962af5df72 100644 --- a/src/test/fio/fio_ceph_messenger.cc +++ b/src/test/fio/fio_ceph_messenger.cc @@ -80,7 +80,8 @@ struct ceph_msgr_reply_io { static void *str_to_ptr(const std::string &str) { - return (void *)strtoul(str.c_str(), NULL, 16); + // str is assumed to be a valid ptr string + return reinterpret_cast(ceph::parse(str, 16).value()); } static std::string ptr_to_str(void *ptr)