All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH obexd 1/4] Code clean-up: Remove unnecessary empty lines
@ 2011-09-22  7:52 Rafal Michalski
  2011-09-22  7:52 ` [PATCH obexd 2/4] Code clean-up: Remove unnecessary character in comment Rafal Michalski
  2011-09-27  9:49 ` [PATCH obexd 1/4] Code clean-up: Remove unnecessary empty lines Johan Hedberg
  0 siblings, 2 replies; 5+ messages in thread
From: Rafal Michalski @ 2011-09-22  7:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Rafal Michalski

This patch removes unnecessary empty lines.
---
 plugins/phonebook-tracker.c |    1 -
 plugins/vcard.c             |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 47ce878..da2e2bb 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -1003,7 +1003,6 @@ static void add_affiliation(char **field, const char *value)
 static void contact_init(struct phonebook_contact *contact,
 							const char **reply)
 {
-
 	contact->fullname = g_strdup(reply[COL_FULL_NAME]);
 	contact->family = g_strdup(reply[COL_FAMILY_NAME]);
 	contact->given = g_strdup(reply[COL_GIVEN_NAME]);
diff --git a/plugins/vcard.c b/plugins/vcard.c
index 0522c96..e5e1de1 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -825,7 +825,6 @@ void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact,
 	vcard_printf_end(vcards);
 }
 
