From 5ce66fca5c37ceed043e82e625a290956707a4e7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 21 Oct 2013 15:54:37 +0800 Subject: [PATCH] Do not use sscanf. --- browser/ui/accelerator_util.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/browser/ui/accelerator_util.cc b/browser/ui/accelerator_util.cc index e4cf70d..c1563ca 100644 --- a/browser/ui/accelerator_util.cc +++ b/browser/ui/accelerator_util.cc @@ -17,13 +17,6 @@ namespace accelerator_util { namespace { -// The sscanf is deprecated in Windows. -#if defined(OS_WIN) -#define SSCANF sscanf_s -#else -#define SSCANF sscanf -#endif - // Return key code of the char. ui::KeyboardCode KeyboardCodeFromCharCode(char c, bool* shifted) { *shifted = false; @@ -175,7 +168,7 @@ bool StringToAccelerator(const std::string& description, } else if (tokens[i].size() > 1 && tokens[i][0] == 'f') { // F1 - F24. int n; - if (SSCANF(tokens[i].c_str(), "f%d", &n) == 1 && n > 0 && n < 25) { + if (base::StringToInt(tokens[i].c_str() + 1, &n)) { key = static_cast(ui::VKEY_F1 + n - 1); } else { LOG(WARNING) << tokens[i] << "is not available on keyboard"; -- 2.7.4