linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd] Make mime type matching case-insensitive
@ 2011-07-27 14:57 Slawomir Bochenski
  2011-07-27 15:02 ` [PATCH v2 " Slawomir Bochenski
  0 siblings, 1 reply; 4+ messages in thread
From: Slawomir Bochenski @ 2011-07-27 14:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Slawomir Bochenski

This makes mime type checking performed inside plugins case-insensitive, to
be in line with d37af12d8cb76d1eb893955938cb6475333dddb9.
---
 plugins/ftp.c  |    2 +-
 plugins/opp.c  |    2 +-
 plugins/pbap.c |    6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/ftp.c b/plugins/ftp.c
index 2ec008f..08d4e34 100644
--- a/plugins/ftp.c
+++ b/plugins/ftp.c
@@ -179,7 +179,7 @@ static int get_by_type(struct ftp_session *ftp, const char *type)
 	if (type == NULL && name == NULL)
 		return -EBADR;
 
-	if (g_strcmp0(type, CAP_TYPE) == 0)
+	if (g_ascii_strcasecmp(type, CAP_TYPE) == 0)
 		return obex_get_stream_start(os, capability);
 
 	path = g_build_filename(ftp->folder, name, NULL);
diff --git a/plugins/opp.c b/plugins/opp.c
index 4f0ed08..4aca594 100644
--- a/plugins/opp.c
+++ b/plugins/opp.c
@@ -182,7 +182,7 @@ static int opp_get(struct obex_session *os, obex_object_t *obj, void *user_data)
 	if (type == NULL)
 		return -EPERM;
 
-	if (g_str_equal(type, VCARD_TYPE)) {
+	if (g_ascii_strcasecmp(type, VCARD_TYPE)) {
 		if (obex_get_stream_start(os, VCARD_FILE) < 0)
 			return -ENOENT;
 
diff --git a/plugins/pbap.c b/plugins/pbap.c
index 82963af..4892d7a 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -654,14 +654,14 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
 
 	pbap->params = params;
 
-	if (strcmp(type, PHONEBOOK_TYPE) == 0) {
+	if (g_ascii_strcasecmp(type, PHONEBOOK_TYPE) == 0) {
 		/* Always contains the absolute path */
 		if (g_path_is_absolute(name))
 			path = g_strdup(name);
 		else
 			path = g_build_filename("/", name, NULL);
 
-	} else if (strcmp(type, VCARDLISTING_TYPE) == 0) {
+	} else if (g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
 		/* Always relative */
 		if (!name || strlen(name) == 0)
 			/* Current folder */
@@ -670,7 +670,7 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
 			/* Current folder + relative path */
 			path = g_build_filename(pbap->folder, name, NULL);
 
-	} else if (strcmp(type, VCARDENTRY_TYPE) == 0) {
+	} else if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
 		/* File name only */
 		path = g_strdup(name);
 	} else
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 obexd] Make mime type matching case-insensitive
  2011-07-27 14:57 [PATCH obexd] Make mime type matching case-insensitive Slawomir Bochenski
@ 2011-07-27 15:02 ` Slawomir Bochenski
  2011-07-27 16:25   ` [PATCH v3 " Slawomir Bochenski
  0 siblings, 1 reply; 4+ messages in thread
From: Slawomir Bochenski @ 2011-07-27 15:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Slawomir Bochenski

This makes mime type checking performed inside plugins case-insensitive, to
be in line with d37af12d8cb76d1eb893955938cb6475333dddb9.
---
v2: add check for non-NULL type in ftp.c:get_by_type()

 plugins/ftp.c  |    2 +-
 plugins/opp.c  |    2 +-
 plugins/pbap.c |    6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/ftp.c b/plugins/ftp.c
index 2ec008f..8e17b6f 100644
--- a/plugins/ftp.c
+++ b/plugins/ftp.c
@@ -179,7 +179,7 @@ static int get_by_type(struct ftp_session *ftp, const char *type)
 	if (type == NULL && name == NULL)
 		return -EBADR;
 
-	if (g_strcmp0(type, CAP_TYPE) == 0)
+	if (type != NULL && g_ascii_strcasecmp(type, CAP_TYPE) == 0)
 		return obex_get_stream_start(os, capability);
 
 	path = g_build_filename(ftp->folder, name, NULL);
diff --git a/plugins/opp.c b/plugins/opp.c
index 4f0ed08..4aca594 100644
--- a/plugins/opp.c
+++ b/plugins/opp.c
@@ -182,7 +182,7 @@ static int opp_get(struct obex_session *os, obex_object_t *obj, void *user_data)
 	if (type == NULL)
 		return -EPERM;
 
-	if (g_str_equal(type, VCARD_TYPE)) {
+	if (g_ascii_strcasecmp(type, VCARD_TYPE)) {
 		if (obex_get_stream_start(os, VCARD_FILE) < 0)
 			return -ENOENT;
 
diff --git a/plugins/pbap.c b/plugins/pbap.c
index 82963af..4892d7a 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -654,14 +654,14 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
 
 	pbap->params = params;
 
-	if (strcmp(type, PHONEBOOK_TYPE) == 0) {
+	if (g_ascii_strcasecmp(type, PHONEBOOK_TYPE) == 0) {
 		/* Always contains the absolute path */
 		if (g_path_is_absolute(name))
 			path = g_strdup(name);
 		else
 			path = g_build_filename("/", name, NULL);
 
-	} else if (strcmp(type, VCARDLISTING_TYPE) == 0) {
+	} else if (g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
 		/* Always relative */
 		if (!name || strlen(name) == 0)
 			/* Current folder */
@@ -670,7 +670,7 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
 			/* Current folder + relative path */
 			path = g_build_filename(pbap->folder, name, NULL);
 
-	} else if (strcmp(type, VCARDENTRY_TYPE) == 0) {
+	} else if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
 		/* File name only */
 		path = g_strdup(name);
 	} else
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 obexd] Make mime type matching case-insensitive
  2011-07-27 15:02 ` [PATCH v2 " Slawomir Bochenski
@ 2011-07-27 16:25   ` Slawomir Bochenski
  2011-07-28  8:27     ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Slawomir Bochenski @ 2011-07-27 16:25 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Slawomir Bochenski

This makes mime type checking performed inside plugins case-insensitive, to
be in line with d37af12d8cb76d1eb893955938cb6475333dddb9.
---
v3: Fix incorrect transition from boolean function in opp.c

Phew! Hope I got this right this time.

 plugins/ftp.c  |    2 +-
 plugins/opp.c  |    2 +-
 plugins/pbap.c |    6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/ftp.c b/plugins/ftp.c
index 2ec008f..8e17b6f 100644
--- a/plugins/ftp.c
+++ b/plugins/ftp.c
@@ -179,7 +179,7 @@ static int get_by_type(struct ftp_session *ftp, const char *type)
 	if (type == NULL && name == NULL)
 		return -EBADR;
 
-	if (g_strcmp0(type, CAP_TYPE) == 0)
+	if (type != NULL && g_ascii_strcasecmp(type, CAP_TYPE) == 0)
 		return obex_get_stream_start(os, capability);
 
 	path = g_build_filename(ftp->folder, name, NULL);
diff --git a/plugins/opp.c b/plugins/opp.c
index 4f0ed08..5937110 100644
--- a/plugins/opp.c
+++ b/plugins/opp.c
@@ -182,7 +182,7 @@ static int opp_get(struct obex_session *os, obex_object_t *obj, void *user_data)
 	if (type == NULL)
 		return -EPERM;
 
-	if (g_str_equal(type, VCARD_TYPE)) {
+	if (g_ascii_strcasecmp(type, VCARD_TYPE) == 0) {
 		if (obex_get_stream_start(os, VCARD_FILE) < 0)
 			return -ENOENT;
 
diff --git a/plugins/pbap.c b/plugins/pbap.c
index 82963af..4892d7a 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -654,14 +654,14 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
 
 	pbap->params = params;
 
-	if (strcmp(type, PHONEBOOK_TYPE) == 0) {
+	if (g_ascii_strcasecmp(type, PHONEBOOK_TYPE) == 0) {
 		/* Always contains the absolute path */
 		if (g_path_is_absolute(name))
 			path = g_strdup(name);
 		else
 			path = g_build_filename("/", name, NULL);
 
-	} else if (strcmp(type, VCARDLISTING_TYPE) == 0) {
+	} else if (g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
 		/* Always relative */
 		if (!name || strlen(name) == 0)
 			/* Current folder */
@@ -670,7 +670,7 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
 			/* Current folder + relative path */
 			path = g_build_filename(pbap->folder, name, NULL);
 
-	} else if (strcmp(type, VCARDENTRY_TYPE) == 0) {
+	} else if (g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
 		/* File name only */
 		path = g_strdup(name);
 	} else
-- 
1.7.5.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 obexd] Make mime type matching case-insensitive
  2011-07-27 16:25   ` [PATCH v3 " Slawomir Bochenski
@ 2011-07-28  8:27     ` Johan Hedberg
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2011-07-28  8:27 UTC (permalink / raw)
  To: Slawomir Bochenski; +Cc: linux-bluetooth

Hi Slawek,

On Wed, Jul 27, 2011, Slawomir Bochenski wrote:
> This makes mime type checking performed inside plugins case-insensitive, to
> be in line with d37af12d8cb76d1eb893955938cb6475333dddb9.
> ---
> v3: Fix incorrect transition from boolean function in opp.c
> 
> Phew! Hope I got this right this time.
> 
>  plugins/ftp.c  |    2 +-
>  plugins/opp.c  |    2 +-
>  plugins/pbap.c |    6 +++---
>  3 files changed, 5 insertions(+), 5 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-28  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-27 14:57 [PATCH obexd] Make mime type matching case-insensitive Slawomir Bochenski
2011-07-27 15:02 ` [PATCH v2 " Slawomir Bochenski
2011-07-27 16:25   ` [PATCH v3 " Slawomir Bochenski
2011-07-28  8:27     ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).