remove warnings, check for nil

ulab-original
Jay Sorg 13 years ago
parent 5972c136bf
commit b0ebf1c146

@ -106,15 +106,15 @@ xrdp_mm_delete(struct xrdp_mm* self)
static int APP_CC static int APP_CC
xrdp_mm_send_login(struct xrdp_mm* self) xrdp_mm_send_login(struct xrdp_mm* self)
{ {
struct stream * s = (struct stream *)NULL; struct stream* s;
int rv = 0; int rv;
int index = 0; int index;
int count = 0; int count;
int xserverbpp; int xserverbpp;
char * username = (char *)NULL; char* username;
char * password = (char *)NULL; char* password;
char * name = (char *)NULL; char* name;
char * value = (char *)NULL; char* value;
xrdp_wm_log_msg(self->wm, "sending login info to session manager, " xrdp_wm_log_msg(self->wm, "sending login info to session manager, "
"please wait..."); "please wait...");
@ -367,12 +367,12 @@ static int APP_CC
xrdp_mm_setup_mod2(struct xrdp_mm* self) xrdp_mm_setup_mod2(struct xrdp_mm* self)
{ {
char text[256]; char text[256];
char* name = (char *)NULL; char* name;
char* value = (char *)NULL; char* value;
int i = 0; int i;
int rv = 0; int rv;
int key_flags = 0; int key_flags;
int device_flags = 0; int device_flags;
g_memset(text,0,sizeof(char) * 256); g_memset(text,0,sizeof(char) * 256);
rv = 1; rv = 1;
@ -466,11 +466,11 @@ xrdp_mm_setup_mod2(struct xrdp_mm* self)
static int APP_CC static int APP_CC
xrdp_mm_trans_send_channel_setup(struct xrdp_mm* self, struct trans* trans) xrdp_mm_trans_send_channel_setup(struct xrdp_mm* self, struct trans* trans)
{ {
int index = 0; int index;
int chan_id = 0; int chan_id;
int chan_flags = 0; int chan_flags;
int size = 0; int size;
struct stream* s = (struct stream *)NULL; struct stream* s;
char chan_name[256]; char chan_name[256];
g_memset(chan_name,0,sizeof(char) * 256); g_memset(chan_name,0,sizeof(char) * 256);
@ -513,7 +513,7 @@ static int APP_CC
xrdp_mm_trans_send_channel_data_response(struct xrdp_mm* self, xrdp_mm_trans_send_channel_data_response(struct xrdp_mm* self,
struct trans* trans) struct trans* trans)
{ {
struct stream* s = (struct stream *)NULL; struct stream* s;
s = trans_get_out_s(trans, 8192); s = trans_get_out_s(trans, 8192);
if (s == 0) if (s == 0)
@ -543,12 +543,12 @@ xrdp_mm_trans_process_init_response(struct xrdp_mm* self, struct trans* trans)
static int APP_CC static int APP_CC
xrdp_mm_trans_process_channel_data(struct xrdp_mm* self, struct trans* trans) xrdp_mm_trans_process_channel_data(struct xrdp_mm* self, struct trans* trans)
{ {
struct stream* s = (struct stream *)NULL; struct stream* s;
int size = 0; int size;
int total_size = 0; int total_size;
int chan_id = 0; int chan_id;
int chan_flags = 0; int chan_flags;
int rv = 0; int rv;
s = trans_get_in_s(trans); s = trans_get_in_s(trans);
if (s == 0) if (s == 0)
@ -575,10 +575,10 @@ static int APP_CC
xrdp_mm_chan_process_msg(struct xrdp_mm* self, struct trans* trans, xrdp_mm_chan_process_msg(struct xrdp_mm* self, struct trans* trans,
struct stream* s) struct stream* s)
{ {
int rv = 0; int rv;
int id = 0; int id;
int size = 0; int size;
char* next_msg = (char *)NULL; char* next_msg;
rv = 0; rv = 0;
while (s_check_rem(s, 8)) while (s_check_rem(s, 8))
@ -618,11 +618,11 @@ xrdp_mm_chan_process_msg(struct xrdp_mm* self, struct trans* trans,
static int APP_CC static int APP_CC
xrdp_mm_chan_data_in(struct trans* trans) xrdp_mm_chan_data_in(struct trans* trans)
{ {
struct xrdp_mm* self = (struct xrdp_mm *)NULL; struct xrdp_mm* self;
struct stream* s = (struct stream *)NULL; struct stream* s;
int id = 0; int id;
int size = 0; int size;
int error = 0; int error;
if (trans == 0) if (trans == 0)
{ {
@ -649,7 +649,7 @@ xrdp_mm_chan_data_in(struct trans* trans)
static int APP_CC static int APP_CC
xrdp_mm_chan_send_init(struct xrdp_mm* self) xrdp_mm_chan_send_init(struct xrdp_mm* self)
{ {
struct stream* s = (struct stream *)NULL; struct stream* s;
s = trans_get_out_s(self->chan_trans, 8192); s = trans_get_out_s(self->chan_trans, 8192);
if (s == 0) if (s == 0)
@ -668,10 +668,10 @@ xrdp_mm_chan_send_init(struct xrdp_mm* self)
static int APP_CC static int APP_CC
xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s) xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s)
{ {
int ok = 0; int ok;
int display = 0; int display;
int rv = 0; int rv;
int index = 0; int index;
int uid; int uid;
int gid; int gid;
char text[256]; char text[256];
@ -761,13 +761,13 @@ xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s)
static int static int
xrdp_mm_get_sesman_port(char* port, int port_bytes) xrdp_mm_get_sesman_port(char* port, int port_bytes)
{ {
int fd = -1; int fd;
int error = 0; int error;
int index = 0; int index;
char* val = 0; char* val;
char cfg_file[256]; char cfg_file[256];
struct list* names = (struct list *)NULL; struct list* names;
struct list* values = (struct list *)NULL; struct list* values;
g_memset(cfg_file,0,sizeof(char) * 256); g_memset(cfg_file,0,sizeof(char) * 256);
/* default to port 3350 */ /* default to port 3350 */
@ -816,13 +816,13 @@ int APP_CC
xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2, xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2,
tbus param3, tbus param4) tbus param3, tbus param4)
{ {
struct stream* s = (struct stream *)NULL; struct stream* s;
int rv = 0; int rv;
int length = 0; int length;
int total_length = 0; int total_length;
int flags = 0; int flags;
int id = 0; int id;
char * data = (char *)NULL; char* data;
rv = 0; rv = 0;
if ((self->chan_trans != 0) && self->chan_trans_up) if ((self->chan_trans != 0) && self->chan_trans_up)
@ -861,12 +861,12 @@ xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2,
static int APP_CC static int APP_CC
xrdp_mm_sesman_data_in(struct trans* trans) xrdp_mm_sesman_data_in(struct trans* trans)
{ {
struct xrdp_mm* self = (struct xrdp_mm *)NULL; struct xrdp_mm* self;
struct stream* s = (struct stream *)NULL; struct stream* s;
int version = 0; int version;
int size = 0; int size;
int error = 0; int error;
int code = 0; int code;
if (trans == 0) if (trans == 0)
{ {
@ -902,16 +902,15 @@ xrdp_mm_sesman_data_in(struct trans* trans)
int APP_CC int APP_CC
xrdp_mm_connect(struct xrdp_mm* self) xrdp_mm_connect(struct xrdp_mm* self)
{ {
struct list* names = (struct list *)NULL; struct list* names;
struct list* values = (struct list *)NULL; struct list* values;
int index = 0; int index;
int count = 0; int count;
int use_sesman = 0; int use_sesman;
int error = 0; int ok;
int ok = 0; int rv;
int rv = 0; char* name;
char* name = (char *)NULL; char* value;
char* value = (char *)NULL;
char ip[256]; char ip[256];
char errstr[256]; char errstr[256];
char text[256]; char text[256];
@ -1041,7 +1040,7 @@ xrdp_mm_get_wait_objs(struct xrdp_mm* self,
int APP_CC int APP_CC
xrdp_mm_check_wait_objs(struct xrdp_mm* self) xrdp_mm_check_wait_objs(struct xrdp_mm* self)
{ {
int rv = 0; int rv;
if (self == 0) if (self == 0)
{ {
@ -1087,18 +1086,36 @@ xrdp_mm_check_wait_objs(struct xrdp_mm* self)
return rv; return rv;
} }
#if 0
/*****************************************************************************/
struct xrdp_painter* APP_CC
get_painter(struct xrdp_mod* mod)
{
struct xrdp_wm* wm;
struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
wm = (struct xrdp_wm*)(mod->wm);
p = xrdp_painter_create(wm, wm->session);
mod->painter = (tintptr)p;
}
return p;
}
#endif
/*****************************************************************************/ /*****************************************************************************/
int DEFAULT_CC int DEFAULT_CC
server_begin_update(struct xrdp_mod* mod) server_begin_update(struct xrdp_mod* mod)
{ {
struct xrdp_wm* wm = (struct xrdp_wm *)NULL; struct xrdp_wm* wm;
struct xrdp_painter* p = (struct xrdp_painter *)NULL; struct xrdp_painter* p;
wm = (struct xrdp_wm*)(mod->wm); wm = (struct xrdp_wm*)(mod->wm);
p = xrdp_painter_create(wm, wm->session); p = xrdp_painter_create(wm, wm->session);
xrdp_painter_begin_update(p); xrdp_painter_begin_update(p);
mod->painter = (long)p; mod->painter = (long)p;
return 0; return 0;
} }
@ -1106,13 +1123,16 @@ server_begin_update(struct xrdp_mod* mod)
int DEFAULT_CC int DEFAULT_CC
server_end_update(struct xrdp_mod* mod) server_end_update(struct xrdp_mod* mod)
{ {
struct xrdp_painter* p = (struct xrdp_painter *)NULL; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
xrdp_painter_end_update(p); xrdp_painter_end_update(p);
xrdp_painter_delete(p); xrdp_painter_delete(p);
mod->painter = 0; mod->painter = 0;
return 0; return 0;
} }
@ -1122,8 +1142,8 @@ int DEFAULT_CC
server_bell_trigger(struct xrdp_mod* mod) server_bell_trigger(struct xrdp_mod* mod)
{ {
struct xrdp_wm* wm; struct xrdp_wm* wm;
wm = (struct xrdp_wm*)(mod->wm);
wm = (struct xrdp_wm*)(mod->wm);
xrdp_wm_send_bell(wm); xrdp_wm_send_bell(wm);
return 0; return 0;
} }
@ -1133,11 +1153,15 @@ server_bell_trigger(struct xrdp_mod* mod)
int DEFAULT_CC int DEFAULT_CC
server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy) server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy)
{ {
struct xrdp_wm* wm = (struct xrdp_wm *)NULL; struct xrdp_wm* wm;
struct xrdp_painter* p = (struct xrdp_painter *)NULL; struct xrdp_painter* p;
wm = (struct xrdp_wm*)(mod->wm);
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
wm = (struct xrdp_wm*)(mod->wm);
xrdp_painter_fill_rect(p, wm->screen, x, y, cx, cy); xrdp_painter_fill_rect(p, wm->screen, x, y, cx, cy);
return 0; return 0;
} }
@ -1150,8 +1174,12 @@ server_screen_blt(struct xrdp_mod* mod, int x, int y, int cx, int cy,
struct xrdp_wm* wm; struct xrdp_wm* wm;
struct xrdp_painter* p; struct xrdp_painter* p;
wm = (struct xrdp_wm*)(mod->wm);
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
wm = (struct xrdp_wm*)(mod->wm);
p->rop = 0xcc; p->rop = 0xcc;
xrdp_painter_copy(p, wm->screen, wm->screen, x, y, cx, cy, srcx, srcy); xrdp_painter_copy(p, wm->screen, wm->screen, x, y, cx, cy, srcx, srcy);
return 0; return 0;
@ -1166,8 +1194,12 @@ server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
struct xrdp_bitmap* b; struct xrdp_bitmap* b;
struct xrdp_painter* p; struct xrdp_painter* p;
wm = (struct xrdp_wm*)(mod->wm);
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
wm = (struct xrdp_wm*)(mod->wm);
b = xrdp_bitmap_create_with_data(width, height, wm->screen->bpp, data, wm); b = xrdp_bitmap_create_with_data(width, height, wm->screen->bpp, data, wm);
xrdp_painter_copy(p, b, wm->screen, x, y, cx, cy, srcx, srcy); xrdp_painter_copy(p, b, wm->screen, x, y, cx, cy, srcx, srcy);
xrdp_bitmap_delete(b); xrdp_bitmap_delete(b);
@ -1230,6 +1262,10 @@ server_set_clip(struct xrdp_mod* mod, int x, int y, int cx, int cy)
struct xrdp_painter* p; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
return xrdp_painter_set_clip(p, x, y, cx, cy); return xrdp_painter_set_clip(p, x, y, cx, cy);
} }
@ -1240,6 +1276,10 @@ server_reset_clip(struct xrdp_mod* mod)
struct xrdp_painter* p; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
return xrdp_painter_clr_clip(p); return xrdp_painter_clr_clip(p);
} }
@ -1250,6 +1290,10 @@ server_set_fgcolor(struct xrdp_mod* mod, int fgcolor)
struct xrdp_painter* p; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
p->fg_color = fgcolor; p->fg_color = fgcolor;
p->pen.color = p->fg_color; p->pen.color = p->fg_color;
return 0; return 0;
@ -1262,6 +1306,10 @@ server_set_bgcolor(struct xrdp_mod* mod, int bgcolor)
struct xrdp_painter* p; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
p->bg_color = bgcolor; p->bg_color = bgcolor;
return 0; return 0;
} }
@ -1273,6 +1321,10 @@ server_set_opcode(struct xrdp_mod* mod, int opcode)
struct xrdp_painter* p; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
p->rop = opcode; p->rop = opcode;
return 0; return 0;
} }
@ -1284,6 +1336,10 @@ server_set_mixmode(struct xrdp_mod* mod, int mixmode)
struct xrdp_painter* p; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
p->mix_mode = mixmode; p->mix_mode = mixmode;
return 0; return 0;
} }
@ -1296,6 +1352,10 @@ server_set_brush(struct xrdp_mod* mod, int x_orgin, int y_orgin,
struct xrdp_painter* p; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
p->brush.x_orgin = x_orgin; p->brush.x_orgin = x_orgin;
p->brush.y_orgin = y_orgin; p->brush.y_orgin = y_orgin;
p->brush.style = style; p->brush.style = style;
@ -1310,6 +1370,10 @@ server_set_pen(struct xrdp_mod* mod, int style, int width)
struct xrdp_painter* p; struct xrdp_painter* p;
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
p->pen.style = style; p->pen.style = style;
p->pen.width = width; p->pen.width = width;
return 0; return 0;
@ -1322,8 +1386,12 @@ server_draw_line(struct xrdp_mod* mod, int x1, int y1, int x2, int y2)
struct xrdp_wm* wm; struct xrdp_wm* wm;
struct xrdp_painter* p; struct xrdp_painter* p;
wm = (struct xrdp_wm*)(mod->wm);
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
wm = (struct xrdp_wm*)(mod->wm);
return xrdp_painter_line(p, wm->screen, x1, y1, x2, y2); return xrdp_painter_line(p, wm->screen, x1, y1, x2, y2);
} }
@ -1357,8 +1425,12 @@ server_draw_text(struct xrdp_mod* mod, int font,
struct xrdp_wm* wm; struct xrdp_wm* wm;
struct xrdp_painter* p; struct xrdp_painter* p;
wm = (struct xrdp_wm*)(mod->wm);
p = (struct xrdp_painter*)(mod->painter); p = (struct xrdp_painter*)(mod->painter);
if (p == 0)
{
return 0;
}
wm = (struct xrdp_wm*)(mod->wm);
return xrdp_painter_draw_text2(p, wm->screen, font, flags, return xrdp_painter_draw_text2(p, wm->screen, font, flags,
mixmode, clip_left, clip_top, mixmode, clip_left, clip_top,
clip_right, clip_bottom, clip_right, clip_bottom,
@ -1371,7 +1443,7 @@ server_draw_text(struct xrdp_mod* mod, int font,
int DEFAULT_CC int DEFAULT_CC
server_reset(struct xrdp_mod* mod, int width, int height, int bpp) server_reset(struct xrdp_mod* mod, int width, int height, int bpp)
{ {
struct xrdp_wm* wm = (struct xrdp_wm *)NULL; struct xrdp_wm* wm;
wm = (struct xrdp_wm*)(mod->wm); wm = (struct xrdp_wm*)(mod->wm);
if (wm->client_info == 0) if (wm->client_info == 0)
@ -1411,7 +1483,7 @@ int DEFAULT_CC
server_query_channel(struct xrdp_mod* mod, int index, char* channel_name, server_query_channel(struct xrdp_mod* mod, int index, char* channel_name,
int* channel_flags) int* channel_flags)
{ {
struct xrdp_wm* wm = (struct xrdp_wm *)NULL; struct xrdp_wm* wm;
wm = (struct xrdp_wm*)(mod->wm); wm = (struct xrdp_wm*)(mod->wm);
if (wm->mm->sesman_controlled) if (wm->mm->sesman_controlled)
@ -1427,7 +1499,7 @@ server_query_channel(struct xrdp_mod* mod, int index, char* channel_name,
int DEFAULT_CC int DEFAULT_CC
server_get_channel_id(struct xrdp_mod* mod, char* name) server_get_channel_id(struct xrdp_mod* mod, char* name)
{ {
struct xrdp_wm* wm = (struct xrdp_wm *)NULL; struct xrdp_wm* wm;
wm = (struct xrdp_wm*)(mod->wm); wm = (struct xrdp_wm*)(mod->wm);
if (wm->mm->sesman_controlled) if (wm->mm->sesman_controlled)
@ -1443,7 +1515,7 @@ server_send_to_channel(struct xrdp_mod* mod, int channel_id,
char* data, int data_len, char* data, int data_len,
int total_data_len, int flags) int total_data_len, int flags)
{ {
struct xrdp_wm* wm = (struct xrdp_wm *)NULL; struct xrdp_wm* wm;
wm = (struct xrdp_wm*)(mod->wm); wm = (struct xrdp_wm*)(mod->wm);
if (wm->mm->sesman_controlled) if (wm->mm->sesman_controlled)

Loading…
Cancel
Save