From 4f8b0bc47a192d5940e758dd26bf5962e0e2c207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Tue, 30 Jul 2002 07:18:48 +0000 Subject: [PATCH] Changed max line length to 100 git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@81 423420c4-83ab-492f-b58f-81f9feb106b5 --- bitmap.c | 31 ++++--------- cache.c | 15 ++---- indent-all.sh | 3 +- licence.c | 21 +++------ mcs.c | 3 +- orders.c | 85 +++++++++++++--------------------- proto.h | 21 +++------ rdesktop.c | 14 ++---- rdp.c | 25 ++++------ secure.c | 27 ++++------- tcp.c | 10 ++-- xkeymap.c | 69 ++++++++++------------------ xwin.c | 125 ++++++++++++++++---------------------------------- 13 files changed, 149 insertions(+), 300 deletions(-) diff --git a/bitmap.c b/bitmap.c index 380a703..a000c54 100644 --- a/bitmap.c +++ b/bitmap.c @@ -43,8 +43,7 @@ } BOOL -bitmap_decompress(unsigned char *output, int width, int height, - unsigned char *input, int size) +bitmap_decompress(unsigned char *output, int width, int height, unsigned char *input, int size) { unsigned char *end = input + size; unsigned char *prevline = NULL, *line = NULL; @@ -114,8 +113,7 @@ bitmap_decompress(unsigned char *output, int width, int height, switch (opcode) { case 0: /* Fill */ - if ((lastopcode == opcode) - && !((x == width) && (prevline == NULL))) + if ((lastopcode == opcode) && !((x == width) && (prevline == NULL))) insertmix = True; break; case 8: /* Bicolour */ @@ -167,9 +165,7 @@ bitmap_decompress(unsigned char *output, int width, int height, if (prevline == NULL) line[x] = mix; else - line[x] = - prevline[x] ^ - mix; + line[x] = prevline[x] ^ mix; insertmix = False; count--; @@ -193,8 +189,7 @@ bitmap_decompress(unsigned char *output, int width, int height, } else { - REPEAT(line[x] = - prevline[x] ^ mix); + REPEAT(line[x] = prevline[x] ^ mix); } break; @@ -202,8 +197,7 @@ bitmap_decompress(unsigned char *output, int width, int height, if (prevline == NULL) { REPEAT(MASK_UPDATE(); - if (mask & mixmask) - line[x] = mix; + if (mask & mixmask) line[x] = mix; else line[x] = 0;); } @@ -211,11 +205,9 @@ bitmap_decompress(unsigned char *output, int width, int height, { REPEAT(MASK_UPDATE(); if (mask & mixmask) - line[x] = - prevline[x] ^ mix; + line[x] = prevline[x] ^ mix; else - line[x] = - prevline[x];); + line[x] = prevline[x];); } break; @@ -230,12 +222,10 @@ bitmap_decompress(unsigned char *output, int width, int height, case 8: /* Bicolour */ REPEAT(if (bicolour) { - line[x] = colour2; - bicolour = False;} + line[x] = colour2; bicolour = False;} else { - line[x] = colour1; - bicolour = True; count++;} + line[x] = colour1; bicolour = True; count++;} ); break; @@ -248,8 +238,7 @@ bitmap_decompress(unsigned char *output, int width, int height, break; default: - unimpl("bitmap opcode 0x%x\n", - opcode); + unimpl("bitmap opcode 0x%x\n", opcode); return False; } } diff --git a/cache.c b/cache.c index e2d6e57..584714c 100644 --- a/cache.c +++ b/cache.c @@ -32,8 +32,7 @@ cache_get_bitmap(uint8 cache_id, uint16 cache_idx) { HBITMAP bitmap; - if ((cache_id < NUM_ELEMENTS(bmpcache)) - && (cache_idx < NUM_ELEMENTS(bmpcache[0]))) + if ((cache_id < NUM_ELEMENTS(bmpcache)) && (cache_idx < NUM_ELEMENTS(bmpcache[0]))) { bitmap = bmpcache[cache_id][cache_idx]; if (bitmap != NULL) @@ -50,8 +49,7 @@ cache_put_bitmap(uint8 cache_id, uint16 cache_idx, HBITMAP bitmap) { HBITMAP old; - if ((cache_id < NUM_ELEMENTS(bmpcache)) - && (cache_idx < NUM_ELEMENTS(bmpcache[0]))) + if ((cache_id < NUM_ELEMENTS(bmpcache)) && (cache_idx < NUM_ELEMENTS(bmpcache[0]))) { old = bmpcache[cache_id][cache_idx]; if (old != NULL) @@ -75,8 +73,7 @@ cache_get_font(uint8 font, uint16 character) { FONTGLYPH *glyph; - if ((font < NUM_ELEMENTS(fontcache)) - && (character < NUM_ELEMENTS(fontcache[0]))) + if ((font < NUM_ELEMENTS(fontcache)) && (character < NUM_ELEMENTS(fontcache[0]))) { glyph = &fontcache[font][character]; if (glyph->pixmap != NULL) @@ -94,8 +91,7 @@ cache_put_font(uint8 font, uint16 character, uint16 offset, { FONTGLYPH *glyph; - if ((font < NUM_ELEMENTS(fontcache)) - && (character < NUM_ELEMENTS(fontcache[0]))) + if ((font < NUM_ELEMENTS(fontcache)) && (character < NUM_ELEMENTS(fontcache[0]))) { glyph = &fontcache[font][character]; if (glyph->pixmap != NULL) @@ -177,8 +173,7 @@ cache_get_desktop(uint32 offset, int cx, int cy, int bytes_per_pixel) /* Store desktop data in the cache */ void -cache_put_desktop(uint32 offset, int cx, int cy, int scanline, - int bytes_per_pixel, uint8 * data) +cache_put_desktop(uint32 offset, int cx, int cy, int scanline, int bytes_per_pixel, uint8 * data) { int length = cx * cy * bytes_per_pixel; diff --git a/indent-all.sh b/indent-all.sh index 090e394..d20dae8 100755 --- a/indent-all.sh +++ b/indent-all.sh @@ -1,3 +1,2 @@ #!/bin/sh -indent -bli0 -i8 -cli8 -npcs *.h *.c - +indent -bli0 -i8 -cli8 -npcs -l100 *.h *.c diff --git a/licence.c b/licence.c index e318a3e..b0615ef 100644 --- a/licence.c +++ b/licence.c @@ -32,8 +32,7 @@ BOOL licence_issued = False; /* Generate a session key and RC4 keys, given client and server randoms */ static void -licence_generate_keys(uint8 * client_key, uint8 * server_key, - uint8 * client_rsa) +licence_generate_keys(uint8 * client_key, uint8 * server_key, uint8 * client_rsa) { uint8 session_key[48]; uint8 temp_hash[48]; @@ -59,8 +58,7 @@ licence_generate_hwid(uint8 * hwid) /* Present an existing licence to the server */ static void licence_present(uint8 * client_random, uint8 * rsa_data, - uint8 * licence_data, int licence_size, - uint8 * hwid, uint8 * signature) + uint8 * licence_data, int licence_size, uint8 * hwid, uint8 * signature) { uint32 sec_flags = SEC_LICENCE_NEG; uint16 length = @@ -99,8 +97,7 @@ licence_present(uint8 * client_random, uint8 * rsa_data, /* Send a licence request packet */ static void -licence_send_request(uint8 * client_random, uint8 * rsa_data, - char *user, char *host) +licence_send_request(uint8 * client_random, uint8 * rsa_data, char *user, char *host) { uint32 sec_flags = SEC_LICENCE_NEG; uint16 userlen = strlen(user) + 1; @@ -158,8 +155,7 @@ licence_process_demand(STREAM s) licence_size = load_licence(&licence_data); if (licence_size == -1) { - licence_send_request(null_data, null_data, username, - hostname); + licence_send_request(null_data, null_data, username, hostname); return; } @@ -171,8 +167,7 @@ licence_process_demand(STREAM s) RC4_set_key(&crypt_key, 16, licence_key); RC4(&crypt_key, sizeof(hwid), hwid, hwid); - licence_present(null_data, null_data, licence_data, licence_size, - hwid, signature); + licence_present(null_data, null_data, licence_data, licence_size, hwid, signature); xfree(licence_data); } @@ -229,8 +224,7 @@ static void licence_process_authreq(STREAM s) { uint8 *in_token, *in_sig; - uint8 out_token[LICENCE_TOKEN_SIZE], - decrypt_token[LICENCE_TOKEN_SIZE]; + uint8 out_token[LICENCE_TOKEN_SIZE], decrypt_token[LICENCE_TOKEN_SIZE]; uint8 hwid[LICENCE_HWID_SIZE], crypt_hwid[LICENCE_HWID_SIZE]; uint8 sealed_buffer[LICENCE_TOKEN_SIZE + LICENCE_HWID_SIZE]; uint8 out_sig[LICENCE_SIGNATURE_SIZE]; @@ -248,8 +242,7 @@ licence_process_authreq(STREAM s) licence_generate_hwid(hwid); memcpy(sealed_buffer, decrypt_token, LICENCE_TOKEN_SIZE); memcpy(sealed_buffer + LICENCE_TOKEN_SIZE, hwid, LICENCE_HWID_SIZE); - sec_sign(out_sig, 16, licence_sign_key, 16, - sealed_buffer, sizeof(sealed_buffer)); + sec_sign(out_sig, 16, licence_sign_key, 16, sealed_buffer, sizeof(sealed_buffer)); /* Deliberately break signature if licencing disabled */ if (!licence) diff --git a/mcs.c b/mcs.c index ce852f9..661a0ba 100644 --- a/mcs.c +++ b/mcs.c @@ -89,8 +89,7 @@ ber_out_integer(STREAM s, int value) /* Output a DOMAIN_PARAMS structure (ASN.1 BER) */ static void -mcs_out_domain_params(STREAM s, int max_channels, int max_users, - int max_tokens, int max_pdusize) +mcs_out_domain_params(STREAM s, int max_channels, int max_users, int max_tokens, int max_pdusize) { ber_out_header(s, MCS_TAG_DOMAIN_PARAMS, 32); ber_out_integer(s, max_channels); diff --git a/orders.c b/orders.c index d486e22..1de45ce 100644 --- a/orders.c +++ b/orders.c @@ -198,7 +198,8 @@ process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, BOOL delta) rdp_parse_brush(s, &os->brush, present >> 7); - DEBUG(("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n", os->opcode, os->x, os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour)); + DEBUG(("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n", os->opcode, os->x, + os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour)); ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy, &os->brush, os->bgcolour, os->fgcolour); @@ -232,8 +233,7 @@ process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, BOOL delta) DEBUG(("SCREENBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,srcx=%d,srcy=%d)\n", os->opcode, os->x, os->y, os->cx, os->cy, os->srcx, os->srcy)); - ui_screenblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, - os->srcx, os->srcy); + ui_screenblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, os->srcx, os->srcy); } /* Process a line order */ @@ -264,8 +264,7 @@ process_line(STREAM s, LINE_ORDER * os, uint32 present, BOOL delta) rdp_parse_pen(s, &os->pen, present >> 7); DEBUG(("LINE(op=0x%x,sx=%d,sy=%d,dx=%d,dx=%d,fg=0x%x)\n", - os->opcode, os->startx, os->starty, os->endx, os->endy, - os->pen.colour)); + os->opcode, os->startx, os->starty, os->endx, os->endy, os->pen.colour)); if (os->opcode < 0x01 || os->opcode > 0x10) { @@ -273,8 +272,7 @@ process_line(STREAM s, LINE_ORDER * os, uint32 present, BOOL delta) return; } - ui_line(os->opcode - 1, os->startx, os->starty, - os->endx, os->endy, &os->pen); + ui_line(os->opcode - 1, os->startx, os->starty, os->endx, os->endy, &os->pen); } /* Process an opaque rectangle order */ @@ -296,8 +294,7 @@ process_rect(STREAM s, RECT_ORDER * os, uint32 present, BOOL delta) if (present & 0x10) in_uint8(s, os->colour); - DEBUG(("RECT(x=%d,y=%d,cx=%d,cy=%d,fg=0x%x)\n", - os->x, os->y, os->cx, os->cy, os->colour)); + DEBUG(("RECT(x=%d,y=%d,cx=%d,cy=%d,fg=0x%x)\n", os->x, os->y, os->cx, os->cy, os->colour)); ui_rect(os->x, os->y, os->cx, os->cy, os->colour); } @@ -327,8 +324,7 @@ process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, BOOL delta) in_uint8(s, os->action); DEBUG(("DESKSAVE(l=%d,t=%d,r=%d,b=%d,off=%d,op=%d)\n", - os->left, os->top, os->right, os->bottom, os->offset, - os->action)); + os->left, os->top, os->right, os->bottom, os->offset, os->action)); width = os->right - os->left + 1; height = os->bottom - os->top + 1; @@ -336,8 +332,7 @@ process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, BOOL delta) if (os->action == 0) ui_desktop_save(os->offset, os->left, os->top, width, height); else - ui_desktop_restore(os->offset, os->left, os->top, width, - height); + ui_desktop_restore(os->offset, os->left, os->top, width, height); } /* Process a memory blt order */ @@ -377,15 +372,13 @@ process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, BOOL delta) in_uint16_le(s, os->cache_idx); DEBUG(("MEMBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d)\n", - os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, - os->cache_idx)); + os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, os->cache_idx)); bitmap = cache_get_bitmap(os->cache_id, os->cache_idx); if (bitmap == NULL) return; - ui_memblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, - bitmap, os->srcx, os->srcy); + ui_memblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, bitmap, os->srcx, os->srcy); } /* Process a 3-way blt order */ @@ -435,15 +428,16 @@ process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, BOOL delta) if (present & 0x010000) in_uint16_le(s, os->unknown); - DEBUG(("TRIBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d,bs=%d,bg=0x%x,fg=0x%x)\n", os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, os->cache_idx, os->brush.style, os->bgcolour, os->fgcolour)); + DEBUG(("TRIBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d,bs=%d,bg=0x%x,fg=0x%x)\n", + os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, os->cache_idx, + os->brush.style, os->bgcolour, os->fgcolour)); bitmap = cache_get_bitmap(os->cache_id, os->cache_idx); if (bitmap == NULL) return; ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, - bitmap, os->srcx, os->srcy, - &os->brush, os->bgcolour, os->fgcolour); + bitmap, os->srcx, os->srcy, &os->brush, os->bgcolour, os->fgcolour); } /* Parse a delta co-ordinate in polyline order form */ @@ -500,8 +494,7 @@ process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta) opcode = ROP2_NXOR; DEBUG(("POLYLINE(x=%d,y=%d,fl=0x%x,fg=0x%x,n=%d,sz=%d)\n", - os->x, os->y, os->flags, os->fgcolour, os->lines, - os->datasize)); + os->x, os->y, os->flags, os->fgcolour, os->lines, os->datasize)); DEBUG(("Data: ")); @@ -615,8 +608,7 @@ process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, BOOL delta) os->clipbottom - os->cliptop, os->boxleft, os->boxtop, os->boxright - os->boxleft, - os->boxbottom - os->boxtop, - os->bgcolour, os->fgcolour, os->text, os->length); + os->boxbottom - os->boxtop, os->bgcolour, os->fgcolour, os->text, os->length); } /* Process a raw bitmap cache order */ @@ -638,13 +630,11 @@ process_raw_bmpcache(STREAM s) in_uint16_le(s, cache_idx); in_uint8p(s, data, bufsize); - DEBUG(("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", - width, height, cache_id, cache_idx)); + DEBUG(("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); inverted = xmalloc(width * height); for (y = 0; y < height; y++) { - memcpy(&inverted[(height - y - 1) * width], &data[y * width], - width); + memcpy(&inverted[(height - y - 1) * width], &data[y * width], width); } bitmap = ui_create_bitmap(width, height, inverted); @@ -673,8 +663,7 @@ process_bmpcache(STREAM s) in_uint8s(s, 4); /* row_size, final_size */ in_uint8p(s, data, size); - DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", - width, height, cache_id, cache_idx)); + DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); bmpdata = xmalloc(width * height); @@ -746,8 +735,7 @@ process_fontcache(STREAM s) in_uint8p(s, data, datasize); bitmap = ui_create_glyph(width, height, data); - cache_put_font(font, character, offset, baseline, - width, height, bitmap); + cache_put_font(font, character, offset, baseline, width, height, bitmap); } } @@ -854,8 +842,7 @@ process_orders(STREAM s) os->bounds.top, os->bounds.right - os->bounds.left + 1, - os->bounds.bottom - - os->bounds.top + 1); + os->bounds.bottom - os->bounds.top + 1); } delta = order_flags & RDP_ORDER_DELTA; @@ -863,53 +850,43 @@ process_orders(STREAM s) switch (os->order_type) { case RDP_ORDER_DESTBLT: - process_destblt(s, &os->destblt, - present, delta); + process_destblt(s, &os->destblt, present, delta); break; case RDP_ORDER_PATBLT: - process_patblt(s, &os->patblt, - present, delta); + process_patblt(s, &os->patblt, present, delta); break; case RDP_ORDER_SCREENBLT: - process_screenblt(s, &os->screenblt, - present, delta); + process_screenblt(s, &os->screenblt, present, delta); break; case RDP_ORDER_LINE: - process_line(s, &os->line, - present, delta); + process_line(s, &os->line, present, delta); break; case RDP_ORDER_RECT: - process_rect(s, &os->rect, - present, delta); + process_rect(s, &os->rect, present, delta); break; case RDP_ORDER_DESKSAVE: - process_desksave(s, &os->desksave, - present, delta); + process_desksave(s, &os->desksave, present, delta); break; case RDP_ORDER_MEMBLT: - process_memblt(s, &os->memblt, - present, delta); + process_memblt(s, &os->memblt, present, delta); break; case RDP_ORDER_TRIBLT: - process_triblt(s, &os->triblt, - present, delta); + process_triblt(s, &os->triblt, present, delta); break; case RDP_ORDER_POLYLINE: - process_polyline(s, &os->polyline, - present, delta); + process_polyline(s, &os->polyline, present, delta); break; case RDP_ORDER_TEXT2: - process_text2(s, &os->text2, - present, delta); + process_text2(s, &os->text2, present, delta); break; default: diff --git a/proto.h b/proto.h index 5ad0364..2a51d63 100644 --- a/proto.h +++ b/proto.h @@ -6,8 +6,7 @@ HBITMAP cache_get_bitmap(uint8 cache_id, uint16 cache_idx); void cache_put_bitmap(uint8 cache_id, uint16 cache_idx, HBITMAP bitmap); FONTGLYPH *cache_get_font(uint8 font, uint16 character); void cache_put_font(uint8 font, uint16 character, uint16 offset, - uint16 baseline, uint16 width, uint16 height, - HGLYPH pixmap); + uint16 baseline, uint16 width, uint16 height, HGLYPH pixmap); DATABLOB *cache_get_text(uint8 cache_id); void cache_put_text(uint8 cache_id, void *data, int length); uint8 *cache_get_desktop(uint32 offset, int cx, int cy, int bytes_per_pixel); @@ -52,8 +51,7 @@ BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory); void rdp_disconnect(void); /* secure.c */ -void sec_hash_48(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2, - uint8 salt); +void sec_hash_48(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2, uint8 salt); void sec_hash_16(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2); void buf_out_uint32(uint8 * buffer, uint32 value); void sec_sign(uint8 * signature, int siglen, uint8 * session_key, int keylen, @@ -72,8 +70,7 @@ void tcp_disconnect(void); /* xkeymap.c */ void xkeymap_init1(void); void xkeymap_init2(void); -key_translation xkeymap_translate_key(KeySym keysym, unsigned int keycode, - unsigned int state); +key_translation xkeymap_translate_key(KeySym keysym, unsigned int keycode, unsigned int state); uint16 xkeymap_translate_button(unsigned int button); char *get_ksname(KeySym keysym); BOOL inhibit_key(KeySym keysym); @@ -85,8 +82,7 @@ void ui_destroy_window(void); void ui_select(int rdp_socket); void ui_move_pointer(int x, int y); HBITMAP ui_create_bitmap(int width, int height, uint8 * data); -void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, - uint8 * data); +void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data); void ui_destroy_bitmap(HBITMAP bmp); HGLYPH ui_create_glyph(int width, int height, uint8 * data); void ui_destroy_glyph(HGLYPH glyph); @@ -103,14 +99,11 @@ void ui_bell(void); void ui_destblt(uint8 opcode, int x, int y, int cx, int cy); void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, BRUSH * brush, int bgcolour, int fgcolour); -void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, int srcx, - int srcy); -void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, - int srcx, int srcy); +void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy); +void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy); void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy, BRUSH * brush, int bgcolour, int fgcolour); -void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, - PEN * pen); +void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN * pen); void ui_rect(int x, int y, int cx, int cy, int colour); void ui_draw_glyph(int mixmode, int x, int y, int cx, int cy, HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour); diff --git a/rdesktop.c b/rdesktop.c index 5d50c14..dd7620e 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -83,8 +83,7 @@ main(int argc, char *argv[]) int c; printf("rdesktop: A Remote Desktop Protocol client.\n"); - printf("Version " VERSION - ". Copyright (C) 1999-2001 Matt Chapman.\n"); + printf("Version " VERSION ". Copyright (C) 1999-2001 Matt Chapman.\n"); printf("See http://www.rdesktop.org/ for more information.\n\n"); flags = RDP_LOGON_NORMAL; @@ -121,8 +120,7 @@ main(int argc, char *argv[]) break; case 'k': - STRNCPY(keymapname, optarg, - sizeof(keymapname)); + STRNCPY(keymapname, optarg, sizeof(keymapname)); break; case 'g': @@ -229,8 +227,8 @@ main(int argc, char *argv[]) strncat(title, server, sizeof(title) - sizeof("rdesktop - ")); xkeymap_init1(); - if(!ui_init()) - return 1; + if (!ui_init()) + return 1; if (!rdp_connect(server, flags, domain, password, shell, directory)) return 1; @@ -358,9 +356,7 @@ hexdump(unsigned char *p, unsigned int len) printf(" "); for (i = 0; i < thisline; i++) - printf("%c", - (line[i] >= 0x20 - && line[i] < 0x7f) ? line[i] : '.'); + printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); printf("\n"); offset += thisline; diff --git a/rdp.c b/rdp.c index 1876192..4e6131c 100644 --- a/rdp.c +++ b/rdp.c @@ -155,8 +155,7 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user, int len_password = 2 * strlen(password); int len_program = 2 * strlen(program); int len_directory = 2 * strlen(directory); - uint32 sec_flags = encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) - : SEC_LOGON_INFO; + uint32 sec_flags = encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) : SEC_LOGON_INFO; STREAM s; s = sec_init(sec_flags, 18 + len_domain + len_user + len_password @@ -212,8 +211,7 @@ rdp_send_synchronise() /* Send a single input event */ void -rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, - uint16 param1, uint16 param2) +rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2) { STREAM s; @@ -442,8 +440,7 @@ rdp_send_confirm_active() RDP_CAPLEN_GENERAL + RDP_CAPLEN_BITMAP + RDP_CAPLEN_ORDER + RDP_CAPLEN_BMPCACHE + RDP_CAPLEN_COLCACHE + RDP_CAPLEN_ACTIVATE + RDP_CAPLEN_CONTROL + - RDP_CAPLEN_POINTER + RDP_CAPLEN_SHARE + RDP_CAPLEN_UNKNOWN - + 4 /* w2k fix, why? */ ; + RDP_CAPLEN_POINTER + RDP_CAPLEN_SHARE + RDP_CAPLEN_UNKNOWN + 4 /* w2k fix, why? */ ; s = rdp_init(14 + caplen + sizeof(RDP_SOURCE)); @@ -526,8 +523,7 @@ process_pointer_pdu(STREAM s) in_uint16_le(s, datalen); in_uint8p(s, data, datalen); in_uint8p(s, mask, masklen); - cursor = ui_create_cursor(x, y, width, height, mask, - data); + cursor = ui_create_cursor(x, y, width, height, mask, data); ui_set_cursor(cursor); cache_put_cursor(cache_idx, cursor); break; @@ -578,12 +574,9 @@ process_bitmap_updates(STREAM s) bmpdata = xmalloc(width * height); for (y = 0; y < height; y++) { - in_uint8a(s, - &bmpdata[(height - y - 1) * width], - width); + in_uint8a(s, &bmpdata[(height - y - 1) * width], width); } - ui_paint_bitmap(left, top, cx, cy, width, height, - bmpdata); + ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata); xfree(bmpdata); continue; } @@ -596,8 +589,7 @@ process_bitmap_updates(STREAM s) bmpdata = xmalloc(width * height); if (bitmap_decompress(bmpdata, width, height, data, size)) { - ui_paint_bitmap(left, top, cx, cy, width, height, - bmpdata); + ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata); } xfree(bmpdata); @@ -722,8 +714,7 @@ rdp_connect(char *server, uint32 flags, char *domain, char *password, if (!sec_connect(server)) return False; - rdp_send_logon_info(flags, domain, username, password, - command, directory); + rdp_send_logon_info(flags, domain, username, password, command, directory); return True; } diff --git a/secure.c b/secure.c index c947163..fd18c5f 100644 --- a/secure.c +++ b/secure.c @@ -127,10 +127,8 @@ sec_generate_keys(uint8 * client_key, uint8 * server_key, int rc4_key_size) memcpy(sec_sign_key, session_key, 16); /* Generate RC4 keys */ - sec_hash_16(sec_decrypt_key, &session_key[16], client_key, - server_key); - sec_hash_16(sec_encrypt_key, &session_key[32], client_key, - server_key); + sec_hash_16(sec_decrypt_key, &session_key[16], client_key, server_key); + sec_hash_16(sec_encrypt_key, &session_key[32], client_key, server_key); if (rc4_key_size == 1) { @@ -181,8 +179,7 @@ buf_out_uint32(uint8 * buffer, uint32 value) /* Generate a signature hash, using a combination of SHA1 and MD5 */ void -sec_sign(uint8 * signature, int siglen, uint8 * session_key, int keylen, - uint8 * data, int datalen) +sec_sign(uint8 * signature, int siglen, uint8 * session_key, int keylen, uint8 * data, int datalen) { uint8 shasig[20]; uint8 md5sig[16]; @@ -286,8 +283,7 @@ reverse(uint8 * p, int len) /* Perform an RSA public key encryption operation */ static void -sec_rsa_encrypt(uint8 * out, uint8 * in, int len, - uint8 * modulus, uint8 * exponent) +sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint8 * modulus, uint8 * exponent) { BN_CTX ctx; BIGNUM mod, exp, x, y; @@ -358,8 +354,7 @@ sec_send(STREAM s, uint32 flags) hexdump(s->p + 8, datalen); #endif - sec_sign(s->p, 8, sec_sign_key, rc4_key_len, s->p + 8, - datalen); + sec_sign(s->p, 8, sec_sign_key, rc4_key_len, s->p + 8, datalen); sec_encrypt(s->p + 8, datalen); } @@ -468,8 +463,7 @@ sec_parse_public_key(STREAM s, uint8 ** modulus, uint8 ** exponent) /* Parse a crypto information structure */ static BOOL sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size, - uint8 ** server_random, uint8 ** modulus, - uint8 ** exponent) + uint8 ** server_random, uint8 ** modulus, uint8 ** exponent) { uint32 crypt_level, random_len, rsa_info_len; uint16 tag, length; @@ -505,8 +499,7 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size, switch (tag) { case SEC_TAG_PUBKEY: - if (!sec_parse_public_key - (s, modulus, exponent)) + if (!sec_parse_public_key(s, modulus, exponent)) return False; break; @@ -534,14 +527,12 @@ sec_process_crypt_info(STREAM s) uint8 client_random[SEC_RANDOM_SIZE]; uint32 rc4_key_size; - if (!sec_parse_crypt_info(s, &rc4_key_size, &server_random, - &modulus, &exponent)) + if (!sec_parse_crypt_info(s, &rc4_key_size, &server_random, &modulus, &exponent)) return; /* Generate a client random, and hence determine encryption keys */ generate_random(client_random); - sec_rsa_encrypt(sec_crypted_random, client_random, - SEC_RANDOM_SIZE, modulus, exponent); + sec_rsa_encrypt(sec_crypted_random, client_random, SEC_RANDOM_SIZE, modulus, exponent); sec_generate_keys(client_random, server_random, rc4_key_size); } diff --git a/tcp.c b/tcp.c index 2db344c..58a79cb 100644 --- a/tcp.c +++ b/tcp.c @@ -110,8 +110,7 @@ tcp_connect(char *server) if ((nslookup = gethostbyname(server)) != NULL) { - memcpy(&servaddr.sin_addr, nslookup->h_addr, - sizeof(servaddr.sin_addr)); + memcpy(&servaddr.sin_addr, nslookup->h_addr, sizeof(servaddr.sin_addr)); } else if (!(servaddr.sin_addr.s_addr = inet_addr(server))) { @@ -128,17 +127,14 @@ tcp_connect(char *server) servaddr.sin_family = AF_INET; servaddr.sin_port = htons(tcp_port_rdp); - if (connect - (sock, (struct sockaddr *) &servaddr, - sizeof(struct sockaddr)) < 0) + if (connect(sock, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) < 0) { error("connect: %s\n", strerror(errno)); close(sock); return False; } - setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void *) &true, - sizeof(true)); + setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void *) &true, sizeof(true)); in.size = 4096; in.data = xmalloc(in.size); diff --git a/xkeymap.c b/xkeymap.c index c0ae328..690cc7e 100644 --- a/xkeymap.c +++ b/xkeymap.c @@ -54,8 +54,7 @@ add_to_keymap(char *keyname, uint8 scancode, uint16 modifiers, char *mapname) } DEBUG_KBD("Adding translation, keysym=0x%x, scancode=0x%x, " - "modifiers=0x%x\n", (unsigned int) keysym, scancode, - modifiers); + "modifiers=0x%x\n", (unsigned int) keysym, scancode, modifiers); keymap[keysym & KEYMAP_MASK].scancode = scancode; keymap[keysym & KEYMAP_MASK].modifiers = modifiers; @@ -140,8 +139,7 @@ xkeymap_read(char *mapname) p = strchr(line, ' '); if (p == NULL) { - error("Bad line %d in keymap %s\n", line_num, - mapname); + error("Bad line %d in keymap %s\n", line_num, mapname); continue; } else @@ -249,8 +247,7 @@ xkeymap_translate_key(KeySym keysym, unsigned int keycode, unsigned int state) return tr; } - printf("No translation for (keysym 0x%lx, %s)\n", keysym, - get_ksname(keysym)); + printf("No translation for (keysym 0x%lx, %s)\n", keysym, get_ksname(keysym)); /* not in keymap, try to interpret the raw scancode */ if ((keycode >= min_keycode) && (keycode <= 0x60)) @@ -344,14 +341,12 @@ ensure_remote_modifiers(uint32 ev_time, key_translation tr) if (MASK_HAS_BITS(tr.modifiers, MapShiftMask)) { /* Needs this modifier. Send down. */ - rdp_send_scancode(ev_time, RDP_KEYPRESS, - SCANCODE_CHAR_LSHIFT); + rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_LSHIFT); } else { /* Should not use this modifier. Send up. */ - rdp_send_scancode(ev_time, RDP_KEYRELEASE, - SCANCODE_CHAR_LSHIFT); + rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LSHIFT); } } @@ -363,14 +358,12 @@ ensure_remote_modifiers(uint32 ev_time, key_translation tr) if (MASK_HAS_BITS(tr.modifiers, MapAltGrMask)) { /* Needs this modifier. Send down. */ - rdp_send_scancode(ev_time, RDP_KEYPRESS, - SCANCODE_CHAR_RALT); + rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_RALT); } else { /* Should not use this modifier. Send up. */ - rdp_send_scancode(ev_time, RDP_KEYRELEASE, - SCANCODE_CHAR_RALT); + rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RALT); } } @@ -383,18 +376,14 @@ ensure_remote_modifiers(uint32 ev_time, key_translation tr) if (MASK_HAS_BITS(tr.modifiers, MapNumLockMask)) { /* Needs this modifier. Toggle */ - rdp_send_scancode(ev_time, RDP_KEYPRESS, - SCANCODE_CHAR_NUMLOCK); - rdp_send_scancode(ev_time, RDP_KEYRELEASE, - SCANCODE_CHAR_NUMLOCK); + rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_NUMLOCK); + rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_NUMLOCK); } else { /* Should not use this modifier. Toggle */ - rdp_send_scancode(ev_time, RDP_KEYPRESS, - SCANCODE_CHAR_NUMLOCK); - rdp_send_scancode(ev_time, RDP_KEYRELEASE, - SCANCODE_CHAR_NUMLOCK); + rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_NUMLOCK); + rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_NUMLOCK); } } @@ -410,36 +399,28 @@ update_modifier_state(uint16 modifiers, BOOL pressed) switch (modifiers) { case SCANCODE_CHAR_LSHIFT: - MASK_CHANGE_BIT(remote_modifier_state, - MapLeftShiftMask, pressed); + MASK_CHANGE_BIT(remote_modifier_state, MapLeftShiftMask, pressed); break; case SCANCODE_CHAR_RSHIFT: - MASK_CHANGE_BIT(remote_modifier_state, - MapRightShiftMask, pressed); + MASK_CHANGE_BIT(remote_modifier_state, MapRightShiftMask, pressed); break; case SCANCODE_CHAR_LCTRL: - MASK_CHANGE_BIT(remote_modifier_state, - MapLeftCtrlMask, pressed); + MASK_CHANGE_BIT(remote_modifier_state, MapLeftCtrlMask, pressed); break; case SCANCODE_CHAR_RCTRL: - MASK_CHANGE_BIT(remote_modifier_state, - MapRightCtrlMask, pressed); + MASK_CHANGE_BIT(remote_modifier_state, MapRightCtrlMask, pressed); break; case SCANCODE_CHAR_LALT: - MASK_CHANGE_BIT(remote_modifier_state, MapLeftAltMask, - pressed); + MASK_CHANGE_BIT(remote_modifier_state, MapLeftAltMask, pressed); break; case SCANCODE_CHAR_RALT: - MASK_CHANGE_BIT(remote_modifier_state, - MapRightAltMask, pressed); + MASK_CHANGE_BIT(remote_modifier_state, MapRightAltMask, pressed); break; case SCANCODE_CHAR_LWIN: - MASK_CHANGE_BIT(remote_modifier_state, MapLeftWinMask, - pressed); + MASK_CHANGE_BIT(remote_modifier_state, MapLeftWinMask, pressed); break; case SCANCODE_CHAR_RWIN: - MASK_CHANGE_BIT(remote_modifier_state, - MapRightWinMask, pressed); + MASK_CHANGE_BIT(remote_modifier_state, MapRightWinMask, pressed); break; case SCANCODE_CHAR_NUMLOCK: /* KeyReleases for NumLocks are sent immediately. Toggle the @@ -449,16 +430,13 @@ update_modifier_state(uint16 modifiers, BOOL pressed) BOOL newNumLockState; newNumLockState = (MASK_HAS_BITS - (remote_modifier_state, - MapNumLockMask) == False); + (remote_modifier_state, MapNumLockMask) == False); MASK_CHANGE_BIT(remote_modifier_state, - MapNumLockMask, - newNumLockState); + MapNumLockMask, newNumLockState); } break; } - DEBUG_KBD("After updating modifier_state:0x%x\n", - remote_modifier_state); + DEBUG_KBD("After updating modifier_state:0x%x\n", remote_modifier_state); } @@ -477,8 +455,7 @@ rdp_send_scancode(uint32 time, uint16 flags, uint16 scancode) } else { - DEBUG_KBD("Sending scancode=0x%x, flags=0x%x\n", scancode, - flags); + DEBUG_KBD("Sending scancode=0x%x, flags=0x%x\n", scancode, flags); rdp_send_input(time, RDP_INPUT_SCANCODE, flags, scancode, 0); } } diff --git a/xwin.c b/xwin.c index 2c8c3a1..1311bce 100644 --- a/xwin.c +++ b/xwin.c @@ -217,8 +217,7 @@ init_inputmethod(void) It seems to work alright anyway, though. */ if (IC != NULL) { - if (XGetICValues(IC, XNFilterEvents, &filtered_events, NULL) - != NULL) + if (XGetICValues(IC, XNFilterEvents, &filtered_events, NULL) != NULL) { error("Failed to obtain XNFilterEvents value from IC\n"); filtered_events = 0; @@ -251,7 +250,7 @@ ui_init() error("Failed to open display\n"); return False; } - if(fullscreen) + if (fullscreen) { screen = DefaultScreenOfDisplay(display); width = WidthOfScreen(screen); @@ -284,8 +283,7 @@ ui_create_window(char *title) desirable, e.g. 24 bits->32 bits. */ while (i--) { - if ((pfm[i].depth == depth) - && (pfm[i].bits_per_pixel > bpp)) + if ((pfm[i].depth == depth) && (pfm[i].bits_per_pixel > bpp)) { bpp = pfm[i].bits_per_pixel; } @@ -332,8 +330,7 @@ ui_create_window(char *title) wnd = XCreateWindow(display, RootWindowOfScreen(screen), 0, 0, width, height, 0, CopyFromParent, InputOutput, CopyFromParent, - CWBackingStore | CWBackPixel | CWOverrideRedirect, - &attribs); + CWBackingStore | CWBackPixel | CWOverrideRedirect, &attribs); XStoreName(display, wnd, title); @@ -357,9 +354,7 @@ ui_create_window(char *title) xkeymap_init2(); - input_mask = - KeyPressMask | KeyReleaseMask | ButtonPressMask | - ButtonReleaseMask; + input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; if (grab_keyboard) input_mask |= EnterWindowMask | LeaveWindowMask; if (sendmotion) @@ -439,31 +434,24 @@ xwin_process_events() { XmbLookupString(IC, (XKeyPressedEvent *) & - xevent, str, - sizeof(str), &keysym, - &status); - if (! - ((status == XLookupKeySym) - || (status == XLookupBoth))) + xevent, str, sizeof(str), &keysym, &status); + if (!((status == XLookupKeySym) || (status == XLookupBoth))) { - error("XmbLookupString failed with status 0x%x\n", status); + error("XmbLookupString failed with status 0x%x\n", + status); break; } } else { /* Plain old XLookupString */ - DEBUG_KBD - ("No input context, using XLookupString\n"); + DEBUG_KBD("No input context, using XLookupString\n"); XLookupString((XKeyEvent *) & xevent, - str, sizeof(str), - &keysym, NULL); + str, sizeof(str), &keysym, NULL); } ksname = get_ksname(keysym); - DEBUG_KBD - ("\nKeyPress for (keysym 0x%lx, %s)\n", - keysym, ksname); + DEBUG_KBD("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname); if (inhibit_key(keysym)) { @@ -472,40 +460,32 @@ xwin_process_events() } tr = xkeymap_translate_key(keysym, - xevent.xkey. - keycode, - xevent.xkey.state); + xevent.xkey.keycode, xevent.xkey.state); ensure_remote_modifiers(ev_time, tr); if (tr.scancode == 0) break; - rdp_send_scancode(ev_time, RDP_KEYPRESS, - tr.scancode); + rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode); break; case KeyRelease: XLookupString((XKeyEvent *) & xevent, str, sizeof(str), &keysym, NULL); ksname = get_ksname(keysym); - DEBUG_KBD - ("\nKeyRelease for (keysym 0x%lx, %s)\n", - keysym, ksname); + DEBUG_KBD("\nKeyRelease for (keysym 0x%lx, %s)\n", keysym, ksname); if (inhibit_key(keysym)) break; tr = xkeymap_translate_key(keysym, - xevent.xkey. - keycode, - xevent.xkey.state); + xevent.xkey.keycode, xevent.xkey.state); if (tr.scancode == 0) break; - rdp_send_scancode(ev_time, RDP_KEYRELEASE, - tr.scancode); + rdp_send_scancode(ev_time, RDP_KEYRELEASE, tr.scancode); break; case ButtonPress: @@ -513,23 +493,17 @@ xwin_process_events() /* fall through */ case ButtonRelease: - button = xkeymap_translate_button(xevent. - xbutton. - button); + button = xkeymap_translate_button(xevent.xbutton.button); if (button == 0) break; rdp_send_input(ev_time, RDP_INPUT_MOUSE, - flags | button, - xevent.xbutton.x, - xevent.xbutton.y); + flags | button, xevent.xbutton.x, xevent.xbutton.y); break; case MotionNotify: rdp_send_input(ev_time, RDP_INPUT_MOUSE, - MOUSE_FLAG_MOVE, - xevent.xmotion.x, - xevent.xmotion.y); + MOUSE_FLAG_MOVE, xevent.xmotion.x, xevent.xmotion.y); break; case FocusIn: @@ -537,19 +511,15 @@ xwin_process_events() case EnterNotify: if (grab_keyboard) XGrabKeyboard(display, wnd, True, - GrabModeAsync, - GrabModeAsync, - CurrentTime); + GrabModeAsync, GrabModeAsync, CurrentTime); break; case FocusOut: /* reset keys */ rdp_send_input(ev_time, RDP_INPUT_SCANCODE, - KBD_FLAG_DOWN | KBD_FLAG_UP, - SCANCODE_CHAR_LCTRL, 0); + KBD_FLAG_DOWN | KBD_FLAG_UP, SCANCODE_CHAR_LCTRL, 0); rdp_send_input(ev_time, RDP_INPUT_SCANCODE, - KBD_FLAG_DOWN | KBD_FLAG_UP, - SCANCODE_CHAR_LALT, 0); + KBD_FLAG_DOWN | KBD_FLAG_UP, SCANCODE_CHAR_LALT, 0); /* fall through */ case LeaveNotify: if (grab_keyboard) @@ -629,8 +599,7 @@ ui_create_bitmap(int width, int height, uint8 * data) } void -ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, - uint8 * data) +ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data) { XImage *image; uint8 *tdata; @@ -914,8 +883,7 @@ ui_patblt(uint8 opcode, SET_BACKGROUND(fgcolour); XSetFillStyle(display, gc, FillOpaqueStippled); XSetStipple(display, gc, fill); - XSetTSOrigin(display, gc, brush->xorigin, - brush->yorigin); + XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin); FILL_RECTANGLE(x, y, cx, cy); @@ -939,8 +907,7 @@ ui_screenblt(uint8 opcode, SET_FUNCTION(opcode); XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y); if (ownbackstore) - XCopyArea(display, backstore, backstore, gc, srcx, srcy, cx, - cy, x, y); + XCopyArea(display, backstore, backstore, gc, srcx, srcy, cx, cy, x, y); RESET_FUNCTION(opcode); } @@ -952,8 +919,7 @@ ui_memblt(uint8 opcode, SET_FUNCTION(opcode); XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y); if (ownbackstore) - XCopyArea(display, (Pixmap) src, backstore, gc, srcx, srcy, - cx, cy, x, y); + XCopyArea(display, (Pixmap) src, backstore, gc, srcx, srcy, cx, cy, x, y); RESET_FUNCTION(opcode); } @@ -970,22 +936,18 @@ ui_triblt(uint8 opcode, { case 0x69: /* PDSxxn */ ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy); - ui_patblt(ROP2_NXOR, x, y, cx, cy, brush, bgcolour, - fgcolour); + ui_patblt(ROP2_NXOR, x, y, cx, cy, brush, bgcolour, fgcolour); break; case 0xb8: /* PSDPxax */ - ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, - fgcolour); + ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour); ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy); - ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, - fgcolour); + ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour); break; case 0xc0: /* PSa */ ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy); - ui_patblt(ROP2_AND, x, y, cx, cy, brush, bgcolour, - fgcolour); + ui_patblt(ROP2_AND, x, y, cx, cy, brush, bgcolour, fgcolour); break; default: @@ -1026,8 +988,7 @@ ui_draw_glyph(int mixmode, SET_BACKGROUND(bgcolour); XSetFillStyle(display, gc, - (mixmode == - MIX_TRANSPARENT) ? FillStippled : FillOpaqueStippled); + (mixmode == MIX_TRANSPARENT) ? FillStippled : FillOpaqueStippled); XSetStipple(display, gc, (Pixmap) glyph); XSetTSOrigin(display, gc, x, y); @@ -1097,8 +1058,7 @@ ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y, { case 0xff: if (i + 2 < length) - cache_put_text(text[i + 1], text, - text[i + 2]); + cache_put_text(text[i + 1], text, text[i + 2]); else { error("this shouldn't be happening\n"); @@ -1115,8 +1075,7 @@ ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y, if (entry != NULL) { if ((((uint8 *) (entry->data))[1] == - 0) - && (!(flags & TEXT2_IMPLICIT_X))) + 0) && (!(flags & TEXT2_IMPLICIT_X))) { if (flags & TEXT2_VERTICAL) y += text[i + 2]; @@ -1132,9 +1091,7 @@ ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y, text = &(text[i]); i = 0; for (j = 0; j < entry->size; j++) - DO_GLYPH(((uint8 *) (entry-> - data)), - j); + DO_GLYPH(((uint8 *) (entry->data)), j); } break; @@ -1156,21 +1113,18 @@ ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) if (ownbackstore) { - image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes, - ZPixmap); + image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes, ZPixmap); } else { pix = XCreatePixmap(display, wnd, cx, cy, depth); XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0); - image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, - ZPixmap); + image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap); XFreePixmap(display, pix); } offset *= bpp / 8; - cache_put_desktop(offset, cx, cy, image->bytes_per_line, bpp / 8, - (uint8 *) image->data); + cache_put_desktop(offset, cx, cy, image->bytes_per_line, bpp / 8, (uint8 *) image->data); XDestroyImage(image); } @@ -1187,8 +1141,7 @@ ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) return; image = XCreateImage(display, visual, depth, ZPixmap, 0, - (char *) data, cx, cy, BitmapPad(display), - cx * bpp / 8); + (char *) data, cx, cy, BitmapPad(display), cx * bpp / 8); if (ownbackstore) {