]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix argument type of read() and write() on windows
authorTonu Naks <naks@adacore.com>
Fri, 15 Aug 2025 10:04:27 +0000 (10:04 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 11 Sep 2025 09:10:47 +0000 (11:10 +0200)
gcc/ada/ChangeLog:

* libgnat/s-crtl.ads: define unsigned
* libgnat/s-crtl__mingw.adb (read, write): change arg type

gcc/ada/libgnat/s-crtl.ads
gcc/ada/libgnat/s-crtl__mingw.adb

index 196b0109ab558a20b194f2e6c1eed5203c74e53d..5ca7fc46849572d07270b1099d5fdb400bbdfb44 100644 (file)
@@ -50,6 +50,9 @@ package System.CRTL is
 
    subtype int is Integer;
 
+   type unsigned is mod 2 ** 32;
+   for unsigned'Size use 32;
+
    type long is range -(2 ** (System.Parameters.long_bits - 1))
                    .. +(2 ** (System.Parameters.long_bits - 1)) - 1;
 
index 6b103597451971c3f0e8316c3fe57659860c127a..8f10cb8c13f47136bd7fb72e1a07be2dbdbe5fef 100644 (file)
@@ -40,10 +40,10 @@ package body System.CRTL is
    function read (fd : int; buffer : chars; count : size_t) return ssize_t
    is
       function read_raw
-        (fd : int; buffer : chars; count : size_t) return int;
+        (fd : int; buffer : chars; count : unsigned) return int;
       pragma Import (C, read_raw, "read");
    begin
-      return ssize_t (read_raw (fd, buffer, count));
+      return ssize_t (read_raw (fd, buffer, unsigned (count)));
    end read;
 
    -----------
@@ -53,10 +53,10 @@ package body System.CRTL is
    function write (fd : int; buffer : chars; count : size_t) return ssize_t
    is
       function write_raw
-        (fd : int; buffer : chars; count : size_t) return int;
+        (fd : int; buffer : chars; count : unsigned) return int;
       pragma Import (C, write_raw, "write");
    begin
-      return ssize_t (write_raw (fd, buffer, count));
+      return ssize_t (write_raw (fd, buffer, unsigned (count)));
    end write;
 
 end System.CRTL;