From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28487 invoked by alias); 9 Aug 2002 09:19:23 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 28479 invoked from network); 9 Aug 2002 09:19:21 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 9 Aug 2002 09:19:21 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g79966l19955 for ; Fri, 9 Aug 2002 05:06:07 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g799JJu03731 for ; Fri, 9 Aug 2002 05:19:19 -0400 Received: from cygbert.vinschen.de (vpn50-14.rdu.redhat.com [172.16.50.14]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g799JIe19358 for ; Fri, 9 Aug 2002 02:19:18 -0700 Received: (from corinna@localhost) by cygbert.vinschen.de (8.11.6/8.9.3/Linux sendmail 8.9.3) id g799JFI09518 for gdb-patches@sources.redhat.com; Fri, 9 Aug 2002 11:19:15 +0200 Date: Fri, 09 Aug 2002 02:19:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: [RFA]: Change all fopen modes to binary in cli-dump.c [was Re: [RFA] cli/cli-dump.c: Write dump always in binary mode on Cygwin] Message-ID: <20020809111915.M4229@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <3D52A2E9.8070005@ges.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D52A2E9.8070005@ges.redhat.com> User-Agent: Mutt/1.3.22.1i X-SW-Source: 2002-08/txt/msg00210.txt.bz2 On Thu, Aug 08, 2002 at 12:57:13PM -0400, Andrew Cagney wrote: > BTW, > > NickC's just pointed Corinna and I at include/fopen-{bin,same}.c. I > guess GDB could just use those when it wants a binary file open. In the light of this I had a closer look to cli/cli-dump.c and found that there are a lot of constand "w"'s "a"'s and "r"'s used. So the previous patch was pretty incomplete. The below patch substitutes every constant fopen mode in cli/cli-dump.c by the appropriate binary open mode define from include/fopen-bin.h. Ok to check in? Corinna 2002-08-09 Corinna Vinschen * cli/cli-dump.c: Change fopen modes to use binary open modes as defined in include/fopen-bin.h throughout. Index: cli/cli-dump.c =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-dump.c,v retrieving revision 1.5 diff -u -p -r1.5 cli-dump.c --- cli/cli-dump.c 7 Aug 2002 08:52:24 -0000 1.5 +++ cli/cli-dump.c 9 Aug 2002 09:12:48 -0000 @@ -360,61 +360,61 @@ dump_filetype (char *cmd, char *mode, ch static void dump_srec_memory (char *args, int from_tty) { - dump_memory_to_file (args, "w", "srec"); + dump_memory_to_file (args, FOPEN_WB, "srec"); } static void dump_srec_value (char *args, int from_tty) { - dump_value_to_file (args, "w", "srec"); + dump_value_to_file (args, FOPEN_WB, "srec"); } static void dump_ihex_memory (char *args, int from_tty) { - dump_memory_to_file (args, "w", "ihex"); + dump_memory_to_file (args, FOPEN_WB, "ihex"); } static void dump_ihex_value (char *args, int from_tty) { - dump_value_to_file (args, "w", "ihex"); + dump_value_to_file (args, FOPEN_WB, "ihex"); } static void dump_tekhex_memory (char *args, int from_tty) { - dump_memory_to_file (args, "w", "tekhex"); + dump_memory_to_file (args, FOPEN_WB, "tekhex"); } static void dump_tekhex_value (char *args, int from_tty) { - dump_value_to_file (args, "w", "tekhex"); + dump_value_to_file (args, FOPEN_WB, "tekhex"); } static void dump_binary_memory (char *args, int from_tty) { - dump_memory_to_file (args, "w", "binary"); + dump_memory_to_file (args, FOPEN_WB, "binary"); } static void dump_binary_value (char *args, int from_tty) { - dump_value_to_file (args, "w", "binary"); + dump_value_to_file (args, FOPEN_WB, "binary"); } static void append_binary_memory (char *args, int from_tty) { - dump_memory_to_file (args, "a", "binary"); + dump_memory_to_file (args, FOPEN_AB, "binary"); } static void append_binary_value (char *args, int from_tty) { - dump_value_to_file (args, "a", "binary"); + dump_value_to_file (args, FOPEN_AB, "binary"); } struct dump_context @@ -442,7 +442,7 @@ add_dump_command (char *name, void (*fun c->completer = filename_completer; d = XMALLOC (struct dump_context); d->func = func; - d->mode = "wb"; + d->mode = FOPEN_WB; set_cmd_context (c, d); c->func = call_dump_func; @@ -450,7 +450,7 @@ add_dump_command (char *name, void (*fun c->completer = filename_completer; d = XMALLOC (struct dump_context); d->func = func; - d->mode = "ab"; + d->mode = FOPEN_AB; set_cmd_context (c, d); c->func = call_dump_func; @@ -547,7 +547,7 @@ restore_section_callback (bfd *ibfd, ase static void restore_binary_file (char *filename, struct callback_data *data) { - FILE *file = fopen_with_cleanup (filename, "r"); + FILE *file = fopen_with_cleanup (filename, FOPEN_RB); int status; char *buf; long len; -- Corinna Vinschen Cygwin Developer Red Hat, Inc. mailto:vinschen@redhat.com