# "Native" Zlib Implementation Patch

**URL:** <https://www.ruby-forum.com/t/native-zlib-implementation-patch/135505>\
**Category:** IronRuby\
**Created:** [April 22, 2008, 7:01pm UTC](https://www.ruby-forum.com/t/native-zlib-implementation-patch/135505 "2008-04-22T19:01:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamwave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7feea3/32.png) [@dreamwave](https://www.ruby-forum.com/u/dreamwave)\
**Post date:** [April 22, 2008, 7:01pm UTC](https://www.ruby-forum.com/t/native-zlib-implementation-patch/135505/1 "2008-04-22T19:01:39Z")

</div>

A patch implementing Zlib decompression (with GZip decompression  
support) as a built in library has been submitted to RubyForge:  
[http://rubyforge.org/tracker/index.php?func=detail&aid=19711&group\_id=4359&atid=16800](http://rubyforge.org/tracker/index.php?func=detail&aid=19711&group_id=4359&atid=16800)  
. It’s quite a bit faster then trying to use Zliby (this is  
essentially a port of that). It works, though binary files seem to be  
causing some problem, I suspect it’s because of the differences in  
Unicode Strings in the CLR vs non-Unicode strings in ruby 1.8.6.  
Anyway, it’s a start.

–  
Michael L.  
[Polymath Prokrammer]  
[http://blog.prokrams.com](http://blog.prokrams.com)

---

<div class="post-metadata">

**Author:** ![dreamwave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7feea3/32.png) [@dreamwave](https://www.ruby-forum.com/u/dreamwave)\
**Post date:** [April 23, 2008, 2:11am UTC](https://www.ruby-forum.com/t/native-zlib-implementation-patch/135505/2 "2008-04-23T02:11:01Z")

</div>

Michael L.:

> “Native” Zlib Implementation Patch

Thanks for sending this in!

FYI - a few quick pointers about your contribution. No need to take any  
action since I’ve fixed most of them on my machine already.

1. Bangs

Please do your best to incorporate the bangs in your contributions. The  
bangs indicate a non-nullable reference type. I find that it’s best if  
you create a VS macro to insert them - I bind this macro to the CTRL-!  
key:

Sub InsertBang()  
DTE.ActiveDocument.Selection.Text = “/_!_/”  
End Sub

This helps to reinforce in your mind (and in the mind of the code  
reviewer) whether a given reference type is non-nullable or not. This  
will also greatly help us out when we start running spec# for real  
across our codebase to look for violations of this contract.

Generally you’ll find that any time you get a CodeContext from us it’s  
guaranteed to not be null, which means that you don’t have to do a null  
check. The converse is also true - if you have a nullable reference  
type, you’ll need to validate it with one of the helpers in our  
Microsoft.Scripting.ContractUtils class.

1. General formatting issues

Please do try and stick with .NET naming conventions if possible when  
porting code from Java etc. I realize that it does take time to do this,  
and thanks, but it’s either you do it or I have to 🙂 Not a big deal  
since I can just do a CTRL-K CTRL-F on your code, but it would rock if  
you could format along the same lines as the rest of the code.

1. Testing / coverage

If possible please let us know how many specs from the spec suite your  
code passes etc. That would help us determine how much to look into the  
codebase itself.

Thanks,  
-John

---

<div class="post-metadata">

**Author:** ![dreamwave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7feea3/32.png) [@dreamwave](https://www.ruby-forum.com/u/dreamwave)\
**Post date:** [April 23, 2008, 4:59am UTC](https://www.ruby-forum.com/t/native-zlib-implementation-patch/135505/3 "2008-04-23T04:59:36Z")

</div>

The rubinius specs for Zlib are… wanting. Though there are some.  
Are the rubinius specs used as is?

On Tue, Apr 22, 2008 at 8:08 PM, John L. (IRONRUBY)  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Please do your best to incorporate the bangs in your contributions. The bangs indicate a non-nullable reference type. I find that it’s best if you create a VS macro to insert them - I bind this macro to the CTRL-! key:
> 
> Ironruby-core mailing list  
> removed\_email\_address@domain.invalid  
> [http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

–  
Michael L.  
[Polymath Prokrammer]  
[http://blog.prokrams.com](http://blog.prokrams.com)

---

<div class="post-metadata">

**Author:** ![dreamwave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7feea3/32.png) [@dreamwave](https://www.ruby-forum.com/u/dreamwave)\
**Post date:** [April 23, 2008, 5:25am UTC](https://www.ruby-forum.com/t/native-zlib-implementation-patch/135505/4 "2008-04-23T05:25:53Z")

</div>

Michael L.:

> The rubinius specs for Zlib are… wanting. Though there are some.  
> Are the rubinius specs used as is?

Just peeked at the latest rubinius specs and there is some coverage. I’m  
going to start working on running the latest rubinius spec runner in my  
next checkin.

-John
