[seed] More work on dbus branch



commit fa25ef382a87a5416527bc498f4061353dc1d87c
Author: Robert Carr <racarr svn gnome org>
Date:   Fri May 8 22:27:44 2009 -0400

    More work on dbus branch
---
 libseed/seed-types.c |   18 ++++++++++++++++++
 libseed/seed-types.h |    6 ++++++
 libseed/seed.h       |    6 ++++++
 3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 9c98768..4c5ccdb 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -17,6 +17,7 @@
 
 #include "seed-private.h"
 #include <dlfcn.h>
+#include <string.h>
 
 JSClassRef gobject_class;
 JSClassRef gobject_method_class;
@@ -1826,6 +1827,23 @@ seed_value_from_string (JSContextRef ctx,
   return valstr;
 }
 
+JSValueRef
+seed_value_from_binary_string (JSContextRef ctx,
+			       const gchar *bytes,
+			       gint n_bytes,
+			       JSValueRef *exception)
+{
+  JSValueRef ret;
+
+  gchar *nstr = g_alloca ((n_bytes +1)*sizeof(gchar));
+  strncpy (nstr, bytes, n_bytes);
+  nstr[n_bytes] = '\0';
+  
+  ret = seed_value_from_string (ctx, nstr, exception);
+  
+  return ret;
+}
+
 gchar *
 seed_value_to_filename (JSContextRef ctx,
 			JSValueRef val, JSValueRef * exception)
diff --git a/libseed/seed-types.h b/libseed/seed-types.h
index f2e578f..1940123 100644
--- a/libseed/seed-types.h
+++ b/libseed/seed-types.h
@@ -144,4 +144,10 @@ void seed_toggle_ref (gpointer data, GObject * object, gboolean is_last_ref);
 
 gboolean seed_validate_enum (GIEnumInfo *info, long val);
 
+JSValueRef
+seed_value_from_binary_string (JSContextRef ctx,
+			       const gchar *bytes,
+			       gint n_bytes,
+			       JSValueRef *exception);
+
 #endif
diff --git a/libseed/seed.h b/libseed/seed.h
index 1bb2640..5ab15b9 100644
--- a/libseed/seed.h
+++ b/libseed/seed.h
@@ -379,5 +379,11 @@ SeedType seed_value_get_type (SeedContext ctx, SeedType type);
 
 gchar **seed_object_copy_property_names(SeedContext ctx, SeedObject object); 
 
+SeedValue
+seed_value_from_binary_string (SeedContext ctx,
+			       const gchar *bytes,
+			       gint n_bytes,
+			       SeedException *exception);
+
 
 #endif



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