Lines Matching +full:src +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0
5 int ceph_armor(char *dst, const char *src, const char *end);
6 int ceph_unarmor(char *dst, const char *src, const char *end);
23 return c - 'A'; in decode_bits()
25 return c - 'a' + 26; in decode_bits()
27 return c - '0' + 52; in decode_bits()
33 return 0; /* just non-negative, please */ in decode_bits()
34 return -EINVAL; in decode_bits()
37 int ceph_armor(char *dst, const char *src, const char *end) in ceph_armor() argument
42 while (src < end) { in ceph_armor()
45 a = *src++; in ceph_armor()
46 *dst++ = encode_bits(a >> 2); in ceph_armor()
47 if (src < end) { in ceph_armor()
48 b = *src++; in ceph_armor()
50 if (src < end) { in ceph_armor()
51 c = *src++; in ceph_armor()
52 *dst++ = encode_bits(((b & 15) << 2) | in ceph_armor()
56 *dst++ = encode_bits((b & 15) << 2); in ceph_armor()
75 int ceph_unarmor(char *dst, const char *src, const char *end) in ceph_unarmor() argument
79 while (src < end) { in ceph_unarmor()
82 if (src[0] == '\n') { in ceph_unarmor()
83 src++; in ceph_unarmor()
86 if (src + 4 > end) in ceph_unarmor()
87 return -EINVAL; in ceph_unarmor()
88 a = decode_bits(src[0]); in ceph_unarmor()
89 b = decode_bits(src[1]); in ceph_unarmor()
90 c = decode_bits(src[2]); in ceph_unarmor()
91 d = decode_bits(src[3]); in ceph_unarmor()
93 return -EINVAL; in ceph_unarmor()
95 *dst++ = (a << 2) | (b >> 4); in ceph_unarmor()
96 if (src[2] == '=') in ceph_unarmor()
98 *dst++ = ((b & 15) << 4) | (c >> 2); in ceph_unarmor()
99 if (src[3] == '=') in ceph_unarmor()
100 return olen + 2; in ceph_unarmor()
103 src += 4; in ceph_unarmor()