Reviewers: Kasper Lund, Description: Made the ARM port with simulator build and run on Windows.
The reason for the "ugly" definition of SScanF is that the Windows CRT does not have a vsscanf function making it difficult to add OS::SSprintF to platform.h. Please review this at http://codereview.chromium.org/2988 Affected files: M src/disasm-arm.cc M src/simulator-arm.cc Index: src/simulator-arm.cc =================================================================== --- src/simulator-arm.cc (revision 347) +++ src/simulator-arm.cc (working copy) @@ -43,8 +43,12 @@ using ::v8::internal::OS; using ::v8::internal::ReadLine; using ::v8::internal::DeleteArray; +#ifdef WIN32 +#define SScanF sscanf_s +#else +#define SScanF sscanf +#endif - // The Debugger class is used by the simulator while debugging simulated ARM // code. class Debugger { @@ -130,7 +134,7 @@ } return true; } else { - return sscanf(desc, "%i", value) == 1; // NOLINT + return SScanF(desc, "%i", value) == 1; // NOLINT } return false; } @@ -215,7 +219,7 @@ } else { // Use sscanf to parse the individual parts of the command line. At the // moment no command expects more than two parameters. - int args = sscanf(line, // NOLINT + int args = SScanF(line, // NOLINT "%" XSTR(COMMAND_SIZE) "s " "%" XSTR(ARG_SIZE) "s " "%" XSTR(ARG_SIZE) "s", Index: src/disasm-arm.cc =================================================================== --- src/disasm-arm.cc (revision 347) +++ src/disasm-arm.cc (working copy) @@ -855,13 +855,9 @@ const char* NameConverter::NameOfAddress(byte* addr) const { - static char tmp_buffer[32]; -#ifdef WIN32 - _snprintf(tmp_buffer, sizeof tmp_buffer, "%p", addr); -#else - snprintf(tmp_buffer, sizeof tmp_buffer, "%p", addr); -#endif - return tmp_buffer; + static v8::internal::EmbeddedVector<char, 32> tmp_buffer; + v8::internal::OS::SNPrintF(tmp_buffer, "%p", addr); + return tmp_buffer.start(); } --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
