some more big endian fixes

This commit is contained in:
jsorg71 2005-07-10 19:17:09 +00:00
parent 196bfa81d6
commit d349f6920a
4 changed files with 41 additions and 3 deletions

View File

@ -22,7 +22,9 @@
#define ARCH_H
/* check endianess */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#if defined(__sparc__)
#define B_ENDIAN
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#define L_ENDIAN
#elif __BYTE_ORDER == __BIG_ENDIAN
#define B_ENDIAN

View File

@ -308,7 +308,7 @@ libxrdp_send_bitmap(struct xrdp_session* session, int width, int height,
for (j = 0; j < lines_sending; j++)
{
q = q - line_size;
out_uint8a(s, q, line_size)
out_uint8a(s, q, line_size) /* B_ENDIAN doesn't work here, todo */
out_uint8s(s, e * Bpp);
}
s_mark_end(s);

View File

@ -949,7 +949,11 @@ int lib_mod_connect(struct vnc* v)
{
out_uint8(pixel_format, 8); /* bits per pixel */
out_uint8(pixel_format, 8); /* depth */
#if defined(B_ENDIAN)
out_uint8(pixel_format, 1); /* big endian */
#else
out_uint8(pixel_format, 0); /* big endian */
#endif
out_uint8(pixel_format, 0); /* true color flag */
out_uint16_be(pixel_format, 0); /* red max */
out_uint16_be(pixel_format, 0); /* green max */
@ -963,7 +967,11 @@ int lib_mod_connect(struct vnc* v)
{
out_uint8(pixel_format, 16); /* bits per pixel */
out_uint8(pixel_format, 16); /* depth */
#if defined(B_ENDIAN)
out_uint8(pixel_format, 1); /* big endian */
#else
out_uint8(pixel_format, 0); /* big endian */
#endif
out_uint8(pixel_format, 1); /* true color flag */
out_uint16_be(pixel_format, 31); /* red max */
out_uint16_be(pixel_format, 63); /* green max */

View File

@ -108,9 +108,37 @@ pipe_sig(int sig_num)
int
main(int argc, char** argv)
{
int test;
int host_be;
#if defined(_WIN32)
WSADATA w;
#endif
/* check compiled endian with actual edian */
test = 1;
host_be = !((int)(*(unsigned char*)(&test)));
#if defined(B_ENDIAN)
if (!host_be)
#endif
#if defined(L_ENDIAN)
if (host_be)
#endif
{
g_printf("endian wrong, edit arch.h\n\r");
return 0;
}
/* check long, int and void* sizes */
if (sizeof(int) != 4)
{
g_printf("unusable int size, must be 4\n\r");
return 0;
}
if (sizeof(long) != sizeof(void*) || (sizeof(long) != 4 && sizeof(long) != 8))
{
g_printf("unusable long size, must be 4 or 8\n\r");
return 0;
}
#if defined(_WIN32)
WSAStartup(2, &w);
InitializeCriticalSection(&g_term_mutex);
#endif