public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/ibuclaw/heads/mingw)] Questionable fix (fgetwc is defined in C library, and this implementation does not really work with
@ 2021-04-16  1:04 Iain Buclaw
  0 siblings, 0 replies; 4+ messages in thread
From: Iain Buclaw @ 2021-04-16  1:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:16d2afd6e369d50bfaea9b00cb3451b3a7b7df23

commit 16d2afd6e369d50bfaea9b00cb3451b3a7b7df23
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sun Apr 11 20:56:48 2021 +0200

    Questionable fix (fgetwc is defined in C library, and this implementation does not really work with wchar_t)

Diff:
---
 libphobos/libdruntime/core/stdc/stdio.d | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d
index 6cd7851f96c..dab5ba8d7b2 100644
--- a/libphobos/libdruntime/core/stdc/stdio.d
+++ b/libphobos/libdruntime/core/stdc/stdio.d
@@ -1486,6 +1486,35 @@ else version (CRuntime_Microsoft)
         else
             return _filbuf(fp);
     }
+    ///
+    int _fputwc_nolock(int c, FILE* fp)
+    {
+        pragma(inline, true);
+        fp._cnt = fp._cnt - 1;
+        if (fp._cnt >= 0)
+        {
+            immutable ch = cast(char)c;
+            *fp._ptr = ch;
+            fp._ptr = fp._ptr + 1;
+            return ch & 0xFF;
+        }
+        else
+            return _flsbuf(c, fp);
+    }
+    ///
+    int _fgetwc_nolock(FILE* fp)
+    {
+        pragma(inline, true);
+        fp._cnt = fp._cnt - 1;
+        if (fp._cnt >= 0)
+        {
+            immutable ch = *fp._ptr;
+            fp._ptr = fp._ptr + 1;
+            return ch & 0xFF;
+        }
+        else
+            return _filbuf(fp);
+    }
   }
   else
   {
@@ -1493,11 +1522,11 @@ else version (CRuntime_Microsoft)
     int _fputc_nolock(int c, FILE* fp);
     ///
     int _fgetc_nolock(FILE* fp);
-  }
     ///
     int _fputwc_nolock(int c, FILE* fp);
     ///
     int _fgetwc_nolock(FILE* fp);
+  }
     ///
     void _lock_file(FILE* fp);
     ///


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/ibuclaw/heads/mingw)] Questionable fix (fgetwc is defined in C library, and this implementation does not really work with
@ 2021-04-17 20:43 Iain Buclaw
  0 siblings, 0 replies; 4+ messages in thread
From: Iain Buclaw @ 2021-04-17 20:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:75cf7d9dcae04b11f5941ca5e940a4ef30010211

commit 75cf7d9dcae04b11f5941ca5e940a4ef30010211
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sun Apr 11 20:56:48 2021 +0200

    Questionable fix (fgetwc is defined in C library, and this implementation does not really work with wchar_t)

Diff:
---
 libphobos/libdruntime/core/stdc/stdio.d | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d
index 6cd7851f96c..dab5ba8d7b2 100644
--- a/libphobos/libdruntime/core/stdc/stdio.d
+++ b/libphobos/libdruntime/core/stdc/stdio.d
@@ -1486,6 +1486,35 @@ else version (CRuntime_Microsoft)
         else
             return _filbuf(fp);
     }
+    ///
+    int _fputwc_nolock(int c, FILE* fp)
+    {
+        pragma(inline, true);
+        fp._cnt = fp._cnt - 1;
+        if (fp._cnt >= 0)
+        {
+            immutable ch = cast(char)c;
+            *fp._ptr = ch;
+            fp._ptr = fp._ptr + 1;
+            return ch & 0xFF;
+        }
+        else
+            return _flsbuf(c, fp);
+    }
+    ///
+    int _fgetwc_nolock(FILE* fp)
+    {
+        pragma(inline, true);
+        fp._cnt = fp._cnt - 1;
+        if (fp._cnt >= 0)
+        {
+            immutable ch = *fp._ptr;
+            fp._ptr = fp._ptr + 1;
+            return ch & 0xFF;
+        }
+        else
+            return _filbuf(fp);
+    }
   }
   else
   {
@@ -1493,11 +1522,11 @@ else version (CRuntime_Microsoft)
     int _fputc_nolock(int c, FILE* fp);
     ///
     int _fgetc_nolock(FILE* fp);
-  }
     ///
     int _fputwc_nolock(int c, FILE* fp);
     ///
     int _fgetwc_nolock(FILE* fp);
