Skip to content

Commit

Permalink
libosdp: Add support for windows builds
Browse files Browse the repository at this point in the history
For rust and python modules, we need to target windows as a first
class citizen. Although we don't have any active users in those
platforms ATM, it would still be a nice to have.

Signed-off-by: Siddharth Chandrasekaran <[email protected]>
  • Loading branch information
sidcha authored and Siddharth Chandrasekaran committed Feb 20, 2024
1 parent 81207c8 commit 6280378
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/osdp_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
#include <stdarg.h>
#include <stdlib.h>
#ifndef CONFIG_DISABLE_PRETTY_LOGGING
#include <unistd.h>
#endif
#include <sys/time.h>

#include "osdp_common.h"

Expand Down
7 changes: 4 additions & 3 deletions src/osdp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@

#define osdp_dump hexdump // for zephyr compatibility.

static inline __attribute__((noreturn)) void die()
static inline __noreturn void die()
{
exit(EXIT_FAILURE);
__builtin_unreachable();
__unreachable();
}

#define BUG() \
Expand Down Expand Up @@ -447,7 +447,8 @@ static inline int get_tx_buf_size(struct osdp_pd *pd)
int packet_buf_size = sizeof(pd->packet_buf);

if (pd->peer_rx_size) {
packet_buf_size = MIN(packet_buf_size, (int)pd->peer_rx_size);
if (packet_buf_size > (int)pd->peer_rx_size)
packet_buf_size = (int)pd->peer_rx_size;
}
return packet_buf_size;
}
Expand Down
10 changes: 5 additions & 5 deletions src/osdp_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
* @param length Length of data section in this command.
* @param data File contents. Variable length
*/
struct osdp_cmd_file_xfer {
PACK(struct osdp_cmd_file_xfer {
uint8_t type;
uint32_t size;
uint32_t offset;
uint16_t length;
uint8_t data[];
} __packed;
});

/**
* @brief OSDP specified command: File Transfer Stat:
Expand All @@ -57,12 +57,12 @@ struct osdp_cmd_file_xfer {
* @param rx_size Alternate maximum message size for CMD_FILETRANSFER. If set to
* 0 then no change requested, otherwise use this value
*/
struct osdp_cmd_file_stat {
PACK(struct osdp_cmd_file_stat {
uint8_t control;
uint16_t delay;
int16_t status;
uint16_t rx_size;
} __packed;
});

enum file_tx_state_e {
OSDP_FILE_IDLE,
Expand Down Expand Up @@ -90,4 +90,4 @@ int osdp_file_tx_command(struct osdp_pd *pd, int file_id, uint32_t flags);
int osdp_get_file_tx_state(struct osdp_pd *pd);
void osdp_file_tx_abort(struct osdp_pd *pd);

#endif /* _OSDP_FILE_H_ */
#endif /* _OSDP_FILE_H_ */
4 changes: 2 additions & 2 deletions src/osdp_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
#define PKT_CONTROL_SCB 0x08
#define PKT_TRACE_MANGLED 0x80

struct osdp_packet_header {
PACK(struct osdp_packet_header {
uint8_t som;
uint8_t pd_address;
uint8_t len_lsb;
uint8_t len_msb;
uint8_t control;
uint8_t data[];
} __packed;
});

static inline bool packet_has_mark(struct osdp_pd *pd)
{
Expand Down
2 changes: 1 addition & 1 deletion utils

0 comments on commit 6280378

Please sign in to comment.