Skip to content

Commit

Permalink
try stdint.h types with PyArg_ParseTupleAndKeywords
Browse files Browse the repository at this point in the history
  • Loading branch information
zariiii9003 committed Nov 19, 2024
1 parent 971d62a commit 70a46a7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 41 deletions.
26 changes: 13 additions & 13 deletions src/e2e/crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
28 changes: 14 additions & 14 deletions src/e2e/p01.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/e2e/p02.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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[] = {
Expand Down
12 changes: 6 additions & 6 deletions src/e2e/p04.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions src/e2e/p05.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 70a46a7

Please sign in to comment.