From: keescook Date: Sat, 13 Jan 2007 01:17:19 +0000 (+0000) Subject: overwritten heap, wrong casts fixed. Closes SF#1575829 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=41d5edd305122148718ea6dcfce4f92150215f8e;p=inkscape.git overwritten heap, wrong casts fixed. Closes SF#1575829 --- diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index 7c845e70f..a3e87b31b 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -156,7 +156,7 @@ attach_all (Gtk::Table &table, const Gtk::Widget *arr[], unsigned size, int star Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); else if (arr[i]) { - Gtk::Label& label = reinterpret_cast (const_cast(*arr[i])); + Gtk::Label& label = static_cast (const_cast(*arr[i])); label.set_alignment (0.0); table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index 7df2eaee5..5f6386046 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -191,7 +191,7 @@ ExtensionEditor::on_pagelist_selection_changed (void) void ExtensionEditor::dbfunc (Inkscape::Extension::Extension * in_plug, gpointer in_data) { - ExtensionEditor * ee = reinterpret_cast(in_data); + ExtensionEditor * ee = static_cast(in_data); ee->add_extension(in_plug); return; } diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index 6563040dc..980d225b2 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -49,9 +49,10 @@ EntityEntry::create (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr) obj = new EntityMultiLineEntry (ent, tt, wr); break; default: - g_warning ("Can't happen."); + g_warning ("An unknown RDF format was requested."); } + g_assert (obj); obj->_label.show(); return obj; } @@ -78,14 +79,14 @@ EntityLineEntry::EntityLineEntry (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Reg EntityLineEntry::~EntityLineEntry() { - delete reinterpret_cast(_packable); + delete static_cast(_packable); } void EntityLineEntry::update (SPDocument *doc) { const char *text = rdf_get_work_entity (doc, _entity); - reinterpret_cast(_packable)->set_text (text ? text : ""); + static_cast(_packable)->set_text (text ? text : ""); } void @@ -95,8 +96,8 @@ EntityLineEntry::on_changed() _wr->setUpdating (true); SPDocument *doc = SP_ACTIVE_DOCUMENT; - char const *text = reinterpret_cast(_packable)->get_text().c_str(); - if (rdf_set_work_entity (doc, _entity, text)) + Glib::ustring text = static_cast(_packable)->get_text(); + if (rdf_set_work_entity (doc, _entity, text.c_str())) sp_document_done (doc, SP_VERB_NONE, /* TODO: annotate */ "entity-entry.cpp:101"); _wr->setUpdating (false); @@ -119,15 +120,15 @@ EntityMultiLineEntry::EntityMultiLineEntry (rdf_work_entity_t* ent, Gtk::Tooltip EntityMultiLineEntry::~EntityMultiLineEntry() { - delete reinterpret_cast(_packable); + delete static_cast(_packable); } void EntityMultiLineEntry::update (SPDocument *doc) { const char *text = rdf_get_work_entity (doc, _entity); - Gtk::ScrolledWindow *s = reinterpret_cast(_packable); - Gtk::TextView *tv = reinterpret_cast(s->get_child()); + Gtk::ScrolledWindow *s = static_cast(_packable); + Gtk::TextView *tv = static_cast(s->get_child()); tv->get_buffer()->set_text (text ? text : ""); } @@ -138,10 +139,10 @@ EntityMultiLineEntry::on_changed() _wr->setUpdating (true); SPDocument *doc = SP_ACTIVE_DOCUMENT; - Gtk::ScrolledWindow *s = reinterpret_cast(_packable); - Gtk::TextView *tv = reinterpret_cast(s->get_child()); - char const *text = tv->get_buffer()->get_text().c_str(); - if (rdf_set_work_entity (doc, _entity, text)) + Gtk::ScrolledWindow *s = static_cast(_packable); + Gtk::TextView *tv = static_cast(s->get_child()); + Glib::ustring text = tv->get_buffer()->get_text(); + if (rdf_set_work_entity (doc, _entity, text.c_str())) sp_document_done (doc, SP_VERB_NONE, /* TODO: annotate */ "entity-entry.cpp:146"); _wr->setUpdating (false); diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index c872c06df..24bd5595f 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -67,7 +67,7 @@ LicenseItem::on_toggled() sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_NONE, /* TODO: annotate */ "licensor.cpp:65"); _wr.setUpdating (false); - reinterpret_cast(_eep->_packable)->set_text (_lic->uri); + static_cast(_eep->_packable)->set_text (_lic->uri); _eep->on_changed(); } @@ -129,10 +129,10 @@ Licensor::update (SPDocument *doc) for (i=0; rdf_licenses[i].name; i++) if (license == &rdf_licenses[i]) break; - reinterpret_cast(children()[i+1].get_widget())->set_active(); + static_cast(children()[i+1].get_widget())->set_active(); } else { - reinterpret_cast(children()[0].get_widget())->set_active(); + static_cast(children()[0].get_widget())->set_active(); } /* update the URI */