+  }
     ///
     void _lock_file(FILE* fp);
     ///


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/ibuclaw/heads/mingw)] Questionable fix (fgetwc is defined in C library, and this implementation does not really work with
@ 2021-04-13 20:42 Iain Buclaw
  0 siblings, 0 replies; 4+ messages in thread
From: Iain Buclaw @ 2021-04-13 20:42 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2306d6f5cc23647d8f98e29bdb36b8530cfff4cc

commit 2306d6f5cc23647d8f98e29bdb36b8530cfff4cc
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sun Apr 11 20:56:48 2021 +0200

    Questionable fix (fgetwc is defined in C library, and this implementation does not really work with wchar_t)

Diff:
---
 libphobos/libdruntime/core/stdc/stdio.d | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d
index 6cd7851f96c..dab5ba8d7b2 100644
--- a/libphobos/libdruntime/core/stdc/stdio.d
+++ b/libphobos/libdruntime/core/stdc/stdio.d
@@ -1486,6 +1486,35 @@ else version (CRuntime_Microsoft)
         else
             return _filbuf(fp);
     }
+    ///
+    int _fputwc_nolock(int c, FILE* fp)
+    {
+        pragma(inline, true);
+        fp._cnt = fp._cnt - 1;
+        if (fp._cnt >= 0)
+        {
+            immutable ch = cast(char)c;
+            *fp._ptr = ch;
+            fp._ptr = fp._ptr + 1;
+            return ch & 0xFF;
+        }
+        else
+            return _flsbuf(c, fp);
+    }
+    ///
+    int _fgetwc_nolock(FILE* fp)
+    {
+        pragma(inline, true);
+        fp._cnt = fp._cnt - 1;
+        if (fp._cnt >= 0)
+        {
+            immutable ch = *fp._ptr;
+            fp._ptr = fp._ptr + 1;
+            return ch & 0xFF;
+        }
+        else
+            return _filbuf(fp);
+    }
   }
   else
   {
@@ -1493,11 +1522,11 @@ else version (CRuntime_Microsoft)
     int _fputc_nolock(int c, FILE* fp);
     ///
     int _fgetc_nolock(FILE* fp);
-  }
     ///
     int _fputwc_nolock(int c, FILE* fp);
     ///
     int _fgetwc_nolock(FILE* fp);
+  }
     ///
     void _lock_file(FILE* fp);
     ///


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/ibuclaw/heads/mingw)] Questionable fix (fgetwc is defined in C library, and this implementation does not really work with
@ 2021-04-11 18:58 Iain Buclaw
  0 siblings, 0 replies; 4+ messages in thread
From: Iain Buclaw @ 2021-04-11 18:58 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6724c01a716b8bf5efaf6a42148cc6f9ea6807f2

commit 6724c01a716b8bf5efaf6a42148cc6f9ea6807f2
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sun Apr 11 20:56:48 2021 +0200

    Questionable fix (fgetwc is defined in C library, and this implementation does not really work with wchar_t)

Diff:
---
 libphobos/libdruntime/core/stdc/stdio.d | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d
index 6cd7851f96c..dab5ba8d7b2 100644
--- a/libphobos/libdruntime/core/stdc/stdio.d
+++ b/libphobos/libdruntime/core/stdc/stdio.d
@@ -1486,6 +1486,35 @@ else version (CRuntime_Microsoft)
         else
             return _filbuf(fp);
     }
+    ///
+    int _fputwc_nolock(int c, FILE* fp)
+    {
+        pragma(inline, true);
+        fp._cnt = fp._cnt - 1;
+        if (fp._cnt >= 0)
+        {
+            immutable ch = cast(char)c;
+            *fp._ptr = ch;
+            fp._ptr = fp._ptr + 1;
+            return ch & 0xFF;
+        }
+        else
+            return _flsbuf(c, fp);
+    }
+    ///
+    int _fgetwc_nolock(FILE* fp)
+    {
+        pragma(inline, true);
+        fp._cnt = fp._cnt - 1;
+        if (fp._cnt >= 0)
+        {
+            immutable ch = *fp._ptr;
+            fp._ptr = fp._ptr + 1;
+            return ch & 0xFF;
+        }
+        else
+            return _filbuf(fp);
+    }
   }
   else
   {
@@ -1493,11 +1522,11 @@ else version (CRuntime_Microsoft)
     int _fputc_nolock(int c, FILE* fp);
     ///
     int _fgetc_nolock(FILE* fp);
-  }
     ///
     int _fputwc_nolock(int c, FILE* fp);
     ///
     int _fgetwc_nolock(FILE* fp);
+  }
     ///
     void _lock_file(FILE* fp);
     ///


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-17 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16  1:04 [gcc(refs/users/ibuclaw/heads/mingw)] Questionable fix (fgetwc is defined in C library, and this implementation does not really work with Iain Buclaw
  -- strict thread matches above, loose matches on Subject: below --
2021-04-17 20:43 Iain Buclaw
2021-04-13 20:42 Iain Buclaw
2021-04-11 18:58 Iain Buclaw

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).