summaryrefslogtreecommitdiff
path: root/rtgui
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2009-10-25 23:26:04 +0000
committerbernard.xiong <[email protected]>2009-10-25 23:26:04 +0000
commite252eb75eb9324e02bdd1c210601501d76c927a6 (patch)
tree96da858bb8e743aba6c30a18c45d361d0f13c145 /rtgui
parent428b10bb91a111934478771766f8c4e491bb33ac (diff)
remove some warning in compiling.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@136 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'rtgui')
-rw-r--r--rtgui/common/dc.c5
-rw-r--r--rtgui/common/filerw.c24
-rw-r--r--rtgui/common/image.c8
-rw-r--r--rtgui/common/image_png.c4
4 files changed, 33 insertions, 8 deletions
diff --git a/rtgui/common/dc.c b/rtgui/common/dc.c
index 5701c56f4e..0ccd51ebfa 100644
--- a/rtgui/common/dc.c
+++ b/rtgui/common/dc.c
@@ -13,6 +13,9 @@
*/
#include <rtgui/dc.h>
#include <rtgui/rtgui_system.h>
+
+#include <string.h> /* for strlen */
+#include <stdlib.h> /* fir qsort */
void rtgui_dc_destory(struct rtgui_dc* dc)
{
@@ -408,7 +411,7 @@ void rtgui_dc_draw_text (struct rtgui_dc* dc, const rt_uint8_t* text, struct rtg
rtgui_font_derefer(gb2312_font);
#else
- len = strlen(text);
+ len = strlen((const char*)text);
rtgui_font_draw(font, dc, text, len, &text_rect);
#endif
}
diff --git a/rtgui/common/filerw.c b/rtgui/common/filerw.c
index 09905f33b3..a7656d853c 100644
--- a/rtgui/common/filerw.c
+++ b/rtgui/common/filerw.c
@@ -302,7 +302,27 @@ rt_uint8_t* rtgui_filerw_mem_getdata(struct rtgui_filerw* context)
}
/* file read/write public interface */
-#ifdef RT_USING_DFS_FILERW
+#ifdef RT_USING_DFS_FILERW
+static int parse_mode(const char *mode)
+{
+ int f=0;
+
+ for (;;)
+ {
+ switch (*mode)
+ {
+ case 0: return f;
+ case 'b': break;
+ case 'r': f=O_RDONLY; break;
+ case 'w': f=O_WRONLY|O_CREAT|O_TRUNC; break;
+ case 'a': f=O_WRONLY|O_CREAT|O_APPEND; break;
+ case '+': f=(f&(~O_WRONLY))|O_RDWR; break;
+ }
+
+ ++mode;
+ }
+}
+
struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char* mode)
{
int fd;
@@ -311,7 +331,7 @@ struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char*
RT_ASSERT(filename != RT_NULL);
rw = RT_NULL;
- fd = open(filename, mode, 0);
+ fd = open(filename, parse_mode(mode), 0);
if ( fd >= 0 )
{
diff --git a/rtgui/common/image.c b/rtgui/common/image.c
index 5fd386049e..9908c2962a 100644
--- a/rtgui/common/image.c
+++ b/rtgui/common/image.c
@@ -12,11 +12,11 @@
* 2009-10-16 Bernard first version
*/
#include <rtthread.h>
-#include <rtgui/image.h>
-
+#include <rtgui/image.h>
+
#include <rtgui/image_xpm.h>
-#include <rtgui/rtgui_system.h>
-
+#include <rtgui/rtgui_system.h>
+
#include <string.h>
#ifdef RTGUI_IMAGE_BMP
diff --git a/rtgui/common/image_png.c b/rtgui/common/image_png.c
index 55fdc49c01..6ea8bab52c 100644
--- a/rtgui/common/image_png.c
+++ b/rtgui/common/image_png.c
@@ -190,7 +190,9 @@ static rt_bool_t rtgui_image_png_load(struct rtgui_image* image, struct rtgui_fi
{
png->line_pixels = rtgui_malloc(image->w * sizeof(rtgui_color_t));
png->pixels = RT_NULL;
- }
+ }
+
+ return RT_TRUE;
}
static void rtgui_image_png_unload(struct rtgui_image* image)