[folks] folks: Check UID components are non-empty
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] folks: Check UID components are non-empty
- Date: Mon, 14 Nov 2016 00:21:01 +0000 (UTC)
commit f56e1f7852c72575087c8ec0dfb239a7a07fc7e1
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Nov 14 00:10:43 2016 +0000
folks: Check UID components are non-empty
When building a UID, check that the three components are non-empty. Add
preconditions to build_uid() which check this. All of the existing
callers of that method are guaranteed to not pass in empty strings, so
this is not a behaviour change.
https://bugzilla.gnome.org/show_bug.cgi?id=773011
folks/persona.vala | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/folks/persona.vala b/folks/persona.vala
index 6c54686..265669f 100644
--- a/folks/persona.vala
+++ b/folks/persona.vala
@@ -300,7 +300,8 @@ public abstract class Folks.Persona : Object
/**
* Build a UID from the given components.
*
- * Each component is escaped before the UID is built.
+ * Each component is escaped before the UID is built. All components must be
+ * non-empty strings.
*
* @param backend_name the {@link Backend.name}
* @param persona_store_id the {@link PersonaStore.id}
@@ -311,6 +312,9 @@ public abstract class Folks.Persona : Object
*/
public static string build_uid (string backend_name,
string persona_store_id, string persona_id)
+ requires (backend_name != "")
+ requires (persona_store_id != "")
+ requires (persona_id != "")
{
return "%s:%s:%s".printf (Persona._escape_uid_component (backend_name),
Persona._escape_uid_component (persona_store_id),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]