unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Colascione <dan.colascione@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] system-type cygwin with window-system w32
Date: Mon, 18 Jul 2011 02:53:19 -0400	[thread overview]
Message-ID: <E1Qihhf-0002sK-CC@fencepost.gnu.org> (raw)
In-Reply-To: <4E2377E2.1020804@gmail.com> (message from Daniel Colascione on Sun, 17 Jul 2011 17:01:38 -0700)

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?



  parent reply	other threads:[~2011-07-18  6:53 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18  0:01 [PATCH] system-type cygwin with window-system w32 Daniel Colascione
2011-07-18  0:06 ` Daniel Colascione
2011-07-18  6:13 ` Eli Zaretskii
2011-07-18  6:29   ` Daniel Colascione
2011-07-18  8:53     ` Eli Zaretskii
2011-07-18 10:10       ` Daniel Colascione
2011-07-18 16:04         ` Paul Eggert
2011-07-18 16:19         ` Eli Zaretskii
2011-07-18 13:55     ` Jason Rumney
2011-07-18 16:13     ` Paul Eggert
2011-07-18 17:34       ` Andreas Schwab
2011-07-18  6:53 ` Eli Zaretskii [this message]
2011-07-18  7:01   ` Daniel Colascione
2011-07-18  9:04     ` Eli Zaretskii
2011-07-18  9:41       ` Daniel Colascione
2011-07-18 10:10         ` Eli Zaretskii
2011-07-18 10:49           ` Daniel Colascione
2011-07-18 11:22             ` Juanma Barranquero
2011-07-18 16:41             ` Eli Zaretskii
2011-07-18 16:48               ` Daniel Colascione
2011-07-18 17:08                 ` Eli Zaretskii
2011-07-18 22:08             ` Richard Stallman
2011-07-18 22:24               ` Daniel Colascione
2011-07-18 22:45                 ` David Kastrup
2011-07-18 22:56                   ` Daniel Colascione
2011-07-19 16:49                     ` Richard Stallman
2011-07-21  1:44               ` Lennart Borgman
2011-07-18 22:08             ` Richard Stallman
2011-07-18 13:31       ` Jason Rumney
2011-07-18 13:46         ` Richard Riley
2011-07-18  8:42 ` Eli Zaretskii
2011-07-18 10:33   ` Daniel Colascione
2011-07-18 16:29     ` Eli Zaretskii
2011-07-18 17:04       ` Daniel Colascione
2011-07-18 15:54 ` Stefan Monnier
2011-07-18 15:55 ` Stefan Monnier
2011-07-18 17:37 ` Andreas Schwab
  -- strict thread matches above, loose matches on Subject: below --
2011-07-18 17:33 grischka
2011-07-18 17:50 ` Daniel Colascione
2011-07-18 18:08   ` Daniel Colascione
2011-07-18 18:52     ` grischka
2011-07-18 19:11       ` Daniel Colascione
2011-07-18 21:01         ` grischka
2011-07-19  2:58           ` Eli Zaretskii
2011-07-19  2:59             ` Daniel Colascione
2011-07-21 17:44           ` Lennart Borgman
2011-07-22  7:30             ` Daniel Colascione
2011-07-22  7:41               ` Lennart Borgman
2011-07-22 21:24                 ` chad
2011-07-22 21:57                   ` Lennart Borgman
2011-07-18 18:38   ` grischka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1Qihhf-0002sK-CC@fencepost.gnu.org \
    --to=eliz@gnu.org \
    --cc=dan.colascione@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).