Fixing code formatting with astyle

This commit is contained in:
Alexandre Quesnel 2020-11-30 03:29:57 +00:00
parent 51905d765a
commit 2d6d249f76
12 changed files with 516 additions and 513 deletions

View File

@ -121,7 +121,7 @@ libxrdp_get_pdu_bytes(const char *aheader)
/******************************************************************************/
/* only used during connection */
struct stream *
libxrdp_force_read(struct trans* trans)
libxrdp_force_read(struct trans *trans)
{
int bytes;
struct stream *s;
@ -307,7 +307,8 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
return 1;
}
}
else {
else
{
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_palette: slowpath");
xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
}
@ -629,7 +630,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
q = q - server_line_bytes;
for (k = 0; k < width; k++)
{
pixel = *((tui16*)(q + k * 2));
pixel = *((tui16 *)(q + k * 2));
out_uint16_le(s, pixel);
}
out_uint8s(s, e * 2);
@ -641,7 +642,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
q = q - server_line_bytes;
for (k = 0; k < width; k++)
{
pixel = *((tui32*)(q + k * 4));
pixel = *((tui32 *)(q + k * 4));
out_uint8(s, pixel);
out_uint8(s, pixel >> 8);
out_uint8(s, pixel >> 16);
@ -655,7 +656,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
q = q - server_line_bytes;
for (k = 0; k < width; k++)
{
pixel = *((int*)(q + k * 4));
pixel = *((int *)(q + k * 4));
out_uint32_le(s, pixel);
}
out_uint8s(s, e * 4);
@ -971,16 +972,16 @@ libxrdp_orders_mem_blt(struct xrdp_session *session, int cache_id,
/******************************************************************************/
int
libxrdp_orders_composite_blt(struct xrdp_session* session, int srcidx,
libxrdp_orders_composite_blt(struct xrdp_session *session, int srcidx,
int srcformat, int srcwidth, int srcrepeat,
int* srctransform, int mskflags,
int *srctransform, int mskflags,
int mskidx, int mskformat, int mskwidth,
int mskrepeat, int op, int srcx, int srcy,
int mskx, int msky, int dstx, int dsty,
int width, int height, int dstformat,
struct xrdp_rect* rect)
struct xrdp_rect *rect)
{
return xrdp_orders_composite_blt((struct xrdp_orders*)session->orders,
return xrdp_orders_composite_blt((struct xrdp_orders *)session->orders,
srcidx, srcformat, srcwidth, srcrepeat,
srctransform, mskflags,
mskidx, mskformat, mskwidth, mskrepeat,
@ -1493,7 +1494,7 @@ libxrdp_codec_jpeg_compress(struct xrdp_session *session,
char *out_data, int *io_len)
{
struct xrdp_orders *orders;
void* jpeg_han;
void *jpeg_han;
orders = (struct xrdp_orders *)(session->orders);
jpeg_han = orders->jpeg_han;
@ -1505,7 +1506,7 @@ libxrdp_codec_jpeg_compress(struct xrdp_session *session,
/*****************************************************************************/
int EXPORT_CC
libxrdp_fastpath_send_surface(struct xrdp_session *session,
char* data_pad, int pad_bytes,
char *data_pad, int pad_bytes,
int data_bytes,
int destLeft, int destTop,
int destRight, int destBottom, int bpp,

View File

@ -81,9 +81,9 @@ fsplit3(char *in_data, int start_line, int width, int e,
rp |= (pixel << 8) & 0xff000000;
gp |= (pixel << 16) & 0xff000000;
bp |= (pixel << 24) & 0xff000000;
*((int*)(r_data + out_index)) = rp;
*((int*)(g_data + out_index)) = gp;
*((int*)(b_data + out_index)) = bp;
*((int *)(r_data + out_index)) = rp;
*((int *)(g_data + out_index)) = gp;
*((int *)(b_data + out_index)) = bp;
out_index += 4;
index += 4;
}
@ -166,10 +166,10 @@ fsplit4(char *in_data, int start_line, int width, int e,
rp |= (pixel << 8) & 0xff000000;
gp |= (pixel << 16) & 0xff000000;
bp |= (pixel << 24) & 0xff000000;
*((int*)(a_data + out_index)) = ap;
*((int*)(r_data + out_index)) = rp;
*((int*)(g_data + out_index)) = gp;
*((int*)(b_data + out_index)) = bp;
*((int *)(a_data + out_index)) = ap;
*((int *)(r_data + out_index)) = rp;
*((int *)(g_data + out_index)) = gp;
*((int *)(b_data + out_index)) = bp;
out_index += 4;
index += 4;
}
@ -205,13 +205,13 @@ fsplit4(char *in_data, int start_line, int width, int e,
/*****************************************************************************/
#define DELTA_ONE \
do { \
do { \
delta = src8[cx] - src8[0]; \
is_neg = (delta >> 7) & 1; \
dst8[cx] = (((delta ^ -is_neg) + is_neg) << 1) - is_neg; \
src8++; \
dst8++; \
} while (0)
} while (0)
/*****************************************************************************/
static int

View File

@ -566,7 +566,7 @@ xrdp_caps_process_multifragmentupdate(struct xrdp_rdp *self, struct stream *s,
return 0;
}
/*****************************************************************************/
/*****************************************************************************/
static int
xrdp_caps_process_frame_ack(struct xrdp_rdp *self, struct stream *s, int len)
{

View File

@ -138,10 +138,10 @@ xrdp_channel_send(struct xrdp_channel *self, struct stream *s, int channel_id,
*
* That's flag makes MSTSC crash when using RAIL channel.
*/
// if (channel->flags & XR_CHANNEL_OPTION_SHOW_PROTOCOL)
// {
// flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
// }
// if (channel->flags & XR_CHANNEL_OPTION_SHOW_PROTOCOL)
// {
// flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
// }
out_uint32_le(s, flags);

View File

@ -179,7 +179,9 @@ xrdp_fastpath_process_EVENT_SCANCODE(struct xrdp_fastpath *self,
}
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED))
{
flags |= KBD_FLAG_EXT;
}
xrdp_fastpath_session_callback(self, RDP_INPUT_SCANCODE,
code, 0, flags, 0);

View File

@ -132,14 +132,14 @@ xrdp_iso_process_rdp_neg_req(struct xrdp_iso *self, struct stream *s)
in_uint8(s, flags);
if (flags != 0x0 && flags != 0x8 && flags != 0x1)
{
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, flags: %x",flags);
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, flags: %x", flags);
return 1;
}
in_uint16_le(s, len);
if (len != 8)
{
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, length: %x",len);
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, length: %x", len);
return 1;
}

View File

@ -70,7 +70,7 @@ xrdp_jpeg_compress(void *handle, char *in_data, int width, int height,
temp_buf = 0;
if (e == 0)
{
src_buf = (unsigned char*)in_data;
src_buf = (unsigned char *)in_data;
}
else
{
@ -97,7 +97,7 @@ xrdp_jpeg_compress(void *handle, char *in_data, int width, int height,
}
src_buf = (unsigned char *) temp_buf;
}
dst_buf = (unsigned char*)(s->p);
dst_buf = (unsigned char *)(s->p);
error = tjCompress(tj_han, src_buf, width + e, (width + e) * 4, height,
TJPF_XBGR, dst_buf, &cdata_bytes,
TJSAMP_420, quality, 0);

View File

@ -164,12 +164,12 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
in_uint16_be(s, userid);
in_uint16_be(s, chanid);
LOG(LOG_LEVEL_DEBUG,"MCS_CJRQ - channel join request received");
LOG(LOG_LEVEL_DEBUG, "MCS_CJRQ - channel join request received");
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_mcs_recv adding channel %4.4x", chanid);
if (xrdp_mcs_send_cjcf(self, userid, chanid) != 0)
{
LOG(LOG_LEVEL_ERROR,"Non handled error from xrdp_mcs_send_cjcf") ;
LOG(LOG_LEVEL_ERROR, "Non handled error from xrdp_mcs_send_cjcf") ;
}
s = libxrdp_force_read(self->iso_layer->trans);
@ -188,7 +188,7 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
}
else
{
LOG(LOG_LEVEL_DEBUG,"Received an unhandled appid:%d",appid);
LOG(LOG_LEVEL_DEBUG, "Received an unhandled appid:%d", appid);
}
break;
@ -722,8 +722,8 @@ xrdp_mcs_out_gcc_data(struct xrdp_sec *self)
int index;
int channel;
int gcc_size;
char* gcc_size_ptr;
char* ud_ptr;
char *gcc_size_ptr;
char *ud_ptr;
num_channels = self->mcs_layer->channel_list->count;
num_channels_even = num_channels + (num_channels & 1);

View File

@ -84,8 +84,8 @@ static const tui16 g_crc_table[256] =
insert 2 bits into outputBuffer
******************************************************************************/
#define insert_2_bits(_data) \
do \
{ \
do \
{ \
if ((bits_left >= 3) && (bits_left <= 8)) \
{ \
i = bits_left - 2; \
@ -100,14 +100,14 @@ do \
outputBuffer[opb_index] |= _data << j; \
bits_left = j; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 3 bits into outputBuffer
******************************************************************************/
#define insert_3_bits(_data) \
do \
{ \
do \
{ \
if ((bits_left >= 4) && (bits_left <= 8)) \
{ \
i = bits_left - 3; \
@ -122,14 +122,14 @@ do \
outputBuffer[opb_index] |= _data << j; \
bits_left = j; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 4 bits into outputBuffer
******************************************************************************/
#define insert_4_bits(_data) \
do \
{ \
do \
{ \
if ((bits_left >= 5) && (bits_left <= 8)) \
{ \
i = bits_left - 4; \
@ -144,14 +144,14 @@ do \
outputBuffer[opb_index] |= _data << j; \
bits_left = j; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 5 bits into outputBuffer
******************************************************************************/
#define insert_5_bits(_data) \
do \
{ \
do \
{ \
if ((bits_left >= 6) && (bits_left <= 8)) \
{ \
i = bits_left - 5; \
@ -166,14 +166,14 @@ do \
outputBuffer[opb_index] |= _data << j; \
bits_left = j; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 6 bits into outputBuffer
******************************************************************************/
#define insert_6_bits(_data) \
do \
{ \
do \
{ \
if ((bits_left >= 7) && (bits_left <= 8)) \
{ \
i = bits_left - 6; \
@ -188,14 +188,14 @@ do \
outputBuffer[opb_index] |= (_data << j); \
bits_left = j; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 7 bits into outputBuffer
******************************************************************************/
#define insert_7_bits(_data) \
do \
{ \
do \
{ \
if (bits_left == 8) \
{ \
outputBuffer[opb_index] |= _data << 1; \
@ -209,14 +209,14 @@ do \
outputBuffer[opb_index] |= _data << j; \
bits_left = j; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 8 bits into outputBuffer
******************************************************************************/
#define insert_8_bits(_data) \
do \
{ \
do \
{ \
if (bits_left == 8) \
{ \
outputBuffer[opb_index++] |= _data; \
@ -230,14 +230,14 @@ do \
outputBuffer[opb_index] |= _data << j; \
bits_left = j; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 9 bits into outputBuffer
******************************************************************************/
#define insert_9_bits(_data16) \
do \
{ \
do \
{ \
i = 9 - bits_left; \
j = 8 - i; \
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
@ -248,14 +248,14 @@ do \
opb_index++; \
bits_left = 8; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 10 bits into outputBuffer
******************************************************************************/
#define insert_10_bits(_data16) \
do \
{ \
do \
{ \
i = 10 - bits_left; \
if ((bits_left >= 3) && (bits_left <= 8)) \
{ \
@ -273,14 +273,14 @@ do \
outputBuffer[opb_index] |= (char) (_data16 << k); \
bits_left = k; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 11 bits into outputBuffer
******************************************************************************/
#define insert_11_bits(_data16) \
do \
{ \
do \
{ \
i = 11 - bits_left; \
if ((bits_left >= 4) && (bits_left <= 8)) \
{ \
@ -298,14 +298,14 @@ do \
outputBuffer[opb_index] |= (char) (_data16 << k); \
bits_left = k; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 12 bits into outputBuffer
******************************************************************************/
#define insert_12_bits(_data16) \
do \
{ \
do \
{ \
i = 12 - bits_left; \
if ((bits_left >= 5) && (bits_left <= 8)) \
{ \
@ -323,14 +323,14 @@ do \
outputBuffer[opb_index] |= (char) (_data16 << k); \
bits_left = k; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 13 bits into outputBuffer
******************************************************************************/
#define insert_13_bits(_data16) \
do \
{ \
do \
{ \
i = 13 - bits_left; \
if ((bits_left >= 6) && (bits_left <= 8)) \
{ \
@ -348,14 +348,14 @@ do \
outputBuffer[opb_index] |= (char) (_data16 << k); \
bits_left = k; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 14 bits into outputBuffer
******************************************************************************/
#define insert_14_bits(_data16) \
do \
{ \
do \
{ \
i = 14 - bits_left; \
if ((bits_left >= 7) && (bits_left <= 8)) \
{ \
@ -373,14 +373,14 @@ do \
outputBuffer[opb_index] |= (char) (_data16 << k); \
bits_left = k; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 15 bits into outputBuffer
******************************************************************************/
#define insert_15_bits(_data16) \
do \
{ \
do \
{ \
i = 15 - bits_left; \
if (bits_left == 8) \
{ \
@ -398,14 +398,14 @@ do \
outputBuffer[opb_index] |= (char) (_data16 << k); \
bits_left = k; \
} \
} while (0)
} while (0)
/*****************************************************************************
insert 16 bits into outputBuffer
******************************************************************************/
#define insert_16_bits(_data16) \
do \
{ \
do \
{ \
i = 16 - bits_left; \
j = i - 8; \
k = 8 - j; \
@ -413,7 +413,7 @@ do \
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
outputBuffer[opb_index] |= (char) (_data16 << k); \
bits_left = k; \
} while (0)
} while (0)
/**
* Initialize mppc_enc structure

View File

@ -1640,20 +1640,20 @@ xrdp_orders_mem_blt(struct xrdp_orders *self, int cache_id,
/*****************************************************************************/
/* returns error */
int
xrdp_orders_composite_blt(struct xrdp_orders* self, int srcidx, int srcformat,
int srcwidth, int srcrepeat, int* srctransform,
xrdp_orders_composite_blt(struct xrdp_orders *self, int srcidx, int srcformat,
int srcwidth, int srcrepeat, int *srctransform,
int mskflags, int mskidx, int mskformat,
int mskwidth, int mskrepeat, int op,
int srcx, int srcy, int mskx, int msky,
int dstx, int dsty, int width, int height,
int dstformat,
struct xrdp_rect* rect)
struct xrdp_rect *rect)
{
int order_flags;
int vals[20];
int present;
char* present_ptr;
char* order_flags_ptr;
char *present_ptr;
char *order_flags_ptr;
if (xrdp_orders_check(self, 80) != 0)
{
@ -2482,7 +2482,7 @@ xrdp_orders_cache_glyph(struct xrdp_orders *self,
/*****************************************************************************/
/* returns error */
static int write_2byte_signed(struct stream * s, int value)
static int write_2byte_signed(struct stream *s, int value)
{
unsigned char byte;
int negative = 0;
@ -2528,7 +2528,7 @@ static int write_2byte_signed(struct stream * s, int value)
/*****************************************************************************/
/* returns error */
static int write_2byte_unsigned(struct stream * s, unsigned int value)
static int write_2byte_unsigned(struct stream *s, unsigned int value)
{
unsigned char byte;

View File

@ -99,7 +99,7 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
}
else
{
LOG(LOG_LEVEL_ALWAYS,"Warning: Your configured crypt level is "
LOG(LOG_LEVEL_ALWAYS, "Warning: Your configured crypt level is "
"undefined, 'high' will be used");
client_info->crypt_level = 3;
}
@ -109,7 +109,7 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
client_info->channels_allowed = g_text2bool(value);
if (client_info->channels_allowed == 0)
{
LOG(LOG_LEVEL_DEBUG,"Info - All channels are disabled");
LOG(LOG_LEVEL_DEBUG, "Info - All channels are disabled");
}
}
else if (g_strcasecmp(item, "allow_multimon") == 0)
@ -117,7 +117,7 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
client_info->multimon = g_text2bool(value);
if (client_info->multimon == 0)
{
LOG(LOG_LEVEL_DEBUG,"Info - Multi monitor server support disabled");
LOG(LOG_LEVEL_DEBUG, "Info - Multi monitor server support disabled");
}
}
else if (g_strcasecmp(item, "max_bpp") == 0)
@ -160,7 +160,7 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
}
else
{
LOG(LOG_LEVEL_ALWAYS,"Warning: Your configured fastpath level is "
LOG(LOG_LEVEL_ALWAYS, "Warning: Your configured fastpath level is "
"undefined, fastpath will not be used");
client_info->use_fast_path = 0;
}

View File

@ -1619,7 +1619,7 @@ xrdp_sec_send_fastpath(struct xrdp_sec *self, struct stream *s)
/* http://msdn.microsoft.com/en-us/library/cc240510.aspx
2.2.1.3.2 Client Core Data (TS_UD_CS_CORE) */
static int
xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec* self, struct stream* s)
xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec *self, struct stream *s)
{
int colorDepth;
int postBeta2ColorDepth;
@ -1764,7 +1764,7 @@ xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec* self, struct stream* s)
/*****************************************************************************/
static int
xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream *s)
{
int crypt_method;
int found;
@ -1851,11 +1851,11 @@ xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
found = 1;
}
}
// if (found == 0)
// {
// LOG_DEVEL(LOG_LEVEL_TRACE, " can not find client / server agreed encryption method");
// return 1;
// }
// if (found == 0)
// {
// LOG_DEVEL(LOG_LEVEL_TRACE, " can not find client / server agreed encryption method");
// return 1;
// }
return 0;
}