Codereview request for 4153167: separate between ANSI and OEM code pages on Windows (original) (raw)
Alan Bateman Alan.Bateman at oracle.com
Fri Feb 17 15:48:03 UTC 2012
- Previous message: Codereview request for 4153167: separate between ANSI and OEM code pages on Windows
- Next message: hg: jdk8/tl/langtools: 7142672: Problems with the value passed to the 'classes' param of JavaCompiler.CompilationTask.getTask(...)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 17/02/2012 15:35, Tom Hawtin wrote:
Although it's in some sense safe in this case, you might get a grumble about introducing a new sprintf. +static char* getConsoleEncoding() +{ + char* buf = malloc(16); + int cp = GetConsoleCP(); + if (cp >= 874 && cp <= 950) + sprintf(buf, "ms%d", cp); + else + sprintf(buf, "cp%d", cp); + return buf; +} Tom You're right, we should avoid sprintf. It's not an issue here but will be flagged by tools that do static analysis on the source.
-Alan.
- Previous message: Codereview request for 4153167: separate between ANSI and OEM code pages on Windows
- Next message: hg: jdk8/tl/langtools: 7142672: Problems with the value passed to the 'classes' param of JavaCompiler.CompilationTask.getTask(...)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]