diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-02-06 15:06:17 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-02-06 15:06:17 +0000 |
| commit | da71443f77f499468d48b3f404eb6c59851eef8a (patch) | |
| tree | 7635b5003762929196a29b91ed0db77ab9b21bd3 | |
| parent | Unwanted output in documentation dropped (diff) | |
| download | inkscape-da71443f77f499468d48b3f404eb6c59851eef8a.tar.gz inkscape-da71443f77f499468d48b3f404eb6c59851eef8a.zip | |
(cppcheck and janitorial tasks:) C-style casting to C++-style casting
(bzr r10946)
| -rw-r--r-- | src/sp-switch.h | 2 | ||||
| -rw-r--r-- | src/sp-use-reference.h | 2 | ||||
| -rw-r--r-- | src/trace/siox.cpp | 18 | ||||
| -rw-r--r-- | src/ui/dialog/debug.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/dialog.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/messages.cpp | 5 | ||||
| -rw-r--r-- | src/ui/dialog/tile.cpp | 6 |
7 files changed, 22 insertions, 23 deletions
diff --git a/src/sp-switch.h b/src/sp-switch.h index 8eafe6e7b..c2c98e3b3 100644 --- a/src/sp-switch.h +++ b/src/sp-switch.h @@ -55,7 +55,7 @@ private: }; struct SPSwitch : public SPGroup { - void resetChildEvaluated() { ((CSwitch *)group)->_reevaluate(); } + void resetChildEvaluated() { (static_cast<CSwitch *>(group))->_reevaluate(); } }; struct SPSwitchClass : public SPGroupClass { diff --git a/src/sp-use-reference.h b/src/sp-use-reference.h index bbedb9875..f40dbb6e5 100644 --- a/src/sp-use-reference.h +++ b/src/sp-use-reference.h @@ -28,7 +28,7 @@ public: SPUseReference(SPObject *owner) : URIReference(owner) {} SPItem *getObject() const { - return (SPItem *)URIReference::getObject(); + return static_cast<SPItem *>(URIReference::getObject()); } protected: diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp index 4c6cf1eac..9376fad66 100644 --- a/src/trace/siox.cpp +++ b/src/trace/siox.cpp @@ -1330,29 +1330,31 @@ bool Siox::colorSignature(const std::vector<CieLab> &inputVec, if (length < 1) // no error. just don't do anything return true; - CieLab *input = (CieLab *) malloc(length * sizeof(CieLab)); + CieLab *input = new CieLab [length]; if (!input) - { + { error("Could not allocate buffer for signature"); return false; - } + } for (unsigned int i=0 ; i < length ; i++) + { input[i] = inputVec[i]; + } unsigned int stage1length = 0; - colorSignatureStage1(input, 0, length, 0, - &stage1length, dims); + colorSignatureStage1(input, 0, length, 0, &stage1length, dims); unsigned int stage2length = 0; - colorSignatureStage2(input, 0, stage1length, 0, - &stage2length, length * 0.001, dims); + colorSignatureStage2(input, 0, stage1length, 0, &stage2length, length * 0.001, dims); result.clear(); for (unsigned int i=0 ; i < stage2length ; i++) + { result.push_back(input[i]); + } - free(input); + delete[] input; return true; } diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index 426cd5d99..8ffbd5c52 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -167,7 +167,7 @@ void dialogLoggingFunction(const gchar */*log_domain*/, const gchar *messageText, gpointer user_data) { - DebugDialogImpl *dlg = (DebugDialogImpl *)user_data; + DebugDialogImpl *dlg = static_cast<DebugDialogImpl *>(user_data); dlg->message(messageText); } diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 0a7359155..43c9493b3 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -41,20 +41,20 @@ namespace Dialog { void sp_retransientize(Inkscape::Application */*inkscape*/, SPDesktop *desktop, gpointer dlgPtr) { - Dialog *dlg = (Dialog *)dlgPtr; + Dialog *dlg = static_cast<Dialog *>(dlgPtr); dlg->onDesktopActivated (desktop); } gboolean sp_retransientize_again(gpointer dlgPtr) { - Dialog *dlg = (Dialog *)dlgPtr; + Dialog *dlg = static_cast<Dialog *>(dlgPtr); dlg->retransientize_suppress = false; return FALSE; // so that it is only called once } void sp_dialog_shutdown(GtkObject */*object*/, gpointer dlgPtr) { - Dialog *dlg = (Dialog *)dlgPtr; + Dialog *dlg = static_cast<Dialog *>(dlgPtr); dlg->onShutdown(); } @@ -63,7 +63,7 @@ void hideCallback(GtkObject */*object*/, gpointer dlgPtr) { g_return_if_fail( dlgPtr != NULL ); - Dialog *dlg = (Dialog *)dlgPtr; + Dialog *dlg = static_cast<Dialog *>(dlgPtr); dlg->onHideF12(); } @@ -71,7 +71,7 @@ void unhideCallback(GtkObject */*object*/, gpointer dlgPtr) { g_return_if_fail( dlgPtr != NULL ); - Dialog *dlg = (Dialog *)dlgPtr; + Dialog *dlg = static_cast<Dialog *>(dlgPtr); dlg->onShowF12(); } diff --git a/src/ui/dialog/messages.cpp b/src/ui/dialog/messages.cpp index 52bd58492..df02215fe 100644 --- a/src/ui/dialog/messages.cpp +++ b/src/ui/dialog/messages.cpp @@ -124,9 +124,8 @@ static void dialogLoggingCallback(const gchar */*log_domain*/, const gchar *messageText, gpointer user_data) { - Messages *dlg = (Messages *)user_data; - - dlg->message((char *)messageText); + Messages *dlg = static_cast<Messages *>(user_data); + dlg->message(const_cast<char*>(messageText)); } diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 50b63f701..8ca0ba348 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -41,8 +41,7 @@ * 0 *elem1 == *elem2 * >0 *elem1 goes after *elem2 */ -int -sp_compare_x_position(SPItem *first, SPItem *second) +int sp_compare_x_position(SPItem *first, SPItem *second) { using Geom::X; using Geom::Y; @@ -603,8 +602,7 @@ void TileDialog::updateSelection() static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, TileDialog *dlg) { - TileDialog *tledlg = (TileDialog *) dlg; - tledlg->updateSelection(); + dlg->updateSelection(); } |
