I have made a giant patch against inkscape 0.38.1 which allows it
compile under Solaris and with the SunPro compiler. No doubt it won't
apply cleanly against the CVS head but I'll look in to that in a few days.
Most of the changes are fairly straightforward. A lot of function
prototypes had different type signatures to their implementations.
Namespace declarations were terminated with semicolons when they
shouldn't be. A few source files used GNU extensions. Some numerical
constants had ambiguous types. The Solaris maths library doesn't have
separate functions for single precision values and fpresetsticky is
called fpsetsticky. I created a header file, floatmaths.h, which
contains appropriate defines to remedy this. I also replaced <stdint.h>
with <inttypes.h>. C99 library support starts with Solaris 10.
The only changes of dubious merit I can think of were; changing round to
rint as I'm not sure if this will affect the semantics of the code in
questions, and importing an implementation of hash_map when you should
really switch to GHashTable as the comments suggest. I couldn't see an
obvious place to initialize the GHashTables.
Note that the floating point optimization level (-fsimple=n) must be 1
or lower as aggressive optimization will break assertions in the code. I
will probably create a Inkscape package for blastwave.org (CSW).
--
Wishing you good fortune,
--Robin Kay-- (komadori)
diff -ur inkscape-0.38.1-orig/src/chunk.h inkscape-0.38.1/src/chunk.h
--- inkscape-0.38.1-orig/src/chunk.h 2004-07-02 01:52:04.126170000 +0100
+++ inkscape-0.38.1/src/chunk.h 2004-07-01 04:19:00.151422000 +0100
@@ -0,0 +1,84 @@
+/*! \file deque
+ * \brief This header provides the definitions and decleration of the chunk class used in hash_map
+ * \author Christian Boesgaard <pink@...432...> and Jacob C. Poulsen <ja7@...432...>.
+ */
+
+//#include <alloc.h>
+#include <iterator>
+
+// using pair
+#include <utility>
+
+// using operator new
+#include <memory>
+
+// Type legend:
+// H: (small) key type, should support effective ==
+// K: key type
+// T: content type
+
+typedef unsigned int uint;
+
+template <class H, class K, class T, uint chunk_size>
+class chunk {
+ typedef std::pair<const K, T> pair_t; // <key, value> pair
+public:
+ chunk(): next(0){
+ d = reinterpret_cast<pair_t*>(dd);
+ }
+ void free_data(size_t end_pos=chunk_size) {
+ //destroy(d,d+end_pos);
+ for (size_t i=0; i<end_pos; i++) {
+ (&d[i])->~pair_t();
+ }
+ };
+
+
+ H h[chunk_size]; // hash values
+ chunk* next; // next chunk
+/// chunk* prev; // previous chunk
+ // we're using a char[] to get some "raw" memory
+ char dd[chunk_size * sizeof(pair_t)]; // space for data pairs
+ pair_t* d; // iterator used to access data pairs
+
+ // the find functions will return a 0-pointer if the element was not found
+
+ // find to use when doing lookups and inserts
+ pair_t* find_p(H hh, const K& kk, uint last = chunk_size) {
+ for (uint i = 0; i < last; ++i) {
+#ifdef N_USE_HASH
+ if (kk == (d[i]).first) {return &d[i];}
+#else
+ if (hh == h[i] && kk == (d[i]).first) {return &d[i];}
+#endif
+ }
+ return 0;
+ }
+
+ // find to use when deleting elements, we will move the last
+ // element in the bucket to the place
+ // hpp is a place to return a pointer to the small hashvalue
+
+ pair_t* find_d(H hh, const K& kk, H** hpp,
+ uint last = chunk_size) {
+ for (uint i = 0; i < last; ++i) {
+#ifdef N_USE_HASH
+ if (kk == (d[i]).first) {
+#else
+ if (hh == h[i] && kk == (d[i]).first) {
+#endif
+ *hpp = &h[i];
+ return &d[i];
+ }
+ }
+ return 0;
+ }
+ // set a value
+ // this function is the only one used to set elements directly
+ void set(H hh, const pair_t& p, uint i) {
+ h[i] = hh;
+ // do inplace new
+ pair_t* pp = &d[i];
+ new(pp) pair_t(p);
+ }
+};
diff -ur inkscape-0.38.1-orig/src/desktop-snap.cpp inkscape-0.38.1/src/desktop-snap.cpp
--- inkscape-0.38.1-orig/src/desktop-snap.cpp 2004-03-03 23:44:37.000000000 +0000
+++ inkscape-0.38.1/src/desktop-snap.cpp 2004-07-01 03:07:30.120952000 +0100
@@ -71,7 +71,7 @@
NR::Point const req0(req);
/* Implement "move from req0 by some multiple of mv" as "dot product with something
orthogonal to mv remains unchanged". */
- NR::Point const n2(rot90(mv));
+ NR::Point const n2(NR::rot90(mv));
double const d2 = dot(n2, req);
if(sp_intersector_line_intersection(n2, d2, n, d, req) == intersects) {
return L2(req - req0);
Only in inkscape-0.38.1/src: desktop-snap.o
diff -ur inkscape-0.38.1-orig/src/desktop.cpp inkscape-0.38.1/src/desktop.cpp
--- inkscape-0.38.1-orig/src/desktop.cpp 2004-04-06 06:39:41.000000000 +0100
+++ inkscape-0.38.1/src/desktop.cpp 2004-07-01 03:05:16.156205000 +0100
@@ -823,7 +823,7 @@
gtk_box_pack_start (GTK_BOX (sbar), dtw->sticky_zoom, FALSE, FALSE, 0);
// zoom status spinbutton
- dtw->zoom_status = gtk_spin_button_new_with_range (log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1);
+ dtw->zoom_status = gtk_spin_button_new_with_range (log(SP_DESKTOP_ZOOM_MIN)/log(2.0), log(SP_DESKTOP_ZOOM_MAX)/log(2.0), 0.1);
gtk_tooltips_set_tip (tt, dtw->zoom_status, _("Zoom"), NULL);
gtk_widget_set_usize (dtw->zoom_status, STATUS_ZOOM_WIDTH, -1);
gtk_entry_set_width_chars (GTK_ENTRY (dtw->zoom_status), 6);
@@ -1744,20 +1744,20 @@
sp_desktop_widget_update_zoom (SPDesktopWidget *dtw)
{
g_signal_handlers_block_by_func (G_OBJECT (dtw->zoom_status), (gpointer)G_CALLBACK (sp_dtw_zoom_value_changed), dtw);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (dtw->zoom_status), log(SP_DESKTOP_ZOOM(dtw->desktop)) / log(2));
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dtw->zoom_status), log(SP_DESKTOP_ZOOM(dtw->desktop)) / log(2.0));
g_signal_handlers_unblock_by_func (G_OBJECT (dtw->zoom_status), (gpointer)G_CALLBACK (sp_dtw_zoom_value_changed), dtw);
}
gdouble
sp_dtw_zoom_value_to_display (gdouble value)
{
- return floor (pow (2, value) * 100.0 + 0.5);
+ return floor (pow (2.0, value) * 100.0 + 0.5);
}
gdouble
sp_dtw_zoom_display_to_value (gdouble value)
{
- return log (value / 100.0) / log (2);
+ return log (value / 100.0) / log (2.0);
}
gint
diff -ur inkscape-0.38.1-orig/src/dialogs/filedialog.cpp inkscape-0.38.1/src/dialogs/filedialog.cpp
--- inkscape-0.38.1-orig/src/dialogs/filedialog.cpp 2004-04-07 07:14:56.000000000 +0100
+++ inkscape-0.38.1/src/dialogs/filedialog.cpp 2004-07-01 02:17:05.166324000 +0100
@@ -348,7 +348,7 @@
-}; //namespace Dialogs
-}; //namespace UI
-}; //namespace Inkscape
+} //namespace Dialogs
+} //namespace UI
+} //namespace Inkscape
diff -ur inkscape-0.38.1-orig/src/dialogs/filedialog.h inkscape-0.38.1/src/dialogs/filedialog.h
--- inkscape-0.38.1-orig/src/dialogs/filedialog.h 2004-04-01 09:37:48.000000000 +0100
+++ inkscape-0.38.1/src/dialogs/filedialog.h 2004-07-01 02:16:48.494087000 +0100
@@ -167,13 +167,9 @@
}; //FileSaveDialog
-}; //namespace Dialogs
-}; //namespace UI
-}; //namespace Inkscape
-
-
-
-
+} //namespace Dialogs
+} //namespace UI
+} //namespace Inkscape
#endif /* __FILE_DIALOG_H__ */
diff -ur inkscape-0.38.1-orig/src/dir-util.cpp inkscape-0.38.1/src/dir-util.cpp
--- inkscape-0.38.1-orig/src/dir-util.cpp 2004-01-26 00:29:37.000000000 +0000
+++ inkscape-0.38.1/src/dir-util.cpp 2004-07-01 19:10:45.924433000 +0100
@@ -6,10 +6,10 @@
#include "dir-util.h"
#include <string.h>
-const gchar *
-sp_relative_path_from_path (const gchar * path, const gchar * base)
+const char *
+sp_relative_path_from_path (const char * path, const char * base)
{
- const gchar * p, * b, * r;
+ const char * p, * b, * r;
if (path == NULL) return NULL;
if (base == NULL) return path;
@@ -31,10 +31,10 @@
return path;
}
-const gchar *
-sp_extension_from_path (const gchar * path)
+const char *
+sp_extension_from_path (const char * path)
{
- const gchar * p;
+ const char * p;
if (path == NULL) return NULL;
diff -ur inkscape-0.38.1-orig/src/display/nr-arena-shape.cpp inkscape-0.38.1/src/display/nr-arena-shape.cpp
--- inkscape-0.38.1-orig/src/display/nr-arena-shape.cpp 2004-04-07 07:14:56.000000000 +0100
+++ inkscape-0.38.1/src/display/nr-arena-shape.cpp 2004-07-01 02:44:01.685201000 +0100
@@ -13,7 +13,8 @@
*/
-#include <math.h>
+#include "../floatmaths.h"
+
#include <string.h>
#include <glib.h>
#include <libnr/nr-rect.h>
diff -ur inkscape-0.38.1-orig/src/document.cpp inkscape-0.38.1/src/document.cpp
--- inkscape-0.38.1-orig/src/document.cpp 2004-03-14 03:21:29.000000000 +0000
+++ inkscape-0.38.1/src/document.cpp 2004-07-01 19:23:15.250308000 +0100
@@ -839,7 +839,7 @@
}
SPItem*
-sp_document_item_at_point (SPDocument *document, unsigned int key, NR::Point p, gboolean into_groups)
+sp_document_item_at_point (SPDocument *document, unsigned int key, NR::Point const p, gboolean into_groups)
{
g_return_val_if_fail (document != NULL, NULL);
g_return_val_if_fail (SP_IS_DOCUMENT (document), NULL);
diff -ur inkscape-0.38.1-orig/src/extension/db.cpp inkscape-0.38.1/src/extension/db.cpp
--- inkscape-0.38.1-orig/src/extension/db.cpp 2004-04-04 04:58:41.000000000 +0100
+++ inkscape-0.38.1/src/extension/db.cpp 2004-07-01 02:58:43.204554000 +0100
@@ -247,4 +247,4 @@
return;
}
-}; }; /* namespace Extension, Inkscape */
+} } /* namespace Extension, Inkscape */
diff -ur inkscape-0.38.1-orig/src/extension/db.h inkscape-0.38.1/src/extension/db.h
--- inkscape-0.38.1-orig/src/extension/db.h 2004-04-01 09:37:49.000000000 +0100
+++ inkscape-0.38.1/src/extension/db.h 2004-07-01 02:16:29.950175000 +0100
@@ -68,7 +68,7 @@
extern DB db;
-}; }; /* namespace Extension, Inkscape */
+} } /* namespace Extension, Inkscape */
#endif /* __MODULES_DB_H__ */
diff -ur inkscape-0.38.1-orig/src/extension/extension.cpp inkscape-0.38.1/src/extension/extension.cpp
--- inkscape-0.38.1-orig/src/extension/extension.cpp 2004-04-08 06:33:02.000000000 +0100
+++ inkscape-0.38.1/src/extension/extension.cpp 2004-07-01 02:57:42.971575000 +0100
@@ -928,6 +928,6 @@
}
-}; /* namespace Extension */
-}; /* namespace Inkscape */
+} /* namespace Extension */
+} /* namespace Inkscape */
diff -ur inkscape-0.38.1-orig/src/extension/extension.h inkscape-0.38.1/src/extension/extension.h
--- inkscape-0.38.1-orig/src/extension/extension.h 2004-04-07 07:14:57.000000000 +0100
+++ inkscape-0.38.1/src/extension/extension.h 2004-07-01 02:12:37.479116000 +0100
@@ -129,6 +129,8 @@
variable. It should really take up a very small space. It's
important to note that the name is stored as the key to the
hash table. */
+ class param_t;
+ friend class param_t;
class param_t {
public:
gchar * name; /**< The name of this parameter */
@@ -263,8 +265,8 @@
const SPStyle *style);
};
-}; /* namespace Extension */
-}; /* namespace Inkscape */
+} /* namespace Extension */
+} /* namespace Inkscape */
#endif /* __INK_EXTENSION_H__ */
diff -ur inkscape-0.38.1-orig/src/extension/implementation/implementation.cpp inkscape-0.38.1/src/extension/implementation/implementation.cpp
--- inkscape-0.38.1-orig/src/extension/implementation/implementation.cpp 2004-03-17 06:52:34.000000000 +0000
+++ inkscape-0.38.1/src/extension/implementation/implementation.cpp 2004-07-01 02:46:20.282594000 +0100
@@ -129,9 +129,9 @@
return 0;
}
-}; /* namespace Implementation */
-}; /* namespace Extension */
-}; /* namespace Inkscape */
+} /* namespace Implementation */
+} /* namespace Extension */
+} /* namespace Inkscape */
/*
Local Variables:
diff -ur inkscape-0.38.1-orig/src/extension/implementation/implementation.h inkscape-0.38.1/src/extension/implementation/implementation.h
--- inkscape-0.38.1-orig/src/extension/implementation/implementation.h 2004-03-17 06:52:34.000000000 +0000
+++ inkscape-0.38.1/src/extension/implementation/implementation.h 2004-07-01 02:21:30.733764000 +0100
@@ -18,7 +18,7 @@
namespace Extension {
namespace Implementation {
class Implementation;
-};};};
+} } }
#include <extension/extension.h>
@@ -94,9 +94,9 @@
const SPStyle *style);
};
-}; /* namespace Implementation */
-}; /* namespace Extension */
-}; /* namespace Inkscape */
+} /* namespace Implementation */
+} /* namespace Extension */
+} /* namespace Inkscape */
#endif /* __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ */
diff -ur inkscape-0.38.1-orig/src/extension/implementation/script.cpp inkscape-0.38.1/src/extension/implementation/script.cpp
--- inkscape-0.38.1-orig/src/extension/implementation/script.cpp 2004-04-08 06:31:58.000000000 +0100
+++ inkscape-0.38.1/src/extension/implementation/script.cpp 2004-07-01 02:52:19.418915000 +0100
@@ -54,7 +54,7 @@
officially in the load function. This allows for less allocation
of memory in the unloaded state.
*/
-Script::Script (void) : Implementation::Implementation()
+Script::Script() /*: Implementation::Implementation()*/
{
command = NULL;
return;
@@ -569,9 +569,9 @@
return;
}
-}; /* Inkscape */
-}; /* module */
-}; /* Implementation */
+} /* Inkscape */
+} /* module */
+} /* Implementation */
/*
Local Variables:
diff -ur inkscape-0.38.1-orig/src/extension/implementation/script.h inkscape-0.38.1/src/extension/implementation/script.h
--- inkscape-0.38.1-orig/src/extension/implementation/script.h 2004-04-02 17:23:15.000000000 +0100
+++ inkscape-0.38.1/src/extension/implementation/script.h 2004-07-01 02:48:59.139245000 +0100
@@ -55,9 +55,9 @@
};
-}; /* Inkscape */
-}; /* Extension */
-}; /* Implementation */
+} /* Inkscape */
+} /* Extension */
+} /* Implementation */
#endif /* __INKSCAPE_EXTENSION_IMPEMENTATION_SCRIPT_H__ */
/*
diff -ur inkscape-0.38.1-orig/src/extension/internal/ps-out.cpp inkscape-0.38.1/src/extension/internal/ps-out.cpp
--- inkscape-0.38.1-orig/src/extension/internal/ps-out.cpp 2004-04-02 16:24:57.000000000 +0100
+++ inkscape-0.38.1/src/extension/internal/ps-out.cpp 2004-07-01 02:56:56.473003000 +0100
@@ -63,4 +63,4 @@
return;
}
-};};}; /* namespace Inkscape, Extension, Implementation */
+} } } /* namespace Inkscape, Extension, Implementation */
diff -ur inkscape-0.38.1-orig/src/extension/internal/ps-out.h inkscape-0.38.1/src/extension/internal/ps-out.h
--- inkscape-0.38.1-orig/src/extension/internal/ps-out.h 2004-04-02 16:24:57.000000000 +0100
+++ inkscape-0.38.1/src/extension/internal/ps-out.h 2004-07-01 02:56:42.269315000 +0100
@@ -29,7 +29,7 @@
};
-};};}; /* namespace Inkscape, Extension, Implementation */
+} } } /* namespace Inkscape, Extension, Implementation */
#endif /* EXTENSION_INTERNAL_PS_OUT_H */
diff -ur inkscape-0.38.1-orig/src/extension/internal/ps.cpp inkscape-0.38.1/src/extension/internal/ps.cpp
--- inkscape-0.38.1-orig/src/extension/internal/ps.cpp 2004-04-09 07:16:06.000000000 +0100
+++ inkscape-0.38.1/src/extension/internal/ps.cpp 2004-07-01 02:55:55.706445000 +0100
@@ -845,8 +845,8 @@
}
-}; /* namespace Internal */
-}; /* namespace Extension */
-}; /* namespace Inkscape */
+} /* namespace Internal */
+} /* namespace Extension */
+} /* namespace Inkscape */
/* End of GNU GPL code */
diff -ur inkscape-0.38.1-orig/src/extension/internal/ps.h inkscape-0.38.1/src/extension/internal/ps.h
--- inkscape-0.38.1-orig/src/extension/internal/ps.h 2004-03-03 04:30:21.000000000 +0000
+++ inkscape-0.38.1/src/extension/internal/ps.h 2004-07-01 02:55:29.807654000 +0100
@@ -70,8 +70,8 @@
static void init (void);
};
-}; /* namespace Internal */
-}; /* namespace Extension */
-}; /* namespace Inkscape */
+} /* namespace Internal */
+} /* namespace Extension */
+} /* namespace Inkscape */
#endif /* __EXTENSION_INTERNAL_PS_H__ */
diff -ur inkscape-0.38.1-orig/src/extension/internal/svg.cpp inkscape-0.38.1/src/extension/internal/svg.cpp
--- inkscape-0.38.1-orig/src/extension/internal/svg.cpp 2004-04-06 06:39:43.000000000 +0100
+++ inkscape-0.38.1/src/extension/internal/svg.cpp 2004-07-01 02:54:13.362159000 +0100
@@ -172,4 +172,4 @@
return;
}
-};};}; /* namespace inkscape, module, implementation */
+} } } /* namespace inkscape, module, implementation */
diff -ur inkscape-0.38.1-orig/src/extension/internal/svg.h inkscape-0.38.1/src/extension/internal/svg.h
--- inkscape-0.38.1-orig/src/extension/internal/svg.h 2004-03-03 04:30:21.000000000 +0000
+++ inkscape-0.38.1/src/extension/internal/svg.h 2004-07-01 02:53:52.417928000 +0100
@@ -33,7 +33,7 @@
};
-};};}; /* namespace Inkscape, Extension, Implementation */
+} } } /* namespace Inkscape, Extension, Implementation */
#endif /* __SVG_H__ */
/*
diff -ur inkscape-0.38.1-orig/src/fast_bucket.h inkscape-0.38.1/src/fast_bucket.h
--- inkscape-0.38.1-orig/src/fast_bucket.h 2004-07-02 01:52:59.717860000 +0100
+++ inkscape-0.38.1/src/fast_bucket.h 2004-07-01 04:18:05.727462000 +0100
@@ -0,0 +1,191 @@
+/*! \file fast_bucket.h
+ * \brief This header provides the definitions and decleration of the fast_bucket class used in hash_map
+
+ * \author Christian Boesgaard <pink@...432...> and Jacob C. Poulsen <ja7@...432...>.
+ */
+
+// using pair
+#include <utility>
+
+// using operator new
+#include <memory>
+
+#include "chunk.h"
+
+#define chunk_size 10
+
+template <class H, class K, class T>
+class fast_bucket {
+ fast_bucket(const fast_bucket<H, K, T>&);
+ const fast_bucket<H, K, T>& operator=(const fast_bucket<H, K, T>&);
+ typedef std::pair<const K, T> pair_t;
+ typedef chunk<H, K, T, chunk_size> chunk_;
+ typedef T value_t;
+ typedef K key_t;
+private:
+public:
+ // chunks
+ chunk_* first; // the first chunk in the single linked list
+
+ // housekeeping for first chunk
+ // this is located in the fast_bucket class because it is the only
+ // place it is used and it comes with a price in space
+ uint end_pos; // is index to the "end iterator" (one past...)
+
+ // find to use when deleting elements, we will move the last
+ // element in the bucket to the place
+ // hpp is a place to return a pointer to the small hashvalue
+ pair_t* find_d(H hh, const K& kk, H** hpp) {
+ // check the first chunk
+ pair_t* t;
+ if (t = first->find_d(hh, kk, hpp, end_pos)) {return t;}
+
+ // check the rest
+ chunk_* c = first->next;
+ while (c) {
+ pair_t* pp;
+ if ((pp = c->find_d(hh, kk, hpp)) != 0) {return pp;}
+ c = c->next;
+ }
+ return 0;
+ }
+
+ // move last element to a place according to args
+ // this is the delete operation, so we need to do it the nice way!
+ void move_last_element_to(pair_t* pp, H* hp) {
+ // is the first chunk empty?
+ if (end_pos == 0) {
+ // the chunk is empty -- get rid of it
+ chunk_* trash = first;
+ first = trash->next;
+ end_pos = chunk_size;
+ delete trash;
+ }
+
+ const uint last_element_pos = --end_pos;
+ *hp = first->h[last_element_pos];
+ //destroy(pp);
+ pp->~pair_t();
+
+ // do inplace new
+ new(pp) pair_t(first->d[last_element_pos]);
+ //destroy(&(first->d[last_element_pos]));
+ (&(first->d[last_element_pos]))->~pair_t();
+ }
+
+
+ // inserting into the first chunk
+ pair_t* insert_last(H hh, const pair_t& p){
+ uint last_element_pos;
+ // common case first to help pipeline
+ if (end_pos != chunk_size) {
+ last_element_pos = end_pos++;
+ first->set(hh, p, last_element_pos);
+ }
+ else {
+ // no place left, add a chunk
+ add_chunk();
+ last_element_pos = end_pos++;
+ first->set(hh, p, last_element_pos);
+ }
+ return &(first->d[last_element_pos]);
+ }
+
+ void add_chunk() {
+ chunk_* second = first;
+ first = new chunk_;
+ first->next = second;
+ end_pos = 0;
+ }
+
+public:
+ fast_bucket() {
+ first = new chunk_;
+ end_pos = 0; // end position
+ }
+ ~fast_bucket() {
+ // just destroy data and delete the chunks
+ chunk_* c = first->next;
+ while (c) {
+ chunk_* trash = c;
+ c = c->next;
+ trash->free_data();
+ delete trash;
+ }
+ first->free_data(end_pos);
+ delete first;
+ }
+
+ // return size of bucket in valid elements
+ uint size() {
+ uint chunks = 0; // n chunks excl. the last
+ chunk_* c = first->next;
+ while (c) {
+ c = c->next;
+ ++chunks;
+ }
+ // the elements in the first chunk is end_pos
+ return (chunks * chunk_size) + end_pos;
+ }
+ pair_t* find(H hh, const K& kk) {
+ // first chunk
+ pair_t* pp;
+ if (pp = first->find_p(hh, kk, end_pos)) {return pp;}
+ // the rest
+ chunk_* c = first->next;
+ while (c) {
+ pair_t* pp;
+ if ((pp = c->find_p(hh, kk)) != 0) {return pp;}
+ c = c->next;
+ }
+ return 0;
+ }
+
+ // insert element in bucket
+ std::pair<pair_t*, bool> insert(H hh, const pair_t& p) {
+ // check if the key is here
+ if (pair_t* pp = find(hh, p.first)) {
+ // it is -- overwrite
+ pp->second = p.second; ///!!! is this ok??
+ return std::pair<pair_t*, bool>(pp, false);
+ }
+ else {
+ // insert last
+ return std::pair<pair_t*, bool>(insert_last(hh, p), true);
+ }
+ }
+
+ // find or insert element
+ value_t& find_or_insert(H hh, const key_t& k) {
+ // check if the key is here
+ if (pair_t* pp = find(hh, k)) {
+ return pp->second;
+ }
+ pair_t* pp = insert_last(hh, pair_t(k, value_t()));
+ return pp->second;
+ }
+
+
+ // delete element from bucket
+ void erase(H hh, const K& k) {
+ // check if the key is here
+ H* hp;
+ pair_t* pp;
+ if (pp = find_d(hh, k, &hp)) {
+ // it is -- overwrite with the last element
+ move_last_element_to(pp, hp);
+ }
+ }
+
+ // end_value returns a value& to the last element.
+ value_t& end_value() {
+ uint last_element_pos = end_pos - 1;
+ return first->d[last_element_pos].second;
+ }
+
+ // end_value returns a pointer to the last pair.
+ pair_t* end_pair() {
+ uint last_element_pos = end_pos - 1;
+ return &(first->d[last_element_pos]);
+ }
+};
diff -ur inkscape-0.38.1-orig/src/floatmaths.h inkscape-0.38.1/src/floatmaths.h
--- inkscape-0.38.1-orig/src/floatmaths.h 2004-07-02 01:53:43.021623000 +0100
+++ inkscape-0.38.1/src/floatmaths.h 2004-07-01 14:13:00.159211000 +0100
@@ -0,0 +1,15 @@
+#ifndef FLOATMATHS_H
+#define FLOATMATHS_H
+
+#include <ieeefp.h>
+#include <math.h>
+
+#if defined(__sun) && defined(__SVR4)
+#define fabsf fabs
+#define ceilf ceil
+#define floorf floor
+#define isfinite finite
+#define fpresetsticky fpsetsticky
+#endif
+
+#endif
diff -ur inkscape-0.38.1-orig/src/hash_map.h inkscape-0.38.1/src/hash_map.h
--- inkscape-0.38.1-orig/src/hash_map.h 2004-07-02 01:51:58.422066000 +0100
+++ inkscape-0.38.1/src/hash_map.h 2004-07-01 14:04:52.600609000 +0100
@@ -0,0 +1,119 @@
+/*! \file stl_hash_map.h
+ * \brief This header provides the definitions and declaration of the hash_map.
+
+ * \author Christian Boesgaard <pink@...432...> and Jacob C. Poulsen <ja7@...432...>.
+ */
+
+#ifndef __STL_HASH_MAP_H__
+#define __STL_HASH_MAP_H__
+
+#include <utility>
+#include <vector>
+#include "fast_bucket.h"
+#include "stl_hash_functions.h"
+
+namespace cphstl {
+
+template <class key_t, class value_t, class Hash_t, class Equal>
+class hash_map {
+
+ typedef std::pair<const key_t,value_t> pair_t;
+ typedef std::pair<const key_t,value_t> value_type;
+ typedef const pair_t* const_iterator;
+ typedef unsigned long hashvalue_t;
+ typedef fast_bucket<hashvalue_t,key_t,value_t> fast_bucket_t;
+public:
+ typedef pair_t* iterator;
+
+#ifndef JTABLE_SIZE
+#define JTABLE_SIZE 8192
+#endif
+
+ hash_map(size_t size = JTABLE_SIZE):
+ jump_table_size_(size), size_(0){
+ memset(jump_table,0,sizeof(jump_table));
+ }
+ ~hash_map() {
+ //destroy(jump_table, jump_table+jump_table_size());
+ int len = jump_table_size ();
+ for (int i=0; i<len; i++) {
+ if (jump_table[i] != 0)
+ jump_table[i]->~fast_bucket_t();
+ }
+ }
+
+ iterator end() {return 0;}
+
+ value_t& operator[](const key_t&);
+
+ /*
+ NOT IMPLEMENTED:
+ pair_t* insert(const key_t&);
+ pair<iterator, bool> insert(const value_type& val);
+ void erase(iterator pos);
+ const_iterator find(const key_t& key);
+ */
+
+ iterator find(const key_t& key) {
+ hashvalue_t hv = h(key);
+ size_t index = hv % jump_table_size();
+ if(jump_table[index]) {
+ fast_bucket_t* fb = jump_table[index];
+ return fb->find(hv, key);
+ }
+ return end();
+ }
+
+
+// should return size_type?? bjarne 487!!!
+ void erase(const key_t& key) {
+ hashvalue_t hv = h(key);
+ size_t index = hv % jump_table_size();
+ if(jump_table[index]) {
+ fast_bucket_t* fb = jump_table[index];
+ fb->erase(hv, key);
+ }
+ }
+
+ std::pair<iterator, bool> insert(const value_type& val) {
+ key_t key = val.first;
+ hashvalue_t hv = h(key);
+ size_t index = hv % jump_table_size();
+ if(!jump_table[index]) {
+ fast_bucket_t* fb = new fast_bucket_t();
+ jump_table[index] = fb;
+ fb->insert_last(hv, val);
+ return std::pair<iterator, bool>(fb->end_pair(), true);
+ }
+ fast_bucket_t* fb=jump_table[index];
+ return fb->insert(hv, val);
+ }
+
+
+ size_t size() {return size_;}
+ size_t max_size() {return size_*1000;}
+private:
+ size_t jump_table_size_;
+ size_t jump_table_size() { return jump_table_size_;}
+ size_t size_;
+ fast_bucket_t* jump_table[JTABLE_SIZE];
+ Hash_t h;
+};
+
+template <class key_t, class value_t, class Hash_t, class Equal>
+value_t& hash_map<key_t,value_t,Hash_t,Equal>::operator[](const key_t& key) {
+ hashvalue_t hv = h(key);
+ size_t index = hv % jump_table_size();
+ if(!jump_table[index]) {
+ fast_bucket_t* fb = new fast_bucket_t();
+ jump_table[index] = fb;
+ fb->insert_last(hv,pair_t(key,value_t()));
+ return fb->end_value();
+ }
+ fast_bucket_t* fb=jump_table[index];
+ return fb->find_or_insert(hv, key);
+}
+
+}
+
+#endif
diff -ur inkscape-0.38.1-orig/src/helper/bezier-utils.cpp inkscape-0.38.1/src/helper/bezier-utils.cpp
--- inkscape-0.38.1-orig/src/helper/bezier-utils.cpp 2004-04-04 04:58:41.000000000 +0100
+++ inkscape-0.38.1/src/helper/bezier-utils.cpp 2004-07-01 02:21:01.847146000 +0100
@@ -24,9 +24,11 @@
#define SP_HUGE 1e5
#define noBEZIER_DEBUG
-#include <math.h>
#include <stdlib.h>
+
#include "bezier-utils.h"
+#include "../floatmaths.h"
+
#include <libnr/nr-point-fns.h>
#include <glib.h>
diff -ur inkscape-0.38.1-orig/src/helper/canvas-bpath.cpp inkscape-0.38.1/src/helper/canvas-bpath.cpp
--- inkscape-0.38.1-orig/src/helper/canvas-bpath.cpp 2004-04-01 09:37:49.000000000 +0100
+++ inkscape-0.38.1/src/helper/canvas-bpath.cpp 2004-07-01 02:20:36.488376000 +0100
@@ -12,6 +12,8 @@
*
*/
+#include "../floatmaths.h"
+
#include <libart_lgpl/art_rect.h>
#include <libart_lgpl/art_vpath.h>
#include <libart_lgpl/art_bpath.h>
diff -ur inkscape-0.38.1-orig/src/helper/sp-ctrlline.cpp inkscape-0.38.1/src/helper/sp-ctrlline.cpp
--- inkscape-0.38.1-orig/src/helper/sp-ctrlline.cpp 2004-04-01 09:37:49.000000000 +0100
+++ inkscape-0.38.1/src/helper/sp-ctrlline.cpp 2004-07-01 02:20:23.830183000 +0100
@@ -17,7 +17,8 @@
*
*/
-#include <math.h>
+#include "../floatmaths.h"
+
#include "sp-canvas.h"
#include "sp-canvas-util.h"
#include "sp-ctrlline.h"
diff -ur inkscape-0.38.1-orig/src/inkview.cpp inkscape-0.38.1/src/inkview.cpp
--- inkscape-0.38.1-orig/src/inkview.cpp 2004-04-01 09:37:47.000000000 +0100
+++ inkscape-0.38.1/src/inkview.cpp 2004-07-01 19:25:54.971029000 +0100
@@ -424,7 +424,7 @@
is_jar(const gchar *filename)
{
//fixme: mime check or something
- char *extension;
+ const char *extension;
if ((extension = strrchr(filename, '.')) != NULL) {
if (strcmp(extension, ".jar") == 0 || strcmp(extension, ".sxw") == 0)
return true;
diff -ur inkscape-0.38.1-orig/src/libnr/nr-point.h inkscape-0.38.1/src/libnr/nr-point.h
--- inkscape-0.38.1-orig/src/libnr/nr-point.h 2004-03-01 07:29:05.000000000 +0000
+++ inkscape-0.38.1/src/libnr/nr-point.h 2004-06-30 23:19:29.483328000 +0100
@@ -7,6 +7,10 @@
#include <libnr/nr-coord.h>
#include <libnr/nr-dim2.h>
+#ifndef __GNUC__
+#define __attribute__(x)
+#endif
+
struct NRPoint {
NR::Coord x, y;
};
diff -ur inkscape-0.38.1-orig/src/libnr/nr-rotate.h inkscape-0.38.1/src/libnr/nr-rotate.h
--- inkscape-0.38.1-orig/src/libnr/nr-rotate.h 2004-02-26 09:23:57.000000000 +0000
+++ inkscape-0.38.1/src/libnr/nr-rotate.h 2004-07-01 20:56:22.496040000 +0100
@@ -15,7 +15,7 @@
rotate();
public:
- explicit rotate(Coord theta);
+ explicit rotate(Coord const theta);
explicit rotate(Point const &p) : vec(p) {}
bool operator==(rotate const &o) const {
diff -ur inkscape-0.38.1-orig/src/libnr/nr-svp-uncross.cpp inkscape-0.38.1/src/libnr/nr-svp-uncross.cpp
--- inkscape-0.38.1-orig/src/libnr/nr-svp-uncross.cpp 2004-02-09 02:26:08.000000000 +0000
+++ inkscape-0.38.1/src/libnr/nr-svp-uncross.cpp 2004-06-30 23:25:41.579973000 +0100
@@ -191,7 +191,7 @@
}
/* test continuation direction */
NR::Coord order = nr_svl_slice_compare (cs, ns);
- if (fabs (order < 0.01)) {
+ if (order < 0.01) {
/* Potentially close, test endpoint */
/* Bitch'o'bitches (Lauris) */
if (cs->vertex->next->y < ns->vertex->next->y) {
diff -ur inkscape-0.38.1-orig/src/libnr/nr-svp.cpp inkscape-0.38.1/src/libnr/nr-svp.cpp
--- inkscape-0.38.1-orig/src/libnr/nr-svp.cpp 2004-02-26 09:23:57.000000000 +0000
+++ inkscape-0.38.1/src/libnr/nr-svp.cpp 2004-06-30 23:21:15.844477000 +0100
@@ -15,6 +15,7 @@
#include <assert.h>
#include <stdio.h>
+#include <ieeefp.h>
#include <glib.h>
#include "nr-values.h"
diff -ur inkscape-0.38.1-orig/src/libnr/nr-types.cpp inkscape-0.38.1/src/libnr/nr-types.cpp
--- inkscape-0.38.1-orig/src/libnr/nr-types.cpp 2004-02-20 08:49:50.000000000 +0000
+++ inkscape-0.38.1/src/libnr/nr-types.cpp 2004-06-30 23:16:52.979743000 +0100
@@ -16,7 +16,7 @@
double len = hypot(_pt[0], _pt[1]);
g_return_if_fail(len != 0);
g_return_if_fail(!isnan(len));
- static double const inf = 1e400;
+ static double const inf = pow(10.0, 400.0);
if(len != inf) {
*this /= len;
} else {
diff -ur inkscape-0.38.1-orig/src/libnrtype/nr-font.cpp inkscape-0.38.1/src/libnrtype/nr-font.cpp
--- inkscape-0.38.1-orig/src/libnrtype/nr-font.cpp 2004-02-23 01:49:12.000000000 +0000
+++ inkscape-0.38.1/src/libnrtype/nr-font.cpp 2004-07-01 18:48:47.982943000 +0100
@@ -65,7 +65,7 @@
}
NRRasterFont *
-nr_rasterfont_new (NRFont *font, NR::Matrix transform)
+nr_rasterfont_new (NRFont *font, NR::Matrix const transform)
{
return ((NRTypeFaceClass *) ((NRObject *) font->face)->klass)->rasterfont_new (font, transform);
}
diff -ur inkscape-0.38.1-orig/src/libnrtype/nr-rasterfont.cpp inkscape-0.38.1/src/libnrtype/nr-rasterfont.cpp
--- inkscape-0.38.1-orig/src/libnrtype/nr-rasterfont.cpp 2004-03-24 09:36:39.000000000 +0000
+++ inkscape-0.38.1/src/libnrtype/nr-rasterfont.cpp 2004-07-01 18:43:09.925595000 +0100
@@ -13,6 +13,8 @@
#include <string.h>
+#include "../floatmaths.h"
+
#include <libnr/nr-macros.h>
#include <libnr/nr-point-l.h>
#include <libnr/nr-rect.h>
@@ -161,7 +163,7 @@
static NRRFGlyphSlot *nr_rasterfont_ensure_glyph_slot (NRRasterFont *rf, unsigned int glyph, unsigned int flags);
NRRasterFont *
-nr_rasterfont_generic_new (NRFont *font, NR::Matrix transform)
+nr_rasterfont_generic_new (NRFont *font, NR::Matrix const transform)
{
NRRasterFont *rf;
diff -ur inkscape-0.38.1-orig/src/libnrtype/nr-type-directory.cpp inkscape-0.38.1/src/libnrtype/nr-type-directory.cpp
--- inkscape-0.38.1-orig/src/libnrtype/nr-type-directory.cpp 2004-03-15 02:17:28.000000000 +0000
+++ inkscape-0.38.1/src/libnrtype/nr-type-directory.cpp 2004-07-01 01:19:59.318131000 +0100
@@ -298,9 +298,7 @@
bool
ink_strstr (const char *haystack, const char *pneedle)
{
-#ifndef WIN32
- return (strcasestr(haystack, pneedle) != NULL);
-#else
+#if defined(WIN32) || (defined(__sun) && defined(__SVR4))
// windows has no strcasestr implementation, so here is ours...
// stolen from nmap
char buf[512];
@@ -323,6 +321,8 @@
} else foundto = needle;
}
return false;
+#else
+ return (strcasestr(haystack, pneedle) != NULL);
#endif
}
diff -ur inkscape-0.38.1-orig/src/libnrtype/nr-type-xft.cpp inkscape-0.38.1/src/libnrtype/nr-type-xft.cpp
--- inkscape-0.38.1-orig/src/libnrtype/nr-type-xft.cpp 2004-03-02 05:40:35.000000000 +0000
+++ inkscape-0.38.1/src/libnrtype/nr-type-xft.cpp 2004-07-01 01:29:06.315821000 +0100
@@ -12,6 +12,7 @@
#include <string.h>
#include <stdio.h>
+#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
#include <glib.h>
diff -ur inkscape-0.38.1-orig/src/livarot/AVL.h inkscape-0.38.1/src/livarot/AVL.h
--- inkscape-0.38.1-orig/src/livarot/AVL.h 2004-02-29 02:13:59.000000000 +0000
+++ inkscape-0.38.1/src/livarot/AVL.h 2004-06-30 23:27:39.658293000 +0100
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
//#include <iostream.h>
diff -ur inkscape-0.38.1-orig/src/livarot/AlphaLigne.cpp inkscape-0.38.1/src/livarot/AlphaLigne.cpp
--- inkscape-0.38.1-orig/src/livarot/AlphaLigne.cpp 2004-02-29 02:13:59.000000000 +0000
+++ inkscape-0.38.1/src/livarot/AlphaLigne.cpp 2004-07-01 02:19:14.112206000 +0100
@@ -9,8 +9,7 @@
#include "AlphaLigne.h"
//#include "Buffer.h"
-
-#include <math.h>
+#include "../floatmaths.h"
AlphaLigne::AlphaLigne(int iMin,int iMax)
{
diff -ur inkscape-0.38.1-orig/src/livarot/AlphaLigne.h inkscape-0.38.1/src/livarot/AlphaLigne.h
--- inkscape-0.38.1-orig/src/livarot/AlphaLigne.h 2004-02-29 02:13:59.000000000 +0000
+++ inkscape-0.38.1/src/livarot/AlphaLigne.h 2004-07-01 00:40:00.969485000 +0100
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
//#include <iostream.h>
diff -ur inkscape-0.38.1-orig/src/livarot/BitLigne.cpp inkscape-0.38.1/src/livarot/BitLigne.cpp
--- inkscape-0.38.1-orig/src/livarot/BitLigne.cpp 2004-04-01 09:37:50.000000000 +0100
+++ inkscape-0.38.1/src/livarot/BitLigne.cpp 2004-07-01 02:19:28.910299000 +0100
@@ -8,8 +8,7 @@
*/
#include "BitLigne.h"
-
-#include <math.h>
+#include "../floatmaths.h"
BitLigne::BitLigne(int ist,int ien,float iScale)
{
diff -ur inkscape-0.38.1-orig/src/livarot/BitLigne.h inkscape-0.38.1/src/livarot/BitLigne.h
--- inkscape-0.38.1-orig/src/livarot/BitLigne.h 2004-02-29 02:13:59.000000000 +0000
+++ inkscape-0.38.1/src/livarot/BitLigne.h 2004-07-01 00:37:30.705467000 +0100
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
#include "LivarotDefs.h"
Only in inkscape-0.38.1/src/livarot: BitLigne.o
diff -ur inkscape-0.38.1-orig/src/livarot/DblLinked.h inkscape-0.38.1/src/livarot/DblLinked.h
--- inkscape-0.38.1-orig/src/livarot/DblLinked.h 2004-02-29 02:13:59.000000000 +0000
+++ inkscape-0.38.1/src/livarot/DblLinked.h 2004-06-30 23:27:58.066138000 +0100
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
//#include <iostream.h>
diff -ur inkscape-0.38.1-orig/src/livarot/Ligne.cpp inkscape-0.38.1/src/livarot/Ligne.cpp
--- inkscape-0.38.1-orig/src/livarot/Ligne.cpp 2004-04-07 07:14:57.000000000 +0100
+++ inkscape-0.38.1/src/livarot/Ligne.cpp 2004-07-01 02:19:36.479344000 +0100
@@ -10,10 +10,7 @@
#include "Ligne.h"
//#include "Buffer.h"
#include "BitLigne.h"
-
-#include <math.h>
-
-
+#include "../floatmaths.h"
//int showCopy=0;
//#define faster_flatten 1
diff -ur inkscape-0.38.1-orig/src/livarot/Ligne.h inkscape-0.38.1/src/livarot/Ligne.h
--- inkscape-0.38.1-orig/src/livarot/Ligne.h 2004-02-29 02:14:00.000000000 +0000
+++ inkscape-0.38.1/src/livarot/Ligne.h 2004-07-01 00:36:52.770590000 +0100
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
#include "LivarotDefs.h"
diff -ur inkscape-0.38.1-orig/src/livarot/LivarotDefs.h inkscape-0.38.1/src/livarot/LivarotDefs.h
--- inkscape-0.38.1-orig/src/livarot/LivarotDefs.h 2004-03-06 02:49:27.000000000 +0000
+++ inkscape-0.38.1/src/livarot/LivarotDefs.h 2004-06-30 23:28:15.682110000 +0100
@@ -8,7 +8,7 @@
#ifndef my_defs
#define my_defs
-#include <stdint.h>
+#include <inttypes.h>
// error codes (mostly obsolete)
enum
diff -ur inkscape-0.38.1-orig/src/livarot/MyMath.h inkscape-0.38.1/src/livarot/MyMath.h
--- inkscape-0.38.1-orig/src/livarot/MyMath.h 2004-01-15 07:03:32.000000000 +0000
+++ inkscape-0.38.1/src/livarot/MyMath.h 2004-07-01 00:36:27.554185000 +0100
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
//#include <iostream.h>
diff -ur inkscape-0.38.1-orig/src/livarot/Path.h inkscape-0.38.1/src/livarot/Path.h
--- inkscape-0.38.1-orig/src/livarot/Path.h 2004-04-07 07:14:57.000000000 +0100
+++ inkscape-0.38.1/src/livarot/Path.h 2004-06-30 23:47:04.328875000 +0100
@@ -389,7 +389,10 @@
}
outline_callback_data;
- typedef void (outlineCallback) (outline_callback_data * data, double tol, double width);
+ typedef void (outlineCallback) (outline_callback_data * data, double tol, double width);
+
+ struct outline_callbacks;
+ friend struct outline_callbacks;
typedef struct outline_callbacks
{
outlineCallback *cubicto;
diff -ur inkscape-0.38.1-orig/src/livarot/PathConversion.cpp inkscape-0.38.1/src/livarot/PathConversion.cpp
--- inkscape-0.38.1-orig/src/livarot/PathConversion.cpp 2004-03-10 12:16:57.000000000 +0000
+++ inkscape-0.38.1/src/livarot/PathConversion.cpp 2004-07-01 21:51:05.908913000 +0100
@@ -730,7 +730,7 @@
}
}
-const NR::Point Path::PrevPoint(int i) const
+const NR::Point Path::PrevPoint(const int i) const
{
/* TODO: I suspect this should assert `(unsigned) i < descr_nb'. We can probably change
the argument to unsigned. descr_nb should probably be changed to unsigned too. */
@@ -809,7 +809,7 @@
{
NR::Point se = iE-iS;
NR::Point ca(cos(angle),sin(angle));
- NR::Point cse(dot(se,ca),cross(se,ca));
+ NR::Point cse(NR::dot(se,ca),cross(se,ca));
cse[0] /= rx;
cse[1] /= ry;
double const lensq = dot(cse,cse);
diff -ur inkscape-0.38.1-orig/src/livarot/PathOutline.cpp inkscape-0.38.1/src/livarot/PathOutline.cpp
--- inkscape-0.38.1-orig/src/livarot/PathOutline.cpp 2004-03-10 01:10:30.000000000 +0000
+++ inkscape-0.38.1/src/livarot/PathOutline.cpp 2004-07-01 02:19:45.761346000 +0100
@@ -8,9 +8,11 @@
#include "Path.h"
//#include "MyMath.h"
-#include <math.h>
+#include "../floatmaths.h"
#include <libnr/nr-point-fns.h>
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
/*
* the "outliner"
* takes a sequence of path commands and produces a set of commands that approximates the offset
@@ -955,7 +957,7 @@
double l = csex * csex + csey * csey;
if (l >= 4)
return;
- const double d = sqrt(std::max(1 - l / 4, 0.0));
+ const double d = sqrt(MAX(1 - l / 4, 0.0));
double csdx = csey, csdy = -csex;
l = sqrt (l);
csdx /= l;
@@ -1234,7 +1236,7 @@
biss /= lb;
const double angCo = dot (biss, enNor);
const double l = width / angCo;
- miter = std::max(miter, 0.5 * lb);
+ miter = MAX(miter, 0.5 * lb);
if (l > miter) {
const double angSi = cross (biss, stNor);
const double r = (l - miter) * angCo / angSi;
diff -ur inkscape-0.38.1-orig/src/livarot/Shape.h inkscape-0.38.1/src/livarot/Shape.h
--- inkscape-0.38.1-orig/src/livarot/Shape.h 2004-04-01 09:37:50.000000000 +0100
+++ inkscape-0.38.1/src/livarot/Shape.h 2004-07-01 22:00:02.834524000 +0100
@@ -12,7 +12,7 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
//#include <iostream.h>
@@ -398,8 +398,8 @@
// the result is NOT a polygon; you need a subsequent call to ConvertToShape to get a real polygon
int MakeOffset (Shape * of, double dec, JoinType join, double miter);
- bool DistanceLE(NR::Point thePt, double const max_dist);
- double Distance(NR::Point thePt);
+ bool DistanceLE(NR::Point const thePt, double const max_dist);
+ double Distance(NR::Point const thePt);
int PtWinding (const NR::Point px) const ; // plus rapide
int Winding (const NR::Point px) const ;
diff -ur inkscape-0.38.1-orig/src/livarot/ShapeMisc.cpp inkscape-0.38.1/src/livarot/ShapeMisc.cpp
--- inkscape-0.38.1-orig/src/livarot/ShapeMisc.cpp 2004-03-09 09:18:23.000000000 +0000
+++ inkscape-0.38.1/src/livarot/ShapeMisc.cpp 2004-07-01 02:19:55.246551000 +0100
@@ -7,10 +7,11 @@
*/
#include "Shape.h"
+#include "Path.h"
+//#include "MyMath.h"
+#include "../floatmaths.h"
#include <libnr/nr-point.h>
#include <libnr/nr-point-fns.h>
-//#include "MyMath.h"
-#include "Path.h"
#include <glib.h>
/*
diff -ur inkscape-0.38.1-orig/src/livarot/ShapeUtils.h inkscape-0.38.1/src/livarot/ShapeUtils.h
--- inkscape-0.38.1-orig/src/livarot/ShapeUtils.h 2004-02-29 02:14:05.000000000 +0000
+++ inkscape-0.38.1/src/livarot/ShapeUtils.h 2004-06-30 23:47:49.239888000 +0100
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
//#include <iostream.h>
diff -ur inkscape-0.38.1-orig/src/main.cpp inkscape-0.38.1/src/main.cpp
--- inkscape-0.38.1-orig/src/main.cpp 2004-04-06 06:39:41.000000000 +0100
+++ inkscape-0.38.1/src/main.cpp 2004-07-01 14:13:24.744295000 +0100
@@ -27,6 +27,7 @@
#ifdef HAVE_FPSETMASK
#include <ieeefp.h>
+#include "floatmaths.h"
#endif
#include <string.h>
#include <locale.h>
diff -ur inkscape-0.38.1-orig/src/marker-status.h inkscape-0.38.1/src/marker-status.h
--- inkscape-0.38.1-orig/src/marker-status.h 2004-02-26 09:49:05.000000000 +0000
+++ inkscape-0.38.1/src/marker-status.h 2004-07-01 03:12:56.175157000 +0100
@@ -1,6 +1,10 @@
#ifndef SEEN_MARKER_DEBUG_H
#define SEEN_MARKER_DEBUG_H
+#ifndef __GNUC__
+#define __attribute__(x)
+#endif
+
void marker_status(char const *format, ...) __attribute__((format(__printf__, 1, 2)));
#endif /* !SEEN_MARKER_DEBUG_H */
diff -ur inkscape-0.38.1-orig/src/nodepath.cpp inkscape-0.38.1/src/nodepath.cpp
--- inkscape-0.38.1-orig/src/nodepath.cpp 2004-04-08 06:00:40.000000000 +0100
+++ inkscape-0.38.1/src/nodepath.cpp 2004-07-01 17:32:09.340350000 +0100
@@ -2361,7 +2361,7 @@
node_scale (n, grow / SP_DESKTOP_ZOOM (n->subpath->nodepath->desktop), which);
}
-void sp_nodepath_selected_nodes_scale(Path::Path *nodepath, gdouble const grow, int which)
+void sp_nodepath_selected_nodes_scale(Path::Path *nodepath, gdouble grow, int which)
{
if (!nodepath) return;
@@ -2375,7 +2375,7 @@
update_repr (nodepath);
}
-void sp_nodepath_selected_nodes_scale_screen (Path::Path *nodepath, gdouble const grow, int which)
+void sp_nodepath_selected_nodes_scale_screen (Path::Path *nodepath, gdouble grow, int which)
{
if (!nodepath) return;
diff -ur inkscape-0.38.1-orig/src/object-edit.cpp inkscape-0.38.1/src/object-edit.cpp
--- inkscape-0.38.1-orig/src/object-edit.cpp 2004-03-08 00:19:04.000000000 +0000
+++ inkscape-0.38.1/src/object-edit.cpp 2004-07-01 03:16:42.079755000 +0100
@@ -320,7 +320,7 @@
&& ( snaps != 0 ) )
{
gdouble arg = 2.0*M_PI*spiral->revo*spiral->t0 + spiral->arg;
- spiral->t0 = (round(arg/(M_PI/snaps))*(M_PI/snaps) - spiral->arg)/(2.0*M_PI*spiral->revo);
+ spiral->t0 = (rint(arg/(M_PI/snaps))*(M_PI/snaps) - spiral->arg)/(2.0*M_PI*spiral->revo);
}
spiral->t0 = CLAMP (spiral->t0, 0.0, 0.999);
@@ -350,7 +350,7 @@
if ( ( state & GDK_CONTROL_MASK )
&& snaps ) {
- spiral->arg = round (spiral->arg/(M_PI/snaps))*(M_PI/snaps);
+ spiral->arg = rint (spiral->arg/(M_PI/snaps))*(M_PI/snaps);
}
sp_object_request_update ((SPObject *) spiral, SP_OBJECT_MODIFIED_FLAG);
diff -ur inkscape-0.38.1-orig/src/remove-last.h inkscape-0.38.1/src/remove-last.h
--- inkscape-0.38.1-orig/src/remove-last.h 2004-02-26 09:23:56.000000000 +0000
+++ inkscape-0.38.1/src/remove-last.h 2004-07-01 03:34:45.916484000 +0100
@@ -9,7 +9,7 @@
{
using std::vector;
- typename vector<T>::reverse_iterator i(find(seq.rbegin(), seq.rend(), elem));
+ typename vector<T>::reverse_iterator i(std::find(seq.rbegin(), seq.rend(), elem));
g_assert( i != seq.rend() );
typename vector<T>::iterator ii(&*i);
seq.erase(ii);
diff -ur inkscape-0.38.1-orig/src/sp-guide.cpp inkscape-0.38.1/src/sp-guide.cpp
--- inkscape-0.38.1-orig/src/sp-guide.cpp 2004-04-01 09:37:48.000000000 +0100
+++ inkscape-0.38.1/src/sp-guide.cpp 2004-07-01 16:50:39.372934000 +0100
@@ -264,7 +264,7 @@
* true indicates a "committing" version: in response to button release event after
* dragging a guideline, or clicking OK in guide editing dialog.
*/
-void sp_guide_moveto(SPGuide const &guide, gdouble const position, bool const commit)
+void sp_guide_moveto(SPGuide const &guide, double const position, bool const commit)
{
g_assert(SP_IS_GUIDE(&guide));
diff -ur inkscape-0.38.1-orig/src/sp-item-notify-moveto.cpp inkscape-0.38.1/src/sp-item-notify-moveto.cpp
--- inkscape-0.38.1-orig/src/sp-item-notify-moveto.cpp 2004-02-26 09:23:56.000000000 +0000
+++ inkscape-0.38.1/src/sp-item-notify-moveto.cpp 2004-07-01 03:37:43.324260000 +0100
@@ -20,7 +20,7 @@
g_return_if_fail(SP_IS_ITEM(&item));
g_return_if_fail( unsigned(snappoint_ix) < 8 );
NR::Point const dir( mv_g.normal );
- double const dir_lensq(dot(dir, dir));
+ double const dir_lensq(NR::dot(dir, dir));
g_return_if_fail( dir_lensq != 0 );
NR::Point snappoints[8];
diff -ur inkscape-0.38.1-orig/src/sp-item-notify-moveto.h inkscape-0.38.1/src/sp-item-notify-moveto.h
--- inkscape-0.38.1-orig/src/sp-item-notify-moveto.h 2004-02-26 09:23:56.000000000 +0000
+++ inkscape-0.38.1/src/sp-item-notify-moveto.h 2004-07-01 16:50:18.068479000 +0100
@@ -4,7 +4,7 @@
#include <forward.h>
void sp_item_notify_moveto(SPItem &item, SPGuide const &g, int const snappoint_ix,
- double position, bool const commit);
+ double const position, bool const commit);
#endif /* !__SP_ITEM_NOTIFY_MOVETO_H__ */
diff -ur inkscape-0.38.1-orig/src/sp-item-update-cns.cpp inkscape-0.38.1/src/sp-item-update-cns.cpp
--- inkscape-0.38.1-orig/src/sp-item-update-cns.cpp 2004-02-26 09:23:56.000000000 +0000
+++ inkscape-0.38.1/src/sp-item-update-cns.cpp 2004-07-01 03:38:14.732900000 +0100
@@ -27,7 +27,7 @@
fi != fiEnd; ++fi)
{
SPGuideConstraint const &cn = *fi;
- if ( find(item.constraints.begin(),
+ if ( std::find(item.constraints.begin(),
item.constraints.end(),
cn)
== item.constraints.end() )
diff -ur inkscape-0.38.1-orig/src/sp-object.cpp inkscape-0.38.1/src/sp-object.cpp
--- inkscape-0.38.1-orig/src/sp-object.cpp 2004-03-15 04:02:46.000000000 +0000
+++ inkscape-0.38.1/src/sp-object.cpp 2004-07-01 03:43:19.909472000 +0100
@@ -993,7 +993,7 @@
style = sp_repr_attr (object->repr, "style");
if (style) {
- gchar *p;
+ const gchar *p;
gint len;
len = strlen (key);
for (p = strstr (style, key); p; p = strstr (style, key)) {
diff -ur inkscape-0.38.1-orig/src/sp-shape.cpp inkscape-0.38.1/src/sp-shape.cpp
--- inkscape-0.38.1-orig/src/sp-shape.cpp 2004-04-08 06:00:43.000000000 +0100
+++ inkscape-0.38.1/src/sp-shape.cpp 2004-07-01 03:46:17.796590000 +0100
@@ -36,6 +36,7 @@
#include "sp-root.h"
#include "sp-marker.h"
#include "sp-shape.h"
+#include "floatmaths.h"
#define noSHAPE_VERBOSE
diff -ur inkscape-0.38.1-orig/src/sp-spiral.cpp inkscape-0.38.1/src/sp-spiral.cpp
--- inkscape-0.38.1-orig/src/sp-spiral.cpp 2004-04-01 09:37:48.000000000 +0100
+++ inkscape-0.38.1/src/sp-spiral.cpp 2004-07-01 03:51:25.843598000 +0100
@@ -444,7 +444,7 @@
g_assert (t >= 0.0);
/* Any callers passing -ve t will have a bug for non-integral values of exp. */
- double const rad = spiral->rad * pow(t, spiral->exp);
+ double const rad = spiral->rad * pow(t, (double)spiral->exp);
double const arg = 2.0 * M_PI * spiral->revo * t + spiral->arg;
return NR::Point(rad * cos (arg) + spiral->cx,
@@ -522,7 +522,7 @@
g_return_if_fail (SP_IS_SPIRAL(spiral));
if (rad)
- *rad = spiral->rad * pow(t, spiral->exp);
+ *rad = spiral->rad * pow(t, (double)spiral->exp);
if (arg)
*arg = 2.0 * M_PI * spiral->revo * t + spiral->arg;
}
diff -ur inkscape-0.38.1-orig/src/spiral-context.cpp inkscape-0.38.1/src/spiral-context.cpp
--- inkscape-0.38.1-orig/src/spiral-context.cpp 2004-04-01 09:37:48.000000000 +0100
+++ inkscape-0.38.1/src/spiral-context.cpp 2004-07-01 03:35:10.237506000 +0100
@@ -437,7 +437,7 @@
gdouble arg = NR::atan2 (delta) - 2.0*M_PI*spiral->revo;
if (state & GDK_CONTROL_MASK) {
- arg = round (arg/(M_PI/snaps))*(M_PI/snaps);
+ arg = rint (arg/(M_PI/snaps))*(M_PI/snaps);
}
/* Fixme: these parameters should be got from dialog box */
diff -ur inkscape-0.38.1-orig/src/splivarot.cpp inkscape-0.38.1/src/splivarot.cpp
--- inkscape-0.38.1-orig/src/splivarot.cpp 2004-04-01 09:37:48.000000000 +0100
+++ inkscape-0.38.1/src/splivarot.cpp 2004-07-01 03:41:48.518466000 +0100
@@ -186,8 +186,8 @@
// extract the livarot Paths from the source objects
// also get the winding rule specified in the style
int nbOriginaux = g_slist_length (il);
- Path *originaux[nbOriginaux];
- FillRule origWind[nbOriginaux];
+ Path **originaux = (Path **)alloca(nbOriginaux * sizeof(Path *));
+ FillRule *origWind = (FillRule *)alloca(nbOriginaux * sizeof(FillRule));
int curOrig;
{
curOrig = 0;
diff -ur inkscape-0.38.1-orig/src/star-context.cpp inkscape-0.38.1/src/star-context.cpp
--- inkscape-0.38.1-orig/src/star-context.cpp 2004-04-01 09:37:48.000000000 +0100
+++ inkscape-0.38.1/src/star-context.cpp 2004-07-01 03:53:01.003400000 +0100
@@ -435,7 +435,7 @@
gdouble r1 = NR::L2 (d);
gdouble arg1 = atan2 (d);
if (state & GDK_CONTROL_MASK) {
- arg1 = round (arg1/(M_PI/snaps))*(M_PI/snaps);
+ arg1 = rint (arg1/(M_PI/snaps))*(M_PI/snaps);
}
bool isflat = sc->isflatsided;
sp_star_position_set (star, sc->magnitude, p0, r1, r1 * sc->proportion, arg1, arg1 + M_PI / sides, isflat);
diff -ur inkscape-0.38.1-orig/src/stl_hash_functions.h inkscape-0.38.1/src/stl_hash_functions.h
--- inkscape-0.38.1-orig/src/stl_hash_functions.h 2004-07-02 01:53:30.333724000 +0100
+++ inkscape-0.38.1/src/stl_hash_functions.h 2004-07-01 04:19:40.215269000 +0100
@@ -0,0 +1,123 @@
+/*! \file stl_hash_functions.h
+ * \brief This header provides the definitions and declaration of hash functions used in hash_map.
+
+ * \author Christian Boesgaard <pink@...432...> and Jacob C. Poulsen <ja7@...432...>.
+ */
+
+
+#ifndef __STL_HASH_FUNCTIONS_H__
+#define __STL_HASH_FUNCTIONS_H__
+
+#include <string>
+
+typedef unsigned int uint;
+typedef unsigned char byte;
+
+class hash_jyrki {
+public:
+ hash_jyrki(uint s = 0) {
+ srand(s);
+ for (int i = 0; i < 1024; ++i) {
+ T[i] = (uint)rand();
+ }
+ }
+ uint operator() (char const* s) {
+ uint t = 0;
+ byte* p = (byte*)s;
+ uint i = 0;
+ for (; *p != 0; ++i) {
+ t ^= T[((0x3 & i) << 8) + *p++];
+ }
+ t ^= T[i];
+ return t;
+ }
+
+private:
+ uint T[1024];
+};
+
+template <class t>
+struct hash_stl {
+ long operator() (const t& s);
+};
+
+template<>
+struct hash_stl<const char*> {
+ long operator() (const char * s) {
+ uint t = 0;
+ while (*s != 0) {
+ t = 5 * t + *s++;
+ }
+ return t;
+ }
+};
+
+template<>
+struct hash_stl
std::string {
+ long operator() (const std::string& ss) {
+ const char* s=ss.c_str();
+ uint t = 0;
+ while (*s != 0) {
+ t = 5 * t + *s++;
+ }
+ return t;
+ };
+};
+
+
+
+class hash_crypto {
+#define mix(a, b, c) { \
+a -= b; a -= c; a ^= (c >>13); \
+b -= c; b -= a; b ^= (a <<8); \
+c -= a; c -= b; c ^= (b >>13); \
+a -= b; a -= c; a ^= (c >>12); \
+b -= c; b -= a; b ^= (a <<16); \
+c -= a; c -= b; c ^= (b >>5); \
+a -= b; a -= c; a ^= (c >>3); \
+b -= c; b -= a; b ^= (a <<10); \
+c -= a; c -= b; c ^= (b >>15); \
+}
+
+public:
+ uint operator() (char const* k);
+};
+
+uint hash_crypto::operator() (char const* k) {
+ uint length = 0;
+ while (*k++) {++length;}
+ uint len = length;
+ uint a = 0x9e3779b9;
+ uint b = 0x9e3779b9;
+ uint c = 0x8f256195;
+
+ while (len >= 12) {
+ a += (k[0] + (uint(k[1])<<8) + (uint(k[2])<<16) + (uint(k[3])<<24));
+ b += (k[4] + (uint(k[5])<<8) + (uint(k[6])<<16) + (uint(k[7])<<24));
+ c += (k[8] + (uint(k[9])<<8) + (uint(k[10])<<16) + (uint(k[11])<<24));
+ mix(a, b, c);
+ k += 12; len -= 12;
+ }
+
+ c += length;
+ switch (len) {
+ case 11: c+=(uint(k[10])<<24);
+ case 10: c+=(uint(k[9])<<16);
+ case 9 : c+=(uint(k[8])<<8);
+
+ case 8: b+=(uint(k[7])<<24);
+ case 7: b+=(uint(k[6])<<16);
+ case 6: b+=(uint(k[5])<<8);
+ case 5: b+=k[4];
+
+ case 4: a+=(uint(k[3])<<24);
+ case 3: a+=(uint(k[2])<<16);
+ case 2: a+=(uint(k[1])<<8);
+
+ case 1: a+=k[0];
+ }
+ mix(a, b, c);
+ return c;
+}
+
+#endif
diff -ur inkscape-0.38.1-orig/src/streams-jar.cpp inkscape-0.38.1/src/streams-jar.cpp
--- inkscape-0.38.1-orig/src/streams-jar.cpp 2004-03-17 17:28:20.000000000 +0000
+++ inkscape-0.38.1/src/streams-jar.cpp 2004-07-01 03:55:56.402454000 +0100
@@ -30,7 +30,7 @@
#endif
//guint32 crc = check_crc(data, flags);
- gchar filename[filename_length+1];
+ gchar *filename = (gchar *)alloca(filename_length+1);
_urihandle->read(filename, filename_length);
filename[filename_length] = '\0';
@@ -92,7 +92,7 @@
int ret;
if ((ret = do_consume_and_inflate(nbytes)) == EOF && eflen > 0) {
- guint8 efbuf[eflen];
+ guint8 *efbuf = (guint8 *)alloca(eflen);
_urihandle->read(efbuf, eflen);
return 1;
}
@@ -102,7 +102,7 @@
int JarBuffer::consume_uncompressed(int nbytes)
{
- guint8 data[nbytes];
+ guint8 *data = (guint8 *)alloca(nbytes);
if (consume(data, nbytes) == EOF)
return EOF;
diff -ur inkscape-0.38.1-orig/src/streams-zlib.cpp inkscape-0.38.1/src/streams-zlib.cpp
--- inkscape-0.38.1-orig/src/streams-zlib.cpp 2004-03-17 17:28:20.000000000 +0000
+++ inkscape-0.38.1/src/streams-zlib.cpp 2004-07-01 03:53:58.994511000 +0100
@@ -105,7 +105,7 @@
int ZlibBuffer::do_consume_and_inflate(int nbytes)
{
- guint8 buf[nbytes];
+ guint8 *buf = (guint8 *)alloca(nbytes);
if (consume(buf, nbytes) == EOF)
return EOF;
diff -ur inkscape-0.38.1-orig/src/svg/ftos.cpp inkscape-0.38.1/src/svg/ftos.cpp
--- inkscape-0.38.1-orig/src/svg/ftos.cpp 2004-04-09 07:16:17.000000000 +0100
+++ inkscape-0.38.1/src/svg/ftos.cpp 2004-07-01 01:40:57.875356000 +0100
@@ -275,10 +275,12 @@
int decimal=0;
#ifdef HAS_ECVT
- char *p = ecvt(val, count, &decimal, &sign);
+ char *p = ecvt(val, count, &decimal, &sign);
#else
- char *p;
- asprintf(&p, "%.0f", val);
+ char *p, tmp[256];
+ snprintf(tmp, 256, "%.0f", val);
+ p = (char *)malloc(strlen(tmp) + 1);
+ strcpy(p, tmp);
#endif
#ifdef DEBUG
diff -ur inkscape-0.38.1-orig/src/svg/round.cpp inkscape-0.38.1/src/svg/round.cpp
--- inkscape-0.38.1-orig/src/svg/round.cpp 2004-04-08 04:36:35.000000000 +0100
+++ inkscape-0.38.1/src/svg/round.cpp 2004-07-01 01:33:20.035147000 +0100
@@ -42,6 +42,6 @@
double rround(double x, int k)
{
if (k==0) return rround(x);
- else return rround(x*pow(10,k)) / pow(10,k);
+ else return rround(x*pow(10.0, k)) / pow(10.0, k);
}
diff -ur inkscape-0.38.1-orig/src/svg/svg-path.cpp inkscape-0.38.1/src/svg/svg-path.cpp
--- inkscape-0.38.1-orig/src/svg/svg-path.cpp 2004-03-18 19:48:25.000000000 +0000
+++ inkscape-0.38.1/src/svg/svg-path.cpp 2004-07-01 01:32:39.876558000 +0100
@@ -520,7 +520,7 @@
{
/* end of number */
- val *= sign * pow (10, exp_sign * exp);
+ val *= sign * pow (10.0, exp_sign * exp);
if (ctx->rel)
{
/* Handle relative coordinates. This switch statement attempts
diff -ur inkscape-0.38.1-orig/src/verbs.cpp inkscape-0.38.1/src/verbs.cpp
--- inkscape-0.38.1-orig/src/verbs.cpp 2004-04-07 07:14:55.000000000 +0100
+++ inkscape-0.38.1/src/verbs.cpp 2004-07-01 20:02:43.504293000 +0100
@@ -70,19 +70,33 @@
/* FIXME !!! we should probably go ahead and use GHashTables, actually -- more portable */
+#include <functional>
+
#if defined(__GNUG__) && (__GNUG__ >= 3)
# include <ext/hash_map>
using __gnu_cxx::hash_map;
#else
-# include <hash_map.h>
+# include "hash_map.h"
+using cphstl::hash_map;
#endif
#if defined(__GNUG__) && (__GNUG__ >= 3)
namespace __gnu_cxx {
#endif
+template <typename T> class my_hash;
+
+template <>
+class my_hash<sp_verb_t> {
+ typedef sp_verb_t T;
+public:
+ size_t operator()(const T& x) {
+ return (size_t)g_int_hash((gpointer)&x);
+ }
+};
+
template <>
-class hash<SPView *> {
+class my_hash<SPView *> {
typedef SPView *T;
public:
size_t operator()(const T& x) const {
@@ -94,9 +108,9 @@
}; /* namespace __gnu_cxx */
#endif
-typedef hash_map<sp_verb_t, SPAction *> ActionTable;
-typedef hash_map<SPView *, ActionTable *> VerbTable;
-typedef hash_map<sp_verb_t, SPVerbActionFactory *> FactoryTable;
+typedef hash_map<sp_verb_t, SPAction *, my_hash<sp_verb_t>, std::equal_to<sp_verb_t> > ActionTable;
+typedef hash_map<SPView *, ActionTable *, my_hash<SPView *>, std::equal_to<SPView *> > VerbTable;
+typedef hash_map<sp_verb_t, SPVerbActionFactory *, my_hash<sp_verb_t>, std::equal_to<sp_verb_t> > FactoryTable;
static VerbTable verb_tables;
static FactoryTable factories;