Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Sep 14, 2024
1 parent 4aca344 commit 4d4d23f
Show file tree
Hide file tree
Showing 26 changed files with 10,179 additions and 10,201 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Like the [Brain Imaging Data Structure](https://bids.neuroimaging.io/get_involve

The easiest way to contribute to dcm2niix is to ask questions you have by [generating Github issues](https://github.com/rordenlab/dcm2niix/issues) or [asking a question on the NITRC forum](https://www.nitrc.org/forum/?group_id=880).

The code is open source, and you can share your improvements by [creating a pull request](https://github.com/rordenlab/dcm2niix/pulls).
The code is open source, and you can share your improvements by [creating a pull request](https://github.com/rordenlab/dcm2niix/pulls) to the **development** branch. Please note that the **master** branch is always the current stable release and does not accept pull requests.
dcm2niix is a community project that has benefitted from many [contributors](https://github.com/rordenlab/dcm2niix/graphs/contributors).

The INCF suggests indicating who is responsible for maintaining software for [stability and support](https://incf.org/incf-standards-review-criteria-v20). Therefore, below we indicate several active contributors and their primary domain of expertise. However, this list is not comprehensive, and it is noted that the project has been supported by contributions from many users. This list does not reflect magnitude of prior contributions, rather it is a non-exhaustive list of members who are actively maintaining the project.
Expand Down
54 changes: 26 additions & 28 deletions console/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* See README for more details.
*/

//#include "includes.h"
// #include "includes.h"

//#include "os.h"
// #include "os.h"
#include "base64.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static const unsigned char base64_table[65] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
Expand All @@ -30,22 +30,21 @@ static const unsigned char base64_table[65] =
* nul terminated to make it easier to use as a C string. The nul terminator is
* not included in out_len.
*/
unsigned char * base64_encode(const unsigned char *src, size_t len,
size_t *out_len)
{
unsigned char *base64_encode(const unsigned char *src, size_t len,
size_t *out_len) {
unsigned char *out, *pos;
const unsigned char *end, *in;
size_t olen;

olen = len * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
#ifdef USE_EOLN
#ifdef USE_EOLN
int line_len 0;
olen += olen / 72; /* line feeds */
#endif
#endif
olen++; /* nul termination */
if (olen < len)
return NULL; /* integer overflow */
out = (unsigned char *) malloc(olen); //os_
return NULL; /* integer overflow */
out = (unsigned char *)malloc(olen); // os_
if (out == NULL)
return NULL;
end = src + len;
Expand All @@ -57,13 +56,13 @@ unsigned char * base64_encode(const unsigned char *src, size_t len,
*pos++ = base64_table[((in[1] & 0x0f) << 2) | (in[2] >> 6)];
*pos++ = base64_table[in[2] & 0x3f];
in += 3;
#ifdef USE_EOLN
#ifdef USE_EOLN
line_len += 4;
if (line_len >= 72) {
*pos++ = '\n';
line_len = 0;
}
#endif
#endif
}

if (end - in) {
Expand All @@ -73,18 +72,18 @@ unsigned char * base64_encode(const unsigned char *src, size_t len,
*pos++ = '=';
} else {
*pos++ = base64_table[((in[0] & 0x03) << 4) |
(in[1] >> 4)];
(in[1] >> 4)];
*pos++ = base64_table[(in[1] & 0x0f) << 2];
}
*pos++ = '=';
#ifdef USE_EOLN
#ifdef USE_EOLN
line_len += 4;
#endif
#endif
}
#ifdef USE_EOLN
#ifdef USE_EOLN
if (line_len)
*pos++ = '\n';
#endif
#endif
*pos = '\0';
if (out_len)
*out_len = pos - out;
Expand All @@ -101,18 +100,17 @@ unsigned char * base64_encode(const unsigned char *src, size_t len,
*
* Caller is responsible for freeing the returned buffer.
*/
unsigned char * base64_decode(const unsigned char *src, size_t len,
size_t *out_len)
{
unsigned char *base64_decode(const unsigned char *src, size_t len,
size_t *out_len) {
unsigned char dtable[256], *out, *pos, block[4], tmp;
size_t i, count, olen;
int pad = 0;

memset(dtable, 0x80, 256); //os_
memset(dtable, 0x80, 256); // os_
for (i = 0; i < sizeof(base64_table) - 1; i++)
dtable[base64_table[i]] = (unsigned char) i;
//next line rewritten to avoid warning -Wchar-subscripts
dtable[61] = 0; //dtable['='] = 0;
dtable[base64_table[i]] = (unsigned char)i;
// next line rewritten to avoid warning -Wchar-subscripts
dtable[61] = 0; // dtable['='] = 0;

count = 0;
for (i = 0; i < len; i++) {
Expand All @@ -124,7 +122,7 @@ unsigned char * base64_decode(const unsigned char *src, size_t len,
return NULL;

olen = count / 4 * 3;
pos = out = (unsigned char *) malloc(olen); //os_
pos = out = (unsigned char *)malloc(olen); // os_
if (out == NULL)
return NULL;

Expand All @@ -150,7 +148,7 @@ unsigned char * base64_decode(const unsigned char *src, size_t len,
pos -= 2;
else {
/* Invalid padding */
free(out); //os_
free(out); // os_
return NULL;
}
break;
Expand Down
8 changes: 4 additions & 4 deletions console/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

#include <stdio.h>

#ifdef __cplusplus
#ifdef __cplusplus
extern "C" {
#endif

unsigned char * base64_encode(const unsigned char *src, size_t len,size_t *out_len);
unsigned char * base64_decode(const unsigned char *src, size_t len,size_t *out_len);
unsigned char *base64_encode(const unsigned char *src, size_t len, size_t *out_len);
unsigned char *base64_decode(const unsigned char *src, size_t len, size_t *out_len);

#ifdef __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
Loading

0 comments on commit 4d4d23f

Please sign in to comment.