cool2k / snappy

Automatically exported from code.google.com/p/snappy
Other
0 stars 0 forks source link

C bindings #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

It would be really great to have C bindings for snappy for projects which 
prefer plain C instead of C++.

Original issue reported on code.google.com by pakhuc...@gmail.com on 30 Mar 2011 at 2:57

GoogleCodeExporter commented 9 years ago

Original comment by se...@google.com on 30 Mar 2011 at 8:26

GoogleCodeExporter commented 9 years ago
Hi,

Sounds like a good idea. Do you want to contribute a patch? All you should need 
is a new .h/.cc file pair with the bindings, and some minor changes to 
Makefile.am to compile the .cc file and install the .h file.

Original comment by se...@google.com on 2 Apr 2011 at 7:31

GoogleCodeExporter commented 9 years ago
Here's a patch that adds the following C wrapper functions:

snappy_compress
snappy_uncompress
snappy_max_compressed_length
snappy_uncompressed_length 
snappy_is_valid_compressed_buffer

Original comment by martin.g...@gmail.com on 3 Apr 2011 at 2:23

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks! This generally looks good. A few comments:

* Please try to follow the C++ coding style used in Snappy, even though these 
are C bindings. You can find a copy of the Google C++ style guide at 
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml .
* You'll need comments; a file comment for each file, and a function comment 
for each function in the .h file.
* There's no license attached to the files; I'll need to talk to the open 
source people exactly how we're handling external patches, but to include it in 
the distribution we'll need to have it licensed under the same BSD license as 
the rest of Snappy.

Original comment by se...@google.com on 3 Apr 2011 at 2:34

GoogleCodeExporter commented 9 years ago
OK, that was just a quick shot. Here is a modified version with renamed 
functions and additional comments. I also added the BSD headers as applied to 
the rest of the snappy sources. Please feel free to modify anything as you like.

Original comment by martin.g...@gmail.com on 3 Apr 2011 at 3:57

Attachments:

GoogleCodeExporter commented 9 years ago
Great. So, two things:

- There are still some style nits -- in particular, several lines above 80 
characters, some double blank lines and some spaces before ( in the prototype. 
I can fix these if you don't want to, though.
- You'll need to sign a contributor license agreement 
(http://code.google.com/legal/individual-cla-v1.0.html). Note that this is not 
a transfer of copyright, just a form to give Google permission to use and 
relicense the code. Note that this can be done electronically, so you won't 
have to mail/fax anything; see the form at the bottom.

Original comment by se...@google.com on 4 Apr 2011 at 9:28

GoogleCodeExporter commented 9 years ago
No problem. Here's another version that hopefully fixes the remaining 
formatting issues. If there are still small things to be corrected, please fix 
them directly. That's probably easier and faster than telling me about them. :)
I've also signed the license agreement you mentioned above.

Original comment by martin.g...@gmail.com on 4 Apr 2011 at 10:42

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by se...@google.com on 4 Apr 2011 at 11:51

GoogleCodeExporter commented 9 years ago
Here's yet another version. I've changed the comments in snappy-c.h to plain C 
style to avoid potential compilation issues.

Original comment by martin.g...@gmail.com on 5 Apr 2011 at 10:32

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in r27. (There were quite a few changes in internal code review.) Thanks 
for your contribution. :-)

Original comment by se...@google.com on 8 Apr 2011 at 9:54

GoogleCodeExporter commented 9 years ago

Original comment by se...@google.com on 8 Apr 2011 at 10:00