gobex: Add "cd ../dir" handling in setpath
PATCH 1/1 gobex: Add "cd ../dir" handling in setpath
--- gobex/gobex.c | 14 ++++++++++---- unit/test-gobex.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-)
gobex/gobex.c +10 -4
@@ -1088,6 +1088,7 @@ guint g_obex_setpath(GObex *obex, const char *path, GObexResponseFunc func, {GObexPacket *req;struct setpath_data data; +const char *folder;g_obex_debug (G_OBEX_DEBUG_COMMAND ,"conn %u" , obex->conn_id);
@@ -1095,12 +1096,17 @@ guint g_obex_setpath(GObex *obex, const char *path, GObexResponseFunc func,memset (&data,0 ,sizeof (data)); -if (strcmp (path,".." ) ==0 ) +if (path !=NULL &&strncmp (".." , path,2 ) ==0 ) { data.flags =0x03 ; -else { -GObexHeader *hdr; + folder = (path[2 ] =='/' ) ? &path[3 ] :NULL ; + }else { data.flags =0x02 ; - hdr =g_obex_header_new_unicode (G_OBEX_HDR_NAME , path); + folder = path; + } + +if (folder !=NULL ) { +GObexHeader *hdr; + hdr =g_obex_header_new_unicode (G_OBEX_HDR_NAME , folder);g_obex_packet_add_header (req, hdr); }
unit/test-gobex.c +42 -0
60 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Johan Hedberg
AppliedHi Bartosz,
Quoted 4 lines · Bartosz Szatkowski
--- gobex/gobex.c | 14 ++++++++++---- unit/test-gobex.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-)
Applied. Thanks.
Johan