[rygel/gnome-2-32] core: Remove newlines from modified description doc
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/gnome-2-32] core: Remove newlines from modified description doc
- Date: Mon, 27 Sep 2010 21:55:55 +0000 (UTC)
commit c63569cc042554cb2d804894c9b8124d41824f14
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Sep 15 14:49:09 2010 +0300
core: Remove newlines from modified description doc
libxml insists on adding a newline after the xml header node, don't
let it do that for the sake of IOP.
src/rygel/rygel-root-device-factory.vala | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index 94bf6ca..3eb1ad4 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -294,17 +294,26 @@ internal class Rygel.RootDeviceFactory {
private void save_modified_desc (XMLDoc doc,
string desc_path) throws GLib.Error {
- FileStream f = FileStream.open (desc_path, "w+");
- int res = -1;
+ var file = FileStream.open (desc_path, "w+");
- if (f != null)
- res = doc.doc.dump (f);
+ if (unlikely (file == null)) {
+ var message = _("Failed to write modified description to %s");
+
+ throw new IOError.FAILED (message, desc_path);
+ }
+
+ string mem = null;
+ int len = -1;
+ doc.doc.dump_memory_format (out mem, out len, false);
- if (f == null || res == -1) {
+ if (unlikely (len <= 0)) {
var message = _("Failed to write modified description to %s");
throw new IOError.FAILED (message, desc_path);
}
+
+ // Make sure we don't have any newlines
+ file.puts (mem.replace ("\n", ""));
}
private bool check_path_exist (string path) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]