From: Hendrik Sattler <p...@hendrik-sattler.de>

---
 apps/ircp/ircp_client.c           |    6 ++--
 apps/ircp/ircp_server.c           |    8 +++---
 apps/obex_test/obex_test_client.c |   43 ++++++++++++++++++++++++-------------
 3 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/apps/ircp/ircp_client.c b/apps/ircp/ircp_client.c
index 7f10d0c..4f9ec57 100644
--- a/apps/ircp/ircp_client.c
+++ b/apps/ircp/ircp_client.c
@@ -378,7 +378,7 @@ int ircp_put(ircp_client_t *cli, char *name)
 {
        struct stat statbuf;
        char *origdir;
-       int err, ret;
+       int ret;
        
        /* Remember cwd */
        origdir = getcwd(NULL, 0);
@@ -394,7 +394,7 @@ int ircp_put(ircp_client_t *cli, char *name)
                char *newrealdir = NULL;
                char *dirname;
                
-               err = chdir(name);
+               (void)chdir(name);
                name = ".";
                
                /* Get real name of new wd, extract last part of and do setpath 
to it */
@@ -408,7 +408,7 @@ int ircp_put(ircp_client_t *cli, char *name)
        
        ret = visit_all_files(name, ircp_visit, cli);
 
-       err = chdir(origdir);
+       (void)chdir(origdir);
        free(origdir);
        return ret;
 
diff --git a/apps/ircp/ircp_server.c b/apps/ircp/ircp_server.c
index 08de942..b9267e6 100644
--- a/apps/ircp/ircp_server.c
+++ b/apps/ircp/ircp_server.c
@@ -257,7 +257,7 @@ out:        free(name);
 int ircp_srv_receive(ircp_server_t *srv, obex_object_t *object, int finished)
 {
        const uint8_t *body = NULL;
-       int len, body_len = 0;
+       int body_len = 0;
 
        if(srv->fd < 0 && finished == FALSE) {
                /* Not receiving a file */
@@ -286,7 +286,7 @@ int ircp_srv_receive(ircp_server_t *srv, obex_object_t 
*object, int finished)
                }
                else {
                        if(srv->fd > 0)
-                               len = write(srv->fd, body, body_len);
+                               (void)write(srv->fd, body, body_len);
                }
                return 1;
        }
@@ -339,7 +339,7 @@ void ircp_srv_close(ircp_server_t *srv)
 //
 int ircp_srv_recv(ircp_server_t *srv, char *inbox)
 {
-       int err, ret;
+       int ret;
        
        if(ircp_checkdir("", inbox, CD_ALLOWABS) < 0) {
                srv->infocb(IRCP_EV_ERRMSG, "Specified desination directory 
does not exist.");
@@ -359,7 +359,7 @@ int ircp_srv_recv(ircp_server_t *srv, char *inbox)
        ret = ircp_srv_sync_wait(srv);
        
        /* Go back to inbox */
-       err = chdir(inbox);
+       (void)chdir(inbox);
        
        return ret;
 }
diff --git a/apps/obex_test/obex_test_client.c 
b/apps/obex_test/obex_test_client.c
index 0bf5d42..65d9b3d 100644
--- a/apps/obex_test/obex_test_client.c
+++ b/apps/obex_test/obex_test_client.c
@@ -221,20 +221,21 @@ int fillstream(obex_t *handle, obex_object_t *object)
 void push_client(obex_t *handle)
 {
        obex_object_t *object;
-
-       char fname[200];
+       char fname[256];
        unsigned int uname_size;
        char *bfname;
        uint8_t *uname;
        int num;
-
        obex_headerdata_t hd;
-       
        uint8_t *buf;
        int file_size;
 
        printf("PUSH filename> ");
-       num = scanf("%s", fname);
+       memset(fname, 0, sizeof(fname));
+       num = scanf("%255c", fname);
+       if (!num)
+               return;
+
        bfname = strdup(basename(fname));
 
        buf = easy_readfile(fname, &file_size);
@@ -283,17 +284,19 @@ void put_client(obex_t *handle)
 {
        obex_object_t *object;
 
-       char lname[200];
-       char rname[200];
+       char lname[256];
+       char rname[256];
        unsigned int rname_size;
        obex_headerdata_t hd;
        int num;
-       
        uint8_t *buf;
        int file_size;
 
-       printf("PUT file (local, remote)> ");
-       num = scanf("%s %s", lname, rname);
+       printf("PUT local filename> ");
+       memset(lname, 0, sizeof(lname));
+       num = scanf("%255c", lname);
+       if (!num)
+               return;
 
        buf = easy_readfile(lname, &file_size);
        if(buf == NULL) {
@@ -301,6 +304,10 @@ void put_client(obex_t *handle)
                return;
        }
 
+       printf("PUT remote filename (default: %s)> ", lname);
+       num = scanf("%255c", rname);
+       if (num == 0)
+               strcpy(rname, lname);
        printf("Going to send %d bytes\n", file_size);
 
        /* Build object */
@@ -342,13 +349,16 @@ void put_client_done(obex_t *handle, obex_object_t 
*object, int obex_rsp)
 void get_client(obex_t *handle, struct context *gt)
 {
        obex_object_t *object;
-       uint8_t rname[200];
-       char req_name[200];
+       uint8_t rname[256];
+       char req_name[256];
        int num, rname_size;
        obex_headerdata_t hd;
 
        printf("GET File> ");
-       num = scanf("%s", req_name);
+       memset(req_name, 0, sizeof(req_name));
+       num = scanf("%255c", req_name);
+       if (!num)
+               return;
 
        if(! (object = OBEX_ObjectNew(handle, OBEX_CMD_GET)))   {
                printf("Error\n");
@@ -414,12 +424,15 @@ void setpath_client(obex_t *handle)
 {
        uint8_t setpath_data[2] = { 0, 0 };
        obex_object_t *object;
-       char path[200];
+       char path[256];
        int num, path_size;
        obex_headerdata_t hd;
 
        printf("SETPATH> ");
-       num = scanf("%s", path);
+       memset(path, 0, sizeof(path));
+       num = scanf("%255c", path);
+       if (!num)
+               return;
 
        if(! (object = OBEX_ObjectNew(handle, OBEX_CMD_SETPATH)))       {
                printf("Error\n");
-- 
1.7.4.1


------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Openobex-users mailing list
Openobex-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to