aboutsummaryrefslogtreecommitdiff
path: root/extmod/modubinascii.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-27 15:36:53 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-28 10:33:03 +1100
commit69661f3343bedf86e514337cff63d96cc42f8859 (patch)
treeaf5dfb380ffdb75dda84828f63cf9d840d992f0f /extmod/modubinascii.c
parent3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff)
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'extmod/modubinascii.c')
-rw-r--r--extmod/modubinascii.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c
index 8256a50cf..4a11d3ead 100644
--- a/extmod/modubinascii.c
+++ b/extmod/modubinascii.c
@@ -53,7 +53,7 @@ mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) {
sep = mp_obj_str_get_str(args[1]);
}
vstr_init_len(&vstr, out_len);
- byte *in = bufinfo.buf, *out = (byte*)vstr.buf;
+ byte *in = bufinfo.buf, *out = (byte *)vstr.buf;
for (mp_uint_t i = bufinfo.len; i--;) {
byte d = (*in >> 4);
if (d > 9) {
@@ -82,7 +82,7 @@ mp_obj_t mod_binascii_unhexlify(mp_obj_t data) {
}
vstr_t vstr;
vstr_init_len(&vstr, bufinfo.len / 2);
- byte *in = bufinfo.buf, *out = (byte*)vstr.buf;
+ byte *in = bufinfo.buf, *out = (byte *)vstr.buf;
byte hex_byte = 0;
for (mp_uint_t i = bufinfo.len; i--;) {
byte hex_ch = *in++;
@@ -172,7 +172,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
vstr_init_len(&vstr, ((bufinfo.len != 0) ? (((bufinfo.len - 1) / 3) + 1) * 4 : 0) + 1);
// First pass, we convert input buffer to numeric base 64 values
- byte *in = bufinfo.buf, *out = (byte*)vstr.buf;
+ byte *in = bufinfo.buf, *out = (byte *)vstr.buf;
mp_uint_t i;
for (i = bufinfo.len; i >= 3; i -= 3) {
*out++ = (in[0] & 0xFC) >> 2;
@@ -186,8 +186,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
if (i == 2) {
*out++ = (in[0] & 0x03) << 4 | (in[1] & 0xF0) >> 4;
*out++ = (in[1] & 0x0F) << 2;
- }
- else {
+ } else {
*out++ = (in[0] & 0x03) << 4;
*out++ = 64;
}
@@ -195,7 +194,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
}
// Second pass, we convert number base 64 values to actual base64 ascii encoding
- out = (byte*)vstr.buf;
+ out = (byte *)vstr.buf;
for (mp_uint_t j = vstr.len - 1; j--;) {
if (*out < 26) {
*out += 'A';
@@ -204,7 +203,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
} else if (*out < 62) {
*out += '0' - 52;
} else if (*out == 62) {
- *out ='+';
+ *out = '+';
} else if (*out == 63) {
*out = '/';
} else {
@@ -247,7 +246,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_binascii_globals, mp_module_binascii_globa
const mp_obj_module_t mp_module_ubinascii = {
.base = { &mp_type_module },
- .globals = (mp_obj_dict_t*)&mp_module_binascii_globals,
+ .globals = (mp_obj_dict_t *)&mp_module_binascii_globals,
};
#endif //MICROPY_PY_UBINASCII