Commit c45e5332 by Arnaud Charlet

[multiple changes]

2014-07-18  Robert Dewar  <dewar@adacore.com>

	* a-witeio.adb: Minor code reorganization.
	* i-cstrea.ads: Add comment.

2014-07-18  Thomas Quinot  <quinot@adacore.com>

	* s-oscons-tmplt.c (NAME_MAX): Minor cleaup and comment
	clarifications.

From-SVN: r212801
parent adc1de25
2014-07-18 Robert Dewar <dewar@adacore.com> 2014-07-18 Robert Dewar <dewar@adacore.com>
* a-witeio.adb: Minor code reorganization.
* i-cstrea.ads: Add comment.
2014-07-18 Thomas Quinot <quinot@adacore.com>
* s-oscons-tmplt.c (NAME_MAX): Minor cleaup and comment
clarifications.
2014-07-18 Robert Dewar <dewar@adacore.com>
* g-memdum.adb, g-memdum.ads, exp_strm.adb: Minor reformatting. * g-memdum.adb, g-memdum.ads, exp_strm.adb: Minor reformatting.
2014-07-18 Pascal Obry <obry@adacore.com> 2014-07-18 Pascal Obry <obry@adacore.com>
......
...@@ -1082,13 +1082,20 @@ package body Ada.Wide_Text_IO is ...@@ -1082,13 +1082,20 @@ package body Ada.Wide_Text_IO is
FIO.Check_Write_Status (AP (File)); FIO.Check_Write_Status (AP (File));
for K in 1 .. Spacing loop for K in 1 .. Spacing loop
-- We use Put here (rather than Putc) so that we get the proper
-- behavior on windows for output of Wide_String to the console.
Put (File, Wide_Character'Val (LM)); Put (File, Wide_Character'Val (LM));
File.Line := File.Line + 1; File.Line := File.Line + 1;
if File.Page_Length /= 0 if File.Page_Length /= 0 and then File.Line > File.Page_Length then
and then File.Line > File.Page_Length
then -- Same situation as above, use Put instead of Putc
Put (File, Wide_Character'Val (PM)); Put (File, Wide_Character'Val (PM));
File.Line := 1; File.Line := 1;
File.Page := File.Page + 1; File.Page := File.Page + 1;
end if; end if;
...@@ -1242,8 +1249,7 @@ package body Ada.Wide_Text_IO is ...@@ -1242,8 +1249,7 @@ package body Ada.Wide_Text_IO is
Putc (Character'Pos (C), File); Putc (Character'Pos (C), File);
end Out_Char; end Out_Char;
R : int; Discard : int;
pragma Unreferenced (R);
-- Start of processing for Put -- Start of processing for Put
...@@ -1252,7 +1258,7 @@ package body Ada.Wide_Text_IO is ...@@ -1252,7 +1258,7 @@ package body Ada.Wide_Text_IO is
if text_translation_required then if text_translation_required then
set_wide_text_mode (fileno (File.Stream)); set_wide_text_mode (fileno (File.Stream));
R := fputwc (Wide_Character'Pos (Item), File.Stream); Discard := fputwc (Wide_Character'Pos (Item), File.Stream);
else else
WC_Out (Item, File.WC_Method); WC_Out (Item, File.WC_Method);
end if; end if;
......
...@@ -221,13 +221,18 @@ package Interfaces.C_Streams is ...@@ -221,13 +221,18 @@ package Interfaces.C_Streams is
-- Control of Text/Binary Mode -- -- Control of Text/Binary Mode --
--------------------------------- ---------------------------------
-- Is the above section title good enough, given the new addition???
-- If text_translation_required is true, then the following functions may -- If text_translation_required is true, then the following functions may
-- be used to dynamically switch a file from binary to text mode or vice -- be used to dynamically switch a file from binary to text mode or vice
-- versa. These functions have no effect if text_translation_required is -- versa. These functions have no effect if text_translation_required is
-- false (i.e. in normal unix mode). Use fileno to get a stream handle. -- false (i.e. in normal unix mode). Use fileno to get a stream handle.
procedure set_binary_mode (handle : int); procedure set_binary_mode (handle : int);
procedure set_text_mode (handle : int); procedure set_text_mode (handle : int);
-- The following needs documentation ???
procedure set_wide_text_mode (handle : int); procedure set_wide_text_mode (handle : int);
---------------------------- ----------------------------
......
...@@ -80,8 +80,11 @@ pragma Style_Checks ("M32766"); ...@@ -80,8 +80,11 @@ pragma Style_Checks ("M32766");
/* Feature macro definitions */ /* Feature macro definitions */
/* Define _POSIX_SOURCE to get NAME_MAX, PATH_MAX */ /**
#define _POSIX_SOURCE ** Note: we deliberately do not define _POSIX_SOURCE / _POSIX_C_SOURCE
** unconditionally, as on many platforms these macros actually disable
** a number of non-POSIX but useful/required features.
**/
#if defined (__linux__) && !defined (_XOPEN_SOURCE) #if defined (__linux__) && !defined (_XOPEN_SOURCE)
/* For Linux, define _XOPEN_SOURCE to get IOV_MAX */ /* For Linux, define _XOPEN_SOURCE to get IOV_MAX */
...@@ -319,17 +322,22 @@ CND(IOV_MAX, "Maximum writev iovcnt") ...@@ -319,17 +322,22 @@ CND(IOV_MAX, "Maximum writev iovcnt")
/* NAME_MAX is used to compute the allocation size for a struct dirent /* NAME_MAX is used to compute the allocation size for a struct dirent
* passed to readdir() / readdir_r(). However on some systems it is not * passed to readdir() / readdir_r(). However on some systems it is not
* defined, as it is technically a filesystem dependent property that * defined, as it is technically a filesystem dependent property that
* we should retrieve through pathconf(). * we should retrieve through pathconf(). In any case, we do not need a
* precise value but only an upper limit.
*/ */
#ifndef NAME_MAX #ifndef NAME_MAX
# ifdef MAXNAMELEN # ifdef MAXNAMELEN
/* Solaris has no NAME_MAX but defines MAXNAMELEN */ /* Solaris has no NAME_MAX but defines MAXNAMELEN */
# define NAME_MAX MAXNAMELEN # define NAME_MAX MAXNAMELEN
# else # elif defined(PATH_MAX)
/* PATH_MAX (maximum length of a full path name) is a safe last /* PATH_MAX (maximum length of a full path name) is a safe fall back */
* chance fall back.
*/
# define NAME_MAX PATH_MAX # define NAME_MAX PATH_MAX
# elif defined(FILENAME_MAX)
/* Similarly FILENAME_MAX can provide a safe fall back */
# define NAME_MAX FILENAME_MAX
# else
/* Hardcode a reasonably large value as a last chance fallback */
# define NAME_MAX 1024
# endif # endif
#endif #endif
CND(NAME_MAX, "Maximum file name length") CND(NAME_MAX, "Maximum file name length")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment