File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -394,7 +394,7 @@ PW32CP wchar_t *php_win32_cp_env_any_to_w(const char* env)
394
394
}/*}}}*/
395
395
396
396
static BOOL php_win32_cp_cli_io_setup (void )
397
- {
397
+ {/*{{{*/
398
398
BOOL ret = TRUE;
399
399
400
400
if (PG (input_encoding ) && PG (input_encoding )[0 ]) {
@@ -420,7 +420,7 @@ static BOOL php_win32_cp_cli_io_setup(void)
420
420
}
421
421
422
422
return ret ;
423
- }
423
+ }/*}}}*/
424
424
425
425
PW32CP const struct php_win32_cp * php_win32_cp_do_setup (const char * enc )
426
426
{/*{{{*/
@@ -498,16 +498,18 @@ PW32CP const struct php_win32_cp *php_win32_cp_cli_do_setup(DWORD id)
498
498
499
499
PW32CP const struct php_win32_cp * php_win32_cp_cli_do_restore (DWORD id )
500
500
{/*{{{*/
501
- if (!id && orig_cp ) {
502
- id = orig_cp -> id ;
501
+ BOOL cli_io_restored = TRUE;
502
+
503
+ if (orig_in_cp ) {
504
+ cli_io_restored = cli_io_restored && SetConsoleCP (orig_in_cp -> id );
503
505
}
504
506
505
- if (SetConsoleCP ( orig_in_cp -> id ) && SetConsoleOutputCP ( orig_out_cp -> id ) ) {
506
- if ( orig_cp ) {
507
- return orig_cp ;
508
- } else {
509
- return php_win32_cp_set_by_id ( id );
510
- }
507
+ if (orig_out_cp ) {
508
+ cli_io_restored = cli_io_restored && SetConsoleOutputCP ( orig_out_cp -> id );
509
+ }
510
+
511
+ if ( cli_io_restored && id ) {
512
+ return php_win32_cp_set_by_id ( id );
511
513
}
512
514
513
515
return NULL ;
You can’t perform that action at this time.
0 commit comments