diff options
author | Zoltan Varga <vargaz@gmail.com> | 2015-02-24 00:08:39 +0300 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2015-02-24 03:47:52 +0300 |
commit | 7aa521b02cd668d64c99df807e3cd9c7ff15c60e (patch) | |
tree | d07e734c3f7f2e442fcec7e2bae7fb1c6201d7dd /mcs/class/corlib | |
parent | f3f179970042d9bf6890a0d3b55e8e90f58f8407 (diff) |
[bcl] Fix Console support on ios, the TextWriter class from the reference sources called TextWriter:Write(char), so stdout was never flushed.
Diffstat (limited to 'mcs/class/corlib')
-rw-r--r-- | mcs/class/corlib/Makefile | 2 | ||||
-rw-r--r-- | mcs/class/corlib/System/Console.iOS.cs | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index 1c17c808861..c48713b2315 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -6,7 +6,7 @@ export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib LIBRARY = corlib.dll LIBRARY_NAME = mscorlib.dll -REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,PFX_LEGACY_3_5 -d:MONO -d:MONO_HYBRID_ENCODING_SUPPORT +REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,PFX_LEGACY_3_5 -d:MONO -d:MONO_HYBRID_ENCODING_SUPPORT,PLATFORM_UNIX LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%) #LIBRARY_USE_INTERMEDIATE_FILE = yes diff --git a/mcs/class/corlib/System/Console.iOS.cs b/mcs/class/corlib/System/Console.iOS.cs index d14271c623a..61534deffa5 100644 --- a/mcs/class/corlib/System/Console.iOS.cs +++ b/mcs/class/corlib/System/Console.iOS.cs @@ -80,6 +80,17 @@ namespace System { catch (Exception) { } } + + /* Called from TextWriter:WriteLine(string) */ + public override void Write(char[] buffer, int index, int count) { + try { + sb.Append (buffer); + if (buffer != null && buffer.Length >= CoreNewLine.Length && EndsWithNewLine (buffer)) + Flush (); + } + catch (Exception) { + } + } bool EndsWithNewLine (string value) { @@ -90,6 +101,16 @@ namespace System { return true; } + + bool EndsWithNewLine (char[] value) + { + for (int i = 0, v = value.Length - CoreNewLine.Length; i < CoreNewLine.Length; ++i, ++v) { + if (value [v] != CoreNewLine [i]) + return false; + } + + return true; + } public override void WriteLine () { |