Hello Bulia,
attached there are my changes that addresses the win32-locale problem.
I changed in all the files that you listed in the bugtracker.
Not included is the ps output.
I generated the output against the current CVS using wincvs.
Bulia, pls add to src/make.ofiles:
extension/internal/ps.o \
+ extension/internal/ps-out.o \
extension/internal/svg.o \
HTH,
Adib.
cvs -z9 diff -u4 sp-ellipse.cpp (in directory C:\projekte\inkscape\src)
Index: sp-ellipse.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/sp-ellipse.cpp,v
retrieving revision 1.14
diff -u -4 -r1.14 sp-ellipse.cpp
--- sp-ellipse.cpp 1 Apr 2004 01:17:35 -0000 1.14
+++ sp-ellipse.cpp 3 Apr 2004 22:47:48 -0000
@@ -20,8 +20,9 @@
#include "libnr/nr-matrix.h"
#include "libnr/nr-matrix-ops.h"
#include "svg/svg.h"
+#include "svg/stringstream.h"
#include "attributes.h"
#include "style.h"
#include "version.h"
#include "helper/sp-intl.h"
@@ -688,12 +689,11 @@
*/
static gboolean
sp_arc_set_elliptical_path_attribute (SPArc *arc, SPRepr *repr)
{
-#define ARC_BUFSIZE 256
gint fa, fs;
gdouble dt;
- gchar c[ARC_BUFSIZE];
+ Inkscape::SVGOStringStream os;
SPGenericEllipse *ge = SP_GENERICELLIPSE (arc);
NR::Point p1 = sp_arc_get_xy (arc, ge->start);
@@ -701,37 +701,32 @@
dt = fmod (ge->end - ge->start, SP_2PI);
if (fabs (dt) < 1e-6) {
NR::Point ph = sp_arc_get_xy (arc, (ge->start + ge->end) / 2.0);
- g_snprintf (c, ARC_BUFSIZE, "M %f %f A %f %f 0 %d %d %f,%f A %g %g 0 %d %d %g %g z",
- p1[NR::X], p1[NR::Y],
- ge->rx.computed, ge->ry.computed,
- 1, (dt > 0),
- ph[NR::X], ph[NR::Y],
- ge->rx.computed, ge->ry.computed,
- 1, (dt > 0),
- p2[NR::X], p2[NR::Y]);
+ os << "M " << p1[NR::X] << " " << p1[NR::Y]
+ << " A " << ge->rx.computed << " " << ge->ry.computed
+ << " 0 1 " << ((dt > 0)?1:0) << " " << ph[NR::X] << "," << ph[NR::Y]
+ << " A " << ge->rx.computed << " " << ge->ry.computed
+ << " 0 1 " << ((dt > 0)?1:0) << " " << p2[NR::X] << " " << p2[NR::Y] << " z";
} else {
fa = (fabs (dt) > M_PI) ? 1 : 0;
fs = (dt > 0) ? 1 : 0;
#ifdef ARC_VERBOSE
g_print ("start:%g end:%g fa=%d fs=%d\n", ge->start, ge->end, fa, fs);
#endif
if (ge->closed) {
- g_snprintf (c, ARC_BUFSIZE, "M %f,%f A %f,%f 0 %d %d %f,%f L %f,%f z",
- p1[NR::X], p1[NR::Y],
- ge->rx.computed, ge->ry.computed,
- fa, fs,
- p2[NR::X], p2[NR::Y],
- ge->cx.computed, ge->cy.computed);
+ os << "M " << p1[NR::X] << "," << p1[NR::Y]
+ << " A " << ge->rx.computed << "," << ge->ry.computed
+ << " 0 " << fa << " " << fs << " " << p2[NR::X] << "," << p2[NR::Y]
+ << " L " << ge->cx.computed << "," << ge->cy.computed << " z";
} else {
- g_snprintf (c, ARC_BUFSIZE, "M %f,%f A %f,%f 0 %d %d %f,%f",
- p1[NR::X], p1[NR::Y],
- ge->rx.computed, ge->ry.computed,
- fa, fs, p2[NR::X], p2[NR::Y]);
+ os << "M " << p1[NR::X] << "," << p1[NR::Y]
+ << " A " << ge->rx.computed << "," << ge->ry.computed
+ << " 0 " << fa << " " << fs << " " << p2[NR::X] << "," << p2[NR::Y];
+
}
}
- return sp_repr_set_attr (repr, "d", c);
+ return sp_repr_set_attr (repr, "d", os.str().c_str());
}
static SPRepr *
sp_arc_write (SPObject *object, SPRepr *repr, guint flags)
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 sp-gradient.cpp (in directory C:\projekte\inkscape\src)
Index: sp-gradient.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/sp-gradient.cpp,v
retrieving revision 1.17
diff -u -4 -r1.17 sp-gradient.cpp
--- sp-gradient.cpp 28 Mar 2004 18:25:39 -0000 1.17
+++ sp-gradient.cpp 4 Apr 2004 02:02:31 -0000
@@ -23,8 +23,9 @@
#include <gtk/gtksignal.h>
#include "helper/nr-gradient-gpl.h"
#include "svg/svg.h"
+#include "svg/stringstream.h"
#include "xml/repr-private.h"
#include "attributes.h"
#include "document-private.h"
#include "sp-object-repr.h"
@@ -144,19 +145,20 @@
static SPRepr *
sp_stop_write (SPObject *object, SPRepr *repr, guint flags)
{
- gchar c[64], s[1024];
+ gchar c[64];
+ Inkscape::SVGOStringStream os;
SPStop *stop = SP_STOP (object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
repr = sp_repr_new ("stop");
}
sp_svg_write_color (c, 64, sp_color_get_rgba32_ualpha (&stop->color, 255));
- g_snprintf (s, 1024, "stop-color:%s;stop-opacity:%g;", c, stop->opacity);
- sp_repr_set_attr (repr, "style", s);
+ os << "stop-color:" << c << ";stop-opacity:" << stop->opacity << ";";
+ sp_repr_set_attr (repr, "style", os.str().c_str());
sp_repr_set_attr (repr, "stop-color", NULL);
sp_repr_set_attr (repr, "stop-opacity", NULL);
sp_repr_set_double (repr, "offset", stop->offset);
@@ -597,15 +599,16 @@
/* We have to be careful, as vector may be our own, so construct repr list at first */
GSList *cl = NULL;
if (vector) {
for (int i = 0; i < vector->nstops; i++) {
- gchar c[64], s[256];
+ gchar c[64];
+ Inkscape::SVGOStringStream os;
SPRepr *child = sp_repr_new ("stop");
sp_repr_set_double (child, "offset",
vector->stops[i].offset * (vector->end - vector->start) + vector->start);
sp_svg_write_color (c, 64, sp_color_get_rgba32_ualpha (&vector->stops[i].color, 0x00));
- g_snprintf (s, 256, "stop-color:%s;stop-opacity:%g;", c, vector->stops[i].opacity);
- sp_repr_set_attr (child, "style", s);
+ os << "stop-color:" << c << ";stop-opacity:" << vector->stops[i].opacity << ";";
+ sp_repr_set_attr (child, "style", os.str().c_str());
/* Order will be reversed here */
cl = g_slist_prepend (cl, child);
}
}
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 sp-metrics.cpp (in directory C:\projekte\inkscape\src)
Index: sp-metrics.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/sp-metrics.cpp,v
retrieving revision 1.3
diff -u -4 -r1.3 sp-metrics.cpp
--- sp-metrics.cpp 26 Feb 2004 09:23:56 -0000 1.3
+++ sp-metrics.cpp 4 Apr 2004 02:12:21 -0000
@@ -1,5 +1,6 @@
#include "sp-metrics.h"
+#include "svg/stringstream.h"
/*
* SPMetric handling and stuff
* I hope this will be usefull :-)
@@ -51,23 +52,28 @@
GString *
sp_metric_to_metric_string (gdouble length, const SPMetric metric_src, const SPMetric metric_dst, gboolean m) {
GString * str;
gdouble len;
+ Inkscape::SVGOStringStream os;
len = sp_absolute_metric_to_metric (length, metric_src, metric_dst);
str = g_string_new ("");
switch (metric_dst) {
case SP_MM:
- g_string_sprintf (str, "%0.2f%s", len, m?" mm":"");
+ os << len << (m?" mm":"");
+ g_string_sprintf (str, os.str().c_str());
break;
case SP_CM:
- g_string_sprintf (str, "%0.2f%s", len, m?" cm":"");
+ os << len << (m?" cm":"");
+ g_string_sprintf (str, os.str().c_str());
break;
case SP_IN:
- g_string_sprintf (str, "%0.2f%s", len, m?" \"":"");
+ os << len << (m?" \"":"");
+ g_string_sprintf (str, os.str().c_str());
break;
case SP_PT:
- g_string_sprintf (str, "%0.2f%s", len, m?" pt":"");
+ os << len << (m?" pt":"");
+ g_string_sprintf (str, os.str().c_str());
break;
case NONE:
g_string_sprintf (str, "%s", "ups!");
break;
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 sp-offset.cpp (in directory C:\projekte\inkscape\src)
Index: sp-offset.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/sp-offset.cpp,v
retrieving revision 1.29
diff -u -4 -r1.29 sp-offset.cpp
--- sp-offset.cpp 14 Mar 2004 19:20:44 -0000 1.29
+++ sp-offset.cpp 4 Apr 2004 01:32:55 -0000
@@ -19,8 +19,9 @@
#include <string.h>
#include <stdlib.h>
#include "svg/svg.h"
+#include "svg/stringstream.h"
#include "attributes.h"
#include "document.h"
#include "helper/bezier-utils.h"
#include "dialogs/object-attributes.h"
@@ -520,24 +521,23 @@
// write the livarot Path into a "d" element to be placed in the xml
gchar *
liv_svg_dump_path2 (Path * path)
{
- GString *result;
- result = g_string_sized_new (40);
-
+ Inkscape::SVGOStringStream os;
+
for (int i = 0; i < path->descr_nb; i++)
{
Path::path_descr theD = path->descr_cmd[i];
int typ = theD.flags & descr_type_mask;
if (typ == descr_moveto)
{
Path::path_descr_moveto* nData=(Path::path_descr_moveto*)(path->descr_data+theD.dStart);
- g_string_sprintfa (result, "M %lf %lf ", nData->p[0], nData->p[1]);
- }
+ os << "M " << nData->p[0] << " " << nData->p[1] << " ";
+ }
else if (typ == descr_lineto)
{
Path::path_descr_lineto* nData=(Path::path_descr_lineto*)(path->descr_data+theD.dStart);
- g_string_sprintfa (result, "L %lf %lf ", nData->p[0], nData->p[1]);
+ os << "L " << nData->p[0] << " " << nData->p[1] << " ";
}
else if (typ == descr_cubicto)
{
Path::path_descr_cubicto* nData=(Path::path_descr_cubicto*)(path->descr_data+theD.dStart);
@@ -546,35 +546,34 @@
NR::Point tmp = path->PrevPoint (i - 1);
lastX=tmp[0];
lastY=tmp[1];
}
- g_string_sprintfa (result, "C %lf %lf %lf %lf %lf %lf ",
- lastX + nData->stD[0] / 3,
- lastY + nData->stD[1] / 3,
- nData->p[0] - nData->enD[0] / 3,
- nData->p[1] - nData->enD[1] / 3, nData->p[0],nData->p[1]);
+ os << "C " << lastX + nData->stD[0] / 3 << " "
+ << lastY + nData->stD[1] / 3 << " "
+ << nData->p[0] - nData->enD[0] / 3 << " "
+ << nData->p[1] - nData->enD[1] / 3 << " "
+ << nData->p[0] << " " << nData->p[1] << " ";
}
else if (typ == descr_arcto)
{
Path::path_descr_arcto* nData=(Path::path_descr_arcto*)(path->descr_data+theD.dStart);
// g_string_sprintfa (result, "L %lf %lf ",theD.d.a.x,theD.d.a.y);
- g_string_sprintfa (result, "A %g %g %g %i %i %g %g ", nData->rx,nData->ry, nData->angle,
- (nData->large) ? 1 : 0,(nData->clockwise) ? 0 : 1, nData->p[0],nData->p[1]);
+ /*g_string_sprintfa (result, "A %g %g %g %i %i %g %g ", nData->rx,nData->ry, nData->angle,
+ (nData->large) ? 1 : 0,(nData->clockwise) ? 0 : 1, nData->p[0],nData->p[1]);*/
+ os << "A " << nData->rx << " " << nData->ry << " " << nData->angle << " "
+ << ((nData->large) ? "1" : "0") << " " << ((nData->clockwise) ? "0" : "1") << " "
+ << nData->p[0] << " " << nData->p[1] << " ";
}
else if (typ == descr_close)
{
- g_string_sprintfa (result, "z ");
+ os << "z ";
}
else
{
}
}
- char *res;
- res = result->str;
- g_string_free (result, FALSE);
-
- return res;
+ return g_strdup(os.str().c_str());
}
static void
sp_offset_set_shape (SPShape * shape)
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 sp-shape.cpp (in directory C:\projekte\inkscape\src)
Index: sp-shape.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/sp-shape.cpp,v
retrieving revision 1.12
diff -u -4 -r1.12 sp-shape.cpp
--- sp-shape.cpp 29 Mar 2004 17:17:54 -0000 1.12
+++ sp-shape.cpp 4 Apr 2004 01:13:52 -0000
@@ -20,8 +20,9 @@
#include "macros.h"
#include "helper/sp-intl.h"
#include "svg/svg.h"
+#include "svg/stringstream.h"
#include "display/nr-arena-shape.h"
#include "uri-references.h"
#include "attributes.h"
#include "print.h"
@@ -116,33 +117,32 @@
if (sp_version_inside_range (version, 0, 0, 0, 25)) {
SPCSSAttr *css;
const gchar *val;
gdouble dval;
- gchar c[32];
gboolean changed;
/* Have to check for percentage opacities */
css = sp_repr_css_attr (repr, "style");
/* We force style rewrite at moment (Lauris) */
changed = TRUE;
val = sp_repr_css_property (css, "opacity", NULL);
if (val && strchr (val, '%')) {
- dval = sp_svg_read_percentage (val, 1.0);
- g_snprintf (c, 32, "%g", dval);
- sp_repr_css_set_property (css, "opacity", c);
+ Inkscape::SVGOStringStream os;
+ os << sp_svg_read_percentage (val, 1.0);
+ sp_repr_css_set_property (css, "opacity", os.str().c_str());
changed = TRUE;
}
val = sp_repr_css_property (css, "fill-opacity", NULL);
if (val && strchr (val, '%')) {
- dval = sp_svg_read_percentage (val, 1.0);
- g_snprintf (c, 32, "%g", dval);
- sp_repr_css_set_property (css, "fill-opacity", c);
+ Inkscape::SVGOStringStream os;
+ os << sp_svg_read_percentage (val, 1.0);
+ sp_repr_css_set_property (css, "fill-opacity", os.str().c_str());
changed = TRUE;
}
val = sp_repr_css_property (css, "stroke-opacity", NULL);
if (val && strchr (val, '%')) {
- dval = sp_svg_read_percentage (val, 1.0);
- g_snprintf (c, 32, "%g", dval);
- sp_repr_css_set_property (css, "stroke-opacity", c);
+ Inkscape::SVGOStringStream os;
+ os << sp_svg_read_percentage (val, 1.0);
+ sp_repr_css_set_property (css, "stroke-opacity", os.str().c_str());
changed = TRUE;
}
if (changed) {
sp_repr_css_set (repr, css, "style");
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 style.cpp (in directory C:\projekte\inkscape\src)
Index: style.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/style.cpp,v
retrieving revision 1.26
diff -u -4 -r1.26 style.cpp
--- style.cpp 26 Mar 2004 21:25:27 -0000 1.26
+++ style.cpp 4 Apr 2004 00:59:32 -0000
@@ -1276,20 +1276,24 @@
p += sp_style_write_ifloat (p, c + BMAX - p, "stroke-miterlimit", &style->stroke_miterlimit, NULL, SP_STYLE_FLAG_IFSET);
/* fixme: */
if (style->stroke_dasharray_set) {
- if (style->stroke_dash.n_dash && style->stroke_dash.dash) {
+ if (style->stroke_dash.n_dash && style->stroke_dash.dash) {
gint i;
- p += g_snprintf (p, c + BMAX - p, "stroke-dasharray:");
+ p += g_snprintf (p, c + BMAX - p, "stroke-dasharray:");
for (i = 0; i < style->stroke_dash.n_dash; i++) {
- p += g_snprintf (p, c + BMAX - p, "%g ", style->stroke_dash.dash[i]);
+ Inkscape::SVGOStringStream os;
+ os << style->stroke_dash.dash[i] << " ";
+ p += g_strlcpy (p, os.str().c_str(), c + BMAX - p);
}
p += g_snprintf (p, c + BMAX - p, ";");
}
}
/* fixme: */
if (style->stroke_dashoffset_set) {
- p += g_snprintf (p, c + BMAX - p, "stroke-dashoffset:%g;", style->stroke_dash.offset);
+ Inkscape::SVGOStringStream os;
+ os << "stroke-dashoffset:" << style->stroke_dash.offset << ";";
+ p += g_strlcpy (p, os.str().c_str(), c + BMAX - p);
}
p += sp_style_write_iscale24 (p, c + BMAX - p, "stroke-opacity", &style->stroke_opacity, NULL, SP_STYLE_FLAG_IFSET);
/* fixme: */
@@ -1346,16 +1350,20 @@
if (from->stroke_dash.n_dash && from->stroke_dash.dash) {
gint i;
p += g_snprintf (p, c + BMAX - p, "stroke-dasharray:");
for (i = 0; i < from->stroke_dash.n_dash; i++) {
- p += g_snprintf (p, c + BMAX - p, "%g ", from->stroke_dash.dash[i]);
+ Inkscape::SVGOStringStream os;
+ os << from->stroke_dash.dash[i] << " ";
+ p += g_strlcpy (p, os.str().c_str(), c + BMAX - p);
}
p += g_snprintf (p, c + BMAX - p, ";");
}
}
/* fixme: */
if (from->stroke_dashoffset_set) {
- p += g_snprintf (p, c + BMAX - p, "stroke-dashoffset:%g;", from->stroke_dash.offset);
+ Inkscape::SVGOStringStream os;
+ os << "stroke-dashoffset:" << from->stroke_dash.offset << ";";
+ p += g_strlcpy (p, os.str().c_str(), c + BMAX - p);
}
p += sp_style_write_iscale24 (p, c + BMAX - p, "stroke-opacity", &from->stroke_opacity, &to->stroke_opacity, SP_STYLE_FLAG_IFDIFF);
/* markers */
@@ -1779,11 +1787,13 @@
val->inherit = TRUE;
} else {
gdouble value;
gchar *e;
- /* fixme: Move this to standard place (Lauris) */
+
+ /* fixme: Move this to standard place (Lauris) */
value = strtod (str, &e);
- if ((const gchar *) e != str) {
+
+ if ((const gchar *) e != str) {
if (!*e) {
/* Userspace */
val->unit = SP_CSS_UNIT_NONE;
val->computed = value;
@@ -2145,43 +2155,55 @@
*/
static gint
sp_style_write_ilength (gchar *p, gint len, const gchar *key, SPILength *val, SPILength *base, guint flags)
{
+ Inkscape::SVGOStringStream os;
+
if (((flags & SP_STYLE_FLAG_IFSET) && val->set) ||
((flags & SP_STYLE_FLAG_IFDIFF) && val->set && sp_length_differ (val, base))) {
if (val->inherit) {
return g_snprintf (p, len, "%s:inherit;", key);
} else {
switch (val->unit) {
case SP_CSS_UNIT_NONE:
- return g_snprintf (p, len, "%s:%g;", key, val->computed);
+ os << key << ":" << val->computed << ";";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_PX:
- return g_snprintf (p, len, "%s:%gpx;", key, val->computed);
+ os << key << ":" << val->computed << "px;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_PT:
- return g_snprintf (p, len, "%s:%gpt;", key, val->computed / 1.25);
+ os << key << ":" << val->computed / 1.25 << "pt;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_PC:
- return g_snprintf (p, len, "%s:%gpc;", key, val->computed / 15.0);
+ os << key << ":" << val->computed / 15.0 << "pc;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_MM:
- return g_snprintf (p, len, "%s:%gmm;", key, val->computed / 3.543307);
+ os << key << ":" << val->computed / 3.543307 << "mm;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_CM:
- return g_snprintf (p, len, "%s:%gmm;", key, val->computed / 35.43307);
+ os << key << ":" << val->computed / 35.43307 << "mm;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_IN:
- return g_snprintf (p, len, "%s:%gin;", key, val->computed / 90.0);
+ os << key << ":" << val->computed / 90 << "in;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_EM:
- return g_snprintf (p, len, "%s:%gem;", key, val->value);
+ os << key << ":" << val->computed << "em;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_EX:
- return g_snprintf (p, len, "%s:%gex;", key, val->value);
+ os << key << ":" << val->computed << "ex;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
case SP_CSS_UNIT_PERCENT:
- return g_snprintf (p, len, "%s:%g%%;", key, val->value);
+ os << key << ":" << val->computed << "%;";
+ return g_strlcpy (p, os.str().c_str(), len);
break;
default:
/* Invalid */
break;
@@ -2279,11 +2301,15 @@
return g_snprintf (p, len, "%s:%s;", key, enum_font_size[i].key);
}
}
} else if (val->type == SP_FONT_SIZE_LENGTH) {
- return g_snprintf (p, len, "%s:%g;", key, val->computed);
+ Inkscape::SVGOStringStream os;
+ os << key << ":" << val->computed << "%;";
+ return g_strlcpy (p, os.str().c_str(), len);
} else if (val->type == SP_FONT_SIZE_PERCENTAGE) {
- return g_snprintf (p, len, "%s:%g%%;", key, SP_F8_16_TO_FLOAT (val->value) * 100.0);
+ Inkscape::SVGOStringStream os;
+ os << key << ":" << SP_F8_16_TO_FLOAT (val->value) * 100.0 << "%;";
+ return g_strlcpy (p, os.str().c_str(), len);
}
}
return 0;
}
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 desktop-properties.cpp (in directory C:\projekte\inkscape\src\dialogs\)
Index: desktop-properties.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/dialogs/desktop-properties.cpp,v
retrieving revision 1.21
diff -u -4 -r1.21 desktop-properties.cpp
--- desktop-properties.cpp 28 Mar 2004 03:56:09 -0000 1.21
+++ desktop-properties.cpp 4 Apr 2004 01:57:30 -0000
@@ -197,9 +197,9 @@
SPDocument *doc;
SPRepr *repr;
SPUnitSelector *us;
const gchar *key;
- gchar c[32];
+ Inkscape::SVGOStringStream os;
if (gtk_object_get_data (GTK_OBJECT (dialog), "update")) return;
dt = SP_ACTIVE_DESKTOP;
@@ -210,13 +210,12 @@
key = (const gchar *)gtk_object_get_data (GTK_OBJECT (adjustment), "key");
us = (SPUnitSelector *)gtk_object_get_data ( GTK_OBJECT (adjustment),
"unit_selector" );
- g_snprintf ( c, 32, "%g%s", adjustment->value,
- sp_unit_selector_get_unit (us)->abbr );
+ os << adjustment->value << sp_unit_selector_get_unit (us)->abbr;
sp_document_set_undo_sensitive (doc, FALSE);
- sp_repr_set_attr (repr, key, c);
+ sp_repr_set_attr (repr, key, os.str().c_str());
sp_document_set_undo_sensitive (doc, TRUE);
}
@@ -284,9 +283,9 @@
GtkWidget *dialog )
{
SPRepr *repr;
SPUnitSelector *us;
- gchar c[32];
+ Inkscape::SVGOStringStream os;
if (gtk_object_get_data (GTK_OBJECT (dialog), "update")) {
return;
}
@@ -298,12 +297,11 @@
us = (SPUnitSelector *)gtk_object_get_data ( GTK_OBJECT (dialog),
"grid_snap_units" );
- g_snprintf ( c, 32, "%g%s", adjustment->value,
- sp_unit_selector_get_unit (us)->abbr );
+ os << adjustment->value << sp_unit_selector_get_unit (us)->abbr;
- sp_repr_set_attr (repr, "gridtolerance", c);
+ sp_repr_set_attr (repr, "gridtolerance", os.str().c_str());
}
static void
@@ -311,9 +309,9 @@
GtkWidget *dialog )
{
SPRepr *repr;
SPUnitSelector *us;
- gchar c[32];
+ Inkscape::SVGOStringStream os;
if (gtk_object_get_data (GTK_OBJECT (dialog), "update")) {
return;
}
@@ -325,12 +323,11 @@
us = (SPUnitSelector *)gtk_object_get_data ( GTK_OBJECT (dialog),
"guide_snap_units" );
- g_snprintf ( c, 32, "%g%s", adjustment->value,
- sp_unit_selector_get_unit (us)->abbr );
+ os << adjustment->value << sp_unit_selector_get_unit (us)->abbr;
- sp_repr_set_attr (repr, "guidetolerance", c);
+ sp_repr_set_attr (repr, "guidetolerance", os.str().c_str());
}
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 fill-style.cpp (in directory C:\projekte\inkscape\src\dialogs\)
Index: fill-style.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/dialogs/fill-style.cpp,v
retrieving revision 1.7
diff -u -4 -r1.7 fill-style.cpp
--- fill-style.cpp 2 Apr 2004 02:15:19 -0000 1.7
+++ fill-style.cpp 4 Apr 2004 01:47:19 -0000
@@ -41,8 +41,9 @@
#include "../helper/sp-intl.h"
#include "../helper/window.h"
#include "../svg/svg.h"
+#include "../svg/stringstream.h"
#include "../widgets/sp-widget.h"
#include "../sp-gradient.h"
#include "../widgets/paint-selector.h"
#include "../style.h"
@@ -711,8 +712,9 @@
guint32 rgba;
gfloat cmyk[4];
SPGradient *vector;
gchar b[64];
+ Inkscape::SVGOStringStream osalpha, oscolour;
if (g_object_get_data (G_OBJECT (spw), "update")) return;
g_object_set_data (G_OBJECT (spw), "update", GINT_TO_POINTER (TRUE));
@@ -763,10 +765,10 @@
sp_paint_selector_get_color_alpha (psel, &color, &alpha);
rgba = sp_color_get_rgba32_falpha (&color, alpha);
sp_svg_write_color (b, 64, rgba);
sp_repr_css_set_property (css, "fill", b);
- g_snprintf (b, 64, "%g", alpha);
- sp_repr_css_set_property (css, "fill-opacity", b);
+ osalpha << alpha;
+ sp_repr_css_set_property (css, "fill-opacity", osalpha.str().c_str());
for (r = reprs; r != NULL; r = r->next) {
sp_repr_set_attr_recursive ( (SPRepr *) r->data,
"sodipodi:fill-cmyk", NULL);
sp_repr_css_change_recursive ((SPRepr *) r->data, css, "style");
@@ -780,17 +782,16 @@
sp_paint_selector_get_color_alpha (psel, &color, &alpha);
rgba = sp_color_get_rgba32_falpha (&color, alpha);
sp_svg_write_color (b, 64, rgba);
sp_repr_css_set_property (css, "fill", b);
- g_snprintf (b, 64, "%g", alpha);
- sp_repr_css_set_property (css, "fill-opacity", b);
+ osalpha << alpha;
+ sp_repr_css_set_property (css, "fill-opacity", osalpha.str().c_str());
sp_color_get_cmyk_floatv (&color, cmyk);
- g_snprintf ( b, 64, "(%g %g %g %g)",
- cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
+ oscolour << "(" << cmyk[0] << " " << cmyk[1] << " " << cmyk[2] << " " << cmyk[3] << ")";
for (r = reprs; r != NULL; r = r->next) {
sp_repr_set_attr_recursive ( (SPRepr *) r->data,
- "sodipodi:fill-cmyk", b );
+ "sodipodi:fill-cmyk", oscolour.str().c_str() );
sp_repr_css_change_recursive ((SPRepr *) r->data, css, "style");
}
sp_repr_css_attr_unref (css);
if (spw->inkscape) sp_document_done (SP_WIDGET_DOCUMENT (spw));
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 item-properties.cpp (in directory C:\projekte\inkscape\src\dialogs\)
Index: item-properties.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/dialogs/item-properties.cpp,v
retrieving revision 1.10
diff -u -4 -r1.10 item-properties.cpp
--- item-properties.cpp 27 Mar 2004 08:51:46 -0000 1.10
+++ item-properties.cpp 4 Apr 2004 02:17:02 -0000
@@ -29,8 +29,9 @@
#include "helper/sp-intl.h"
#include "helper/window.h"
#include "../svg/svg.h"
+#include "../svg/stringstream.h"
#include "../widgets/sp-widget.h"
#include "../inkscape.h"
#include "../document.h"
#include "../desktop-handles.h"
@@ -536,9 +537,9 @@
sp_item_widget_opacity_value_changed (GtkAdjustment *a, SPWidget *spw)
{
SPItem *item;
SPCSSAttr *css;
- gchar c[32];
+ Inkscape::SVGOStringStream os;
if (gtk_object_get_data (GTK_OBJECT (spw), "blocked"))
return;
@@ -547,10 +548,10 @@
gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (TRUE));
css = sp_repr_css_attr_new ();
- g_snprintf (c, 32, "%f", CLAMP (a->value, 0.0, 1.0));
- sp_repr_css_set_property (css, "opacity", c);
+ os << CLAMP (a->value, 0.0, 1.0);
+ sp_repr_css_set_property (css, "opacity", os.str().c_str());
sp_repr_css_change (SP_OBJECT_REPR (item), css, "style");
sp_repr_css_attr_unref (css);
sp_document_maybe_done (SP_WIDGET_DOCUMENT (spw), "ItemDialog:style");
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 stroke-style.cpp (in directory C:\projekte\inkscape\src\dialogs\)
Index: stroke-style.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/dialogs/stroke-style.cpp,v
retrieving revision 1.24
diff -u -4 -r1.24 stroke-style.cpp
--- stroke-style.cpp 28 Feb 2004 00:38:14 -0000 1.24
+++ stroke-style.cpp 4 Apr 2004 00:24:08 -0000
@@ -38,8 +38,9 @@
#include "helper/sp-intl.h"
#include "helper/unit-menu.h"
#include "../svg/svg.h"
+#include "../svg/stringstream.h"
#include "../widgets/sp-widget.h"
#include "../widgets/spw-utilities.h"
#include "../sp-gradient.h"
#include <widgets/paint-selector.h>
@@ -556,9 +557,10 @@
gfloat alpha;
SPGradient *vector;
gchar b[64];
gchar *p;
-
+ Inkscape::SVGOStringStream osalpha, oscolour;
+
if (gtk_object_get_data (GTK_OBJECT (spw), "update"))
return;
#ifdef SP_SS_VERBOSE
@@ -606,26 +608,27 @@
sp_paint_selector_get_color_alpha (psel, &color, &alpha);
sp_svg_write_color ( b, 64,
sp_color_get_rgba32_falpha (&color, alpha) );
sp_repr_css_set_property (css, "stroke", b);
- g_snprintf (b, 64, "%g", alpha);
- sp_repr_css_set_property (css, "stroke-opacity", b);
- if (sp_color_get_colorspace_type (&color) ==
+ osalpha << alpha;
+ sp_repr_css_set_property (css, "stroke-opacity", osalpha.str().c_str());
+
+ if (sp_color_get_colorspace_type (&color) ==
SP_COLORSPACE_TYPE_CMYK)
{
gfloat cmyk[4];
sp_color_get_cmyk_floatv (&color, cmyk);
- g_snprintf ( b, 64, "(%g %g %g %g)",
- cmyk[0], cmyk[1], cmyk[2], cmyk[3] );
- p = b;
-
- } else {
- p = NULL;
+ oscolour << "(" << cmyk[0] << " " << cmyk[1] << " " << cmyk[2] << " " << cmyk[3] << ")";
}
for (r = reprs; r != NULL; r = r->next) {
- sp_repr_set_attr_recursive ( (SPRepr *) r->data,
- "sodipodi:stroke-cmyk", p );
+ if(oscolour.str().length() > 0)
+ sp_repr_set_attr_recursive ( (SPRepr *) r->data,
+ "sodipodi:stroke-cmyk", oscolour.str().c_str() );
+ else
+ sp_repr_set_attr_recursive ( (SPRepr *) r->data,
+ "sodipodi:stroke-cmyk", NULL );
+
sp_repr_css_change_recursive ((SPRepr *) r->data, css, "style");
}
sp_repr_css_attr_unref (css);
@@ -1362,22 +1365,19 @@
double scale )
{
if (ndash > 0) {
- gchar c[1024];
- int i, pos;
- pos = 0;
- for (i = 0; i < ndash; i++) {
- pos += g_snprintf (c + pos, 1022 - pos, "%g", dash[i] * scale);
- if ((i < (ndash - 1)) && (pos < 1020)) {
- c[pos] = ',';
- pos += 1;
+ int i;
+ Inkscape::SVGOStringStream osoffset, osarray;
+ for (i = 0; i < ndash; i++) {
+ osarray << dash[i] * scale;
+ if (i < (ndash - 1)) {
+ osarray << ",";
}
}
- c[pos] = 0;
- sp_repr_css_set_property (css, "stroke-dasharray", c);
- g_snprintf (c, 1024, "%g", offset * scale);
- sp_repr_css_set_property (css, "stroke-dashoffset", c);
+ sp_repr_css_set_property (css, "stroke-dasharray", osarray.str().c_str());
+ osoffset << offset * scale;
+ sp_repr_css_set_property (css, "stroke-dashoffset", osoffset.str().c_str());
} else {
sp_repr_css_set_property (css, "stroke-dasharray", "none");
sp_repr_css_set_property (css, "stroke-dashoffset", NULL);
@@ -1395,10 +1395,9 @@
SPDashSelector *dsel;
const GSList *items, *i, *r;
GSList *reprs;
SPCSSAttr *css;
- gchar c[32];
-
+
wadj = GTK_ADJUSTMENT(gtk_object_get_data (GTK_OBJECT (spw), "width"));
us = SP_UNIT_SELECTOR(gtk_object_get_data (GTK_OBJECT (spw), "units"));
dsel = SP_DASH_SELECTOR(gtk_object_get_data (GTK_OBJECT (spw), "dash"));
@@ -1425,18 +1424,19 @@
NRMatrix i2d, d2i;
double length, dist;
double *dash, offset;
int ndash;
+ Inkscape::SVGOStringStream os;
length = wadj->value;
sp_dash_selector_get_dash (dsel, &ndash, &dash, &offset);
/* Set stroke width */
sp_convert_distance ( &length, sp_unit_selector_get_unit (us),
SP_PS_UNIT );
sp_item_i2d_affine (SP_ITEM (i->data), &i2d);
nr_matrix_invert (&d2i, &i2d);
dist = length * NR_MATRIX_DF_EXPANSION (&d2i);
- g_snprintf (c, 32, "%g", dist);
- sp_repr_css_set_property (css, "stroke-width", c);
+ os << dist;
+ sp_repr_css_set_property (css, "stroke-width", os.str().c_str());
/* Set dash */
sp_stroke_style_set_scaled_dash (css, ndash, dash, offset, dist);
sp_repr_css_change_recursive ( SP_OBJECT_REPR (i->data), css,
"style" );
@@ -1446,14 +1446,15 @@
for (r = reprs; r != NULL; r = r->next) {
double length;
double *dash, offset;
int ndash;
+ Inkscape::SVGOStringStream os;
length = wadj->value;
sp_dash_selector_get_dash (dsel, &ndash, &dash, &offset);
sp_convert_distance ( &length, sp_unit_selector_get_unit (us),
SP_PS_UNIT );
- g_snprintf (c, 32, "%g", length * 1.25);
- sp_repr_css_set_property (css, "stroke-width", c);
+ os << length * 1.25;
+ sp_repr_css_set_property (css, "stroke-width", os.str().c_str());
sp_stroke_style_set_scaled_dash (css, ndash, dash, offset, length);
sp_repr_css_change_recursive ((SPRepr *) r->data, css, "style");
g_free (dash);
}
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 text-edit.cpp (in directory C:\projekte\inkscape\src\dialogs\)
Index: text-edit.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/dialogs/text-edit.cpp,v
retrieving revision 1.17
diff -u -4 -r1.17 text-edit.cpp
--- text-edit.cpp 13 Mar 2004 05:33:05 -0000 1.17
+++ text-edit.cpp 4 Apr 2004 02:25:48 -0000
@@ -50,8 +50,9 @@
#include "dialog-events.h"
#include "../prefs-utils.h"
#include "../verbs.h"
#include "../interface.h"
+#include "../svg/stringstream.h"
#include "text-edit.h"
@@ -434,9 +435,10 @@
{
GtkWidget *fontsel, *preview, *b, *combo;
SPCSSAttr *css;
NRFont *font;
- gchar c[256];
+ Inkscape::SVGOStringStream os;
+ gchar c[256];
const char *sstr;
fontsel = (GtkWidget*)g_object_get_data (G_OBJECT (dlg), "fontsel");
preview = (GtkWidget*)g_object_get_data (G_OBJECT (dlg), "preview");
@@ -464,10 +466,10 @@
nr_typeface_attribute_get (NR_FONT_TYPEFACE (font), "variant", c, 256);
g_strdown (c);
sp_repr_css_set_property (css, "font-variant", c);
- g_snprintf (c, 64, "%g", NR_FONT_SIZE (font));
- sp_repr_css_set_property (css, "font-size", c);
+ os << NR_FONT_SIZE (font);
+ sp_repr_css_set_property (css, "font-size", os.str().c_str());
nr_font_unref (font);
/* Layout */
***** CVS exited normally with code 1 *****
cvs -z9 diff -u4 svg-length.cpp (in directory C:\projekte\inkscape\src\svg\)
Index: svg-length.cpp
===================================================================
RCS file: /cvsroot/inkscape/inkscape/src/svg/svg-length.cpp,v
retrieving revision 1.4
diff -u -4 -r1.4 svg-length.cpp
--- svg-length.cpp 16 Feb 2004 17:02:36 -0000 1.4
+++ svg-length.cpp 4 Apr 2004 02:24:41 -0000
@@ -18,8 +18,9 @@
#include <stdio.h>
#include <ctype.h>
#include "svg.h"
+#include "stringstream.h"
#include <glib.h>
#ifndef MAX
@@ -395,7 +396,9 @@
int
sp_svg_write_percentage (char * buf, int buflen, double val)
{
- return g_snprintf (buf, buflen, "%g%%", val * 100.0);
+ Inkscape::SVGOStringStream os;
+ os << val * 100.0 << "%";
+ return g_strlcpy (buf, os.str().c_str(), buflen);
}
***** CVS exited normally with code 1 *****