Changeset 241ab7e in mainline for uspace/lib/inet/src/eth_addr.c


Ignore:
Timestamp:
2021-08-08T22:34:38Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
edeee9f
Parents:
2177b39
Message:

Declare buffer as uint8_t * for stricter type checking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/inet/src/eth_addr.c

    r2177b39 r241ab7e  
    5050 * @param buf Buffer (ETH_ADDR_SIZE bytes in size) to store bytes
    5151 */
    52 void eth_addr_encode(eth_addr_t *addr, void *buf)
     52void eth_addr_encode(eth_addr_t *addr, uint8_t *buf)
    5353{
    54         uint8_t *bp = (uint8_t *)buf;
    5554        uint64_t a;
    5655        int i;
     
    5958
    6059        for (i = 0; i < ETH_ADDR_SIZE; i++)
    61                 bp[i] = (a >> (40 - 8 * i)) & 0xff;
     60                buf[i] = (a >> (40 - 8 * i)) & 0xff;
    6261}
    6362
     
    7069 * @param addr Place to store Ethernet address
    7170 */
    72 void eth_addr_decode(const void *buf, eth_addr_t *addr)
     71void eth_addr_decode(const uint8_t *buf, eth_addr_t *addr)
    7372{
    74         const uint8_t *bp = (uint8_t *)buf;
    7573        uint64_t a;
    7674        int i;
     
    7876        a = 0;
    7977        for (i = 0; i < ETH_ADDR_SIZE; i++)
    80                 a |= (uint64_t)bp[i] << (40 - 8 * i);
     78                a |= (uint64_t)buf[i] << (40 - 8 * i);
    8179
    8280        addr->a = a;
Note: See TracChangeset for help on using the changeset viewer.