formatting code using astyle

Origin commit data
------------------
Branch: master
Commit: bc17c13de4
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-05-17 (Mon, 17 May 2021)

Origin message was:
------------------
- formatting code using astyle

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2021-05-17 23:47:39 +02:00
parent 7335985023
commit f54b0e7bec
161 changed files with 13025 additions and 11357 deletions

View File

@@ -16,12 +16,14 @@ int get_random(unsigned char *dest, int len)
const char *urnd = "/dev/urandom";
fd = open(urnd, O_RDONLY);
if (fd <= 0) {
if (fd <= 0)
{
printf("cannot open %s\n", urnd);
return -1;
}
if (read(fd, dest, len) != len) {
if (read(fd, dest, len) != len)
{
printf("cannot read from %s\n", urnd);
close(fd);
return -2;
@@ -37,11 +39,13 @@ int parseLengthField(const unsigned char *pkt, int *len)
int i;
*len = 0;
if (!(*pkt & 0x80)) {
if (!(*pkt & 0x80))
{
*len = *pkt;
return 1;
}
for (i = 0; i < (pkt[0] & 0x7F); ++i) {
for (i = 0; i < (pkt[0] & 0x7F); ++i)
{
*len <<= 8;
*len |= pkt[i + 1];
}
@@ -53,7 +57,8 @@ int add_padding(uint8_t *dest, unsigned int len, unsigned int blocklen)
uint8_t padding = 0x80;
int count = 0;
while (len & (blocklen - 1)) {
while (len & (blocklen - 1))
{
*dest++ = padding;
++len;
++count;
@@ -84,7 +89,7 @@ void str2bin(uint8_t *dst, char *data, int len)
int i;
for (i = 0; i < len; i += 2)
*dst++ = (get_bin_from_nibble(data[i]) << 4) | get_bin_from_nibble(data[i + 1]);
* dst++ = (get_bin_from_nibble(data[i]) << 4) | get_bin_from_nibble(data[i + 1]);
}
uint32_t UINT32(const unsigned char *in, unsigned int len)
@@ -92,7 +97,8 @@ uint32_t UINT32(const unsigned char *in, unsigned int len)
uint32_t val = 0;
unsigned int i;
for (i = 0; i < len; i++) {
for (i = 0; i < len; i++)
{
val <<= 8;
val |= *in++;
}