@@ -4384,7 +4384,7 @@ add_dialog_element(
43844384 WORD clss ,
43854385 const char * caption );
43864386static LPWORD lpwAlign (LPWORD );
4387- static int nCopyAnsiToWideChar (LPWORD , LPSTR );
4387+ static int nCopyAnsiToWideChar (LPWORD , LPSTR , BOOL );
43884388#if defined(FEAT_MENU ) && defined(FEAT_TEAROFF )
43894389static void gui_mch_tearoff (char_u * title , vimmenu_T * menu , int initX , int initY );
43904390#endif
@@ -7284,9 +7284,8 @@ gui_mch_dialog(
72847284 add_word (0 ); // Class
72857285
72867286 /* copy the title of the dialog */
7287- nchar = nCopyAnsiToWideChar (p , (title ?
7288- (LPSTR )title :
7289- (LPSTR )("Vim " VIM_VERSION_MEDIUM )));
7287+ nchar = nCopyAnsiToWideChar (p , (title ? (LPSTR )title
7288+ : (LPSTR )("Vim " VIM_VERSION_MEDIUM )), TRUE);
72907289 p += nchar ;
72917290
72927291 if (s_usenewlook )
@@ -7298,13 +7297,13 @@ gui_mch_dialog(
72987297 /* point size */
72997298 * p ++ = - MulDiv (lfSysmenu .lfHeight , 72 ,
73007299 GetDeviceCaps (hdc , LOGPIXELSY ));
7301- nchar = nCopyAnsiToWideChar (p , TEXT ( lfSysmenu .lfFaceName ) );
7300+ nchar = nCopyAnsiToWideChar (p , lfSysmenu .lfFaceName , FALSE );
73027301 }
73037302 else
73047303#endif
73057304 {
73067305 * p ++ = DLG_FONT_POINT_SIZE ; // point size
7307- nchar = nCopyAnsiToWideChar (p , TEXT ( DLG_FONT_NAME ) );
7306+ nchar = nCopyAnsiToWideChar (p , DLG_FONT_NAME , FALSE );
73087307 }
73097308 p += nchar ;
73107309 }
@@ -7485,7 +7484,7 @@ add_dialog_element(
74857484 * p ++ = (WORD )0xffff ;
74867485 * p ++ = clss ; //2 more here
74877486
7488- nchar = nCopyAnsiToWideChar (p , (LPSTR )caption ); //strlen(caption)+1
7487+ nchar = nCopyAnsiToWideChar (p , (LPSTR )caption , TRUE ); //strlen(caption)+1
74897488 p += nchar ;
74907489
74917490 * p ++ = 0 ; // advance pointer over nExtraStuff WORD - 2 more
@@ -7517,19 +7516,21 @@ lpwAlign(
75177516 * parameter as wide character (16-bits / char) string, and returns integer
75187517 * number of wide characters (words) in string (including the trailing wide
75197518 * char NULL). Partly taken from the Win32SDK samples.
7520- */
7519+ * If "use_enc" is TRUE, 'encoding' is used for "lpAnsiIn". If FALSE, current
7520+ * ACP is used for "lpAnsiIn". */
75217521 static int
75227522nCopyAnsiToWideChar (
75237523 LPWORD lpWCStr ,
7524- LPSTR lpAnsiIn )
7524+ LPSTR lpAnsiIn ,
7525+ BOOL use_enc )
75257526{
75267527 int nChar = 0 ;
75277528#ifdef FEAT_MBYTE
75287529 int len = lstrlen (lpAnsiIn ) + 1 ; /* include NUL character */
75297530 int i ;
75307531 WCHAR * wn ;
75317532
7532- if (enc_codepage = = 0 && (int )GetACP () != enc_codepage )
7533+ if (use_enc && enc_codepage > = 0 && (int )GetACP () != enc_codepage )
75337534 {
75347535 /* Not a codepage, use our own conversion function. */
75357536 wn = enc_to_utf16 ((char_u * )lpAnsiIn , NULL );
@@ -7852,8 +7853,8 @@ gui_mch_tearoff(
78527853
78537854 /* copy the title of the dialog */
78547855 nchar = nCopyAnsiToWideChar (p , ((* title )
7855- ? (LPSTR )title
7856- : (LPSTR )("Vim " VIM_VERSION_MEDIUM )));
7856+ ? (LPSTR )title
7857+ : (LPSTR )("Vim " VIM_VERSION_MEDIUM )), TRUE );
78577858 p += nchar ;
78587859
78597860 if (s_usenewlook )
@@ -7865,13 +7866,13 @@ gui_mch_tearoff(
78657866 /* point size */
78667867 * p ++ = - MulDiv (lfSysmenu .lfHeight , 72 ,
78677868 GetDeviceCaps (hdc , LOGPIXELSY ));
7868- nchar = nCopyAnsiToWideChar (p , TEXT ( lfSysmenu .lfFaceName ) );
7869+ nchar = nCopyAnsiToWideChar (p , lfSysmenu .lfFaceName , FALSE );
78697870 }
78707871 else
78717872#endif
78727873 {
78737874 * p ++ = DLG_FONT_POINT_SIZE ; // point size
7874- nchar = nCopyAnsiToWideChar (p , TEXT ( DLG_FONT_NAME ) );
7875+ nchar = nCopyAnsiToWideChar (p , DLG_FONT_NAME , FALSE );
78757876 }
78767877 p += nchar ;
78777878 }
0 commit comments