[folks] Ensure we use string's byte length in both Vala 0.10 and 0.12
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Ensure we use string's byte length in both Vala 0.10 and 0.12
- Date: Sat, 13 Nov 2010 12:10:00 +0000 (UTC)
commit 3c5129f844242694b2825abadb1e3bb65254f3f1
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Nov 13 12:07:33 2010 +0000
Ensure we use string's byte length in both Vala 0.10 and 0.12
string.length gives the byte length in Vala 0.12 and string.size() is
deprecated, however string.length gives the character length in Vala 0.10,
so we need to conditionally change the code for Vala <= 0.10.
Re-closes: bgo#628930
backends/key-file/kf-persona-store.vala | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/backends/key-file/kf-persona-store.vala b/backends/key-file/kf-persona-store.vala
index f4b4ae4..40d2474 100644
--- a/backends/key-file/kf-persona-store.vala
+++ b/backends/key-file/kf-persona-store.vala
@@ -364,10 +364,21 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
try
{
/* Note: We have to use key_file_data.size () here to get its length
- * in _bytes_ rather than _characters_. bgo#628930 */
+ * in _bytes_ rather than _characters_. bgo#628930.
+ * In Vala >= 0.11, string.size() has been deprecated in favour of
+ * string.length (which now returns the byte length, whereas in
+ * Vala <= 0.10, it returned the character length). FIXME: We need to
+ * take this into account until we depend explicitly on
+ * Vala >= 0.11. */
+#if VALA_0_12
yield this.file.replace_contents_async (key_file_data,
key_file_data.length, null, false, FileCreateFlags.PRIVATE,
cancellable);
+#else
+ yield this.file.replace_contents_async (key_file_data,
+ key_file_data.size (), null, false, FileCreateFlags.PRIVATE,
+ cancellable);
+#endif
}
catch (Error e)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]