50 Commits
Author SHA1 Message Date
Egor Bogatov 32321375ee Implement WriteCore and ReadCore in DeflateStream (#16951)
No idea why these were left unimplemented (probably were not used at that point).
Fixes #16950
2019-09-20 12:06:45 +02:00
Steve Pfister 7c4c30ec00 Implement Read and WriteAsyncMemory in Mono DeflateStream
Resolves https://github.com/mono/mono/issues/16122

Since we put in the corefx version of GZipStream, it is expected that
our version of DeflateStream actually implements Write+ReadAsyncMemory.

This change does that by just calling the plain WriteAsync & ReadAsync
methods until we decide (or not) to pull in the corefx DeflateStream.
2019-08-28 16:20:09 -04:00
Egor Bogatov 0fbc5d8315 DeflateStream: check IsInvalid before disposing (#16048) 2019-08-06 14:53:24 +02:00
Egor Bogatov d1700fc93f Add finalizer to DeflateStream (#15879)
Fixes #15825
2019-08-05 13:20:29 +02:00
Kenneth Pouncey 0562fde077 [wasm][bcl] Use zlib for DeflateStream on WASM profile (#14308)
* [wasm][bcl] Use zlib for DeflateStream on WASM profile

- Add `-s USE-ZLIB=1` flag for the emscripten build of `mono.js`
- Add new `zlib-helper` module build that is included in the `mono` wasm build.
- This adds roughly 300 kb to the size.

* Add zlib calls to `icall` for `WASM` profile

* Address comments use `TARGET_WASM` instead of `HOST_WASM`

* Hack around JS exception: RuntimeError: indirect call signature mismatch

- Instead of using the function pointer from DeflateStream (Marshal.GetFunctionPointerForDelegate) obtain the callback functions from the object itself.

* Update error messages and add exception parameter to `mono_runtime_invoke`.

* Add `mono/support` zlib include sources files to make `package` target.

* Add `zlib-helper` build to packager.

- Note: Right now only supports zlib build from mono tree build.
- Add `zlibtest.cs` scenario to compress and uncompress using DeflateStream and GZip.
- Add test to make file to build and run aot version of ziplibtest.

* Add copy of zlib header support files to `package-wasm-runtime`

- The support library is not built for wasm but the zlib include files are needed to build support during wasm build.
- See mono.js build and the use of the `-s USE_ZLIB=1` flag.
- The include files will be used in packager.exe to build zlib support for wasm.

* Use the zlib includes from support to build the zlib support.

* Setup base tests for testing System.IO.Compression integration

* Formatting

* Add more ziparchive tests

* Formatting and indentation

* Add more Zip tests

* Add more tests.

- Add more tests for ZipArchive.
- Add tests for Deflate - small, large and very large strings.
- Add tests for GZipStream - small, large and very large strings.

* Fix merge of EMCC_FLAGS

* Add new option to packager to enable the use of zlib

-   --enable-zlib (enable the use of zlib for System.IO.Compression support)
        type: bool  default: false

- update packager doc

* Address review comments

- Change `enable-zlib` to `zlib`
2019-06-06 05:07:56 +02:00
Marius Ungureanuandbaulig 6e28675564 Update mcs/class/System/System.IO.Compression/DeflateStream.cs
Co-Authored-By: baulig <[email protected]>
2019-01-17 15:00:25 +01:00
Martin Baulig 5068c7cc13 [System.IO.Compression]: Correctly handle exceptions in inner stream. #12205.
DeflateStream now correctly handles exceptions thrown by it's inner stream and
rethrows them after returning from native code.
2019-01-17 15:00:25 +01:00
Ludovic Henry 5187b0bdaa [sdks] Compile support/{zlib-helper,nl}.c so XI/XM/XA does not have to cherry-pick them (#11599)
* [sdks] Compile support/{zlib-helper,nl}.c so XA doesn't have to cherry-pick it.

* [sdks] Fix ios and android compilation and use of tests

The tests are already built as part of the archive, so there is no need to recompile them. We just need to pick them from the right folder.
2018-11-13 22:06:04 -05:00
Filip Navara fe98c3b9a1 Ensure the finalization in DeflateStream is performed in the correct order. (#10330)
* Ensure the finalization of SafeHandle and GCHandle in DeflateStreamNative is performed in the correct order.

* Do not access BaseStream from finalizer.
2018-09-06 18:50:50 -04:00
Marek Safar b3881a418f CoreFX update 2018-04-12 11:39:27 +02:00
Marek Safar 1cc3bc58be Bump corefx 2017-11-23 22:45:15 +01:00
Ludovic Henry 33eb71ae07 [System] Fix DeflateStream crash with high concurrency on Read/Write/Close (#5994)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56727
2017-11-13 15:16:03 -05:00
Marek Safar 411a37af27 Bump corefx 2017-10-05 22:43:54 +02:00
Andi McClure 2ffb9a35a7 Combined cherrypick of changes between mono-4.8.0-branch and orbis-branch-30
ORBIS #ifdefs in BCL, exclude several files and assembly directories
from the orbis build, HAVE_LOCALTIME_R define in C.
2017-03-30 17:57:00 -04:00
Alexander Köplinger e0e93f396d [System] Rename method parameters to match .NET contract 2017-03-16 13:02:09 +01:00
Marek Safar cb2dfe18fd [System] Use GZipStream from corefx 2017-01-04 23:37:19 +01:00
Marek Safar 09774416fd [System] Keep single MonoPInvokeCallbackAttribute implementation 2017-01-03 16:01:24 +01:00
Alexander Köplinger 9f5b8c4cf2 Rename the mobile_static profile to aot_only
We decided it's a better name since we're using the profile to
test FullAOT scenarios on desktop (as opposed to the mobile profiles).

While doing the rename I saw that a lot of the #ifdefs were using
MOBILE_STATIC even though the code should actually be included/excluded
in all FullAOT scenarios, e.g. System.Reflection.Emit. I replaced those
cases with FULL_AOT_RUNTIME instead.

For cases where code is specific to this profile, I added a new
AOT_ONLY_DESKTOP define.
2016-11-24 17:40:54 +01:00
Alexander Köplinger c4692001a9 [bcl] Fix method parameter names to match .NET
The names were fixed only for the subset of methods that are included in netstandard,
and in cases where netstandard differs from Desktop .NET we match with .NET.
2016-08-26 17:49:03 +02:00
Alexander Kyte accce74440 [mobile_static] Use MonoPInvokeCallbackAttribute on MobileStatic 2016-07-02 21:33:08 -04:00
Gabriel Garcia 3ea808102c Protect against overflow
https://github.com/mono/mono/pull/1682#commitcomment-10578913
2015-04-05 17:11:01 -04:00
Gabriel Garcia 7e9f2d4563 Check for buffer overrun 2015-04-05 11:41:36 -04:00
Zoltan Varga c1b4366932 [bcl] Remove NET_4_5 defines from class libs. 2015-01-13 16:34:23 -05:00
João Matos f39bebefea [System] Implemented .NET 4.5 overloads for GZipStream and DeflateStream.
Fixes xambug #21982.
2014-08-12 16:17:08 +01:00
marcos henrich 6a6631d883 Removed DeflateStream.UnmanagedRead Read loop. Fixes #19313.
If the base_stream was a NetworkStream UnmanagedRead loop would call base_stream.Read a second time and block until one byte was available to return. Without the loop UnmanagedRead will only read the base_stream once.
2014-06-02 08:22:33 +01:00
Marek Safar f81e067e01 Fixes GZipStream dispose order. Fixes #14032 2013-08-16 23:16:23 +02:00
Marek Safar f2524362fc Always release DeflateStream unmanaged resources. Fixes #13742 2013-08-08 10:29:05 +02:00
Martin Baulig 171c946ecd Add System.IO.Compression.FileSystem stubs. 2013-03-12 17:22:59 -04:00
Miguel de Icaza f48ceb9860 [System] Removal of the NET_2_0 in the source code
Modulo the GUID in the assembly and the GUID embedded in some
field initializers that use the assembly GUID for their name, the
assemblies are idential before and after the patch.
2012-06-02 13:16:40 -04:00
Jonathan Pryor 825512bff9 [monodroid] Look for zlib support functions from __Internal.
Partial fix for #660928; the rest of the fix will require embedding
the zlib functions within libmonodroid.so.
2011-01-07 11:59:44 -05:00
Gonzalo Paniagua Javier e8fee34fc7 2010-04-14 Gonzalo Paniagua Javier <[email protected]>
* DeflateStream.cs: the delegate uses Cdecl calling convention on
	windows too. Fixes bug #574713.


svn path=/trunk/mcs/; revision=155395
2010-04-14 14:17:29 +00:00
Gonzalo Paniagua Javier 32c96fedba 2010-04-07 Gonzalo Paniagua Javier <[email protected]>
* DeflateStream.cs: always use Cdecl, since the library is compiled
	using that calling convention in windows too.


svn path=/trunk/mcs/; revision=155017
2010-04-07 22:57:36 +00:00
Gonzalo Paniagua Javier cf0257d56c 2010-03-09 Gonzalo Paniagua Javier <[email protected]>
* DeflateStream.cs: don't call unmanaged code when the byte count
	is 0. Fixes bug #586870.


svn path=/trunk/mcs/; revision=153385
2010-03-10 04:46:25 +00:00
Geoff Norton bfd2f646b9 2009-12-23 Geoff Norton <[email protected]>
* DeflateStream.cs: Ensure our callbacks go into the correct
	static methods.

svn path=/trunk/mcs/; revision=148867
2009-12-23 17:05:08 +00:00
Geoff Norton 94769ddb14 fix monotouch build
svn path=/trunk/mcs/; revision=141980
2009-09-15 18:19:33 +00:00
Jonathan Pryor 77f951b6f1 * DeflateStream.cs: MonoTouch reverse callbacks need to be static
methods and be annotated with [MonoPInvokeCallback].  Get things
	  working with these limitations.

svn path=/trunk/mcs/; revision=141905
2009-09-14 18:25:28 +00:00
Geoff Norton d0774b2d66 fix thebuild on monotouch
svn path=/trunk/mcs/; revision=141692
2009-09-10 20:30:02 +00:00
Gonzalo Paniagua Javier faaad5d9b0 do not nullify deflateStream
svn path=/trunk/mcs/; revision=138301
2009-07-21 15:28:56 +00:00
Gonzalo Paniagua Javier 8c052b4698 2009-07-20 Gonzalo Paniagua Javier <[email protected]>
* GzipStream.cs: fixed Dispose (bool).
	* DeflateStream.cs: simplify the interface with unmanaged code, big
	reduction of managaed<->unmanaged round trips.
	Also fixes bug #523418.


svn path=/trunk/mcs/; revision=138252
2009-07-21 02:24:53 +00:00
Gert Driesen 6b10903f70 * DeflateStreamTest.cs: Improved CanRead, CanSeek and CanWrite tests.
Added test for bug #327480. Code formatting.
* GzipStreamTest.cs: Improved CanRead, CanSeek and CanWrite tests.
Code formatting.
* DeflateStream.cs: Avoid double free. Fixes bug #327480.

svn path=/trunk/mcs/; revision=86218
2007-09-22 16:50:02 +00:00
Miguel de Icaza 72be24a388 Fix signature, fixes bug 82019, patch from Jason Madden
svn path=/trunk/mcs/; revision=81493
2007-07-06 16:26:20 +00:00
Konstantin Triger 3a39a3277a remove TARGET_JVM defines
svn path=/trunk/mcs/; revision=72291
2007-02-05 12:33:17 +00:00
Zoltan Varga 7bca2efa27 2006-10-22 Zoltan Varga <[email protected]>
* DeflateStream.cs: Throw a more meaningfull exception when zlib initialization
	fails.

svn path=/trunk/mcs/; revision=66884
2006-10-22 14:19:49 +00:00
Andrew Skiba c1c57cd5c6 TARGET_JVM
svn path=/trunk/mcs/; revision=66041
2006-09-28 14:46:10 +00:00
Atsushi Eno 63723f518b 2006-04-04 Atsushi Enomoto <[email protected]>
* DeflateStream.cs GzipStream.cs : updated API to 2.0 RTM.
	  Dispose() should certainly release resources than the finalizer.


svn path=/trunk/mcs/; revision=58992
2006-04-04 00:45:46 +00:00
Miguel de Icaza a5bd130af9 2006-03-11 Miguel de Icaza <[email protected]>
* Uri.cs: Pragma disable warning 612 (Obsolete methods are being
	used by us internally).

	Ponder: should we instead move our methods to use new versions of
	the Obsoleted ones?

2006-03-11  Miguel de Icaza  <[email protected]>

	* CodeNamespaceImportCollection.cs: It turns out that a lot of the
	errors flagged with "!" were just missing explicit interface
	implementations.  

	Implement.

2006-03-11  Miguel de Icaza  <[email protected]>

	* CodeDomConfigurationHandler.cs: Comment out unused methods. 

	* TempFileCollection.cs: Implement explicitly some interface
	methods to get rid of the "!" errors on CorCompare.

2006-03-11  Miguel de Icaza  <[email protected]>

	* Queue.cs: Flag as serializable.

	* LinkedList.cs (OnDeserialization): Fix signature. 

	* SortedList.cs: Implement explicitly a few methods that were
	flagged by corcompare. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* IOrderedDictionary.cs: Flag GetEnumerator as a "new" method to
	avoid warning.

2006-03-11  Miguel de Icaza  <[email protected]>

	* ConfigurationSettings.cs (ChangeConfigurationSettings): Make
	internal to avoid warnings.  This routine is called from
	System.Web with MethodInfo.Invoke.

2006-03-11  Miguel de Icaza  <[email protected]>

	* DeflateStream.cs: Comment out DllImport that was not being
	used. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* y

	* SerialPort.cs: Remove unused variable (writeBuffer). 

	* SerialPortStream.cs (Dispose): override, not new.

2006-03-11  Miguel de Icaza  <[email protected]>

	* WebClient.cs: Only expose the right methods to avoid warnings. 

	* FtpDataStream.cs (Dispose): Fix signature.

	* FtpWebResponse.cs: Comment out keepAlive field (unused, sounds
	like we are missing features here).

	* IPAddress.cs: Move m_HashCode property to the end, and set
	pragmas to disable warnings.

2006-03-11  Miguel de Icaza  <[email protected]>

	* MailAddress.cs: Comment out unused field to remove warning. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* NetworkChange.cs: Use pragmas to eliminate warnings from events
	that we do not trigger yet.

	This is a candidate for using Aaron's NetworkManager code.  But
	would make us depend on d-bus.

	* NetworkInformationException.cs: Use error_code for ErrorCode,
	instead of NativeErrorCode.   Fixes warning. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* AuthenticatedStream.cs: Fixed normative parameter names (yes, we
	need to do this everywhere one day).

	(Close): actually obey the "leaveInnerStreamOpen" setting from the
	constructor. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* NetworkStream.cs (Dispose): Use the right signature depending on
	the profile being built.

2006-03-11  Miguel de Icaza  <[email protected]>

	* X509Chain.cs: Flagged member as internal to avoid unused warning.

	* X500DistinguishedName.cs: Comment out unused names and move
	temporary unused variables inside the comments that were removed 



svn path=/trunk/mcs/; revision=57836
2006-03-11 19:07:56 +00:00
Sebastien Pouliot 2b2e8bcdd9 2005-05-18 Sebastien Pouliot <[email protected]>
* DeflateStream.cs: Fixed some changed/missing exceptions.
	* GzipStream.cs: Renamed to GZipStream (from beta2).


svn path=/trunk/mcs/; revision=44714
2005-05-18 19:40:02 +00:00
Raja R Harinath ebd4a7df44 In Test:
* System.IO.Compression/GzipStreamTest.cs: Fix compile errors.
	* System.IO.Compression/GzipStreamTest.cs: Likewise.

In System.IO.Compression:
	* DeflateStream.cs, GzipStream.cs, CompressionMode.cs: Make class public.

svn path=/trunk/mcs/; revision=37025
2004-12-03 15:11:36 +00:00
Martin Baulig d1c2d41338 2004-11-10 Martin Baulig <martin@localhost>
* DeflateStream.cs, GzipStream.cs: `System.IO.Stream.Length' doesn't
	have any setter.

svn path=/trunk/mcs/; revision=35951
2004-11-10 06:48:55 +00:00
Miguel de Icaza ff0d74eeb5 Add System.IO.Compression from Chris Lahey ([email protected])
svn path=/trunk/mcs/; revision=34610
2004-10-02 18:48:07 +00:00