Fix code warning.
Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/test/others/framebuffer_demo.c b/mbtk/test/others/framebuffer_demo.c
index 281e9ab..bc35a07 100755
--- a/mbtk/test/others/framebuffer_demo.c
+++ b/mbtk/test/others/framebuffer_demo.c
@@ -10,6 +10,8 @@
#include <sys/mman.h>
#include <math.h>
+#include "mbtk_utils.h"
+
/**< \brief 根据实际情况修改,此处为unsigned short是565的屏,根据程序打印出的
bits_per_pixel的值可以判断出输出格式是565还是888 */
// typedef unsigned int color_t;
@@ -122,8 +124,8 @@
return;
}
- read(fd , &filehead , sizeof(filehead));
- read(fd , &infohead , sizeof(infohead));
+ mbtk_read(fd , &filehead , sizeof(filehead));
+ mbtk_read(fd , &infohead , sizeof(infohead));
printf("bfType: 0x%x, bfSize: %d, bfOffBits: 0x%x\n", filehead.bfType, filehead.bfSize, filehead.bfOffBits);
printf("biSize: %d, biWidth: %d, biHeight: %d\n", infohead.biSize, infohead.biWidth, infohead.biHeight);
@@ -155,11 +157,11 @@
}
printf("biSizeImage:%d, width_error: %d\n", infohead.biSizeImage, width_error);
- read(fd , p_data , infohead.biSizeImage);
+ mbtk_read(fd , p_data , infohead.biSizeImage);
p = p_data;
int ret;
- char data[24] = {0};
+ char data[100] = {0};
int debug_fd = open("/data/debug_fb", O_RDWR|O_CREAT|O_TRUNC, 0644);
if (debug_fd < 0) {
printf("debug_fb open error\n");
@@ -168,7 +170,7 @@
printf("height:%d, width:%d\n", infohead.biHeight, infohead.biWidth);
for(j = infohead.biHeight - 1; j >= 0; j--) {
for(i = 0; i < infohead.biWidth; i++) {
- c = transform_func(p);
+ c = transform_func((char*)p);
// c = *p;
p += pixel_byte;
// c = ((c >> 8) & 0x00ff) | ((c & 0x00ff) << 8);
diff --git a/mbtk/test/others/key_ev_demo.c b/mbtk/test/others/key_ev_demo.c
index 190e4a6..728b5d0 100755
--- a/mbtk/test/others/key_ev_demo.c
+++ b/mbtk/test/others/key_ev_demo.c
@@ -76,6 +76,7 @@
return 0;
}
+#if 0
static void ev_exit(void)
{
while (ev_count > 0)
@@ -83,6 +84,7 @@
close(ev_fds[--ev_count].fd);
}
}
+#endif
/* wait: 0 dont wait; -1 wait forever; >0 wait ms */
static int ev_get(struct input_event *ev, int wait_ms)
diff --git a/mbtk/test/others/mbtk_debug_test.c b/mbtk/test/others/mbtk_debug_test.c
index 3057abf..39c8105 100755
--- a/mbtk/test/others/mbtk_debug_test.c
+++ b/mbtk/test/others/mbtk_debug_test.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <pthread.h>
#include "mbtk_log.h"
#include "mbtk_utils.h"
@@ -7,7 +8,7 @@
void test3()
{
printf("%s start\n", __FUNCTION__);
- char *ptr = 10;
+ char *ptr = (char*)10;
*ptr = 'a';
printf("%s end\n", __FUNCTION__);
}
diff --git a/mbtk/test/others/mbtk_gnss_cli.c b/mbtk/test/others/mbtk_gnss_cli.c
index 8699a39..825d501 100755
--- a/mbtk/test/others/mbtk_gnss_cli.c
+++ b/mbtk/test/others/mbtk_gnss_cli.c
@@ -27,6 +27,7 @@
#include "mbtk_log.h"
#include "mbtk_type.h"
#include "mbtk_gnss.h"
+#include "mbtk_utils.h"
#define GNSS_SOCK_PATH "/tmp/mbtk_gnss_sock"
@@ -81,15 +82,15 @@
} else if(cmd == GNSS_CMD_DEINIT) {
sprintf(buff, "gnss_deinit");
} else if(cmd == GNSS_CMD_SETTING) {
- sprintf(buff, "gnss_setting:%s", arg);
+ sprintf(buff, "gnss_setting:%s", (char*)arg);
} else if(cmd == GNSS_CMD_DL) {
- sprintf(buff, "gnss_dl:%s", arg);
+ sprintf(buff, "gnss_dl:%s", (char*)arg);
} else {
printf("Unknown cmd.\n");
return -1;
}
- write(sock_listen_fd, buff, strlen(buff));
+ mbtk_write(sock_listen_fd, buff, strlen(buff));
int len = 0;
char *rsp = NULL;
diff --git a/mbtk/test/others/partition_write_demo.c b/mbtk/test/others/partition_write_demo.c
index 1256d75..5edfa2d 100755
--- a/mbtk/test/others/partition_write_demo.c
+++ b/mbtk/test/others/partition_write_demo.c
@@ -3,6 +3,7 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
int main(int argc, char *argv[])
{
@@ -20,11 +21,11 @@
while((len = write(fd, buffer, sizeof(buffer))) > 0){
count += len;
- printf("write : %d\n", count);
+ printf("write : %ld\n", count);
//usleep(1000);
}
- printf("Write complete,len = %d, errno = %d\n", len, errno);
+ printf("Write complete,len = %ld, errno = %d\n", len, errno);
close(fd);
#else
diff --git a/mbtk/test/others/proc_demo.c b/mbtk/test/others/proc_demo.c
index 7712b4c..929984c 100755
--- a/mbtk/test/others/proc_demo.c
+++ b/mbtk/test/others/proc_demo.c
@@ -11,7 +11,7 @@
void test(int c)
{
- int d = 10;
+// int d = 10;
//printf("函数参数:test_c = %p, 局部变量:d = %p\n", &c, &d);
}
diff --git a/mbtk/test/others/touch_ev_demo.c b/mbtk/test/others/touch_ev_demo.c
index b7ae90d..133384b 100755
--- a/mbtk/test/others/touch_ev_demo.c
+++ b/mbtk/test/others/touch_ev_demo.c
@@ -20,6 +20,8 @@
#include <dirent.h>
#include <stdbool.h>
+// #include "mbtk_log.h"
+
#ifndef TRUE
#define TRUE 1 /* Boolean true value. */
#endif
@@ -234,7 +236,7 @@
void ev_dispatch(void)
{
unsigned n;
- int ret;
+// int ret;
for (n = 0; n < ev_count; n++) {
ev_callback cb = ev_fdinfo[n].cb;
@@ -356,7 +358,7 @@
int main(int argc, char *argv[])
{
- mbtk_log_init(NULL, "MBTK_EVENT");
+ // mbtk_log_init(NULL, "MBTK_EVENT");
if(ev_init(NULL)) {
LOGE("ev_init() fail.");
diff --git a/mbtk/test/others/usb_check.c b/mbtk/test/others/usb_check.c
index 9aa5ebf..7a8fc43 100755
--- a/mbtk/test/others/usb_check.c
+++ b/mbtk/test/others/usb_check.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <signal.h>
#include <fcntl.h>
+#include <string.h>
#include "mbtk_utils.h"
@@ -26,8 +27,8 @@
while(running){
memset(buff, 0, 1024);
if(mbtk_cmd_line("cat /sys/class/android_usb/android0/state", buff, 1024)) {
- write(fd, buff, strlen(buff));
- write(fd, "\n", 1);
+ mbtk_write(fd, buff, strlen(buff));
+ mbtk_write(fd, "\n", 1);
}
sleep(1);
}