more better for me signed<->unsigned and the const keyword usage
This commit is contained in:
parent
4333a09d65
commit
87be316149
@ -52,13 +52,13 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream)
|
|||||||
|
|
||||||
line_ptr++;
|
line_ptr++;
|
||||||
/* Tolerate an overly long line to acomadate a possible exta '`' */
|
/* Tolerate an overly long line to acomadate a possible exta '`' */
|
||||||
if (strlen(line_ptr) < length) {
|
if (strlen(line_ptr) < (size_t)length) {
|
||||||
bb_error_msg_and_die("Short file");
|
bb_error_msg_and_die("Short file");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
/* Merge four 6 bit chars to three 8 bit chars */
|
/* Merge four 6 bit chars to three 8 bit chars */
|
||||||
fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream);
|
fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream);
|
||||||
line_ptr++;
|
line_ptr++;
|
||||||
length--;
|
length--;
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
@ -83,7 +83,7 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream)
|
|||||||
|
|
||||||
static int read_base64(FILE *src_stream, FILE *dst_stream)
|
static int read_base64(FILE *src_stream, FILE *dst_stream)
|
||||||
{
|
{
|
||||||
const char *base64_table =
|
static const char base64_table[] =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n";
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n";
|
||||||
char term_count = 0;
|
char term_count = 0;
|
||||||
|
|
||||||
|
@ -58,10 +58,10 @@ static const char tbl_std[65] = {
|
|||||||
* buffer of at least 1+BASE64_LENGTH(length) bytes.
|
* buffer of at least 1+BASE64_LENGTH(length) bytes.
|
||||||
* where BASE64_LENGTH(len) = (4 * ((LENGTH + 2) / 3))
|
* where BASE64_LENGTH(len) = (4 * ((LENGTH + 2) / 3))
|
||||||
*/
|
*/
|
||||||
static void uuencode (const unsigned char *s, const char *store, const int length, const char *tbl)
|
static void uuencode (const unsigned char *s, char *store, const int length, const char *tbl)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char *p = (unsigned char *)store;
|
char *p = store;
|
||||||
|
|
||||||
/* Transform the 3x8 bits to 4x6 bits, as required by base64. */
|
/* Transform the 3x8 bits to 4x6 bits, as required by base64. */
|
||||||
for (i = 0; i < length; i += 3) {
|
for (i = 0; i < length; i += 3) {
|
||||||
@ -86,9 +86,9 @@ static void uuencode (const unsigned char *s, const char *store, const int lengt
|
|||||||
#define DST_BUF_SIZE 4 * ((SRC_BUF_SIZE + 2) / 3)
|
#define DST_BUF_SIZE 4 * ((SRC_BUF_SIZE + 2) / 3)
|
||||||
int uuencode_main(int argc, char **argv)
|
int uuencode_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const int src_buf_size = SRC_BUF_SIZE;
|
const size_t src_buf_size = SRC_BUF_SIZE;
|
||||||
const int dst_buf_size = DST_BUF_SIZE;
|
const size_t dst_buf_size = DST_BUF_SIZE;
|
||||||
int write_size = dst_buf_size;
|
size_t write_size = dst_buf_size;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
FILE *src_stream = stdin;
|
FILE *src_stream = stdin;
|
||||||
const char *tbl;
|
const char *tbl;
|
||||||
|
Loading…
Reference in New Issue
Block a user