Replaced bit field for data from block header by unsigned int.

Usually, the block number can grow to 20 bits which is not
guaranteed to fit in a single unsigned int. To avoid compilers
(especially msp430-gcc) complaining about the width of the used
bit field, the type for num has been changed to unsigned int
hence restricting the number of acceptable blocks to 65536 on
those platforms. (No bounds check is done yet.)

m and szx now share a uint8_t.
This commit is contained in:
Olaf Bergmann committed 2014-06-18 16:43:32 +02:00
1 parent ebc4eaccee
commit 4f6a7f5dbf
1 file changed
+3 -3
+3 -3
View File
@@ -35,9 +35,9 @@
* Structure of Block options.
*/
typedef struct {
unsigned int num:20; /**< block number */
unsigned int m:1; /**< 1 if more blocks follow, 0 otherwise */
unsigned int szx:3; /**< block size */
unsigned int num; /**< block number */
uint8_t m:1; /**< 1 if more blocks follow, 0 otherwise */
uint8_t szx:3; /**< block size */
} coap_block_t;
/**