diff options
author | jsorg71 <jsorg71> | 2008-08-25 07:55:41 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2008-08-25 07:55:41 +0000 |
commit | a7df159ce9ccdb98cea6597a888392f62035c7d1 (patch) | |
tree | cd3bf671ff16876bb3cc4ee66ee17053ca7d19aa | |
parent | ab57eb73fc2da494cd68a7d6746312d45adc636f (diff) | |
download | xrdp-proprietary-a7df159ce9ccdb98cea6597a888392f62035c7d1.tar.gz xrdp-proprietary-a7df159ce9ccdb98cea6597a888392f62035c7d1.zip |
log errors and minor fix
-rw-r--r-- | xrdp/xrdp_bitmap.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c index 21a83b5e..b3d7162b 100644 --- a/xrdp/xrdp_bitmap.c +++ b/xrdp/xrdp_bitmap.c @@ -298,15 +298,20 @@ xrdp_bitmap_get_index(struct xrdp_bitmap* self, int* palette, int color) } /*****************************************************************************/ +/* returns error */ int APP_CC xrdp_bitmap_resize(struct xrdp_bitmap* self, int width, int height) { int Bpp; - if (width == self->width && height == self->height) + if ((width == self->width) && (height == self->height)) { return 0; } + if (self->do_not_free_data) + { + return 1; + } self->width = width; self->height = height; Bpp = 4; @@ -316,11 +321,8 @@ xrdp_bitmap_resize(struct xrdp_bitmap* self, int width, int height) case 15: Bpp = 2; break; case 16: Bpp = 2; break; } - if (self->data != 0) - { - g_free(self->data); - self->data = (char*)g_malloc(width * height * Bpp, 1); - } + g_free(self->data); + self->data = (char*)g_malloc(width * height * Bpp, 0); self->line_size = width * Bpp; return 0; } @@ -344,6 +346,12 @@ xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette) struct xrdp_bmp_header header; struct stream* s; + if (!g_file_exist(filename)) + { + g_writeln("xrdp_bitmap_load: error bitmap file [%s] does not exist", + filename); + return 1; + } s = 0; fd = g_file_open(filename); if (fd != -1) |