summaryrefslogtreecommitdiff
path: root/fw/esp32/components/eos/gsm_cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/esp32/components/eos/gsm_cp.c')
-rw-r--r--fw/esp32/components/eos/gsm_cp.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/fw/esp32/components/eos/gsm_cp.c b/fw/esp32/components/eos/gsm_cp.c
index 508aa54..5478a8f 100644
--- a/fw/esp32/components/eos/gsm_cp.c
+++ b/fw/esp32/components/eos/gsm_cp.c
@@ -1,5 +1,3 @@
-#include <stdint.h>
-
#include "gsm.h"
#define UCS2_SUPL_SIZE 11
@@ -60,9 +58,9 @@ static const uint16_t ucs2_to_gsm7_supl[UCS2_SUPL_SIZE][2] = {
{0x20ac, 0x1b65}
};
-int gsm_ucs2_to_7bit(uint16_t ucs2, char *gsm7, int gsm7_size) {
+int gsm_ucs2_to_7bit(char *gsm7, size_t gsm7_size, uint16_t ucs2) {
uint16_t ch = 0xffff;
- int ret = 0;
+ int rv = 0;
if (gsm7_size < 1) return GSM_ERR_SIZE;
@@ -83,28 +81,28 @@ int gsm_ucs2_to_7bit(uint16_t ucs2, char *gsm7, int gsm7_size) {
if (gsm7_size < 2) return GSM_ERR_SIZE;
*gsm7 = 0x1b;
gsm7++;
- ret++;
+ rv++;
}
*gsm7 = ch & 0x7f;
- ret++;
+ rv++;
- return ret;
+ return rv;
}
-int gsm_7bit_to_ucs2(char *gsm7, int gsm7_len, uint16_t *ucs2) {
- int ret;
+int gsm_7bit_to_ucs2(char *gsm7, size_t gsm7_len, uint16_t *ucs2) {
+ int rv;
if (gsm7_len < 1) return GSM_ERR_SIZE;
if (*gsm7 != 0x1b) {
*ucs2 = gsm7_to_ucs2[*gsm7 & 0x7f];
- ret = 1;
+ rv = 1;
} else {
if (gsm7_len < 2) return GSM_ERR_SIZE;
gsm7++;
- ret = 2;
+ rv = 2;
*ucs2 = gsm7e_to_ucs2[*gsm7 & 0x7f];
}
if (*ucs2 == 0xffff) return GSM_ERR;
- return ret;
+ return rv;
}