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 @@
typedef struct sftp_tx_pkt {
uint32_t sz;
uint32_t used;
uint8_t type;
uint8_t data[];
union {
struct {
uint8_t type;
uint8_t data[];
};
uint8_t tdata[];
}
} *sftp_tx_pkt_t;
typedef struct sftp_rx_pkt {
......
......@@ -283,12 +283,12 @@ sftp_tx_pkt_reset(sftp_tx_pkt_t *pktp)
return true;
}
#define APPEND_FUNC_BODY(var) \
if (!grow_tx(pktp, sizeof(var))) \
return false; \
sftp_tx_pkt_t pkt = *pktp; \
memcpy((uint64_t *)(&(&pkt->type)[pkt->used]), &var, sizeof(var)); \
pkt->used += sizeof(var); \
#define APPEND_FUNC_BODY(var) \
if (!grow_tx(pktp, sizeof(var))) \
return false; \
sftp_tx_pkt_t pkt = *pktp; \
memcpy(&pkt->tdata[pkt->used], &var, sizeof(var)); \
pkt->used += sizeof(var); \
return true
bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment