From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] system-type cygwin with window-system w32 Date: Mon, 18 Jul 2011 02:53:19 -0400 Message-ID: References: <4E2377E2.1020804@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1310972302 28395 80.91.229.12 (18 Jul 2011 06:58:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Jul 2011 06:58:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 18 08:58:17 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QihmS-0003je-U1 for ged-emacs-devel@m.gmane.org; Mon, 18 Jul 2011 08:58:17 +0200 Original-Received: from localhost ([::1]:51169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QihmR-0005lo-S9 for ged-emacs-devel@m.gmane.org; Mon, 18 Jul 2011 02:58:16 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qihhh-0004ct-UX for emacs-devel@gnu.org; Mon, 18 Jul 2011 02:53:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qihhg-0007wY-1K for emacs-devel@gnu.org; Mon, 18 Jul 2011 02:53:21 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:47543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qihhf-0007wU-Nt for emacs-devel@gnu.org; Mon, 18 Jul 2011 02:53:19 -0400 Original-Received: from eliz by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Qihhf-0002sK-CC; Mon, 18 Jul 2011 02:53:19 -0400 In-reply-to: <4E2377E2.1020804@gmail.com> (message from Daniel Colascione on Sun, 17 Jul 2011 17:01:38 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:142088 Archived-At: Could you please explain this part of the patch: > /* Create the dialog with PROMPT as title, using DIR as initial > directory and using "*" as pattern. */ > - dir = Fexpand_file_name (dir, Qnil); > - strncpy (init_dir, SDATA (ENCODE_FILE (dir)), MAX_PATH); > - init_dir[MAX_PATH] = '\0'; > - unixtodos_filename (init_dir); > - > - if (STRINGP (default_filename)) > - { > - char *file_name_only; > - char *full_path_name = SDATA (ENCODE_FILE (default_filename)); > - > - unixtodos_filename (full_path_name); > - > - file_name_only = strrchr (full_path_name, '\\'); > - if (!file_name_only) > - file_name_only = full_path_name; > - else > - file_name_only++; > - > - strncpy (filename, file_name_only, MAX_PATH); > - filename[MAX_PATH] = '\0'; > - } > - else > - filename[0] = '\0'; > - > - /* The code in file_dialog_callback that attempts to set the text > - of the file name edit window when handling the CDN_INITDONE > - WM_NOTIFY message does not work. Setting filename to "Current > - Directory" in the only_dir_p case here does work however. */ > - if (filename[0] == 0 && ! NILP (only_dir_p)) > - strcpy (filename, "Current Directory"); > + to_unicode (Fexpand_file_name (dir, Qnil), &dir); > + > + to_unicode (build_string ("All Files (*.*)\0*.*\0Directories\0*|*\0\0"), > + &filter); AFAICT, to_unicode encodes the file name in UTF-16. If so, this will not work in the native Windows build, because it does not use Unicode APIs for file names. In the original code, ENCODE_FILE would use the ANSI encoding, not UTF-16. So, unless I'm missing something, the replacement is not equivalent to the original, and could break the native build. If my analysis is correct, could you please explain the rationale for this change?