[folks] Fix string length calculation in the BackendStore for Vala 0.12



commit 2e4ee8cb2703ea13e6023c6f917f8a76f2c223a5
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Sun Dec 12 16:18:57 2010 +0000

    Fix string length calculation in the BackendStore for Vala 0.12

 folks/backend-store.vala |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/folks/backend-store.vala b/folks/backend-store.vala
index 7ab934f..370fd79 100644
--- a/folks/backend-store.vala
+++ b/folks/backend-store.vala
@@ -600,10 +600,21 @@ public class Folks.BackendStore : Object {
       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.config_file.replace_contents_async (key_file_data,
+              key_file_data.length, null, false, FileCreateFlags.PRIVATE,
+              null);
+#else
           yield this.config_file.replace_contents_async (key_file_data,
               key_file_data.size (), null, false, FileCreateFlags.PRIVATE,
               null);
+#endif
         }
       catch (Error e)
         {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]