index e6d02b62dbf5db759328d644dcaa2135267f4398..ab9c59830f99df36bf2cf958884af4ec25c25e5d 100644 (file)
#include "file.h"
#include "extension/system.h"
#include "extension/output.h"
#include "file.h"
#include "extension/system.h"
#include "extension/output.h"
+#include <vector>
#ifdef WITH_GNOME_VFS
# include <libgnomevfs/gnome-vfs.h>
#ifdef WITH_GNOME_VFS
# include <libgnomevfs/gnome-vfs.h>
namespace Extension {
namespace Internal {
namespace Extension {
namespace Internal {
+#include "clear-n_.h"
+
/**
\return None
\brief What would an SVG editor be without loading/saving SVG
/**
\return None
\brief What would an SVG editor be without loading/saving SVG
/* SVG in */
ext = Inkscape::Extension::build_from_mem(
"<inkscape-extension>\n"
/* SVG in */
ext = Inkscape::Extension::build_from_mem(
"<inkscape-extension>\n"
- "<name>SVG Input</name>\n"
+ "<name>" N_("SVG Input") "</name>\n"
"<id>" SP_MODULE_KEY_INPUT_SVG "</id>\n"
"<input>\n"
"<extension>.svg</extension>\n"
"<mimetype>image/x-svg</mimetype>\n"
"<id>" SP_MODULE_KEY_INPUT_SVG "</id>\n"
"<input>\n"
"<extension>.svg</extension>\n"
"<mimetype>image/x-svg</mimetype>\n"
- "<filetypename>Scalable Vector Graphic (*.svg)</filetypename>\n"
- "<filetypetooltip>Inkscape native file format and W3C standard</filetypetooltip>\n"
+ "<filetypename>" N_("Scalable Vector Graphic (*.svg)") "</filetypename>\n"
+ "<filetypetooltip>" N_("Inkscape native file format and W3C standard") "</filetypetooltip>\n"
"<output_extension>" SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE "</output_extension>\n"
"</input>\n"
"</inkscape-extension>", new Svg());
"<output_extension>" SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE "</output_extension>\n"
"</input>\n"
"</inkscape-extension>", new Svg());
/* SVG out Inkscape */
ext = Inkscape::Extension::build_from_mem(
"<inkscape-extension>\n"
/* SVG out Inkscape */
ext = Inkscape::Extension::build_from_mem(
"<inkscape-extension>\n"
- "<name>SVG Output Inkscape</name>\n"
+ "<name>" N_("SVG Output Inkscape") "</name>\n"
"<id>" SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE "</id>\n"
"<output>\n"
"<extension>.svg</extension>\n"
"<mimetype>image/x-svg</mimetype>\n"
"<id>" SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE "</id>\n"
"<output>\n"
"<extension>.svg</extension>\n"
"<mimetype>image/x-svg</mimetype>\n"
- "<filetypename>Inkscape SVG (*.svg)</filetypename>\n"
- "<filetypetooltip>SVG format with Inkscape extensions</filetypetooltip>\n"
+ "<filetypename>" N_("Inkscape SVG (*.svg)") "</filetypename>\n"
+ "<filetypetooltip>" N_("SVG format with Inkscape extensions") "</filetypetooltip>\n"
"<dataloss>FALSE</dataloss>\n"
"</output>\n"
"</inkscape-extension>", new Svg());
"<dataloss>FALSE</dataloss>\n"
"</output>\n"
"</inkscape-extension>", new Svg());
/* SVG out */
ext = Inkscape::Extension::build_from_mem(
"<inkscape-extension>\n"
/* SVG out */
ext = Inkscape::Extension::build_from_mem(
"<inkscape-extension>\n"
- "<name>SVG Output</name>\n"
+ "<name>" N_("SVG Output") "</name>\n"
"<id>" SP_MODULE_KEY_OUTPUT_SVG "</id>\n"
"<output>\n"
"<extension>.svg</extension>\n"
"<mimetype>image/x-svg</mimetype>\n"
"<id>" SP_MODULE_KEY_OUTPUT_SVG "</id>\n"
"<output>\n"
"<extension>.svg</extension>\n"
"<mimetype>image/x-svg</mimetype>\n"
- "<filetypename>Plain SVG (*.svg)</filetypename>\n"
- "<filetypetooltip>Scalable Vector Graphics format as defined by the W3C</filetypetooltip>\n"
+ "<filetypename>" N_("Plain SVG (*.svg)") "</filetypename>\n"
+ "<filetypetooltip>" N_("Scalable Vector Graphics format as defined by the W3C") "</filetypetooltip>\n"
"</output>\n"
"</inkscape-extension>", new Svg());
"</output>\n"
"</inkscape-extension>", new Svg());
{
GnomeVFSHandle *handle = NULL;
GnomeVFSFileSize bytes_read;
{
GnomeVFSHandle *handle = NULL;
GnomeVFSFileSize bytes_read;
- gchar buffer[BUF_SIZE] = "";
- gchar *doc = NULL;
- gchar *new_doc = NULL;
gsize bytesRead = 0;
gsize bytesWritten = 0;
gsize bytesRead = 0;
gsize bytesWritten = 0;
g_warning(gnome_vfs_result_to_string(result));
}
g_warning(gnome_vfs_result_to_string(result));
}
+ std::vector<gchar> doc;
while (result == GNOME_VFS_OK) {
while (result == GNOME_VFS_OK) {
+ gchar buffer[BUF_SIZE];
result = gnome_vfs_read (handle, buffer, BUF_SIZE, &bytes_read);
result = gnome_vfs_read (handle, buffer, BUF_SIZE, &bytes_read);
- buffer[bytes_read] = '\0';
-
- if (doc == NULL) {
- doc = g_strndup(buffer, bytes_read);
- } else {
- new_doc = g_strconcat(doc, buffer, NULL);
- g_free(doc);
- doc = new_doc;
- }
+ doc.insert(doc.end(), buffer, buffer+bytes_read);
}
}
- return doc;
+ return g_strndup(&doc[0], doc.size());
}
#endif
}
#endif