summaryrefslogtreecommitdiff
path: root/extmod/modubinascii.c
AgeCommit message (Collapse)Author
2020-12-14extmod/modubinascii: Update code, docs for hexlify now CPython has sep.Damien George
Since CPython 3.8 the optional "sep" argument to hexlify is officially supported, so update comments in the code and the docs to reflect this. Signed-off-by: Damien George <damien@micropython.org>
2020-04-23all: Format code to add space after C++-style comment start.stijn
Note: the uncrustify configuration is explicitly set to 'add' instead of 'force' in order not to alter the comments which use extra spaces after // as a means of indenting text for clarity.
2020-04-05all: Use MP_ERROR_TEXT for all error messages.Jim Mussared
2020-04-05extmod/modubinascii: Make code private and module self-contained.Jim Mussared
This commit makes all functions and function wrappers in modubinascii.c STATIC and conditional on the MICROPY_PY_UBINASCII setting, which will exclude the file from qstr/ compressed-string searching when ubinascii is not enabled. The now-unused modubinascii.h header file is also removed. The cc3200 port is updated accordingly to use this module in its entirety instead of providing its own top-level definition of ubinascii. This was originally like this because the cc3200 port has its own ubinascii module which referenced these methods. The plan appeared to be that the API might diverge (e.g. hardware crc), but this should be done similar to I2C/SPI via a port-specific handler, rather than the port having its own definition of the module. Having a centralised module definition also enforces consistency of the API among ports.
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2017-10-04all: Remove inclusion of internal py header files.Damien George
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-08-31extmod/modubinascii: Only include uzlib/tinf.h when it's really needed.Damien George
2017-08-21extmod/modubinascii: Don't post-increment variable that won't be used.Damien George
2017-08-17extmod/modubinascii: Rewrite mod_binascii_a2b_base64.Alex Robbins
This implementation ignores invalid characters in the input. This allows it to decode the output of b2a_base64, and also mimics the behavior of CPython.
2017-08-13all: Raise exceptions via mp_raise_XXXJavier Candeira
- Changed: ValueError, TypeError, NotImplementedError - OSError invocations unchanged, because the corresponding utility function takes ints, not strings like the long form invocation. - OverflowError, IndexError and RuntimeError etc. not changed for now until we decide whether to add new utility functions.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-07-19all: Remove trailing spaces, per coding conventions.Damien George
2017-07-03extmod/modubinascii: Add check for empty buffer passed to hexlify.Damien George
Previous to this patch hexlify(b'', b':') would lead to a bad crash due to the computed length of the result being -1=0xffffffff.
2017-06-15all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers.Damien George
2016-09-21extmod/modubinascii: Fix crc32() function on 32-bit platforms.Pavol Rusnak
2016-09-22all: Remove 'name' member from mp_obj_module_t struct.Damien George
One can instead lookup __name__ in the modules dict to get the value.
2016-08-24extmod/modubinascii: Make crc32() support configurable.Paul Sokolovsky
Disable by default, enable in unix port.
2016-08-24extmod/modubinascii: implement binascii.crc32Pavol Rusnak
2016-05-20extmod: When including extmod headers, prefix path with extmod/.Damien George
2016-01-11py: Change type signature of builtin funs that take variable or kw args.Damien George
With this patch the n_args parameter is changed type from mp_uint_t to size_t.
2015-12-26extmod/modubinascii: Add "separator" argument to hexlify().Paul Sokolovsky
This is extension to CPython, it allows to easily produce human-readable hex dump: >>> ubinascii.hexlify(b"\xaa\x55\xaa\x55", b" ") b'aa 55 aa 55'
2015-11-29py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George
2015-07-06extmod/modubinascii: Re-use error string to reduce code size.Damien George
Drops Thumb2 arch size by 24 bytes.
2015-07-04ubinascii: Fix a shadowed variable case.Paul Sokolovsky
2015-07-04ubinascii: b2a_base64: Optimize away a modulo operation.Paul Sokolovsky
2015-07-04extmod: Add a2b_base64 and b2a_base64 functions to ubinascii.Galen Hazelwood
2015-05-21extmod: Expose mod_binascii_hexlify() and mod_binascii_unhexlify().Daniel Campora
2015-05-20extmod: Add ubinascii.unhexlifyDave Hylands
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
2015-01-21py: Remove mp_obj_str_builder and use vstr instead.Damien George
With this patch str/bytes construction is streamlined. Always use a vstr to build a str/bytes object. If the size is known beforehand then use vstr_init_len to allocate only required memory. Otherwise use vstr_init and the vstr will grow as needed. Then use mp_obj_new_str_from_vstr to create a str/bytes object using the vstr memory. Saves code ROM: 68 bytes on stmhal, 108 bytes on bare-arm, and 336 bytes on unix x64.
2015-01-20py, unix: Allow to compile with -Wunused-parameter.Damien George
See issue #699.
2015-01-01extmod: Prefix py/ for includes from py core directory.Damien George
2014-11-29Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George
This is just a clean-up of the code. Generated code is exactly the same.
2014-11-29modubinascii: Add, with hexlify() implementation.Paul Sokolovsky