Skip to content

Commit

Permalink
Merge 6a18b4b into a5f6774
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatv committed Feb 17, 2021
2 parents a5f6774 + 6a18b4b commit e1775e0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
7 changes: 4 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.1
current_version = 0.1.2
commit = True
tag = True

Expand All @@ -10,14 +10,15 @@ search =
[bumpversion:file:README.rst]
search =
commits-since/ionelmc/python-unlzw/v{current_version}.svg

[bumpversion:file:./README.rst]
search =
compare/v{current_version}...master

[bumpversion:file:docs/conf.py]
search =

version = release = '{current_version}'

[bumpversion:file:src/unlzw/__init__.py]
search =
__version__ = '{current_version}'

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ docs/_build
.bootstrap
.appveyor.token
*.bak

# vscode
.vscode
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Overview
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/unlzw

.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-unlzw/v0.1.1.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-unlzw/v0.1.2.svg
:alt: Commits since latest release
:target: https://github.com/ionelmc/python-unlzw/compare/v0.1.1...master
:target: https://github.com/ionelmc/python-unlzw/compare/v0.1.2...master

.. |wheel| image:: https://img.shields.io/pypi/wheel/unlzw.svg
:alt: PyPI Wheel
Expand Down
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
project = 'unlzw'
year = '2017'
author = 'Ionel Cristian Mărieș'
copyright = '{0}, {1}'.format(year, author)
version = release = '0.1.1'
copyright = '{0}, {1}'.format(year, author)0.1.2

pygments_style = 'trac'
templates_path = ['.']
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def read(*names, **kwargs):

setup(
name='unlzw',
version='0.1.1',
version='0.1.2',
license='BSD 3-Clause License',
description="Bindings for Mark Adler's unlzw library.",
long_description='%s\n%s' % (
Expand Down
10 changes: 6 additions & 4 deletions src/unlzw/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
__version__ = '0.1.1'
__version__ = '0.1.2'

from ._unlzw import ffi as _ffi
from ._unlzw import lib as _lib


def unlzw(data):
out = _ffi.new('unsigned char**')
tmp_out = _ffi.new('unsigned char**')
outlen = _ffi.new('size_t*')
retcode = _lib.unlzw(
_ffi.new('unsigned char[]', data), len(data),
out, outlen
tmp_out, outlen
)
if not retcode:
return _ffi.string(out[0], outlen[0])
out = _ffi.string(tmp_out[0], outlen[0])
_lib.free(tmp_out[0])
return out
elif retcode == 1:
raise MemoryError("Failed to allocate memory.")
elif retcode == -1:
Expand Down
1 change: 1 addition & 0 deletions src/unlzw/_unlzw_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ffi = FFI()
ffi.cdef('''
static int unlzw(unsigned const char *in, size_t inlen, unsigned char **out, size_t *outlen);
void free(void *ptr);
''')

ffi.set_source(
Expand Down

0 comments on commit e1775e0

Please sign in to comment.