Changeset 12663


Ignore:
Timestamp:
Aug 10, 2011, 2:51:59 PM (10 years ago)
Author:
jordan
Message:

#4260 "µTP not working on embedded device" -- apply the changes from https://github.com/ghazel/libutp rather than http://github.com/bittorrent/libutp

Location:
trunk/third-party/libutp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/third-party/libutp/templates.h

    r12603 r12663  
    1818#define FORCEINLINE inline __attribute__((always_inline))
    1919#endif
     20#endif
     21
     22#ifdef __GNUC__
     23// Used for gcc tool chains accepting but not supporting pragma pack
     24// See http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
     25#define PACKED_ATTRIBUTE __attribute__((__packed__))
     26#else
     27#define PACKED_ATTRIBUTE
    2028#endif
    2129
     
    4957
    5058template <class T>
    51 struct big_endian
     59struct PACKED_ATTRIBUTE big_endian
    5260{
    5361        T operator=(T i) { m_integer = aux::host_to_network(i); return i; }
  • trunk/third-party/libutp/utp.cpp

    r12603 r12663  
    9595#pragma pack(push,1)
    9696
    97 struct PackedSockAddr {
     97struct PACKED_ATTRIBUTE PackedSockAddr {
    9898
    9999        // The values are always stored here in network byte order
     
    193193};
    194194
    195 struct RST_Info {
     195struct PACKED_ATTRIBUTE RST_Info {
    196196        PackedSockAddr addr;
    197197        uint32 connid;
     
    212212#define PACKET_SIZE_HUGE_BUCKET 4
    213213
    214 struct PacketFormat {
     214struct PACKED_ATTRIBUTE PacketFormat {
    215215        // connection ID
    216216        uint32_big connid;
     
    230230};
    231231
    232 struct PacketFormatAck {
     232struct PACKED_ATTRIBUTE PacketFormatAck {
    233233        PacketFormat pf;
    234234        byte ext_next;
     
    237237};
    238238
    239 struct PacketFormatExtensions {
     239struct PACKED_ATTRIBUTE PacketFormatExtensions {
    240240        PacketFormat pf;
    241241        byte ext_next;
     
    244244};
    245245
    246 struct PacketFormatV1 {
     246struct PACKED_ATTRIBUTE PacketFormatV1 {
    247247        // packet_type (4 high bits)
    248248        // protocol version (4 low bits)
     
    267267};
    268268
    269 struct PacketFormatAckV1 {
     269struct PACKED_ATTRIBUTE PacketFormatAckV1 {
    270270        PacketFormatV1 pf;
    271271        byte ext_next;
     
    274274};
    275275
    276 struct PacketFormatExtensionsV1 {
     276struct PACKED_ATTRIBUTE PacketFormatExtensionsV1 {
    277277        PacketFormatV1 pf;
    278278        byte ext_next;
  • trunk/third-party/libutp/utypes.h

    r12204 r12663  
    3737
    3838#ifndef __cplusplus
    39 #include <stdbool.h>
     39typedef uint8 bool;
    4040#endif
    4141
Note: See TracChangeset for help on using the changeset viewer.