com php-src: deliver the real cp also if a constant is passed: win32/codepage.c
| From: | Anatol Belski | Date: | Tue, 20 Dec 2016 01:40:44 +0000 |
| Subject: | com php-src: deliver the real cp also if a constant is passed: win32/codepage.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96382@lists.php.net to get a copy of this message | ||
Commit: 21e283647369bfd027c3d9fb740be219da05bc5c
Author: Anatol Belski <ab@php.net> Tue, 20 Dec 2016 02:40:44 +0100
Parents: 6ea44908fb138337f24f32ff3d1b1c8cda4229e1
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=21e283647369bfd027c3d9fb740be219da05bc5c
Log:
deliver the real cp also if a constant is passed
Changed paths:
M win32/codepage.c
Diff:
diff --git a/win32/codepage.c b/win32/codepage.c
index f87d4c0..519ff03 100644
--- a/win32/codepage.c
+++ b/win32/codepage.c
@@ -266,6 +266,17 @@ PW32CP const struct php_win32_cp *php_win32_cp_get_by_id(DWORD id)
{/*{{{*/
size_t i;
+ if (id < php_win32_cp_map[0].id) {
+ switch (id) {
+ case CP_ACP:
+ id = GetACP();
+ break;
+ case CP_OEMCP:
+ id = GetOEMCP();
+ break;
+ }
+ }
+
for (i = 0; i < sizeof(php_win32_cp_map)/sizeof(struct php_win32_cp); i++) {
if (php_win32_cp_map[i].id == id) {
return &php_win32_cp_map[i];