added optional macros PACK_STRUCT_FLD_8() and PACK_STRUCT_FLD_S() to prevent gcc 4 from warning about struct members that do not need packing
This commit is contained in:
parent
63fde52db2
commit
fce9446a1b
|
@ -122,14 +122,14 @@ PACK_STRUCT_END
|
||||||
#endif
|
#endif
|
||||||
PACK_STRUCT_BEGIN
|
PACK_STRUCT_BEGIN
|
||||||
struct netbios_name_hdr {
|
struct netbios_name_hdr {
|
||||||
PACK_STRUCT_FIELD(u8_t nametype);
|
PACK_STRUCT_FLD_8(u8_t nametype);
|
||||||
PACK_STRUCT_FIELD(u8_t encname[(NETBIOS_NAME_LEN*2)+1]);
|
PACK_STRUCT_FLD_8(u8_t encname[(NETBIOS_NAME_LEN*2)+1]);
|
||||||
PACK_STRUCT_FIELD(u16_t type);
|
PACK_STRUCT_FIELD(u16_t type);
|
||||||
PACK_STRUCT_FIELD(u16_t cls);
|
PACK_STRUCT_FIELD(u16_t cls);
|
||||||
PACK_STRUCT_FIELD(u32_t ttl);
|
PACK_STRUCT_FIELD(u32_t ttl);
|
||||||
PACK_STRUCT_FIELD(u16_t datalen);
|
PACK_STRUCT_FIELD(u16_t datalen);
|
||||||
PACK_STRUCT_FIELD(u16_t flags);
|
PACK_STRUCT_FIELD(u16_t flags);
|
||||||
PACK_STRUCT_FIELD(ip_addr_p_t addr);
|
PACK_STRUCT_FLD_S(ip_addr_p_t addr);
|
||||||
} PACK_STRUCT_STRUCT;
|
} PACK_STRUCT_STRUCT;
|
||||||
PACK_STRUCT_END
|
PACK_STRUCT_END
|
||||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||||
|
@ -158,7 +158,7 @@ netbios_name_decoding( char *name_enc, char *name_dec, int name_dec_len)
|
||||||
char *pname;
|
char *pname;
|
||||||
char cname;
|
char cname;
|
||||||
char cnbname;
|
char cnbname;
|
||||||
int index = 0;
|
int idx = 0;
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(name_dec_len);
|
LWIP_UNUSED_ARG(name_dec_len);
|
||||||
|
|
||||||
|
@ -195,9 +195,9 @@ netbios_name_decoding( char *name_enc, char *name_dec, int name_dec_len)
|
||||||
pname++;
|
pname++;
|
||||||
|
|
||||||
/* Do we have room to store the character? */
|
/* Do we have room to store the character? */
|
||||||
if (index < NETBIOS_NAME_LEN) {
|
if (idx < NETBIOS_NAME_LEN) {
|
||||||
/* Yes - store the character. */
|
/* Yes - store the character. */
|
||||||
name_dec[index++] = (cnbname!=' '?cnbname:'\0');
|
name_dec[idx++] = (cnbname!=' '?cnbname:'\0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ netbios_name_encoding(char *name_enc, char *name_dec, int name_dec_len)
|
||||||
char *pname;
|
char *pname;
|
||||||
char cname;
|
char cname;
|
||||||
unsigned char ucname;
|
unsigned char ucname;
|
||||||
int index = 0;
|
int idx = 0;
|
||||||
|
|
||||||
/* Start encoding netbios name. */
|
/* Start encoding netbios name. */
|
||||||
pname = name_enc;
|
pname = name_enc;
|
||||||
|
@ -231,25 +231,25 @@ netbios_name_encoding(char *name_enc, char *name_dec, int name_dec_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we have room to store the character? */
|
/* Do we have room to store the character? */
|
||||||
if (index >= name_dec_len) {
|
if (idx >= name_dec_len) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Yes - store the character. */
|
/* Yes - store the character. */
|
||||||
ucname = cname;
|
ucname = cname;
|
||||||
name_dec[index++] = ('A'+((ucname>>4) & 0x0F));
|
name_dec[idx++] = ('A'+((ucname>>4) & 0x0F));
|
||||||
name_dec[index++] = ('A'+( ucname & 0x0F));
|
name_dec[idx++] = ('A'+( ucname & 0x0F));
|
||||||
pname++;
|
pname++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill with "space" coding */
|
/* Fill with "space" coding */
|
||||||
for (;index<name_dec_len-1;) {
|
for (;idx < name_dec_len - 1;) {
|
||||||
name_dec[index++] = 'C';
|
name_dec[idx++] = 'C';
|
||||||
name_dec[index++] = 'A';
|
name_dec[idx++] = 'A';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Terminate string */
|
/* Terminate string */
|
||||||
name_dec[index]='\0';
|
name_dec[idx] = '\0';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,8 +99,8 @@
|
||||||
#endif
|
#endif
|
||||||
PACK_STRUCT_BEGIN
|
PACK_STRUCT_BEGIN
|
||||||
struct rtp_hdr {
|
struct rtp_hdr {
|
||||||
PACK_STRUCT_FIELD(u8_t version);
|
PACK_STRUCT_FLD_8(u8_t version);
|
||||||
PACK_STRUCT_FIELD(u8_t payloadtype);
|
PACK_STRUCT_FLD_8(u8_t payloadtype);
|
||||||
PACK_STRUCT_FIELD(u16_t seqNum);
|
PACK_STRUCT_FIELD(u16_t seqNum);
|
||||||
PACK_STRUCT_FIELD(u32_t timestamp);
|
PACK_STRUCT_FIELD(u32_t timestamp);
|
||||||
PACK_STRUCT_FIELD(u32_t ssrc);
|
PACK_STRUCT_FIELD(u32_t ssrc);
|
||||||
|
|
|
@ -238,17 +238,17 @@
|
||||||
#endif
|
#endif
|
||||||
PACK_STRUCT_BEGIN
|
PACK_STRUCT_BEGIN
|
||||||
struct sntp_msg {
|
struct sntp_msg {
|
||||||
PACK_STRUCT_FIELD(u8_t li_vn_mode);
|
PACK_STRUCT_FLD_8(u8_t li_vn_mode);
|
||||||
PACK_STRUCT_FIELD(u8_t stratum);
|
PACK_STRUCT_FLD_8(u8_t stratum);
|
||||||
PACK_STRUCT_FIELD(u8_t poll);
|
PACK_STRUCT_FLD_8(u8_t poll);
|
||||||
PACK_STRUCT_FIELD(u8_t precision);
|
PACK_STRUCT_FLD_8(u8_t precision);
|
||||||
PACK_STRUCT_FIELD(u32_t root_delay);
|
PACK_STRUCT_FIELD(u32_t root_delay);
|
||||||
PACK_STRUCT_FIELD(u32_t root_dispersion);
|
PACK_STRUCT_FIELD(u32_t root_dispersion);
|
||||||
PACK_STRUCT_FIELD(u32_t reference_identifier);
|
PACK_STRUCT_FIELD(u32_t reference_identifier);
|
||||||
PACK_STRUCT_FIELD(u32_t reference_timestamp[2]);
|
PACK_STRUCT_FIELD(u32_t reference_timestamp[2]);
|
||||||
PACK_STRUCT_FIELD(u32_t originate_timestamp[2]);
|
PACK_STRUCT_FIELD(u32_t originate_timestamp[2]);
|
||||||
PACK_STRUCT_FIELD(u32_t receive_timestamp[2]);
|
PACK_STRUCT_FIELD(u32_t receive_timestamp[2]);
|
||||||
PACK_STRUCT_FIELD(u32_t transmit_timestamp[2]);
|
PACK_STRUCT_FIELD(u32_t transmit_timestamp[2]);
|
||||||
} PACK_STRUCT_STRUCT;
|
} PACK_STRUCT_STRUCT;
|
||||||
PACK_STRUCT_END
|
PACK_STRUCT_END
|
||||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||||
|
|
Loading…
Reference in New Issue