From 70a46a7ec94dcf5f969d422bf4e3e3b85b807c22 Mon Sep 17 00:00:00 2001 From: zariiii9003 <52598363+zariiii9003@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:15:11 +0100 Subject: [PATCH] try stdint.h types with PyArg_ParseTupleAndKeywords --- src/e2e/crc.c | 26 +++++++++++++------------- src/e2e/p01.c | 28 ++++++++++++++-------------- src/e2e/p02.c | 4 ++-- src/e2e/p04.c | 12 ++++++------ src/e2e/p05.c | 12 ++++++------ 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/e2e/crc.c b/src/e2e/crc.c index c4f2168..61ea012 100644 --- a/src/e2e/crc.c +++ b/src/e2e/crc.c @@ -31,7 +31,7 @@ py_calculate_crc8(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned char start_value = CRC8_INITIAL_VALUE; + uint8_t start_value = CRC8_INITIAL_VALUE; int first_call = true; static char *kwlist[] = { "data", @@ -75,8 +75,8 @@ py_calculate_crc8_h2f(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned char start_value = CRC8H2F_INITIAL_VALUE; - int first_call = true; + uint8_t start_value = CRC8H2F_INITIAL_VALUE; + int32_t first_call = true; static char *kwlist[] = { "data", "start_value", @@ -120,8 +120,8 @@ py_calculate_crc16(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned short start_value = CRC16_INITIAL_VALUE; - int first_call = true; + uint16_t start_value = CRC16_INITIAL_VALUE; + int32_t first_call = true; static char *kwlist[] = { "data", "start_value", @@ -165,8 +165,8 @@ py_calculate_crc16_arc(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned short start_value = CRC16ARC_INITIAL_VALUE; - int first_call = true; + uint16_t start_value = CRC16ARC_INITIAL_VALUE; + int32_t first_call = true; static char *kwlist[] = { "data", "start_value", @@ -209,8 +209,8 @@ py_calculate_crc32(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned long start_value = CRC32_INITIAL_VALUE; - int first_call = true; + uint32_t start_value = CRC32_INITIAL_VALUE; + int32_t first_call = true; static char *kwlist[] = { "data", "start_value", @@ -253,8 +253,8 @@ py_calculate_crc32_p4(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned long start_value = CRC32P4_INITIAL_VALUE; - int first_call = true; + uint32_t start_value = CRC32P4_INITIAL_VALUE; + int32_t first_call = true; static char *kwlist[] = { "data", "start_value", @@ -297,8 +297,8 @@ py_calculate_crc64(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned long long start_value = CRC64_INITIAL_VALUE; - int first_call = true; + uint64_t start_value = CRC64_INITIAL_VALUE; + int32_t first_call = true; static char *kwlist[] = { "data", "start_value", diff --git a/src/e2e/p01.c b/src/e2e/p01.c index 99fb964..4ad957d 100644 --- a/src/e2e/p01.c +++ b/src/e2e/p01.c @@ -64,8 +64,8 @@ uint8_t compute_p01_crc(uint8_t *data_ptr, if ((crc_offset >> 3) < length) { // compute crc over area after crc byte - unsigned short start_byte = (crc_offset >> 3) + 1; - unsigned short byte_count = length - (crc_offset >> 3); + uint16_t start_byte = (crc_offset >> 3) + 1; + uint16_t byte_count = length - (crc_offset >> 3); crc = Crc_CalculateCRC8(data_ptr + start_byte, byte_count, crc, false); } @@ -98,13 +98,13 @@ py_e2e_p01_protect(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned short length; - unsigned short data_id; - unsigned short data_id_mode = E2E_P01_DATAID_BOTH; + uint16_t length; + uint16_t data_id; + uint16_t data_id_mode = E2E_P01_DATAID_BOTH; int increment_counter = true; - unsigned short crc_offset = 0; - unsigned short counter_offset = 8; - unsigned short data_id_nibble_offset = 12; + uint16_t crc_offset = 0; + uint16_t counter_offset = 8; + uint16_t data_id_nibble_offset = 12; static char *kwlist[] = { "data", @@ -214,12 +214,12 @@ py_e2e_p01_check(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned short length; - unsigned short data_id; - unsigned short data_id_mode = E2E_P01_DATAID_BOTH; - unsigned short crc_offset = 0; - unsigned short counter_offset = 8; - unsigned short data_id_nibble_offset = 12; + uint16_t length; + uint16_t data_id; + uint16_t data_id_mode = E2E_P01_DATAID_BOTH; + uint16_t crc_offset = 0; + uint16_t counter_offset = 8; + uint16_t data_id_nibble_offset = 12; static char *kwlist[] = { "data", diff --git a/src/e2e/p02.c b/src/e2e/p02.c index 1784949..a1951f8 100644 --- a/src/e2e/p02.c +++ b/src/e2e/p02.c @@ -32,7 +32,7 @@ py_e2e_p02_protect(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned long length; + uint32_t length; Py_buffer data_id_list; int increment = true; @@ -117,7 +117,7 @@ py_e2e_p02_check(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned long length; + uint32_t length; Py_buffer data_id_list; static char *kwlist[] = { diff --git a/src/e2e/p04.c b/src/e2e/p04.c index 6c00894..2cf3a3b 100644 --- a/src/e2e/p04.c +++ b/src/e2e/p04.c @@ -62,9 +62,9 @@ py_e2e_p04_protect(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned short length; - unsigned long data_id; - unsigned short offset = 0; + uint16_t length; + uint32_t data_id; + uint16_t offset = 0; int increment = true; static char *kwlist[] = { @@ -151,9 +151,9 @@ py_e2e_p04_check(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned short length; - unsigned long data_id; - unsigned short offset = 0; + uint16_t length; + uint32_t data_id; + uint16_t offset = 0; static char *kwlist[] = { "data", diff --git a/src/e2e/p05.c b/src/e2e/p05.c index 02c046b..2a9ea5d 100644 --- a/src/e2e/p05.c +++ b/src/e2e/p05.c @@ -67,9 +67,9 @@ py_e2e_p05_protect(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned short length; - unsigned short data_id; - unsigned short offset = 0; + uint16_t length; + uint16_t data_id; + uint16_t offset = 0; int increment = true; static char *kwlist[] = { @@ -147,9 +147,9 @@ py_e2e_p05_check(PyObject *module, PyObject *kwargs) { Py_buffer data; - unsigned short length; - unsigned short data_id; - unsigned short offset = 0; + uint16_t length; + uint16_t data_id; + uint16_t offset = 0; static char *kwlist[] = { "data",