diff --git a/baselib/msglib/src/standard/messenger_device_session_manager.c b/baselib/msglib/src/standard/messenger_device_session_manager.c index 016102fdc37f37447284be4a31885201c18a235c..05da426908ec0e1f7b6c98cd97dacf0fab5a22d1 100644 --- a/baselib/msglib/src/standard/messenger_device_session_manager.c +++ b/baselib/msglib/src/standard/messenger_device_session_manager.c @@ -13,6 +13,8 @@ * limitations under the License. */ +#include "messenger_device_session_manager.h" + #include #include "securec.h" @@ -24,7 +26,6 @@ #include "utils_mem.h" #include "utils_mutex.h" -#include "messenger_device_session_manager.h" #include "messenger_device_status_manager.h" #include "messenger_utils.h" diff --git a/baselib/msglib/src/standard/messenger_device_status_manager.c b/baselib/msglib/src/standard/messenger_device_status_manager.c index 24f8043a75ae7c28df49e04e6e279acac9a8cc99..b94a8f7e4c852e558ad7f8c1e083f518770cef1a 100644 --- a/baselib/msglib/src/standard/messenger_device_status_manager.c +++ b/baselib/msglib/src/standard/messenger_device_status_manager.c @@ -77,7 +77,7 @@ static void ProcessDeviceStatusReceived(const uint8_t *data, uint32_t len) FREE(queueData); } -static inline void ProcessDeviceStatusReceiver(const DeviceIdentify *devId, uint32_t status, uint32_t devType) +static void ProcessDeviceStatusReceiver(const DeviceIdentify *devId, uint32_t status, uint32_t devType) { DeviceStatusManager *instance = GetDeviceManagerInstance(); diff --git a/baselib/utils/src/utils_base64.c b/baselib/utils/src/utils_base64.c index 7b0a73fc4ea19f06b1525b9b036306d022e4c4e7..94146e5382efd4814726e750a3d931438fc9157f 100644 --- a/baselib/utils/src/utils_base64.c +++ b/baselib/utils/src/utils_base64.c @@ -28,24 +28,16 @@ extern "C" { #define MAX_MALLOC_LEN (1 * 1024 * 1024) static const char *g_base64EncodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static const uint8_t g_base64DecodeTable[256] = { /* 256 due to character size */ - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 62, 65, 65, 65, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 65, 65, 65, 0, 65, 65, - 65, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 65, 65, 65, 65, 65, - 65, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 -}; +static const uint8_t g_base64DecodeTable[256] = { // 256 due to character size + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 62, 65, 65, 65, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 65, 65, 65, 0, 65, 65, 65, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 65, 65, 65, 65, 65, 65, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65}; /* * This function is for Base64 encoding based on the public algorithm @@ -113,10 +105,10 @@ static int32_t Base64Decode(const uint8_t *from, uint8_t *to, uint32_t toCheckLe } uint32_t toLen = fromLen / 4 * 3; /* Base64 decode size */ - if (from[fromLen - 1] == '=') { /* if last bit is null, make it "=" */ + if (from[fromLen - 1] == '=') { /* if last 1 bit is null, make it "=" */ toLen--; } - if (from[fromLen - 2] == '=') { /* if Second-to-last bit is null, make it "=" */ + if (from[fromLen - 2] == '=') { /* if Second-to-last 2 bit is null, make it "=" */ toLen--; } if (toCheckLen < toLen) { @@ -141,10 +133,10 @@ static int32_t Base64Decode(const uint8_t *from, uint8_t *to, uint32_t toCheckLe (((a << 18) & 0x00FC0000) | ((b << 12) & 0x0003F000) | ((c << 6) & 0x00000FC0) | ((d << 0) & 0x0000003F)); if (j < toLen) { - to[j++] = (byte >> 16) & 0xFF; + to[j++] = (byte >> 16) & 0xFF; // 16, the 3rd 8-bit } if (j < toLen) { - to[j++] = (byte >> 8) & 0xFF; + to[j++] = (byte >> 8) & 0xFF; // 8, the 2nd 8-bit } if (j < toLen) { to[j++] = (byte >> 0) & 0xFF;