- Timestamp:
- Apr 24, 2006, 11:09:06 PM (15 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/common.h
r863 r865 33 33 #endif 34 34 35 #if !defined(HAVE_HTONS) && !defined(HAVE_NETINET_IN_H) 35 #if defined(HAVE_HTONS) 36 # define hton16 htons 37 # define hton32 htonl 38 #else 36 39 # if defined(HAVE_ENDIAN_H) 37 40 # include <endian.h> 38 41 # endif 39 static inline uint16_t hton s(uint16_t x)42 static inline uint16_t hton16(uint16_t x) 40 43 { 44 /* This is compile-time optimised with at least -O1 or -Os */ 41 45 #if defined(HAVE_ENDIAN_H) 42 46 if(__BYTE_ORDER == __BIG_ENDIAN) 43 47 #else 44 /* This is compile-time optimised with at least -O1 or -Os */45 48 uint32_t const dummy = 0x12345678; 46 49 if(*(uint8_t const *)&dummy == 0x12) … … 51 54 } 52 55 53 static inline uint32_t hton l(uint32_t x)56 static inline uint32_t hton32(uint32_t x) 54 57 { 58 /* This is compile-time optimised with at least -O1 or -Os */ 55 59 #if defined(HAVE_ENDIAN_H) 56 60 if(__BYTE_ORDER == __BIG_ENDIAN) 57 61 #else 58 /* This is compile-time optimised with at least -O1 or -Os */59 62 uint32_t const dummy = 0x12345678; 60 63 if(*(uint8_t const *)&dummy == 0x12) -
libcaca/trunk/configure.ac
r861 r865 62 62 [ --enable-doc build documentation (needs doxygen and LaTeX)]) 63 63 64 AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h arpa/inet.h netinet/in.h )64 AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h) 65 65 AC_CHECK_FUNCS(signal ioctl vsnprintf getenv putenv strcasecmp htons) 66 66 AC_CHECK_FUNCS(usleep gettimeofday) -
libcaca/trunk/cucul/font.c
r862 r865 137 137 138 138 memcpy(&f->header, f->private + 8, sizeof(struct font_header)); 139 f->header.control_size = hton l(f->header.control_size);140 f->header.data_size = hton l(f->header.data_size);141 f->header.version = hton s(f->header.version);142 f->header.blocks = hton s(f->header.blocks);143 f->header.glyphs = hton l(f->header.glyphs);144 f->header.bpp = hton s(f->header.bpp);145 f->header.width = hton s(f->header.width);146 f->header.height = hton s(f->header.height);147 f->header.flags = hton s(f->header.flags);139 f->header.control_size = hton32(f->header.control_size); 140 f->header.data_size = hton32(f->header.data_size); 141 f->header.version = hton16(f->header.version); 142 f->header.blocks = hton16(f->header.blocks); 143 f->header.glyphs = hton32(f->header.glyphs); 144 f->header.bpp = hton16(f->header.bpp); 145 f->header.width = hton16(f->header.width); 146 f->header.height = hton16(f->header.height); 147 f->header.flags = hton16(f->header.flags); 148 148 149 149 if(size != 8 + f->header.control_size + f->header.data_size … … 162 162 for(i = 0; i < f->header.blocks; i++) 163 163 { 164 f->block_list[i].start = hton l(f->block_list[i].start);165 f->block_list[i].stop = hton l(f->block_list[i].stop);166 f->block_list[i].index = hton l(f->block_list[i].index);164 f->block_list[i].start = hton32(f->block_list[i].start); 165 f->block_list[i].stop = hton32(f->block_list[i].stop); 166 f->block_list[i].index = hton32(f->block_list[i].index); 167 167 168 168 if(f->block_list[i].start > f->block_list[i].stop … … 183 183 for(i = 0; i < f->header.glyphs; i++) 184 184 { 185 f->glyph_list[i].width = hton s(f->glyph_list[i].width);186 f->glyph_list[i].height = hton s(f->glyph_list[i].height);187 f->glyph_list[i].data_offset = hton l(f->glyph_list[i].data_offset);185 f->glyph_list[i].width = hton16(f->glyph_list[i].width); 186 f->glyph_list[i].height = hton16(f->glyph_list[i].height); 187 f->glyph_list[i].data_offset = hton32(f->glyph_list[i].data_offset); 188 188 189 189 if(f->glyph_list[i].data_offset >= f->header.data_size -
libcaca/trunk/src/cacaserver.c
r859 r865 19 19 #include <string.h> 20 20 #include <stdlib.h> 21 #if defined(HAVE_ARPA_INET_H) 22 # include <arpa/inet.h> 23 #elif defined(HAVE_NETINET_IN_H) 24 # include <netinet/in.h> 25 #elif defined(HAVE_WINSOCK2_H) 26 # include <winsock2.h> 27 #endif 21 28 #include <sys/types.h> 22 29 #include <sys/socket.h> 23 #include <arpa/inet.h>24 30 #include <fcntl.h> 25 31 #include <signal.h> -
libcaca/trunk/tools/makefont.c
r861 r865 273 273 static int printf_u32(char const *fmt, uint32_t i) 274 274 { 275 uint32_t ni = hton l(i);275 uint32_t ni = hton32(i); 276 276 return printf_hex(fmt, (uint8_t *)&ni, 4); 277 277 } … … 279 279 static int printf_u16(char const *fmt, uint16_t i) 280 280 { 281 uint16_t ni = hton s(i);281 uint16_t ni = hton16(i); 282 282 return printf_hex(fmt, (uint8_t *)&ni, 2); 283 283 }
Note: See TracChangeset
for help on using the changeset viewer.