Skip to content
Snippets Groups Projects
Commit 1b27978a authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Try an anonymous union containing an anonymouse struct to fix it.

parent c5f774b8
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
...@@ -64,8 +64,13 @@ ...@@ -64,8 +64,13 @@
typedef struct sftp_tx_pkt { typedef struct sftp_tx_pkt {
uint32_t sz; uint32_t sz;
uint32_t used; uint32_t used;
uint8_t type; union {
uint8_t data[]; struct {
uint8_t type;
uint8_t data[];
};
uint8_t tdata[];
}
} *sftp_tx_pkt_t; } *sftp_tx_pkt_t;
typedef struct sftp_rx_pkt { typedef struct sftp_rx_pkt {
......
...@@ -283,12 +283,12 @@ sftp_tx_pkt_reset(sftp_tx_pkt_t *pktp) ...@@ -283,12 +283,12 @@ sftp_tx_pkt_reset(sftp_tx_pkt_t *pktp)
return true; return true;
} }
#define APPEND_FUNC_BODY(var) \ #define APPEND_FUNC_BODY(var) \
if (!grow_tx(pktp, sizeof(var))) \ if (!grow_tx(pktp, sizeof(var))) \
return false; \ return false; \
sftp_tx_pkt_t pkt = *pktp; \ sftp_tx_pkt_t pkt = *pktp; \
memcpy((uint64_t *)(&(&pkt->type)[pkt->used]), &var, sizeof(var)); \ memcpy(&pkt->tdata[pkt->used], &var, sizeof(var)); \
pkt->used += sizeof(var); \ pkt->used += sizeof(var); \
return true return true
bool bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment