diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:07:54 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:07:54 +0100 |
commit | 5afe88df2538274859a162ffd63ed52118e80c19 (patch) | |
tree | b610dfd58dc748fd63f49565b2a43eea2316714f /src/utils/base64.cpp | |
parent | 73ba2a95f5bd4a0dd09af52d5864800be2b0a4c6 (diff) | |
download | mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.gz mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.bz2 mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.xz mana-5afe88df2538274859a162ffd63ed52118e80c19.zip |
Apply C++11 fixits
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
Diffstat (limited to 'src/utils/base64.cpp')
-rw-r--r-- | src/utils/base64.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 57a9fc84..cf10c8fd 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -46,7 +46,7 @@ unsigned char *php3_base64_encode(const unsigned char *string, int length, int * { const unsigned char *current = string; int i = 0; - unsigned char *result = (unsigned char *)malloc(((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char)); + auto *result = (unsigned char *)malloc(((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char)); while (length > 2) { /* keep going until we have less than 24 bits */ @@ -91,11 +91,11 @@ unsigned char *php3_base64_decode(const unsigned char *string, int length, int * int ch, i = 0, j = 0, k; char *chp; - unsigned char *result = (unsigned char *)malloc(length + 1); + auto *result = (unsigned char *)malloc(length + 1); - if (result == NULL) + if (result == nullptr) { - return NULL; + return nullptr; } /* run through the whole string, converting as we go */ @@ -113,7 +113,7 @@ unsigned char *php3_base64_decode(const unsigned char *string, int length, int * if (ch == ' ') ch = '+'; chp = strchr(base64_table, ch); - if (chp == NULL) continue; + if (chp == nullptr) continue; ch = chp - base64_table; switch(i % 4) @@ -145,7 +145,7 @@ unsigned char *php3_base64_decode(const unsigned char *string, int length, int * case 0: case 1: free(result); - return NULL; + return nullptr; case 2: k++; case 3: |