-
 static void field_free(gpointer data)
 {
 	struct phonebook_field *field = data;
-- 
1.6.3.3


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

* [PATCH obexd 2/4] Code clean-up: Remove unnecessary character in comment
  2011-09-22  7:52 [PATCH obexd 1/4] Code clean-up: Remove unnecessary empty lines Rafal Michalski
@ 2011-09-22  7:52 ` Rafal Michalski
  2011-09-22  7:52   ` [PATCH obexd 3/4] Code clean-up: Remove magic number indicating size of buffer Rafal Michalski
  2011-09-27  9:49 ` [PATCH obexd 1/4] Code clean-up: Remove unnecessary empty lines Johan Hedberg
  1 sibling, 1 reply; 5+ messages in thread
From: Rafal Michalski @ 2011-09-22  7:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Rafal Michalski

This patch removes unnecessary comment's character.
---
 plugins/vcard.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/vcard.c b/plugins/vcard.c
index e5e1de1..ca3a052 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -681,7 +681,7 @@ static void vcard_printf_address(GString *vcards, uint8_t format,
 		g_strlcat(fields, field_esc, len);
 
 		if (l->next)
-			/* not addding ';' after last addr field */
+			/* not adding ';' after last addr field */
 			g_strlcat(fields, ";", len);
 	}
 
-- 
1.6.3.3


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

* [PATCH obexd 3/4] Code clean-up: Remove magic number indicating size of buffer
  2011-09-22  7:52 ` [PATCH obexd 2/4] Code clean-up: Remove unnecessary character in comment Rafal Michalski
@ 2011-09-22  7:52   ` Rafal Michalski
  2011-09-22  7:52     ` [PATCH obexd 4/4] Code clean-up: Simplify vCard's phone number printing Rafal Michalski
  0 siblings, 1 reply; 5+ messages in thread
From: Rafal Michalski @ 2011-09-22  7:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Rafal Michalski

This patch removes "magic number" indicating buffer's size
in "vcard_printf_number" function and replace it by value defined under
LEN_MAX. Now it would be consistent with the rest of code, since all
functions from vcard_prinf_* family use LEN_MAX to indicate size
of buffer which may store some vCard's field content.
---
 plugins/vcard.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/vcard.c b/plugins/vcard.c
index ca3a052..901a2ac 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -406,7 +406,7 @@ static void vcard_printf_number(GString *vcards, uint8_t format,
 					enum phonebook_number_type category)
 {
 	const char *intl = "", *category_string = "";
-	char buf[128], field[LEN_MAX];
+	char buf[LEN_MAX], field[LEN_MAX];
 
 	/* TEL is a mandatory field, include even if empty */
 	if (!number || !strlen(number) || !type) {
-- 
1.6.3.3


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

* [PATCH obexd 4/4] Code clean-up: Simplify vCard's phone number printing
  2011-09-22  7:52   ` [PATCH obexd 3/4] Code clean-up: Remove magic number indicating size of buffer Rafal Michalski
@ 2011-09-22  7:52     ` Rafal Michalski
  0 siblings, 0 replies; 5+ messages in thread
From: Rafal Michalski @ 2011-09-22  7:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Rafal Michalski

Previously, it was trynig to create string (by snprintf function
and stored in "buf" buffer) containing "%s" formatting piece for
"vcard_printf" function.
In this case "\%" is not valid escape sequence (it is "%%" for percent
character) - backslash is ignored, so sequence "\%s" is treated as "%s"
and replaced by string for "number" field when snprintf function is
executed. Hence "vcard_printf" function has nothing to do with "number"
field, since "buf" does not contain any "%s" formatting sequence.

This patch make simplification for printing phone number field by
avoiding storing formatting pieces (for instance "%%s"). Now string
for phone number field is stored directly in "field" buffer
(common with Quoted Printable encoding) and simply passed to
"vcard_printf" function.
---
 plugins/vcard.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/plugins/vcard.c b/plugins/vcard.c
index 901a2ac..5b581fb 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -450,17 +450,15 @@ static void vcard_printf_number(GString *vcards, uint8_t format,
 	if ((type == TYPE_INTERNATIONAL) && (number[0] != '+'))
 		intl = "+";
 
+	snprintf(field, sizeof(field), "%s%s", intl, number);
+
 	if (select_qp_encoding(format, number, NULL)) {
 		snprintf(buf, sizeof(buf), "TEL;%s", category_string);
-		snprintf(field, sizeof(field), "%s%s", intl, number);
 		vcard_qp_print_encoded(vcards, buf, field, NULL);
 		return;
 	}
 
-	snprintf(buf, sizeof(buf), "TEL;%s:%s\%s", category_string,
-								intl, number);
-
-	vcard_printf(vcards, buf, number);
+	vcard_printf(vcards, "TEL;%s:%s", category_string, field);
 }
 
 static void vcard_printf_tag(GString *vcards, uint8_t format,
-- 
1.6.3.3


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

* Re: [PATCH obexd 1/4] Code clean-up: Remove unnecessary empty lines
  2011-09-22  7:52 [PATCH obexd 1/4] Code clean-up: Remove unnecessary empty lines Rafal Michalski
  2011-09-22  7:52 ` [PATCH obexd 2/4] Code clean-up: Remove unnecessary character in comment Rafal Michalski
@ 2011-09-27  9:49 ` Johan Hedberg
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2011-09-27  9:49 UTC (permalink / raw)
  To: Rafal Michalski; +Cc: linux-bluetooth

Hi Rafal,

On Thu, Sep 22, 2011, Rafal Michalski wrote:
> This patch removes unnecessary empty lines.
> ---
>  plugins/phonebook-tracker.c |    1 -
>  plugins/vcard.c             |    1 -
>  2 files changed, 0 insertions(+), 2 deletions(-)

All four patches applied. Thanks.

Johan

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

end of thread, other threads:[~2011-09-27  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-22  7:52 [PATCH obexd 1/4] Code clean-up: Remove unnecessary empty lines Rafal Michalski
2011-09-22  7:52 ` [PATCH obexd 2/4] Code clean-up: Remove unnecessary character in comment Rafal Michalski
2011-09-22  7:52   ` [PATCH obexd 3/4] Code clean-up: Remove magic number indicating size of buffer Rafal Michalski
2011-09-22  7:52     ` [PATCH obexd 4/4] Code clean-up: Simplify vCard's phone number printing Rafal Michalski
2011-09-27  9:49 ` [PATCH obexd 1/4] Code clean-up: Remove unnecessary empty lines Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.