GithubHelp home page GithubHelp logo

badboy / minilzo-rs Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 3.0 5.1 MB

A wrapper for minilzo, a lightweight subset of the LZO library

Home Page: http://badboy.github.io/minilzo-rs/

License: MIT License

Rust 100.00%

minilzo-rs's Introduction

minilzo-rs - A wrapper around minilzo, the lightweight subset of the LZO library

Build Status crates.io

LZO is a compression library with focus on decompression speed. originally implemented by Markus F.X.J. Oberhumer. minilzo is a lightweight subset of the full LZO library.

It is available online as a C library.

This rust library is a wrapper around the minilzo library and is fully compatible with LZO/minilzo compressed data.

Build

cargo build --release

Usage

use minilzo;

fn main() {
    let data = b"foobar";

    let compressed = minilzo::compress(&data[..]).unwrap();

    let decompressed = minilzo::decompress(&compressed, data.len()).unwrap();
}

Tests

Run tests with:

cargo test

Run benchmarks with:

cargo bench

License

The minilzo-rs wrapper library is licensed under the terms of the MIT License.
LZO itself is licensed under the terms of the GNU General Public License (GPL v2+).

minilzo-rs's People

Contributors

badboy avatar tbsaunde avatar yjh0502 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

minilzo-rs's Issues

Compatibility with x86-32bit

I packaged btrfs-dedupe for nixos and the builds for x86 are failing, while builds for x86_64 are working. the error suggests, that minilzo is not compiling.

My request would be:

  • Would it be possible to add 32bit support?
  • If it is already implemented what do i need to do, to make it compile/work?

Thanks, ikervagyok


Here is the error, which i get when compiling btrfs-dedupe:

building path(s) ‘/nix/store/n160qsibkvjlkjgiqmzsbxxxknqm62n0-btrfs-dedupe-1.1.0’
unpacking sources
unpacking source archive /nix/store/i97ykw2p7bzl9lm0dhllmhc29db3d5a7-archive.tar.bz2?ref=72c6a301d20f935827b994db210bf0a1e121273a
source root is btrfs-dedupe-72c6a301d20f935827b994db210bf0a1e121273a-72c6a301d20f935827b994db210bf0a1e121273a
Using cargo deps from /nix/store/z3218s53bxxhv9vrlhvmbmq18l5wkxz6-btrfs-dedupe-1.1.0-fetch
Using indexHash '-ba82b75dd6681d6f'
Using rust registry from /nix/store/mnsaxh5zksckcar3pxz7b6yac980r08c-rustRegistry-2017-02-19-d822c58
warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future
warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future
setting SOURCE_DATE_EPOCH to timestamp 1488351352 of file btrfs-dedupe-72c6a301d20f935827b994db210bf0a1e121273a-72c6a301d20f935827b994db210bf0a1e121273a/Cargo.lock
warning: file btrfs-dedupe-72c6a301d20f935827b994db210bf0a1e121273a-72c6a301d20f935827b994db210bf0a1e121273a/Cargo.lock may be generated; SOURCE_DATE_EPOCH may be non-deterministic
patching sources
configuring
building
Running cargo build --release
warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future
   Compiling vec_map v0.6.0 (registry file:///dev/null)
   Compiling log v0.3.6 (registry file:///dev/null)
   Compiling lazy_static v0.2.2 (registry file:///dev/null)
   Compiling rustc-serialize v0.3.22 (registry file:///dev/null)
   Compiling unicode-xid v0.0.3 (registry file:///dev/null)
   Compiling quote v0.3.10 (registry file:///dev/null)
   Compiling unicode-segmentation v1.0.1 (registry file:///dev/null)
   Compiling byte-tools v0.1.2 (registry file:///dev/null)
   Compiling bitflags v0.7.0 (registry file:///dev/null)
   Compiling crc v1.4.0 (registry file:///dev/null)
   Compiling ansi_term v0.9.0 (registry file:///dev/null)
   Compiling unicode-width v0.1.4 (registry file:///dev/null)
   Compiling dtoa v0.2.2 (registry file:///dev/null)
   Compiling itoa v0.1.1 (registry file:///dev/null)
   Compiling libc v0.2.18 (registry file:///dev/null)
   Compiling typenum v1.5.1 (registry file:///dev/null)
   Compiling uuid v0.3.1 (registry file:///dev/null)
   Compiling strsim v0.6.0 (registry file:///dev/null)
   Compiling fake-simd v0.1.2 (registry file:///dev/null)
   Compiling term_size v0.2.1 (registry file:///dev/null)
   Compiling minilzo-sys v0.1.0 (registry file:///dev/null)
   Compiling ioctl v0.3.3 (registry file:///dev/null)
   Compiling minilzo v0.1.0 (registry file:///dev/null)
   Compiling minilzo v0.1.0 (registry file:///dev/null)
error[E0308]: mismatched types
   --> /tmp/nix-build-btrfs-dedupe-1.1.0.drv-0/deps/registry/src/-ba82b75dd6681d6f/minilzo-0.1.0/src/lib.rs:121:13
    |
121 |             inlen as u64,
    |             ^^^^^^^^^^^^ expected u32, found u64

error[E0308]: mismatched types
   --> /tmp/nix-build-btrfs-dedupe-1.1.0.drv-0/deps/registry/src/-ba82b75dd6681d6f/minilzo-0.1.0/src/lib.rs:161:13
    |
161 |             inlen as u64,
    |             ^^^^^^^^^^^^ expected u32, found u64

error: aborting due to 2 previous errors

Build failed, waiting for other jobs to finish...
error: Could not compile `minilzo`.

To learn more, run the command again with --verbose.
builder for ‘/nix/store/09977dmw443ww1xhracjlipj794s11hi-btrfs-dedupe-1.1.0.drv’ failed with exit code 101

Static linking?

Hi. I forked this project to statically link minilzo. Would this be a welcome PR?

Minilzo isn't distributed through git, so I just include a copy.

To my knowledge this doesn't effect licenses, because static vs dynamic linking doesn't matter for GPLv2, and anything using it has to be GPL-compatible still.

minilzo is licensed GPL

minilzo is licensed under the terms of the GPL, meaning this crate is obligated to use the same license.

Support for in-place compression and decompression

The current Rust API does not support in-place compression or decompression. It would be nice to extend it to make that possible.

See examples/overlap.c in the LZO reference implementation for how this can be done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.