diff options
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-15 10:46:15 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2018-06-18 12:27:01 +0000 |
| commit | f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 (patch) | |
| tree | 7c6044fd3a17a2665841959dac9b3b2110b27924 /src/extension/internal | |
| parent | Run clang-tidy’s modernize-use-override pass. (diff) | |
| download | inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.tar.gz inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.zip | |
Run clang-tidy’s modernize-use-nullptr pass.
This replaces all NULL or 0 with nullptr when assigned to or returned as
a pointer.
Diffstat (limited to 'src/extension/internal')
50 files changed, 573 insertions, 573 deletions
diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index f04007d00..808023c7c 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -96,10 +96,10 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View /* Doing an inset here folks */ offset *= -1.0; prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); - sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(Inkscape::ActionContext(desktop)), NULL); + sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(Inkscape::ActionContext(desktop)), nullptr); } else if (offset > 0.0) { prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); - sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(Inkscape::ActionContext(desktop)), NULL); + sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(Inkscape::ActionContext(desktop)), nullptr); } selection->clear(); @@ -119,7 +119,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View Gtk::Widget * BlurEdge::prefs_effect(Inkscape::Extension::Effect * module, Inkscape::UI::View::View * /*view*/, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { - return module->autogui(NULL, NULL, changeSignal); + return module->autogui(nullptr, nullptr, changeSignal); } #include "clear-n_.h" diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index 3cdbee8c1..c3261fdce 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -66,7 +66,7 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) ctx = renderer->createContext(); /* Render document */ - bool ret = renderer->setupDocument(ctx, doc, TRUE, 0., NULL); + bool ret = renderer->setupDocument(ctx, doc, TRUE, 0., nullptr); if (ret) { renderer->renderItem(ctx, base); ctx->saveAsPng(filename); diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 287cf636f..9815088de 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -46,7 +46,7 @@ namespace Internal { bool CairoPsOutput::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS)) { + if (nullptr == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS)) { return FALSE; } else { return TRUE; @@ -55,7 +55,7 @@ bool CairoPsOutput::check (Inkscape::Extension::Extension * /*module*/) bool CairoEpsOutput::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS)) { + if (nullptr == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS)) { return FALSE; } else { return TRUE; @@ -68,7 +68,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l { doc->ensureUpToDate(); - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = TRUE; if (exportId && strcmp(exportId, "")) { @@ -134,13 +134,13 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con unsigned int ret; ext = Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS); - if (ext == NULL) + if (ext == nullptr) return; int level = CAIRO_PS_LEVEL_2; try { const gchar *new_level = mod->get_param_enum("PSlevel"); - if((new_level != NULL) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { level = CAIRO_PS_LEVEL_3; } } catch(...) {} @@ -180,7 +180,7 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con bleedmargin_px = mod->get_param_float("bleed"); } catch(...) {} - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } catch(...) {} @@ -223,13 +223,13 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co unsigned int ret; ext = Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS); - if (ext == NULL) + if (ext == nullptr) return; int level = CAIRO_PS_LEVEL_2; try { const gchar *new_level = mod->get_param_enum("PSlevel"); - if((new_level != NULL) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { level = CAIRO_PS_LEVEL_3; } } catch(...) {} @@ -269,7 +269,7 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co bleedmargin_px = mod->get_param_float("bleed"); } catch(...) {} - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } catch(...) {} diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 23c20b968..36f73136b 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -119,15 +119,15 @@ CairoRenderContext::CairoRenderContext(CairoRenderer *parent) : _is_omittext(FALSE), _is_filtertobitmap(FALSE), _bitmapresolution(72), - _stream(NULL), + _stream(nullptr), _is_valid(FALSE), _vector_based_target(FALSE), - _cr(NULL), // Cairo context - _surface(NULL), + _cr(nullptr), // Cairo context + _surface(nullptr), _target(CAIRO_SURFACE_TYPE_IMAGE), _target_format(CAIRO_FORMAT_ARGB32), - _layout(NULL), - _state(NULL), + _layout(nullptr), + _state(nullptr), _renderer(parent), _render_mode(RENDER_MODE_NORMAL), _clip_mode(CLIP_MODE_MASK), @@ -251,12 +251,12 @@ bool CairoRenderContext::setPdfTarget(gchar const *utf8_fn) _vector_based_target = TRUE; #endif - FILE *osf = NULL; - FILE *osp = NULL; + FILE *osf = nullptr; + FILE *osp = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError *error = NULL; + GError *error = nullptr; gchar *local_fn = g_filename_from_utf8(utf8_fn, -1, &bytesRead, &bytesWritten, &error); gchar const *fn = local_fn; @@ -266,7 +266,7 @@ bool CairoRenderContext::setPdfTarget(gchar const *utf8_fn) * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { if (*fn == '|') { fn += 1; while (isspace(*fn)) fn += 1; @@ -333,12 +333,12 @@ bool CairoRenderContext::setPsTarget(gchar const *utf8_fn) _vector_based_target = TRUE; #endif - FILE *osf = NULL; - FILE *osp = NULL; + FILE *osf = nullptr; + FILE *osp = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError *error = NULL; + GError *error = nullptr; gchar *local_fn = g_filename_from_utf8(utf8_fn, -1, &bytesRead, &bytesWritten, &error); gchar const *fn = local_fn; @@ -348,7 +348,7 @@ bool CairoRenderContext::setPsTarget(gchar const *utf8_fn) * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { if (*fn == '|') { fn += 1; while (isspace(*fn)) fn += 1; @@ -522,7 +522,7 @@ CairoRenderContext::getClipMode(void) const CairoRenderState* CairoRenderContext::_createState(void) { CairoRenderState *state = static_cast<CairoRenderState*>(g_try_malloc(sizeof(CairoRenderState))); - g_assert( state != NULL ); + g_assert( state != nullptr ); state->has_filtereffect = FALSE; state->merge_opacity = TRUE; @@ -530,8 +530,8 @@ CairoRenderState* CairoRenderContext::_createState(void) state->need_layer = FALSE; state->has_overflow = FALSE; state->parent_has_userspace = FALSE; - state->clip_path = NULL; - state->mask = NULL; + state->clip_path = nullptr; + state->mask = nullptr; return state; } @@ -579,14 +579,14 @@ CairoRenderContext::popLayer(void) SPMask *mask = _state->mask; if (clip_path || mask) { - CairoRenderContext *clip_ctx = 0; - cairo_surface_t *clip_mask = 0; + CairoRenderContext *clip_ctx = nullptr; + cairo_surface_t *clip_mask = nullptr; // Apply any clip path first if (clip_path) { TRACE((" Applying clip\n")); if (_render_mode == RENDER_MODE_CLIP) - mask = NULL; // disable mask when performing nested clipping + mask = nullptr; // disable mask when performing nested clipping if (_vector_based_target) { setClipMode(CLIP_MODE_PATH); // Vector @@ -783,7 +783,7 @@ CairoRenderContext::setupSurface(double width, double height) if (_is_valid) return true; - if (_vector_based_target && _stream == NULL) + if (_vector_based_target && _stream == nullptr) return false; _width = width; @@ -796,7 +796,7 @@ CairoRenderContext::setupSurface(double width, double height) os_bbox << "%%BoundingBox: 0 0 " << (int)ceil(width) << (int)ceil(height); // apparently, the numbers should be integers. (see bug 380501) os_pagebbox << "%%PageBoundingBox: 0 0 " << (int)ceil(width) << (int)ceil(height); - cairo_surface_t *surface = NULL; + cairo_surface_t *surface = nullptr; cairo_matrix_t ctm; cairo_matrix_init_identity (&ctm); char buffer[25]; @@ -889,7 +889,7 @@ CairoRenderContext::setSurfaceTarget(cairo_surface_t *surface, bool is_vector, c bool CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm) { - if(surface == NULL) { + if(surface == nullptr) { return false; } if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { @@ -932,13 +932,13 @@ CairoRenderContext::finish(bool finish_surface) g_critical("error while rendering output: %s", cairo_status_to_string(status)); cairo_destroy(_cr); - _cr = NULL; + _cr = nullptr; if (finish_surface) cairo_surface_finish(_surface); status = cairo_surface_status(_surface); cairo_surface_destroy(_surface); - _surface = NULL; + _surface = nullptr; if (_layout) g_object_unref(_layout); @@ -950,7 +950,7 @@ CairoRenderContext::finish(bool finish_surface) (void) fflush(_stream); fclose(_stream); - _stream = NULL; + _stream = nullptr; } if (status == CAIRO_STATUS_SUCCESS) @@ -1133,7 +1133,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver unsigned dkey = SPItem::display_key_new(1); // show items and render them - for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = pat; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children for (auto& child: pat_i->children) { if (SP_IS_ITEM(&child)) { @@ -1162,7 +1162,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver delete pattern_ctx; // hide all items - for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = pat; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children for (auto& child: pat_i->children) { if (SP_IS_ITEM(&child)) { @@ -1257,7 +1257,7 @@ cairo_pattern_t* CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const paintserver, Geom::OptRect const &pbox, float alpha) { - cairo_pattern_t *pattern = NULL; + cairo_pattern_t *pattern = nullptr; bool apply_bbox2user = FALSE; if (SP_IS_LINEARGRADIENT (paintserver)) { @@ -1315,7 +1315,7 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain } else if ( dynamic_cast<SPHatch const *>(paintserver) ) { pattern = _createHatchPainter(paintserver, pbox); } else { - return NULL; + return nullptr; } if (pattern && SP_IS_GRADIENT(paintserver)) { @@ -1441,7 +1441,7 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, Geom::OptRect const &p cairo_set_dash(_cr, dashes, ndashes, style->stroke_dashoffset.value); free(dashes); } else { - cairo_set_dash(_cr, NULL, 0, 0.0); // disable dashing + cairo_set_dash(_cr, nullptr, 0, 0.0); // disable dashing } cairo_set_line_width(_cr, style->stroke_width.computed); @@ -1567,7 +1567,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con return true; bool need_layer = ( !_state->merge_opacity && !_state->need_layer && - ( _state->opacity != 1.0 || _state->clip_path != NULL || _state->mask != NULL ) ); + ( _state->opacity != 1.0 || _state->clip_path != nullptr || _state->mask != nullptr ) ); if (!need_layer) cairo_save(_cr); @@ -1689,7 +1689,7 @@ unsigned int CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont * /*font*/, unsigned int num_glyphs = glyphtext.size(); if (num_glyphs > GLYPH_ARRAY_SIZE) { glyphs = (cairo_glyph_t*)g_try_malloc(sizeof(cairo_glyph_t) * num_glyphs); - if(glyphs == NULL) { + if(glyphs == nullptr) { g_warning("CairorenderContext::_showGlyphs: can not allocate memory for %d glyphs.", num_glyphs); return 0; } @@ -1737,11 +1737,11 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma // create a cairo_font_face from PangoFont // double size = style->font_size.computed; /// \fixme why is this variable never used? gpointer fonthash = (gpointer)font; - cairo_font_face_t *font_face = NULL; + cairo_font_face_t *font_face = nullptr; if(font_table.find(fonthash)!=font_table.end()) font_face = font_table[fonthash]; - FcPattern *fc_pattern = NULL; + FcPattern *fc_pattern = nullptr; #ifdef USE_PANGO_WIN32 # ifdef CAIRO_HAS_WIN32_FONT @@ -1761,7 +1761,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma # ifdef CAIRO_HAS_FT_FONT PangoFcFont *fc_font = PANGO_FC_FONT(font); fc_pattern = fc_font->font_pattern; - if(font_face == NULL) { + if(font_face == nullptr) { font_face = cairo_ft_font_face_create_for_pattern(fc_pattern); font_table[fonthash] = font_face; } diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index 401b06885..2cefb297d 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -91,7 +91,7 @@ public: bool setPdfTarget(gchar const *utf8_fn); bool setPsTarget(gchar const *utf8_fn); /** Set the cairo_surface_t from an external source */ - bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector, cairo_matrix_t *ctm=NULL); + bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector, cairo_matrix_t *ctm=nullptr); void setPSLevel(unsigned int level); void setEPS(bool eps); @@ -215,7 +215,7 @@ protected: unsigned int _showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoGlyphInfo> const &glyphtext, bool is_stroke); - bool _finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm = NULL); + bool _finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm = nullptr); void _setFillStyle(SPStyle const *style, Geom::OptRect const &pbox); void _setStrokeStyle(SPStyle const *style, Geom::OptRect const &pbox); diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 5b9759c15..333c0eb42 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -49,7 +49,7 @@ bool CairoRendererPdfOutput::check(Inkscape::Extension::Extension * /*module*/) { bool result = true; - if (NULL == Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer")) { + if (nullptr == Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer")) { result = false; } @@ -65,7 +65,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int /* Start */ - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = TRUE; if (exportId && strcmp(exportId, "")) { @@ -136,13 +136,13 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, unsigned int ret; ext = Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer"); - if (ext == NULL) + if (ext == nullptr) return; int level = 0; try { const gchar *new_level = mod->get_param_enum("PDFversion"); - if((new_level != NULL) && (g_ascii_strcasecmp("PDF-1.5", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PDF-1.5", new_level) == 0)) { level = 1; } } @@ -182,7 +182,7 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, g_warning("Parameter <resolution> might not exist"); } - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index b48be2ed7..05605a9d9 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -117,9 +117,9 @@ CairoRenderContext* CairoRenderer::createContext(void) { CairoRenderContext *new_context = new CairoRenderContext(this); - g_assert( new_context != NULL ); + g_assert( new_context != nullptr ); - new_context->_state = NULL; + new_context->_state = nullptr; // create initial render state CairoRenderState *state = new_context->_createState(); @@ -516,7 +516,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) SPDocument *document = item->document; std::unique_ptr<Inkscape::Pixbuf> pb( - sp_generate_internal_bitmap(document, NULL, + sp_generate_internal_bitmap(document, nullptr, bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y], width, height, res, res, (guint32) 0xffffff00, item )); @@ -653,7 +653,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page { // PLEASE note when making changes to the boundingbox and transform calculation, corresponding changes should be made to PDFLaTeXRenderer::setupDocument !!! - g_assert( ctx != NULL ); + g_assert( ctx != nullptr ); if (!base) { base = doc->getRoot(); @@ -710,9 +710,9 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page void CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) { - g_assert( ctx != NULL && ctx->_is_valid ); + g_assert( ctx != nullptr && ctx->_is_valid ); - if (cp == NULL) + if (cp == nullptr) return; CairoRenderContext::CairoRenderMode saved_mode = ctx->getRenderMode(); @@ -766,9 +766,9 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) void CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask) { - g_assert( ctx != NULL && ctx->_is_valid ); + g_assert( ctx != nullptr && ctx->_is_valid ); - if (mask == NULL) + if (mask == nullptr) return; // FIXME: the access to the first mask view to obtain the bbox is completely bogus diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index e6e7d4ed4..bf573cfac 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -245,7 +245,7 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #endif if (!libcdr::CDRDocument::isSupported(&input)) { - return NULL; + return nullptr; } RVNGStringVector output; @@ -256,11 +256,11 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #else if (!libcdr::CDRDocument::generateSVG(&input, output)) { #endif - return NULL; + return nullptr; } if (output.empty()) { - return NULL; + return nullptr; } std::vector<RVNGString> tmpSVGOutput; @@ -274,12 +274,12 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // If only one page is present, import that one without bothering user if (tmpSVGOutput.size() > 1) { - CdrImportDialog *dlg = 0; + CdrImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new CdrImportDialog(tmpSVGOutput); if (!dlg->showDialog()) { delete dlg; - return NULL; + return nullptr; } } diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 54099271b..f8cedcb50 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -80,7 +80,7 @@ Emf::~Emf (void) //The destructor bool Emf::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(PRINT_EMF)) + if (nullptr == Inkscape::Extension::db.get(PRINT_EMF)) return FALSE; return TRUE; } @@ -121,8 +121,8 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) (void) mod->finish(); /* Release arena */ mod->base->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // deleted by invoke_hide /* end */ mod->set_param_string("destination", oldoutput); @@ -138,7 +138,7 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena Inkscape::Extension::Extension * ext; ext = Inkscape::Extension::db.get(PRINT_EMF); - if (ext == NULL) + if (ext == nullptr) return; bool new_val = mod->get_param_bool("textToPath"); @@ -166,7 +166,7 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena ext->set_param_bool("textToPath", new_val); // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); print_document_to_file(doc, filename); @@ -479,11 +479,11 @@ uint32_t Emf::add_image(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t cbBits, uint int dibparams = U_BI_UNKNOWN; // type of image not yet determined MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table U_RGBQUAD ct2[2]; uint32_t width, height, colortype, numCt, invert; // if needed these values will be set in get_DIB_params if(cbBits && cbBmi && (iUsage == U_DIB_RGB_COLORS)){ @@ -524,7 +524,7 @@ uint32_t Emf::add_image(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t cbBits, uint } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG || dibparams==U_BI_PNG){ // image was binary png or jpg in source file base64String = g_base64_encode((guchar*) px, numCt ); } @@ -749,7 +749,7 @@ int Emf::in_clips(PEMF_CALLBACK_DATA d, const char *test){ void Emf::add_clips(PEMF_CALLBACK_DATA d, const char *clippath, unsigned int logic){ int op = combine_ops_to_livarot(logic); Geom::PathVector combined_vect; - char *combined = NULL; + char *combined = nullptr; if (op >= 0 && d->dc[d->level].clip_id) { unsigned int real_idx = d->dc[d->level].clip_id - 1; Geom::PathVector old_vect = sp_svg_read_pathv(d->clips.strings[real_idx]); @@ -1080,7 +1080,7 @@ std::string Emf::pix_to_xy(PEMF_CALLBACK_DATA d, double x, double y){ void Emf::select_pen(PEMF_CALLBACK_DATA d, int index) { - PU_EMRCREATEPEN pEmr = NULL; + PU_EMRCREATEPEN pEmr = nullptr; if (index >= 0 && index < d->n_obj){ pEmr = (PU_EMRCREATEPEN) d->emf_obj[index].lpEMFR; @@ -1167,7 +1167,7 @@ Emf::select_pen(PEMF_CALLBACK_DATA d, int index) void Emf::select_extpen(PEMF_CALLBACK_DATA d, int index) { - PU_EMREXTCREATEPEN pEmr = NULL; + PU_EMREXTCREATEPEN pEmr = nullptr; if (index >= 0 && index < d->n_obj) pEmr = (PU_EMREXTCREATEPEN) d->emf_obj[index].lpEMFR; @@ -1379,7 +1379,7 @@ Emf::select_brush(PEMF_CALLBACK_DATA d, int index) void Emf::select_font(PEMF_CALLBACK_DATA d, int index) { - PU_EMREXTCREATEFONTINDIRECTW pEmr = NULL; + PU_EMREXTCREATEFONTINDIRECTW pEmr = nullptr; if (index >= 0 && index < d->n_obj) pEmr = (PU_EMREXTCREATEFONTINDIRECTW) d->emf_obj[index].lpEMFR; @@ -1423,7 +1423,7 @@ Emf::select_font(PEMF_CALLBACK_DATA d, int index) d->dc[d->level].style.text_decoration_line.set = true; d->dc[d->level].style.text_decoration_line.inherit = false; // malformed EMF with empty filename may exist, ignore font change if encountered - char *ctmp = U_Utf16leToUtf8((uint16_t *) (pEmr->elfw.elfLogFont.lfFaceName), U_LF_FACESIZE, NULL); + char *ctmp = U_Utf16leToUtf8((uint16_t *) (pEmr->elfw.elfLogFont.lfFaceName), U_LF_FACESIZE, nullptr); if(ctmp){ if (d->dc[d->level].font_name){ free(d->dc[d->level].font_name); } if(*ctmp){ @@ -1448,7 +1448,7 @@ Emf::delete_object(PEMF_CALLBACK_DATA d, int index) // files too big to fit into memory. if (d->emf_obj[index].lpEMFR) free(d->emf_obj[index].lpEMFR); - d->emf_obj[index].lpEMFR = NULL; + d->emf_obj[index].lpEMFR = nullptr; } } @@ -1472,8 +1472,8 @@ int Emf::AI_hack(PU_EMRHEADER pEmr){ char *ptr; ptr = (char *)pEmr; PU_EMRSETMAPMODE nEmr = (PU_EMRSETMAPMODE) (ptr + pEmr->emr.nSize); - char *string = NULL; - if(pEmr->nDescription)string = U_Utf16leToUtf8((uint16_t *)((char *) pEmr + pEmr->offDescription), pEmr->nDescription, NULL); + char *string = nullptr; + if(pEmr->nDescription)string = U_Utf16leToUtf8((uint16_t *)((char *) pEmr + pEmr->offDescription), pEmr->nDescription, nullptr); if(string){ if((pEmr->nDescription >= 13) && (0==strcmp("Adobe Systems",string)) && @@ -1526,12 +1526,12 @@ void Emf::common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr, tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table uint32_t width, height, colortype, numCt, invert; // if needed these values will be set in get_DIB_params if(cbBits && cbBmi && (iUsage == U_DIB_RGB_COLORS)){ // next call returns pointers and values, but allocates no memory @@ -1573,7 +1573,7 @@ void Emf::common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr, } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG){ // image was binary jpg in source file tmp_image << " xlink:href=\"data:image/jpeg;base64,"; base64String = g_base64_encode((guchar*) px, numCt ); @@ -1630,14 +1630,14 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA int eDbgComment=0; int eDbgFinal=0; char const* eDbgString = getenv( "INKSCAPE_DBG_EMF" ); - if ( eDbgString != NULL ) { + if ( eDbgString != nullptr ) { if(strstr(eDbgString,"RECORD")){ eDbgRecord = 1; } if(strstr(eDbgString,"COMMENT")){ eDbgComment = 1; } if(strstr(eDbgString,"FINAL")){ eDbgFinal = 1; } } /* initialize the tsp for text reassembly */ - tsp.string = NULL; + tsp.string = nullptr; tsp.ori = 0.0; /* degrees */ tsp.fs = 12.0; /* font size */ tsp.x = 0.0; @@ -1874,14 +1874,14 @@ std::cout << "BEFORE DRAW" // Init the new emf_obj list elements to null, provided the // dynamic allocation succeeded. - if ( d->emf_obj != NULL ) + if ( d->emf_obj != nullptr ) { for( int i=0; i < d->n_obj; ++i ) - d->emf_obj[i].lpEMFR = NULL; + d->emf_obj[i].lpEMFR = nullptr; } //if } else { - d->emf_obj = NULL; + d->emf_obj = nullptr; } break; @@ -2352,7 +2352,7 @@ std::cout << "BEFORE DRAW" } if(d->dc[old_level].font_name){ free(d->dc[old_level].font_name); // else memory leak - d->dc[old_level].font_name = NULL; + d->dc[old_level].font_name = nullptr; } old_level--; } @@ -3095,7 +3095,7 @@ std::cout << "BEFORE DRAW" /* Rotation issues are handled entirely in libTERE now */ - uint32_t *dup_wt = NULL; + uint32_t *dup_wt = nullptr; if( lpEMFR->iType==U_EMR_EXTTEXTOUTA){ /* These should be JUST ASCII, but they might not be... @@ -3103,20 +3103,20 @@ std::cout << "BEFORE DRAW" If not, assume that it holds Latin1. If that fails then something is really screwed up! */ - dup_wt = U_Utf8ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, NULL); - if(!dup_wt)dup_wt = U_Latin1ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, NULL); + dup_wt = U_Utf8ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, nullptr); + if(!dup_wt)dup_wt = U_Latin1ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(pEmr->emrtext.nChars); } else if( lpEMFR->iType==U_EMR_EXTTEXTOUTW){ - dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmr + pEmr->emrtext.offString), pEmr->emrtext.nChars, NULL); + dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmr + pEmr->emrtext.offString), pEmr->emrtext.nChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(pEmr->emrtext.nChars); } else { // U_EMR_SMALLTEXTOUT if(pEmrS->fuOptions & U_ETO_SMALL_CHARS){ - dup_wt = U_Utf8ToUtf32le((char *) pEmrS + roff, cChars, NULL); + dup_wt = U_Utf8ToUtf32le((char *) pEmrS + roff, cChars, nullptr); } else { - dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmrS + roff), cChars, NULL); + dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmrS + roff), cChars, nullptr); } if(!dup_wt)dup_wt = unknown_chars(cChars); } @@ -3129,12 +3129,12 @@ std::cout << "BEFORE DRAW" } char *ansi_text; - ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, NULL); + ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, nullptr); free(dup_wt); // Empty string or starts with an invalid escape/control sequence, which is bogus text. Throw it out before g_markup_escape_text can make things worse if(*((uint8_t *)ansi_text) <= 0x1F){ free(ansi_text); - ansi_text=NULL; + ansi_text=nullptr; } if (ansi_text) { @@ -3528,18 +3528,18 @@ void Emf::free_emf_strings(EMF_STRINGS name){ SPDocument * Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { - if (uri == NULL) { - return NULL; + if (uri == nullptr) { + return nullptr; } // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); EMF_CALLBACK_DATA d; d.n_obj = 0; //these might not be set otherwise if the input file is corrupt - d.emf_obj = NULL; + d.emf_obj = nullptr; d.dc[0].font_name = strdup("Arial"); // Default font, set only on lowest level, it copies up from there EMF spec says device can pick whatever it wants // set up the size default for patterns in defs. This might not be referenced if there are no patterns defined in the drawing. @@ -3556,12 +3556,12 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) size_t length; char *contents; - if(emf_readdata(uri, &contents, &length))return(NULL); + if(emf_readdata(uri, &contents, &length))return(nullptr); - d.pDesc = NULL; + d.pDesc = nullptr; // set up the text reassembly system - if(!(d.tri = trinfo_init(NULL)))return(NULL); + if(!(d.tri = trinfo_init(nullptr)))return(nullptr); (void) trinfo_load_ft_opts(d.tri, 1, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP, FT_KERNING_UNSCALED); @@ -3573,7 +3573,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; - SPDocument *doc = NULL; + SPDocument *doc = nullptr; if (good) { doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); } diff --git a/src/extension/internal/emf-inout.h b/src/extension/internal/emf-inout.h index 3c2a814aa..bef58b612 100644 --- a/src/extension/internal/emf-inout.h +++ b/src/extension/internal/emf-inout.h @@ -33,7 +33,7 @@ typedef struct emf_object { emf_object() : type(0), level(0), - lpEMFR(NULL) + lpEMFR(nullptr) {}; int type; int level; @@ -44,7 +44,7 @@ typedef struct emf_strings { emf_strings() : size(0), count(0), - strings(NULL) + strings(nullptr) {}; int size; // number of slots allocated in strings int count; // number of slots used in strings @@ -54,7 +54,7 @@ typedef struct emf_strings { typedef struct emf_device_context { emf_device_context() : // SPStyle: class with constructor - font_name(NULL), + font_name(nullptr), clip_id(0), stroke_set(false), stroke_mode(0), stroke_idx(0), stroke_recidx(0), fill_set(false), fill_mode(0), fill_idx(0), fill_recidx(0), @@ -67,7 +67,7 @@ typedef struct emf_device_context { textAlign(0) // worldTransform, cur { - font_name = NULL; + font_name = nullptr; sizeWnd = sizel_set( 0.0, 0.0 ); sizeView = sizel_set( 0.0, 0.0 ); winorg = point32_set( 0.0, 0.0 ); @@ -127,9 +127,9 @@ typedef struct emf_callback_data { dwRop2(U_R2_COPYPEN), dwRop3(0), MMX(0),MMY(0), drawtype(0), - pDesc(NULL), + pDesc(nullptr), // hatches, images, gradients, struct w/ constructor - tri(NULL), + tri(nullptr), n_obj(0) // emf_obj; {}; diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 0b005f8da..ec4594eea 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -75,8 +75,8 @@ namespace Internal { /* globals */ static double PX2WORLD; static bool FixPPTCharPos, FixPPTDashLine, FixPPTGrad2Polys, FixPPTLinGrad, FixPPTPatternAsHatch, FixImageRot; -static EMFTRACK *et = NULL; -static EMFHANDLES *eht = NULL; +static EMFTRACK *et = nullptr; +static EMFHANDLES *eht = nullptr; void PrintEmf::smuggle_adxkyrtl_out(const char *string, uint32_t **adx, double *ky, int *rtl, int *ndx, float scale) { @@ -85,7 +85,7 @@ void PrintEmf::smuggle_adxkyrtl_out(const char *string, uint32_t **adx, double * uint32_t *ladx; const char *cptr = &string[strlen(string) + 1]; // this works because of the first fake terminator - *adx = NULL; + *adx = nullptr; *ky = 0.0; // set a default value sscanf(cptr, "%7d", ndx); if (!*ndx) { @@ -207,12 +207,12 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) p = ansi_uri; } snprintf(buff, sizeof(buff) - 1, "Inkscape %s \1%s\1", Inkscape::version_string, p); - uint16_t *Description = U_Utf8ToUtf16le(buff, 0, NULL); + uint16_t *Description = U_Utf8ToUtf16le(buff, 0, nullptr); int cbDesc = 2 + wchar16len(Description); // also count the final terminator (void) U_Utf16leEdit(Description, '\1', '\0'); // swap the temporary \1 characters for nulls // construct the EMRHEADER record and append it to the EMF in memory - rec = U_EMRHEADER_set(rclBounds, rclFrame, NULL, cbDesc, Description, szlDev, szlMm, 0); + rec = U_EMRHEADER_set(rclBounds, rclFrame, nullptr, cbDesc, Description, szlDev, szlMm, 0); free(Description); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::begin at EMRHEADER"); @@ -301,7 +301,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) unsigned int PrintEmf::finish(Inkscape::Extension::Print * /*mod*/) { - do_clip_if_present(NULL); // Terminate any open clip. + do_clip_if_present(nullptr); // Terminate any open clip. char *rec; if (!et) { return 0; @@ -310,7 +310,7 @@ unsigned int PrintEmf::finish(Inkscape::Extension::Print * /*mod*/) // earlier versions had flush of fill here, but it never executed and was removed - rec = U_EMREOF_set(0, NULL, et); // generate the EOF record + rec = U_EMREOF_set(0, nullptr, et); // generate the EOF record if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::finish"); } @@ -410,8 +410,8 @@ int PrintEmf::create_brush(SPStyle const *style, PU_COLORREF fcolor) } else if (SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style))) { // must be a gradient // currently we do not do anything with gradients, the code below just sets the color to the average of the stops SPPaintServer *paintserver = style->fill.value.href->getObject(); - SPLinearGradient *lg = NULL; - SPRadialGradient *rg = NULL; + SPLinearGradient *lg = nullptr; + SPRadialGradient *rg = nullptr; if (SP_IS_LINEARGRADIENT(paintserver)) { lg = SP_LINEARGRADIENT(paintserver); @@ -533,8 +533,8 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) { U_EXTLOGPEN *elp; U_NUM_STYLEENTRY n_dash = 0; - U_STYLEENTRY *dash = NULL; - char *rec = NULL; + U_STYLEENTRY *dash = nullptr; + char *rec = nullptr; int linestyle = U_PS_SOLID; int linecap = 0; int linejoin = 0; @@ -545,14 +545,14 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) U_COLORREF hatchColor; U_COLORREF bkColor; uint32_t width, height; - char *px = NULL; + char *px = nullptr; char *rgba_px; uint32_t cbPx = 0; uint32_t colortype; - PU_RGBQUAD ct = NULL; + PU_RGBQUAD ct = nullptr; int numCt = 0; U_BITMAPINFOHEADER Bmih; - PU_BITMAPINFO Bmi = NULL; + PU_BITMAPINFO Bmi = nullptr; if (!et) { return 0; @@ -729,7 +729,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) U_RGB(0, 0, 0), U_HS_HORIZONTAL, 0, - NULL); + nullptr); } rec = extcreatepen_set(&pen, eht, Bmi, cbPx, px, elp); @@ -772,7 +772,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) // set the current pen to the stock object NULL_PEN and then delete the defined pen object, if there is one. void PrintEmf::destroy_pen() { - char *rec = NULL; + char *rec = nullptr; // before an object may be safely deleted it must no longer be selected // select in a stock object to deselect this one, the stock object should // never be used because we always select in a new one before drawing anythingrestore previous brush, necessary??? Would using a default stock object not work? @@ -987,14 +987,14 @@ U_TRIVERTEX PrintEmf::make_trivertex(Geom::Point Pt, U_COLORREF uc){ */ void PrintEmf::do_clip_if_present(SPStyle const *style){ char *rec; - static SPClipPath *scpActive = NULL; + static SPClipPath *scpActive = nullptr; if(!style){ if(scpActive){ // clear the existing clip rec = U_EMRRESTOREDC_set(-1); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::fill at U_EMRRESTOREDC_set"); } - scpActive=NULL; + scpActive=nullptr; } } else { /* The current implementation converts only one level of clipping. If there were more @@ -1005,10 +1005,10 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ Note, to debug this section of code use print statements on sp_svg_write_path(combined_pathvector). */ /* find the first clip_ref at object or up the stack. There may not be one. */ - SPClipPath *scp = NULL; + SPClipPath *scp = nullptr; SPItem *item = SP_ITEM(style->object); while(1) { - scp = (item->clip_ref ? item->clip_ref->getObject() : NULL); + scp = (item->clip_ref ? item->clip_ref->getObject() : nullptr); if(scp)break; item = SP_ITEM(item->parent); if(!item || SP_IS_ROOT(item))break; // this will never be a clipping path @@ -1020,7 +1020,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::fill at U_EMRRESTOREDC_set"); } - scpActive = NULL; + scpActive = nullptr; } if (scp) { // set the new clip @@ -1067,7 +1067,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ } } else { - scpActive = NULL; // no valid path available to draw, so no DC was saved, so no signal to restore + scpActive = nullptr; // no valid path available to draw, so no DC was saved, so no signal to restore } } // change or remove clipping } // scp exists @@ -1133,7 +1133,7 @@ unsigned int PrintEmf::fill( fill_transform = tf; - int brush_stat = create_brush(style, NULL); + int brush_stat = create_brush(style, nullptr); /* native linear gradients are only used if the object is a rectangle AND the gradient is parallel to the sides of the object */ bool is_Rect = false; @@ -1428,7 +1428,7 @@ unsigned int PrintEmf::stroke( Geom::OptRect const &/*pbox*/, Geom::OptRect const &/*dbox*/, Geom::OptRect const &/*bbox*/) { - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); do_clip_if_present(style); // If clipping is needed set it up @@ -1508,7 +1508,7 @@ bool PrintEmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff int moves = 0; int lines = 0; int curves = 0; - char *rec = NULL; + char *rec = nullptr; for (Geom::PathVector::iterator pit = pv.begin(); pit != pv.end(); ++pit) { moves++; @@ -1718,7 +1718,7 @@ unsigned int PrintEmf::image( SPStyle const *style) /** provides indirect link to image object */ { double x1, y1, dw, dh; - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); do_clip_if_present(style); // If clipping is needed set it up @@ -1923,7 +1923,7 @@ unsigned int PrintEmf::draw_pathv_to_EMF(Geom::PathVector const &pathv, const Ge unsigned int PrintEmf::print_pathv(Geom::PathVector const &pathv, const Geom::Affine &transform) { Geom::Affine tf = transform; - char *rec = NULL; + char *rec = nullptr; simple_shape = print_simple_shape(pathv, tf); if (simple_shape || pathv.empty()) { @@ -1976,7 +1976,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } do_clip_if_present(style); // If clipping is needed set it up - char *rec = NULL; + char *rec = nullptr; int ccount, newfont; int fix90n = 0; uint32_t hfont = 0; @@ -2006,7 +2006,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } char *text2 = strdup(text); // because U_Utf8ToUtf16le calls iconv which does not like a const char * - uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, NULL); + uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, nullptr); free(text2); //translates Unicode to NonUnicode, if possible. If any translate, all will, and all to //the same font, because of code in Layout::print @@ -2058,9 +2058,9 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te // of the special fonts. uint16_t *wfacename; if (!newfont) { - wfacename = U_Utf8ToUtf16le(style->font_family.value, 0, NULL); + wfacename = U_Utf8ToUtf16le(style->font_family.value, 0, nullptr); } else { - wfacename = U_Utf8ToUtf16le(FontName(newfont), 0, NULL); + wfacename = U_Utf8ToUtf16le(FontName(newfont), 0, nullptr); } // Scale the text to the minimum stretch. (It tends to stay within bounding rectangles even if @@ -2084,7 +2084,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te wfacename); free(wfacename); - rec = extcreatefontindirectw_set(&hfont, eht, (char *) &lf, NULL); + rec = extcreatefontindirectw_set(&hfont, eht, (char *) &lf, nullptr); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::text at extcreatefontindirectw_set"); } diff --git a/src/extension/internal/filter/bevels.h b/src/extension/internal/filter/bevels.h index 91fe2f8cf..4c2ddc719 100644 --- a/src/extension/internal/filter/bevels.h +++ b/src/extension/internal/filter/bevels.h @@ -45,7 +45,7 @@ protected: public: DiffuseLight ( ) : Filter() { }; - ~DiffuseLight ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~DiffuseLight ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -73,7 +73,7 @@ public: gchar const * DiffuseLight::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream elevation; @@ -125,7 +125,7 @@ protected: public: MatteJelly ( ) : Filter() { }; - ~MatteJelly ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~MatteJelly ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -154,7 +154,7 @@ public: gchar const * MatteJelly::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream bright; @@ -209,7 +209,7 @@ protected: public: SpecularLight ( ) : Filter() { }; - ~SpecularLight ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~SpecularLight ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -238,7 +238,7 @@ public: gchar const * SpecularLight::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream bright; diff --git a/src/extension/internal/filter/blurs.h b/src/extension/internal/filter/blurs.h index 0956b23b6..c99b9efac 100644 --- a/src/extension/internal/filter/blurs.h +++ b/src/extension/internal/filter/blurs.h @@ -46,7 +46,7 @@ protected: public: Blur ( ) : Filter() { }; - ~Blur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Blur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -73,7 +73,7 @@ public: gchar const * Blur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream bbox; std::ostringstream hblur; @@ -117,7 +117,7 @@ protected: public: CleanEdges ( ) : Filter() { }; - ~CleanEdges ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CleanEdges ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -142,7 +142,7 @@ public: gchar const * CleanEdges::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; @@ -177,7 +177,7 @@ protected: public: CrossBlur ( ) : Filter() { }; - ~CrossBlur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CrossBlur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -211,7 +211,7 @@ public: gchar const * CrossBlur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream bright; std::ostringstream fade; @@ -252,7 +252,7 @@ protected: public: Feather ( ) : Filter() { }; - ~Feather ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Feather ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -277,7 +277,7 @@ public: gchar const * Feather::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; @@ -317,7 +317,7 @@ protected: public: ImageBlur ( ) : Filter() { }; - ~ImageBlur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ImageBlur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -361,7 +361,7 @@ public: gchar const * ImageBlur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream hblur; std::ostringstream vblur; diff --git a/src/extension/internal/filter/bumps.h b/src/extension/internal/filter/bumps.h index 95f6170f3..0eaee7a5f 100644 --- a/src/extension/internal/filter/bumps.h +++ b/src/extension/internal/filter/bumps.h @@ -72,7 +72,7 @@ protected: public: Bump ( ) : Filter() { }; - ~Bump ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Bump ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -152,7 +152,7 @@ public: gchar const * Bump::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simplifyImage; std::ostringstream simplifyBump; @@ -301,7 +301,7 @@ protected: public: WaxBump ( ) : Filter() { }; - ~WaxBump ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~WaxBump ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -372,7 +372,7 @@ public: gchar const * WaxBump::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simplifyImage; std::ostringstream simplifyBump; diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index 063073267..ae6bc718c 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -66,7 +66,7 @@ protected: public: Brilliance ( ) : Filter() { }; - ~Brilliance ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Brilliance ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -93,7 +93,7 @@ public: gchar const * Brilliance::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream brightness; std::ostringstream sat; @@ -146,7 +146,7 @@ protected: public: ChannelPaint ( ) : Filter() { }; - ~ChannelPaint ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ChannelPaint ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -182,7 +182,7 @@ public: gchar const * ChannelPaint::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream saturation; std::ostringstream red; @@ -247,7 +247,7 @@ protected: public: ColorBlindness ( ) : Filter() { }; - ~ColorBlindness ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorBlindness ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -293,7 +293,7 @@ public: gchar const * ColorBlindness::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; type << ext->get_param_enum("type"); @@ -322,7 +322,7 @@ protected: public: ColorShift ( ) : Filter() { }; - ~ColorShift ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorShift ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -348,7 +348,7 @@ public: gchar const * ColorShift::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream shift; std::ostringstream sat; @@ -385,7 +385,7 @@ protected: public: Colorize ( ) : Filter() { }; - ~Colorize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Colorize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -433,7 +433,7 @@ public: gchar const * Colorize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; @@ -492,7 +492,7 @@ protected: public: ComponentTransfer ( ) : Filter() { }; - ~ComponentTransfer ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ComponentTransfer ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -522,7 +522,7 @@ public: gchar const * ComponentTransfer::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream CTfunction; const gchar *type = ext->get_param_enum("type"); @@ -577,7 +577,7 @@ protected: public: Duochrome ( ) : Filter() { }; - ~Duochrome ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Duochrome ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -618,7 +618,7 @@ public: gchar const * Duochrome::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a1; std::ostringstream r1; @@ -702,7 +702,7 @@ protected: public: ExtractChannel ( ) : Filter() { }; - ~ExtractChannel ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ExtractChannel ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -739,7 +739,7 @@ public: gchar const * ExtractChannel::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blend; std::ostringstream colors; @@ -808,7 +808,7 @@ protected: public: FadeToBW ( ) : Filter() { }; - ~FadeToBW ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~FadeToBW ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -836,7 +836,7 @@ public: gchar const * FadeToBW::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream level; std::ostringstream wlevel; @@ -887,7 +887,7 @@ protected: public: Greyscale ( ) : Filter() { }; - ~Greyscale ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Greyscale ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -915,7 +915,7 @@ public: gchar const * Greyscale::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream red; std::ostringstream green; @@ -973,7 +973,7 @@ protected: public: Invert ( ) : Filter() { }; - ~Invert ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Invert ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1007,7 +1007,7 @@ public: gchar const * Invert::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream line1; std::ostringstream line2; @@ -1108,7 +1108,7 @@ protected: public: Lighting ( ) : Filter() { }; - ~Lighting ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Lighting ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1134,7 +1134,7 @@ public: gchar const * Lighting::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream amplitude; std::ostringstream exponent; @@ -1179,7 +1179,7 @@ protected: public: LightnessContrast ( ) : Filter() { }; - ~LightnessContrast ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~LightnessContrast ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1204,7 +1204,7 @@ public: gchar const * LightnessContrast::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream lightness; std::ostringstream contrast; @@ -1258,7 +1258,7 @@ protected: public: NudgeRGB ( ) : Filter() { }; - ~NudgeRGB ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NudgeRGB ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1297,7 +1297,7 @@ public: gchar const * NudgeRGB::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream rx; std::ostringstream ry; @@ -1370,7 +1370,7 @@ protected: public: NudgeCMY ( ) : Filter() { }; - ~NudgeCMY ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NudgeCMY ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1409,7 +1409,7 @@ public: gchar const * NudgeCMY::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream cx; std::ostringstream cy; @@ -1476,7 +1476,7 @@ protected: public: Quadritone ( ) : Filter() { }; - ~Quadritone ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Quadritone ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1515,7 +1515,7 @@ public: gchar const * Quadritone::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream dist; std::ostringstream colors; @@ -1559,7 +1559,7 @@ protected: public: SimpleBlend ( ) : Filter() { }; - ~SimpleBlend ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~SimpleBlend ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1600,7 +1600,7 @@ public: gchar const * SimpleBlend::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; @@ -1645,7 +1645,7 @@ protected: public: Solarize ( ) : Filter() { }; - ~Solarize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Solarize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1674,7 +1674,7 @@ public: gchar const * Solarize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream rotate; std::ostringstream blend1; @@ -1732,7 +1732,7 @@ protected: public: Tritone ( ) : Filter() { }; - ~Tritone ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Tritone ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1785,7 +1785,7 @@ public: gchar const * Tritone::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream dist; std::ostringstream a; diff --git a/src/extension/internal/filter/distort.h b/src/extension/internal/filter/distort.h index 6d1fc0a75..f1654d075 100644 --- a/src/extension/internal/filter/distort.h +++ b/src/extension/internal/filter/distort.h @@ -59,7 +59,7 @@ protected: public: FeltFeather ( ) : Filter() { }; - ~FeltFeather ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~FeltFeather ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -106,7 +106,7 @@ public: gchar const * FeltFeather::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream hblur; @@ -182,7 +182,7 @@ protected: public: Roughen ( ) : Filter() { }; - ~Roughen ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Roughen ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -215,7 +215,7 @@ public: gchar const * Roughen::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; diff --git a/src/extension/internal/filter/filter-file.cpp b/src/extension/internal/filter/filter-file.cpp index 07a7eb0af..241f0f52c 100644 --- a/src/extension/internal/filter/filter-file.cpp +++ b/src/extension/internal/filter/filter-file.cpp @@ -34,7 +34,7 @@ void filters_load_file (Glib::ustring filename, gchar * menuname) { Inkscape::XML::Document *doc = sp_repr_read_file(filename.c_str(), INKSCAPE_EXTENSION_URI); - if (doc == NULL) { + if (doc == nullptr) { g_warning("File (%s) is not parseable as XML. Ignored.", filename.c_str()); return; } @@ -47,10 +47,10 @@ filters_load_file (Glib::ustring filename, gchar * menuname) } for (Inkscape::XML::Node * child = root->firstChild(); - child != NULL; child = child->next()) { + child != nullptr; child = child->next()) { if (!strcmp(child->name(), "svg:defs")) { for (Inkscape::XML::Node * defs = child->firstChild(); - defs != NULL; defs = defs->next()) { + defs != nullptr; defs = defs->next()) { if (!strcmp(defs->name(), "svg:filter")) { Filter::filters_load_node(defs, menuname); } // oh! a filter @@ -97,7 +97,7 @@ Filter::filters_load_node (Inkscape::XML::Node * node, gchar * menuname) gchar const * menu_tooltip = node->attribute("inkscape:menu-tooltip"); gchar const * id = node->attribute("id"); - if (label == NULL) { + if (label == nullptr) { label = id; } diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 166e5406f..8e32bc05d 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -27,7 +27,7 @@ namespace Filter { Filter::Filter() : Inkscape::Extension::Implementation::Implementation(), - _filter(NULL) { + _filter(nullptr) { return; } @@ -38,8 +38,8 @@ Filter::Filter(gchar const * filter) : } Filter::~Filter (void) { - if (_filter != NULL) { - _filter = NULL; + if (_filter != nullptr) { + _filter = nullptr; } return; @@ -53,7 +53,7 @@ bool Filter::load(Inkscape::Extension::Extension * /*module*/) Inkscape::Extension::Implementation::ImplementationDocumentCache *Filter::newDocCache(Inkscape::Extension::Extension * /*ext*/, Inkscape::UI::View::View * /*doc*/) { - return NULL; + return nullptr; } gchar const *Filter::get_filter_text(Inkscape::Extension::Extension * /*ext*/) @@ -64,7 +64,7 @@ gchar const *Filter::get_filter_text(Inkscape::Extension::Extension * /*ext*/) Inkscape::XML::Document * Filter::get_filter (Inkscape::Extension::Extension * ext) { gchar const * filter = get_filter_text(ext); - return sp_repr_read_mem(filter, strlen(filter), NULL); + return sp_repr_read_mem(filter, strlen(filter), nullptr); } void @@ -72,7 +72,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic, gchar const * srcGraphicAlpha) { - if (from == NULL) return; + if (from == nullptr) return; // copy attributes for ( Inkscape::Util::List<Inkscape::XML::AttributeRecord const> iter = from->attributeList() ; @@ -83,11 +83,11 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, to->setAttribute(attr, from->attribute(attr)); if (!strcmp(attr, "in") || !strcmp(attr, "in2") || !strcmp(attr, "in3")) { - if (srcGraphic != NULL && !strcmp(from->attribute(attr), "SourceGraphic")) { + if (srcGraphic != nullptr && !strcmp(from->attribute(attr), "SourceGraphic")) { to->setAttribute(attr, srcGraphic); } - if (srcGraphicAlpha != NULL && !strcmp(from->attribute(attr), "SourceAlpha")) { + if (srcGraphicAlpha != nullptr && !strcmp(from->attribute(attr), "SourceAlpha")) { to->setAttribute(attr, srcGraphicAlpha); } } @@ -95,7 +95,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, // for each child call recursively for (Inkscape::XML::Node * from_child = from->firstChild(); - from_child != NULL ; from_child = from_child->next()) { + from_child != nullptr ; from_child = from_child->next()) { Glib::ustring name = "svg:"; name += from_child->name(); @@ -103,7 +103,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, to->appendChild(to_child); merge_filters(to_child, from_child, doc, srcGraphic, srcGraphicAlpha); - if (from_child == from->firstChild() && !strcmp("filter", from->name()) && srcGraphic != NULL && to_child->attribute("in") == NULL) { + if (from_child == from->firstChild() && !strcmp("filter", from->name()) && srcGraphic != nullptr && to_child->attribute("in") == nullptr) { to_child->setAttribute("in", srcGraphic); } Inkscape::GC::release(to_child); @@ -117,7 +117,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { Inkscape::XML::Document *filterdoc = get_filter(module); - if (filterdoc == NULL) { + if (filterdoc == nullptr) { return; // could not parse the XML source of the filter; typically parser will stderr a warning } @@ -136,9 +136,9 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::XML::Node * node = spitem->getRepr(); SPCSSAttr * css = sp_repr_css_attr(node, "style"); - gchar const * filter = sp_repr_css_property(css, "filter", NULL); + gchar const * filter = sp_repr_css_property(css, "filter", nullptr); - if (filter == NULL) { + if (filter == nullptr) { Inkscape::XML::Node * newfilterroot = xmldoc->createElement("svg:filter"); merge_filters(newfilterroot, filterdoc->root(), xmldoc); @@ -159,8 +159,8 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie } gchar * lfilter = g_strndup(filter + 5, strlen(filter) - 6); - Inkscape::XML::Node * filternode = NULL; - for (Inkscape::XML::Node * child = defsrepr->firstChild(); child != NULL; child = child->next()) { + Inkscape::XML::Node * filternode = nullptr; + for (Inkscape::XML::Node * child = defsrepr->firstChild(); child != nullptr; child = child->next()) { if (!strcmp(lfilter, child->attribute("id"))) { filternode = child; break; @@ -169,12 +169,12 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie g_free(lfilter); // no filter - if (filternode == NULL) { + if (filternode == nullptr) { g_warning("no assigned filter found!"); continue; } - if (filternode->lastChild() == NULL) { + if (filternode->lastChild() == nullptr) { // empty filter, we insert merge_filters(filternode, filterdoc->root(), xmldoc); } else { diff --git a/src/extension/internal/filter/filter.h b/src/extension/internal/filter/filter.h index ea4ae2302..3a5b8a811 100644 --- a/src/extension/internal/filter/filter.h +++ b/src/extension/internal/filter/filter.h @@ -37,7 +37,7 @@ protected: private: Inkscape::XML::Document * get_filter (Inkscape::Extension::Extension * ext); - void merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic = NULL, gchar const * srcGraphicAlpha = NULL); + void merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic = nullptr, gchar const * srcGraphicAlpha = nullptr); public: Filter(); diff --git a/src/extension/internal/filter/image.h b/src/extension/internal/filter/image.h index 9cbe05e2f..592e41b9f 100644 --- a/src/extension/internal/filter/image.h +++ b/src/extension/internal/filter/image.h @@ -41,7 +41,7 @@ protected: public: EdgeDetect ( ) : Filter() { }; - ~EdgeDetect ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~EdgeDetect ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -72,7 +72,7 @@ public: gchar const * EdgeDetect::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream matrix; std::ostringstream inverted; diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h index 025cca8fe..905e71e67 100644 --- a/src/extension/internal/filter/morphology.h +++ b/src/extension/internal/filter/morphology.h @@ -50,7 +50,7 @@ protected: public: Crosssmooth ( ) : Filter() { }; - ~Crosssmooth ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Crosssmooth ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -86,7 +86,7 @@ public: gchar const * Crosssmooth::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream width; @@ -158,7 +158,7 @@ protected: public: Outline ( ) : Filter() { }; - ~Outline ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Outline ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -213,7 +213,7 @@ public: gchar const * Outline::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream width1; std::ostringstream dilat1; diff --git a/src/extension/internal/filter/overlays.h b/src/extension/internal/filter/overlays.h index a0436e2ad..e0f78be9c 100644 --- a/src/extension/internal/filter/overlays.h +++ b/src/extension/internal/filter/overlays.h @@ -48,7 +48,7 @@ protected: public: NoiseFill ( ) : Filter() { }; - ~NoiseFill ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NoiseFill ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -90,7 +90,7 @@ public: gchar const * NoiseFill::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h index 653008fc6..aae71fcf3 100644 --- a/src/extension/internal/filter/paint.h +++ b/src/extension/internal/filter/paint.h @@ -63,7 +63,7 @@ protected: public: Chromolitho ( ) : Filter() { }; - ~Chromolitho ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Chromolitho ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -122,7 +122,7 @@ public: gchar const * Chromolitho::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream b1in; std::ostringstream b2in; @@ -224,7 +224,7 @@ protected: public: CrossEngraving ( ) : Filter() { }; - ~CrossEngraving ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CrossEngraving ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -253,7 +253,7 @@ public: gchar const * CrossEngraving::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream clean; std::ostringstream dilat; @@ -323,7 +323,7 @@ protected: public: Drawing ( ) : Filter() { }; - ~Drawing ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Drawing ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -372,7 +372,7 @@ public: gchar const * Drawing::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simply; std::ostringstream clean; @@ -486,7 +486,7 @@ protected: public: Electrize ( ) : Filter() { }; - ~Electrize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Electrize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -516,7 +516,7 @@ public: gchar const * Electrize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream type; @@ -576,7 +576,7 @@ protected: public: NeonDraw ( ) : Filter() { }; - ~NeonDraw ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NeonDraw ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -611,7 +611,7 @@ public: gchar const * NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blend; std::ostringstream simply; @@ -679,7 +679,7 @@ protected: public: PointEngraving ( ) : Filter() { }; - ~PointEngraving ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~PointEngraving ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -735,7 +735,7 @@ public: gchar const * PointEngraving::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; @@ -842,7 +842,7 @@ protected: public: Posterize ( ) : Filter() { }; - ~Posterize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Posterize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -886,7 +886,7 @@ public: gchar const * Posterize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream table; std::ostringstream blendmode; @@ -965,7 +965,7 @@ protected: public: PosterizeBasic ( ) : Filter() { }; - ~PosterizeBasic ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~PosterizeBasic ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -990,7 +990,7 @@ public: gchar const * PosterizeBasic::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream transf; diff --git a/src/extension/internal/filter/protrusions.h b/src/extension/internal/filter/protrusions.h index c4cd2a688..0abac91e7 100644 --- a/src/extension/internal/filter/protrusions.h +++ b/src/extension/internal/filter/protrusions.h @@ -39,7 +39,7 @@ protected: public: Snow ( ) : Filter() { }; - ~Snow ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Snow ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } public: static void init (void) { @@ -65,7 +65,7 @@ public: gchar const * Snow::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream drift; drift << ext->get_param_float("drift"); diff --git a/src/extension/internal/filter/shadows.h b/src/extension/internal/filter/shadows.h index cca34e2a2..19cfdaba7 100644 --- a/src/extension/internal/filter/shadows.h +++ b/src/extension/internal/filter/shadows.h @@ -49,7 +49,7 @@ protected: public: ColorizableDropShadow ( ) : Filter() { }; - ~ColorizableDropShadow ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorizableDropShadow ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -91,7 +91,7 @@ public: gchar const * ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream a; diff --git a/src/extension/internal/filter/textures.h b/src/extension/internal/filter/textures.h index 39b1789b3..3340643a5 100644 --- a/src/extension/internal/filter/textures.h +++ b/src/extension/internal/filter/textures.h @@ -53,7 +53,7 @@ protected: public: InkBlot ( ) : Filter() { }; - ~InkBlot ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~InkBlot ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } public: static void init (void) { @@ -101,7 +101,7 @@ public: gchar const * InkBlot::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream freq; diff --git a/src/extension/internal/filter/transparency.h b/src/extension/internal/filter/transparency.h index b3498a638..1239c1fac 100644 --- a/src/extension/internal/filter/transparency.h +++ b/src/extension/internal/filter/transparency.h @@ -45,7 +45,7 @@ protected: public: Blend ( ) : Filter() { }; - ~Blend ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Blend ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -80,7 +80,7 @@ public: gchar const * Blend::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream source; std::ostringstream mode; @@ -122,7 +122,7 @@ protected: public: ChannelTransparency ( ) : Filter() { }; - ~ChannelTransparency ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ChannelTransparency ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -150,7 +150,7 @@ public: gchar const * ChannelTransparency::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream red; std::ostringstream green; @@ -197,7 +197,7 @@ protected: public: LightEraser ( ) : Filter() { }; - ~LightEraser ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~LightEraser ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -224,7 +224,7 @@ public: gchar const * LightEraser::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream expand; std::ostringstream erode; @@ -271,7 +271,7 @@ protected: public: Opacity ( ) : Filter() { }; - ~Opacity ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Opacity ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -297,7 +297,7 @@ public: gchar const * Opacity::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream matrix; std::ostringstream opacity; @@ -333,7 +333,7 @@ protected: public: Silhouette ( ) : Filter() { }; - ~Silhouette ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Silhouette ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -360,7 +360,7 @@ public: gchar const * Silhouette::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index efac1a02e..ba90c747e 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -64,14 +64,14 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) } bool embed = ( link.compare( "embed" ) == 0 ); - SPDocument *doc = NULL; + SPDocument *doc = nullptr; std::unique_ptr<Inkscape::Pixbuf> pb(Inkscape::Pixbuf::create_from_file(uri)); // TODO: the pixbuf is created again from the base64-encoded attribute in SPImage. // Find a way to create the pixbuf only once. if (pb) { - doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); + doc = SPDocument::createNewDoc(nullptr, TRUE, TRUE); bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); // no need to undo in this temporary document @@ -79,7 +79,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) double height = pb->height(); double defaultxdpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", Inkscape::Util::Quantity::convert(1, "in", "px")); //bool forcexdpi = prefs->getBool("/dialogs/import/forcexdpi"); - ImageResolution *ir = 0; + ImageResolution *ir = nullptr; double xscale = 1; double yscale = 1; @@ -126,7 +126,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) sp_embed_image(image_node, pb.get()); } else { // convert filename to uri - gchar* _uri = g_filename_to_uri(uri, NULL, NULL); + gchar* _uri = g_filename_to_uri(uri, nullptr, nullptr); if(_uri) { image_node->setAttribute("xlink:href", _uri); g_free(_uri); @@ -174,8 +174,8 @@ GdkpixbufInput::init(void) gchar **extensions = gdk_pixbuf_format_get_extensions(pixformat); gchar **mimetypes = gdk_pixbuf_format_get_mime_types(pixformat); - for (int i = 0; extensions[i] != NULL; i++) { - for (int j = 0; mimetypes[j] != NULL; j++) { + for (int i = 0; extensions[i] != nullptr; i++) { + for (int j = 0; mimetypes[j] != nullptr; j++) { /* thanks but no thanks, we'll handle SVG extensions... */ if (strcmp(extensions[i], "svg") == 0) { diff --git a/src/extension/internal/gimpgrad.cpp b/src/extension/internal/gimpgrad.cpp index e6a429d34..1323ca7bc 100644 --- a/src/extension/internal/gimpgrad.cpp +++ b/src/extension/internal/gimpgrad.cpp @@ -133,13 +133,13 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) { Inkscape::IO::dump_fopen_call(filename, "I"); FILE *gradient = Inkscape::IO::fopen_utf8name(filename, "r"); - if (gradient == NULL) { - return NULL; + if (gradient == nullptr) { + return nullptr; } { char tempstr[1024]; - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the read failed" << std::endl; goto error; } @@ -149,7 +149,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) } /* Name field. */ - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the second read failed" << std::endl; goto error; } @@ -157,18 +157,18 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) goto error; } /* Handle very long names. (And also handle nul bytes gracefully: don't use strlen.) */ - while (memchr(tempstr, '\n', sizeof(tempstr) - 1) == NULL) { - if (fgets(tempstr, sizeof(tempstr), gradient) == 0) { + while (memchr(tempstr, '\n', sizeof(tempstr) - 1) == nullptr) { + if (fgets(tempstr, sizeof(tempstr), gradient) == nullptr) { goto error; } } /* n. segments */ - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the third read failed" << std::endl; goto error; } - char *endptr = NULL; + char *endptr = nullptr; long const n_segs = strtol(tempstr, &endptr, 10); if ((*endptr != '\n') || n_segs < 1) { @@ -183,11 +183,11 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) Glib::ustring outsvg("<svg><defs><linearGradient>\n"); long n_segs_found = 0; double prev_right = 0.0; - while (fgets(tempstr, 1024, gradient) != 0) { + while (fgets(tempstr, 1024, gradient) != nullptr) { double dbls[3 + 4 + 4]; gchar *p = tempstr; for (unsigned i = 0; i < G_N_ELEMENTS(dbls); ++i) { - gchar *end = NULL; + gchar *end = nullptr; double const xi = g_ascii_strtod(p, &end); if (!end || end == p || !g_ascii_isspace(*end)) { goto error; @@ -260,7 +260,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) error: fclose(gradient); - return NULL; + return nullptr; } #include "clear-n_.h" diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index c7ebf2494..5347eaa86 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -180,7 +180,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View SPDocument * current_document = view->doc(); auto selected = ((SPDesktop *) view)->getSelection()->items(); - Inkscape::XML::Node * first_select = NULL; + Inkscape::XML::Node * first_select = nullptr; if (!selected.empty()) { first_select = selected.front()->getRepr(); } diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index 558276999..e5b1e4619 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -110,18 +110,18 @@ void ImageResolution::readpng(char const *fn) { return; } - png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); + png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png_ptr) return; png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_read_struct(&png_ptr, 0, 0); + png_destroy_read_struct(&png_ptr, nullptr, nullptr); return; } if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, 0); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); fclose(fp); return; } @@ -153,7 +153,7 @@ void ImageResolution::readpng(char const *fn) { } #endif - png_destroy_read_struct(&png_ptr, &info_ptr, 0); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); fclose(fp); if (ok_) { diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index d4666fcee..5646eeefd 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -65,11 +65,11 @@ namespace Internal static void err(const char *fmt, ...) { va_list args; - g_log(NULL, G_LOG_LEVEL_WARNING, "javafx-out err: "); + g_log(nullptr, G_LOG_LEVEL_WARNING, "javafx-out err: "); va_start(args, fmt); - g_logv(NULL, G_LOG_LEVEL_WARNING, fmt, args); + g_logv(nullptr, G_LOG_LEVEL_WARNING, fmt, args); va_end(args); - g_log(NULL, G_LOG_LEVEL_WARNING, "\n"); + g_log(nullptr, G_LOG_LEVEL_WARNING, "\n"); } @@ -222,7 +222,7 @@ void JavaFXOutput::out(const char *fmt, ...) */ bool JavaFXOutput::doHeader() { - time_t tim = time(NULL); + time_t tim = time(nullptr); out("/*###################################################################\n"); out("### This JavaFX document was generated by Inkscape\n"); out("### http://www.inkscape.org\n"); diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 0581f8edd..e1da0bab6 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -40,7 +40,7 @@ LatexOutput::~LatexOutput (void) //The destructor bool LatexOutput::check(Inkscape::Extension::Extension * /*module*/) { - bool result = Inkscape::Extension::db.get("org.inkscape.print.latex") != NULL; + bool result = Inkscape::Extension::db.get("org.inkscape.print.latex") != nullptr; return result; } @@ -69,8 +69,8 @@ void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, mod->finish(); // Release things (mod->base)->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // should have been deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // should have been deleted by invoke_hide // end mod->set_param_string("destination", oldoutput); diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 83100d11e..aa90c4f59 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -39,7 +39,7 @@ namespace Internal { PrintLatex::PrintLatex (void): _width(0), _height(0), - _stream(NULL) + _stream(nullptr) { } @@ -63,11 +63,11 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc { Inkscape::SVGOStringStream os; int res; - FILE *osf = NULL; - const gchar * fn = NULL; + FILE *osf = nullptr; + const gchar * fn = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError* error = NULL; + GError* error = nullptr; os.setf(std::ios::fixed); fn = mod->get_param_string("destination"); @@ -80,7 +80,7 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { while (isspace(*fn)) fn += 1; Inkscape::IO::dump_fopen_call(fn, "K"); osf = Inkscape::IO::fopen_utf8name(fn, "w+"); @@ -110,7 +110,7 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc g_print("Printing failed\n"); /* fixme: should use pclose() for pipes */ fclose(_stream); - _stream = NULL; + _stream = nullptr; fflush(stdout); return 0; } @@ -144,7 +144,7 @@ unsigned int PrintLatex::finish(Inkscape::Extension::Print * /*mod*/) fflush(_stream); fclose(_stream); - _stream = NULL; + _stream = nullptr; } return 0; } diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 85426e376..c61a95922 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -64,7 +64,7 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename, { doc->ensureUpToDate(); - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = true; if (exportId && strcmp(exportId, "")) { @@ -102,8 +102,8 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename, } LaTeXTextRenderer::LaTeXTextRenderer(bool pdflatex) - : _stream(NULL), - _filename(NULL), + : _stream(nullptr), + _filename(nullptr), _pdflatex(pdflatex), _omittext_state(EMPTY), _omittext_page(1) @@ -136,7 +136,7 @@ LaTeXTextRenderer::~LaTeXTextRenderer(void) */ bool LaTeXTextRenderer::setTargetFile(gchar const *filename) { - if (filename != NULL) { + if (filename != nullptr) { while (isspace(*filename)) filename += 1; _filename = g_path_get_basename(filename); @@ -171,7 +171,7 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) { g_print("Output to LaTeX file failed\n"); /* fixme: should use pclose() for pipes */ fclose(_stream); - _stream = NULL; + _stream = nullptr; fflush(stdout); return false; } @@ -281,8 +281,8 @@ void LaTeXTextRenderer::sp_text_render(SPText *textobj) // get position and alignment // Align vertically on the baseline of the font (retrieved from the anchor point) // Align horizontally on anchorpoint - gchar const *alignment = NULL; - gchar const *aligntabular = NULL; + gchar const *alignment = nullptr; + gchar const *aligntabular = nullptr; switch (style->text_anchor.computed) { case SP_CSS_TEXT_ANCHOR_START: alignment = "[lt]"; @@ -437,7 +437,7 @@ Flowing in rectangle is possible, not in arb shape. SPStyle *style = flowtext->style; - SPItem *frame_item = flowtext->get_frame(NULL); + SPItem *frame_item = flowtext->get_frame(nullptr); SPRect *frame = dynamic_cast<SPRect *>(frame_item); if (!frame_item || !frame) { g_warning("LaTeX export: non-rectangular flowed text shapes are not supported, skipping text."); diff --git a/src/extension/internal/metafile-inout.cpp b/src/extension/internal/metafile-inout.cpp index ae79c8a8a..b90af9529 100644 --- a/src/extension/internal/metafile-inout.cpp +++ b/src/extension/internal/metafile-inout.cpp @@ -93,32 +93,32 @@ Metafile::my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t leng void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ bitmap_t bmStore; bitmap_t *bitmap = &bmStore; - accum->buffer=NULL; // PNG constructed in memory will end up here, caller must free(). + accum->buffer=nullptr; // PNG constructed in memory will end up here, caller must free(). accum->size=0; bitmap->pixels=(pixel_t *)px; bitmap->width = width; bitmap->height = height; - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; + png_structp png_ptr = nullptr; + png_infop info_ptr = nullptr; size_t x, y; - png_byte ** row_pointers = NULL; + png_byte ** row_pointers = nullptr; /* The following number is set by trial and error only. I cannot see where it it is documented in the libpng manual. */ int pixel_size = 3; int depth = 8; - png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png_ptr == NULL){ - accum->buffer=NULL; + png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if (png_ptr == nullptr){ + accum->buffer=nullptr; return; } info_ptr = png_create_info_struct (png_ptr); - if (info_ptr == NULL){ + if (info_ptr == nullptr){ png_destroy_write_struct (&png_ptr, &info_ptr); - accum->buffer=NULL; + accum->buffer=nullptr; return; } @@ -126,7 +126,7 @@ void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ if (setjmp (png_jmpbuf (png_ptr))) { png_destroy_write_struct (&png_ptr, &info_ptr); - accum->buffer=NULL; + accum->buffer=nullptr; return; } @@ -163,9 +163,9 @@ void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ png_set_rows (png_ptr, info_ptr, row_pointers); - png_set_write_fn(png_ptr, accum, my_png_write_data, NULL); + png_set_write_fn(png_ptr, accum, my_png_write_data, nullptr); - png_write_png (png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); + png_write_png (png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, nullptr); for (y = 0; y < bitmap->height; y++) { png_free (png_ptr, row_pointers[y]); @@ -186,7 +186,7 @@ void Metafile::setViewBoxIfMissing(SPDocument *doc) { doc->ensureUpToDate(); // Set document unit - Inkscape::XML::Node *repr = sp_document_namedview(doc, 0)->getRepr(); + Inkscape::XML::Node *repr = sp_document_namedview(doc, nullptr)->getRepr(); Inkscape::SVGOStringStream os; Inkscape::Util::Unit const* doc_unit = doc->getWidth().unit; os << doc_unit->abbr; diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index fb44f8499..4bb8eae32 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -89,7 +89,7 @@ bool PrintMetafile::_load_ppt_fontfix_data() //this is not called by any other return (ppt_fontfix_available = false); } - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); std::string instr; @@ -271,7 +271,7 @@ void PrintMetafile::hatch_classify(char *name, int *hatchType, U_COLORREF *hatch void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf **epixbuf, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor) { if (depth == 0) { - *epixbuf = NULL; + *epixbuf = nullptr; *hatchType = -1; *hatchColor = U_RGB(0, 0, 0); *bkColor = U_RGB(255, 255, 255); @@ -279,7 +279,7 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf depth++; // first look along the pattern chain, if there is one if (SP_IS_PATTERN(parent)) { - for (SPPattern *pat_i = SP_PATTERN(parent); pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = SP_PATTERN(parent); pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (SP_IS_IMAGE(pat_i)) { *epixbuf = ((SPImage *)pat_i)->pixbuf; return; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 42c2bbae3..2c25ea1f4 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -218,7 +218,7 @@ private: virtual void init() { badval = 0.0; - d = NULL; + d = nullptr; rows = 0; cols = 0; size = 0; @@ -229,7 +229,7 @@ private: if (d) { delete[] d; - d = 0; + d = nullptr; } rows = other.rows; cols = other.cols; @@ -289,7 +289,7 @@ public: SingularValueDecomposition (const SVDMatrix &mat) : A (mat), U (), - s (NULL), + s (nullptr), s_size (0), V () { @@ -1010,7 +1010,7 @@ static void gatherText(Inkscape::XML::Node *node, Glib::ustring &buf) } for (Inkscape::XML::Node *child = node->firstChild() ; - child != NULL; child = child->next()) + child != nullptr; child = child->next()) { gatherText(child, buf); } @@ -1466,7 +1466,7 @@ bool OdfOutput::processGradient(SPItem *item, //## Gradient SPGradient *gradient = SP_GRADIENT((checkFillGradient?(SP_STYLE_FILL_SERVER(style)) :(SP_STYLE_STROKE_SERVER(style)))); - if (gradient == NULL) + if (gradient == nullptr) { return false; } @@ -1644,7 +1644,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, analyzeTransform(tf, rotate, xskew, yskew, xscale, yscale); //# Do our stuff - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (nodeName == "svg" || nodeName == "svg:svg") { @@ -2038,7 +2038,7 @@ bool OdfOutput::writeContent(ZipFile &zf, Inkscape::XML::Node *node) //# Descend into the tree, doing all of our conversions //# to both files at the same time - char *oldlocale = g_strdup (setlocale (LC_NUMERIC, NULL)); + char *oldlocale = g_strdup (setlocale (LC_NUMERIC, nullptr)); setlocale (LC_NUMERIC, "C"); if (!writeTree(couts, souts, node)) { diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 552051eed..d078b5a9b 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -357,7 +357,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _preview_height = 300; // Init preview - _thumb_data = NULL; + _thumb_data = nullptr; _pageNumberSpin_adj->set_value(1.0); _current_page = 1; _setPreviewPage(_current_page); @@ -594,7 +594,7 @@ void PdfImportDialog::_setPreviewPage(int page) { if (!_render_thumb) { if (_thumb_data) { gfree(_thumb_data); - _thumb_data = NULL; + _thumb_data = nullptr; } if (!_previewed_page->loadThumb(&_thumb_data, &_thumb_width, &_thumb_height, &_thumb_rowstride)) { @@ -714,7 +714,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from // glib gstdio.c GooString *filename_goo = new GooString(uri); - PDFDoc *pdf_doc = new PDFDoc(filename_goo, NULL, NULL, NULL); // TODO: Could ask for password + PDFDoc *pdf_doc = new PDFDoc(filename_goo, nullptr, nullptr, nullptr); // TODO: Could ask for password //delete filename_goo; #else wchar_t *wfilename = reinterpret_cast<wchar_t*>(g_utf8_to_utf16 (uri, -1, NULL, NULL, NULL)); @@ -754,17 +754,17 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { g_message("Failed to load document from data (error %d)", error); } - return NULL; + return nullptr; } - PdfImportDialog *dlg = NULL; + PdfImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new PdfImportDialog(pdf_doc, uri); if (!dlg->showDialog()) { _cancelled = true; delete dlg; delete pdf_doc; - return NULL; + return nullptr; } } @@ -779,12 +779,12 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { #endif } - SPDocument *doc = NULL; + SPDocument *doc = nullptr; bool saved = false; if(!is_importvia_poppler) { // native importer - doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); + doc = SPDocument::createNewDoc(nullptr, TRUE, TRUE); saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); // No need to undo in this temporary document @@ -802,7 +802,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { dlg->getImportSettings(prefs); // Apply crop settings - PDFRectangle *clipToBox = NULL; + PDFRectangle *clipToBox = nullptr; double crop_setting; sp_repr_get_double(prefs, "cropTo", &crop_setting); diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index caaeca18e..fbcb708fe 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -264,13 +264,13 @@ GfxPatch blankPatch() class ClipHistoryEntry { public: - ClipHistoryEntry(GfxPath *clipPath = NULL, GfxClipType clipType = clipNormal); + ClipHistoryEntry(GfxPath *clipPath = nullptr, GfxClipType clipType = clipNormal); virtual ~ClipHistoryEntry(); // Manipulate clip path stack ClipHistoryEntry *save(); ClipHistoryEntry *restore(); - GBool hasSaves() { return saved != NULL; } + GBool hasSaves() { return saved != nullptr; } void setClip(GfxPath *newClipPath, GfxClipType newClipType = clipNormal); GfxPath *getClipPath() { return clipPath; } GfxClipType getClipType() { return clipType; } @@ -300,18 +300,18 @@ PdfParser::PdfParser(XRef *xrefA, builder(builderA), subPage(gFalse), printCommands(false), - res(new GfxResources(xref, resDict, NULL)), // start the resource stack + res(new GfxResources(xref, resDict, nullptr)), // start the resource stack state(new GfxState(72.0, 72.0, box, rotate, gTrue)), fontChanged(gFalse), clip(clipNone), ignoreUndef(0), baseMatrix(), formDepth(0), - parser(NULL), + parser(nullptr), colorDeltas(), maxDepths(), clipHistory(new ClipHistoryEntry()), - operatorHistory(NULL) + operatorHistory(nullptr) { setDefaultApproximationPrecision(); builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"), @@ -357,18 +357,18 @@ PdfParser::PdfParser(XRef *xrefA, builder(builderA), subPage(gTrue), printCommands(false), - res(new GfxResources(xref, resDict, NULL)), // start the resource stack + res(new GfxResources(xref, resDict, nullptr)), // start the resource stack state(new GfxState(72, 72, box, 0, gFalse)), fontChanged(gFalse), clip(clipNone), ignoreUndef(0), baseMatrix(), formDepth(0), - parser(NULL), + parser(nullptr), colorDeltas(), maxDepths(), clipHistory(new ClipHistoryEntry()), - operatorHistory(NULL) + operatorHistory(nullptr) { setDefaultApproximationPrecision(); @@ -399,12 +399,12 @@ PdfParser::~PdfParser() { if (state) { delete state; - state = NULL; + state = nullptr; } if (clipHistory) { delete clipHistory; - clipHistory = NULL; + clipHistory = nullptr; } } @@ -436,7 +436,7 @@ void PdfParser::parse(Object *obj, GBool topLevel) { parser = new Parser(xref, new Lexer(xref, obj), gFalse); go(topLevel); delete parser; - parser = NULL; + parser = nullptr; } void PdfParser::go(GBool /*topLevel*/) @@ -531,38 +531,38 @@ void PdfParser::pushOperator(const char *name) { OpHistoryEntry *newEntry = new OpHistoryEntry; newEntry->name = name; - newEntry->state = NULL; - newEntry->depth = (operatorHistory != NULL ? (operatorHistory->depth+1) : 0); + newEntry->state = nullptr; + newEntry->depth = (operatorHistory != nullptr ? (operatorHistory->depth+1) : 0); newEntry->next = operatorHistory; operatorHistory = newEntry; // Truncate list if needed if (operatorHistory->depth > maxOperatorHistoryDepth) { OpHistoryEntry *curr = operatorHistory; - OpHistoryEntry *prev = NULL; - while (curr && curr->next != NULL) { + OpHistoryEntry *prev = nullptr; + while (curr && curr->next != nullptr) { curr->depth--; prev = curr; curr = curr->next; } if (prev) { - if (curr->state != NULL) + if (curr->state != nullptr) delete curr->state; delete curr; - prev->next = NULL; + prev->next = nullptr; } } } const char *PdfParser::getPreviousOperator(unsigned int look_back) { - OpHistoryEntry *prev = NULL; - if (operatorHistory != NULL && look_back > 0) { + OpHistoryEntry *prev = nullptr; + if (operatorHistory != nullptr && look_back > 0) { prev = operatorHistory->next; - while (--look_back > 0 && prev != NULL) { + while (--look_back > 0 && prev != nullptr) { prev = prev->next; } } - if (prev != NULL) { + if (prev != nullptr) { return prev->name; } else { return ""; @@ -635,7 +635,7 @@ PdfOperator* PdfParser::findOp(char *name) { a = b = m; } if (cmp != 0) - return NULL; + return nullptr; return &opTab[a]; } @@ -712,7 +712,7 @@ void PdfParser::opConcat(Object args[], int /*numArgs*/) // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opSetDash(Object args[], int /*numArgs*/) { - double *dash = 0; + double *dash = nullptr; Array *a = args[0].getArray(); int length = a->getLength(); @@ -770,7 +770,7 @@ void PdfParser::opSetLineWidth(Object args[], int /*numArgs*/) void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) { Object obj1, obj2, obj3, obj4, obj5; - Function *funcs[4] = {0, 0, 0, 0}; + Function *funcs[4] = {nullptr, nullptr, nullptr, nullptr}; GfxColor backdropColor; GBool haveBackdropColor = gFalse; GBool alpha = gFalse; @@ -876,7 +876,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) } if (obj2.isName(const_cast<char*>("Default")) || obj2.isName(const_cast<char*>("Identity"))) { - funcs[0] = funcs[1] = funcs[2] = funcs[3] = NULL; + funcs[0] = funcs[1] = funcs[2] = funcs[3] = nullptr; state->setTransfer(funcs); } else if (obj2.isArray() && obj2.arrayGetLength() == 4) { int pos = 4; @@ -900,7 +900,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) } } else if (obj2.isName() || obj2.isDict() || obj2.isStream()) { if ((funcs[0] = Function::parse(&obj2))) { - funcs[1] = funcs[2] = funcs[3] = NULL; + funcs[1] = funcs[2] = funcs[3] = nullptr; state->setTransfer(funcs); } } else if (!obj2.isNull()) { @@ -931,7 +931,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) #if !defined(POPPLER_NEW_OBJECT_API) obj3.free(); #endif - funcs[0] = NULL; + funcs[0] = nullptr; #if defined(POPPLER_NEW_OBJECT_API) if (!((obj3 = obj2.dictLookup(const_cast<char*>("TR"))).isNull())) { #else @@ -942,7 +942,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) funcs[0]->getOutputSize() != 1) { error(errSyntaxError, getPos(), "Invalid transfer function in soft mask in ExtGState"); delete funcs[0]; - funcs[0] = NULL; + funcs[0] = nullptr; } } #if defined(POPPLER_NEW_OBJECT_API) @@ -976,7 +976,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) if (obj2.dictLookup(const_cast<char*>("G"), &obj3)->isStream()) { if (obj3.streamGetDict()->lookup(const_cast<char*>("Group"), &obj4)->isDict()) { #endif - GfxColorSpace *blendingColorSpace = 0; + GfxColorSpace *blendingColorSpace = nullptr; GBool isolated = gFalse; GBool knockout = gFalse; #if defined(POPPLER_NEW_OBJECT_API) @@ -985,7 +985,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) { #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - blendingColorSpace = GfxColorSpace::parse(NULL, &obj5, NULL, NULL); + blendingColorSpace = GfxColorSpace::parse(nullptr, &obj5, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) blendingColorSpace = GfxColorSpace::parse(&obj5, NULL, NULL); #else @@ -1140,7 +1140,7 @@ void PdfParser::doSoftMask(Object *str, GBool alpha, #else dict->lookup(const_cast<char*>("Resources"), &obj1); #endif - resDict = obj1.isDict() ? obj1.getDict() : (Dict *)NULL; + resDict = obj1.isDict() ? obj1.getDict() : (Dict *)nullptr; // draw it ++formDepth; @@ -1170,7 +1170,7 @@ void PdfParser::opSetFillGray(Object args[], int /*numArgs*/) { GfxColor color; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceGrayColorSpace()); color.c[0] = dblToCol(args[0].getNum()); state->setFillColor(&color); @@ -1182,7 +1182,7 @@ void PdfParser::opSetStrokeGray(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceGrayColorSpace()); color.c[0] = dblToCol(args[0].getNum()); state->setStrokeColor(&color); @@ -1195,7 +1195,7 @@ void PdfParser::opSetFillCMYKColor(Object args[], int /*numArgs*/) GfxColor color; int i; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceCMYKColorSpace()); for (i = 0; i < 4; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1209,7 +1209,7 @@ void PdfParser::opSetStrokeCMYKColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceCMYKColorSpace()); for (int i = 0; i < 4; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1223,7 +1223,7 @@ void PdfParser::opSetFillRGBColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceRGBColorSpace()); for (int i = 0; i < 3; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1236,7 +1236,7 @@ void PdfParser::opSetFillRGBColor(Object args[], int /*numArgs*/) void PdfParser::opSetStrokeRGBColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceRGBColorSpace()); for (int i = 0; i < 3; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1250,19 +1250,19 @@ void PdfParser::opSetFillColorSpace(Object args[], int /*numArgs*/) { Object obj; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); #if defined(POPPLER_NEW_OBJECT_API) obj = res->lookupColorSpace(args[0].getName()); #else res->lookupColorSpace(args[0].getName(), &obj); #endif - GfxColorSpace *colorSpace = 0; + GfxColorSpace *colorSpace = nullptr; #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &args[0], nullptr, nullptr); } else { - colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj, nullptr, nullptr); } #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (obj.isNull()) { @@ -1295,9 +1295,9 @@ void PdfParser::opSetFillColorSpace(Object args[], int /*numArgs*/) void PdfParser::opSetStrokeColorSpace(Object args[], int /*numArgs*/) { Object obj; - GfxColorSpace *colorSpace = 0; + GfxColorSpace *colorSpace = nullptr; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); #if defined(POPPLER_NEW_OBJECT_API) obj = res->lookupColorSpace(args[0].getName()); #else @@ -1305,9 +1305,9 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int /*numArgs*/) #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &args[0], nullptr, nullptr); } else { - colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj, nullptr, nullptr); } #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (obj.isNull()) { @@ -1344,7 +1344,7 @@ void PdfParser::opSetFillColor(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'sc' command"); return; } - state->setFillPattern(NULL); + state->setFillPattern(nullptr); for (i = 0; i < numArgs; ++i) { color.c[i] = dblToCol(args[i].getNum()); } @@ -1360,7 +1360,7 @@ void PdfParser::opSetStrokeColor(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SC' command"); return; } - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); for (i = 0; i < numArgs; ++i) { color.c[i] = dblToCol(args[i].getNum()); } @@ -1391,7 +1391,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { GfxPattern *pattern; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL, NULL))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), nullptr, nullptr))) { state->setFillPattern(pattern); builder->updateStyle(state); } @@ -1408,7 +1408,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); return; } - state->setFillPattern(NULL); + state->setFillPattern(nullptr); for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) { if (args[i].isNum()) { color.c[i] = dblToCol(args[i].getNum()); @@ -1443,7 +1443,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { GfxPattern *pattern; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL, NULL))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), nullptr, nullptr))) { state->setStrokePattern(pattern); builder->updateStyle(state); } @@ -1460,7 +1460,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); return; } - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) { if (args[i].isNum()) { color.c[i] = dblToCol(args[i].getNum()); @@ -1856,16 +1856,16 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat, // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opShFill(Object args[], int /*numArgs*/) { - GfxShading *shading = 0; - GfxPath *savedPath = NULL; + GfxShading *shading = nullptr; + GfxPath *savedPath = nullptr; double xMin, yMin, xMax, yMax; double xTemp, yTemp; double gradientTransform[6]; - double *matrix = NULL; + double *matrix = nullptr; GBool savedState = gFalse; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) - if (!(shading = res->lookupShading(args[0].getName(), NULL, NULL))) { + if (!(shading = res->lookupShading(args[0].getName(), nullptr, nullptr))) { return; } #else @@ -1883,7 +1883,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/) // check proper operator sequence // first there should be one W(*) and then one 'cm' somewhere before 'sh' GBool seenClip, seenConcat; - seenClip = (clipHistory->getClipPath() != NULL); + seenClip = (clipHistory->getClipPath() != nullptr); seenConcat = gFalse; int i = 1; while (i <= maxOperatorHistoryDepth) { @@ -1909,7 +1909,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/) // clip to bbox if (shading->getHasBBox()) { shading->getBBox(&xMin, &yMin, &xMax, &yMax); - if (matrix != NULL) { + if (matrix != nullptr) { xTemp = matrix[0]*xMin + matrix[2]*yMin + matrix[4]; yTemp = matrix[1]*xMin + matrix[3]*yMin + matrix[5]; state->moveTo(xTemp, yTemp); @@ -2374,7 +2374,7 @@ void PdfParser::opSetFont(Object args[], int /*numArgs*/) if (!font) { // unsetting the font (drawing no text) is better than using the // previous one and drawing random glyphs from it - state->setFont(NULL, args[1].getNum()); + state->setFont(nullptr, args[1].getNum()); fontChanged = gTrue; return; } @@ -2539,7 +2539,7 @@ void PdfParser::opMoveSetShowText(Object args[], int /*numArgs*/) // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) { - Array *a = 0; + Array *a = nullptr; Object obj; int wMode = 0; @@ -2586,7 +2586,7 @@ void PdfParser::doShowText(const GooString *s) { int wMode; double riseX, riseY; CharCode code; - Unicode *u = NULL; + Unicode *u = nullptr; double x, y, dx, dy, tdx, tdy; double originX, originY, tOriginX, tOriginY; double oldCTM[6], newCTM[6]; @@ -3009,7 +3009,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } if (!obj1.isNull()) { #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - colorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj1, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) colorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); #else @@ -3022,7 +3022,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } else if (csMode == streamCSDeviceCMYK) { colorSpace = new GfxDeviceCMYKColorSpace(); } else { - colorSpace = NULL; + colorSpace = nullptr; } #if !defined(POPPLER_NEW_OBJECT_API) obj1.free(); @@ -3055,11 +3055,11 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) // get the mask int maskColors[2*gfxColorMaxComps]; haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; - Stream *maskStr = NULL; + Stream *maskStr = nullptr; int maskWidth = 0; int maskHeight = 0; maskInvert = gFalse; - GfxImageColorMap *maskColorMap = NULL; + GfxImageColorMap *maskColorMap = nullptr; #if defined(POPPLER_NEW_OBJECT_API) maskObj = dict->lookup(const_cast<char*>("Mask")); smaskObj = dict->lookup(const_cast<char*>("SMask")); @@ -3180,7 +3180,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } } #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - GfxColorSpace *maskColorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL); + GfxColorSpace *maskColorSpace = GfxColorSpace::parse(nullptr, &obj1, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); #else @@ -3355,7 +3355,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); } else { builder->addImage(state, str, width, height, colorMap, interpolate, - haveColorKeyMask ? maskColors : static_cast<int *>(NULL)); + haveColorKeyMask ? maskColors : static_cast<int *>(nullptr)); } delete colorMap; @@ -3468,11 +3468,11 @@ void PdfParser::doForm(Object *str) { #else dict->lookup(const_cast<char*>("Resources"), &resObj); #endif - resDict = resObj.isDict() ? resObj.getDict() : (Dict *)NULL; + resDict = resObj.isDict() ? resObj.getDict() : (Dict *)nullptr; // check for a transparency group transpGroup = isolated = knockout = gFalse; - blendingColorSpace = NULL; + blendingColorSpace = nullptr; #if defined(POPPLER_NEW_OBJECT_API) if ((obj1 = dict->lookup(const_cast<char*>("Group"))).isDict()) { if ((obj2 = obj1.dictLookup(const_cast<char*>("S"))).isName(const_cast<char*>("Transparency"))) { @@ -3487,7 +3487,7 @@ void PdfParser::doForm(Object *str) { if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) { #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - blendingColorSpace = GfxColorSpace::parse(NULL, &obj3, NULL, NULL); + blendingColorSpace = GfxColorSpace::parse(nullptr, &obj3, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) blendingColorSpace = GfxColorSpace::parse(&obj3, NULL, NULL); #else @@ -3640,7 +3640,7 @@ void PdfParser::opBeginImage(Object /*args*/[], int /*numArgs*/) // display the image if (str) { - doImage(NULL, str, gTrue); + doImage(nullptr, str, gTrue); // skip 'EI' tag int c1 = str->getUndecodedStream()->getChar(); @@ -3701,7 +3701,7 @@ Stream *PdfParser::buildImageStream() { obj.free(); dict.free(); #endif - return NULL; + return nullptr; } #if !defined(POPPLER_NEW_OBJECT_API) obj.free(); @@ -3806,7 +3806,7 @@ void PdfParser::saveState() { bool is_radial = false; GfxPattern *pattern = state->getFillPattern(); - if (pattern != NULL) + if (pattern != nullptr) if (pattern->getType() == 2 ) { GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern); GfxShading *shading = shading_pattern->getShading(); @@ -3861,8 +3861,8 @@ void PdfParser::setApproximationPrecision(int shadingType, double colorDelta, //------------------------------------------------------------------------ ClipHistoryEntry::ClipHistoryEntry(GfxPath *clipPathA, GfxClipType clipTypeA) : - saved(NULL), - clipPath((clipPathA) ? clipPathA->copy() : NULL), + saved(nullptr), + clipPath((clipPathA) ? clipPathA->copy() : nullptr), clipType(clipTypeA) { } @@ -3871,7 +3871,7 @@ ClipHistoryEntry::~ClipHistoryEntry() { if (clipPath) { delete clipPath; - clipPath = NULL; + clipPath = nullptr; } } @@ -3884,7 +3884,7 @@ void ClipHistoryEntry::setClip(GfxPath *clipPathA, GfxClipType clipTypeA) { clipPath = clipPathA->copy(); clipType = clipTypeA; } else { - clipPath = NULL; + clipPath = nullptr; clipType = clipNormal; } } @@ -3901,7 +3901,7 @@ ClipHistoryEntry *ClipHistoryEntry::restore() { if (saved) { oldEntry = saved; - saved = NULL; + saved = nullptr; delete this; // TODO really should avoid deleting from inside. } else { oldEntry = this; @@ -3915,10 +3915,10 @@ ClipHistoryEntry::ClipHistoryEntry(ClipHistoryEntry *other) { this->clipPath = other->clipPath->copy(); this->clipType = other->clipType; } else { - this->clipPath = NULL; + this->clipPath = nullptr; this->clipType = clipNormal; } - saved = NULL; + saved = nullptr; } #endif /* HAVE_POPPLER */ diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h index f985b15ca..755e6741b 100644 --- a/src/extension/internal/pdfinput/pdf-parser.h +++ b/src/extension/internal/pdfinput/pdf-parser.h @@ -295,10 +295,10 @@ private: void doForm(Object *str); void doForm1(Object *str, Dict *resDict, double *matrix, double *bbox, GBool transpGroup = gFalse, GBool softMask = gFalse, - GfxColorSpace *blendingColorSpace = NULL, + GfxColorSpace *blendingColorSpace = nullptr, GBool isolated = gFalse, GBool knockout = gFalse, - GBool alpha = gFalse, Function *transferFunc = NULL, - GfxColor *backdropColor = NULL); + GBool alpha = gFalse, Function *transferFunc = nullptr, + GfxColor *backdropColor = nullptr); // in-line image operators void opBeginImage(Object args[], int numArgs); diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 8e5a5f639..59481b9eb 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -109,14 +109,14 @@ SvgBuilder::~SvgBuilder() { } void SvgBuilder::_init() { - _font_style = NULL; - _current_font = NULL; - _font_specification = NULL; + _font_style = nullptr; + _current_font = nullptr; + _font_specification = nullptr; _font_scaling = 1; _need_font_update = true; _in_text_object = false; _invalidated_style = true; - _current_state = NULL; + _current_state = nullptr; _width = 0; _height = 0; @@ -128,9 +128,9 @@ void SvgBuilder::_init() { _availableFontNames.push_back(pango_font_family_get_name(*iter)); } - _transp_group_stack = NULL; + _transp_group_stack = nullptr; SvgGraphicsState initial_state; - initial_state.softmask = NULL; + initial_state.softmask = nullptr; initial_state.group_depth = 0; _state_stack.push_back(initial_state); _node_stack.push_back(_container); @@ -186,7 +186,7 @@ Inkscape::XML::Node *SvgBuilder::pushNode(const char *name) { } Inkscape::XML::Node *SvgBuilder::popNode() { - Inkscape::XML::Node *node = NULL; + Inkscape::XML::Node *node = nullptr; if ( _node_stack.size() > 1 ) { node = _node_stack.back(); _node_stack.pop_back(); @@ -215,7 +215,7 @@ Inkscape::XML::Node *SvgBuilder::pushGroup() { setAsLayer(_docname); } } - if (_container->parent()->attribute("inkscape:groupmode") != NULL) { + if (_container->parent()->attribute("inkscape:groupmode") != nullptr) { _ttm[0] = _ttm[3] = 1.0; // clear ttm if parent is a layer _ttm[1] = _ttm[2] = _ttm[4] = _ttm[5] = 0.0; _ttm_is_set = false; @@ -379,7 +379,7 @@ void SvgBuilder::_setStrokeStyle(SPCSSAttr *css, GfxState *state) { sp_repr_css_set_property(css, "stroke-dashoffset", os_offset.str().c_str()); } else { sp_repr_css_set_property(css, "stroke-dasharray", "none"); - sp_repr_css_set_property(css, "stroke-dashoffset", NULL); + sp_repr_css_set_property(css, "stroke-dashoffset", nullptr); } } @@ -503,7 +503,7 @@ void SvgBuilder::addShadedFill(GfxShading *shading, double *matrix, GfxPath *pat SPObject *clip_obj = _doc->getObjectById(clip_path_id); if (clip_obj) { clip_obj->deleteObject(); - node->setAttribute("clip-path", NULL); + node->setAttribute("clip-path", nullptr); TRACE(("removed clipping path: %s\n", clip_path_id)); } break; @@ -570,7 +570,7 @@ bool SvgBuilder::getTransform(double *transform) { void SvgBuilder::setTransform(double c0, double c1, double c2, double c3, double c4, double c5) { // do not remember the group which is a layer - if ((_container->attribute("inkscape:groupmode") == NULL) && !_ttm_is_set) { + if ((_container->attribute("inkscape:groupmode") == nullptr) && !_ttm_is_set) { _ttm[0] = c0; _ttm[1] = c1; _ttm[2] = c2; @@ -581,7 +581,7 @@ void SvgBuilder::setTransform(double c0, double c1, double c2, double c3, } // Avoid transforming a group with an already set clip-path - if ( _container->attribute("clip-path") != NULL ) { + if ( _container->attribute("clip-path") != nullptr ) { pushGroup(); } TRACE(("setTransform: %f %f %f %f %f %f\n", c0, c1, c2, c3, c4, c5)); @@ -598,7 +598,7 @@ void SvgBuilder::setTransform(double const *transform) { * Used by PdfParser to decide when to do fallback operations. */ bool SvgBuilder::isPatternTypeSupported(GfxPattern *pattern) { - if ( pattern != NULL ) { + if ( pattern != nullptr ) { if ( pattern->getType() == 2 ) { // shading pattern GfxShading *shading = (static_cast<GfxShadingPattern *>(pattern))->getShading(); int shadingType = shading->getType(); @@ -622,8 +622,8 @@ bool SvgBuilder::isPatternTypeSupported(GfxPattern *pattern) { * \return a url pointing to the created pattern */ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, GfxState *state, bool is_stroke) { - gchar *id = NULL; - if ( pattern != NULL ) { + gchar *id = nullptr; + if ( pattern != nullptr ) { if ( pattern->getType() == 2 ) { // Shading pattern GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern); double *ptm; @@ -656,7 +656,7 @@ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, GfxState *state, bool is_ id = _createTilingPattern(static_cast<GfxTilingPattern*>(pattern), state, is_stroke); } } else { - return NULL; + return nullptr; } gchar *urltext = g_strdup_printf ("url(#%s)", id); g_free(id); @@ -719,7 +719,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxPatternColorSpace *pat_cs = (GfxPatternColorSpace *)( is_stroke ? state->getStrokeColorSpace() : state->getFillColorSpace() ); // Set fill/stroke colors if this is an uncolored tiling pattern - GfxColorSpace *cs = NULL; + GfxColorSpace *cs = nullptr; if ( tiling_pattern->getPaintType() == 2 && ( cs = pat_cs->getUnder() ) ) { GfxState *pattern_state = pdf_parser->getState(); pattern_state->setFillColorSpace(cs->copy()); @@ -785,7 +785,7 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for num_funcs = radial_shading->getNFuncs(); func = radial_shading->getFunc(0); } else { // Unsupported shading type - return NULL; + return nullptr; } gradient->setAttribute("gradientUnits", "userSpaceOnUse"); // If needed, flip the gradient transform around the y axis @@ -807,7 +807,7 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for if ( num_funcs > 1 || !_addGradientStops(gradient, shading, func) ) { Inkscape::GC::release(gradient); - return NULL; + return nullptr; } Inkscape::XML::Node *defs = _doc->getDefs()->getRepr(); @@ -827,8 +827,8 @@ void SvgBuilder::_addStopToGradient(Inkscape::XML::Node *gradient, double offset Inkscape::XML::Node *stop = _xml_doc->createElement("svg:stop"); SPCSSAttr *css = sp_repr_css_attr_new(); Inkscape::CSSOStringStream os_opacity; - gchar *color_text = NULL; - if ( _transp_group_stack != NULL && _transp_group_stack->for_softmask ) { + gchar *color_text = nullptr; + if ( _transp_group_stack != nullptr && _transp_group_stack->for_softmask ) { double gray = (double)color->r / 65535.0; gray = CLAMP(gray, 0.0, 1.0); os_opacity << gray; @@ -1028,9 +1028,9 @@ void SvgBuilder::updateFont(GfxState *state) { // Prune the font name to get the correct font family name // In a PDF font names can look like this: IONIPB+MetaPlusBold-Italic - char *font_family = NULL; - char *font_style = NULL; - char *font_style_lowercase = NULL; + char *font_family = nullptr; + char *font_style = nullptr; + char *font_style_lowercase = nullptr; char *plus_sign = strstr(_font_specification, "+"); if (plus_sign) { font_family = g_strdup(plus_sign + 1); @@ -1038,7 +1038,7 @@ void SvgBuilder::updateFont(GfxState *state) { } else { font_family = g_strdup(_font_specification); } - char *style_delim = NULL; + char *style_delim = nullptr; if ( ( style_delim = g_strrstr(font_family, "-") ) || ( style_delim = g_strrstr(font_family, ",") ) ) { font_style = style_delim + 1; @@ -1077,7 +1077,7 @@ void SvgBuilder::updateFont(GfxState *state) { // Font weight GfxFont::Weight font_weight = font->getWeight(); - char *css_font_weight = NULL; + char *css_font_weight = nullptr; if ( font_weight != GfxFont::WeightNotDefined ) { if ( font_weight == GfxFont::W400 ) { css_font_weight = (char*) "normal"; @@ -1109,7 +1109,7 @@ void SvgBuilder::updateFont(GfxState *state) { // Font stretch GfxFont::Stretch font_stretch = font->getStretch(); - gchar *stretch_value = NULL; + gchar *stretch_value = nullptr; switch (font_stretch) { case GfxFont::UltraCondensed: stretch_value = (char*) "ultra-condensed"; @@ -1141,7 +1141,7 @@ void SvgBuilder::updateFont(GfxState *state) { default: break; } - if ( stretch_value != NULL ) { + if ( stretch_value != nullptr ) { sp_repr_css_set_property(_font_style, "font-stretch", stretch_value); } @@ -1250,7 +1250,7 @@ void SvgBuilder::_flushText() { bool same_coords[2] = {true, true}; Geom::Point last_delta_pos; unsigned int glyphs_in_a_row = 0; - Inkscape::XML::Node *tspan_node = NULL; + Inkscape::XML::Node *tspan_node = nullptr; Glib::ustring x_coords; Glib::ustring y_coords; Glib::ustring text_buffer; @@ -1415,7 +1415,7 @@ void SvgBuilder::addChar(GfxState *state, double x, double y, uu[i] = u[i]; } - gchar *tmp = g_utf16_to_utf8(uu, uLen, NULL, NULL, NULL); + gchar *tmp = g_utf16_to_utf8(uu, uLen, nullptr, nullptr, nullptr); if ( tmp && *tmp ) { new_glyph.code = tmp; } else { @@ -1492,20 +1492,20 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height bool invert_alpha) { // Create PNG write struct - png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if ( png_ptr == NULL ) { - return NULL; + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if ( png_ptr == nullptr ) { + return nullptr; } // Create PNG info struct png_infop info_ptr = png_create_info_struct(png_ptr); - if ( info_ptr == NULL ) { - png_destroy_write_struct(&png_ptr, NULL); - return NULL; + if ( info_ptr == nullptr ) { + png_destroy_write_struct(&png_ptr, nullptr); + return nullptr; } // Set error handler if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, &info_ptr); - return NULL; + return nullptr; } // Decide whether we should embed this image int attr_value = 1; @@ -1514,8 +1514,8 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height // Set read/write functions Inkscape::IO::StringOutputStream base64_string; Inkscape::IO::Base64OutputStream base64_stream(base64_string); - FILE *fp = NULL; - gchar *file_name = NULL; + FILE *fp = nullptr; + gchar *file_name = nullptr; if (embed_image) { base64_stream.setColumnWidth(0); // Disable line breaks png_set_write_fn(png_ptr, &base64_stream, png_write_base64stream, png_flush_base64stream); @@ -1523,10 +1523,10 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height static int counter = 0; file_name = g_strdup_printf("%s_img%d.png", _docname, counter++); fp = fopen(file_name, "wb"); - if ( fp == NULL ) { + if ( fp == nullptr ) { png_destroy_write_struct(&png_ptr, &info_ptr); g_free(file_name); - return NULL; + return nullptr; } png_init_io(png_ptr, fp); } @@ -1646,7 +1646,7 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height fclose(fp); g_free(file_name); } - return NULL; + return nullptr; } delete image_stream; str->close(); @@ -1712,7 +1712,7 @@ Inkscape::XML::Node *SvgBuilder::_createMask(double width, double height) { if ( !( defs && !strcmp(defs->name(), "svg:defs") ) ) { // Create <defs> node defs = _xml_doc->createElement("svg:defs"); - _root->addChild(defs, NULL); + _root->addChild(defs, nullptr); Inkscape::GC::release(defs); defs = _root->firstChild(); } @@ -1754,12 +1754,12 @@ void SvgBuilder::addImageMask(GfxState *state, Stream *str, int width, int heigh // Scaling 1x1 surfaces might not work so skip setting a mask with this size if ( width > 1 || height > 1 ) { Inkscape::XML::Node *mask_image_node = - _createImage(str, width, height, NULL, interpolate, NULL, true, invert); + _createImage(str, width, height, nullptr, interpolate, nullptr, true, invert); if (mask_image_node) { // Create the mask Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); Inkscape::GC::release(mask_image_node); gchar *mask_url = g_strdup_printf("url(#%s)", mask_node->attribute("id")); @@ -1779,13 +1779,13 @@ void SvgBuilder::addMaskedImage(GfxState * /*state*/, Stream *str, int width, in bool invert_mask, bool mask_interpolate) { Inkscape::XML::Node *mask_image_node = _createImage(mask_str, mask_width, mask_height, - NULL, mask_interpolate, NULL, true, invert_mask); - Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, NULL); + nullptr, mask_interpolate, nullptr, true, invert_mask); + Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, nullptr); if ( mask_image_node && image_node ) { // Create mask for the image Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); // Scale the mask to the size of the image Geom::Affine mask_transform((double)width, 0.0, 0.0, (double)height, 0.0, 0.0); @@ -1812,13 +1812,13 @@ void SvgBuilder::addSoftMaskedImage(GfxState * /*state*/, Stream *str, int width GfxImageColorMap *mask_color_map, bool mask_interpolate) { Inkscape::XML::Node *mask_image_node = _createImage(mask_str, mask_width, mask_height, - mask_color_map, mask_interpolate, NULL, true); - Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, NULL); + mask_color_map, mask_interpolate, nullptr, true); + Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, nullptr); if ( mask_image_node && image_node ) { // Create mask for the image Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); // Set mask and add image gchar *mask_url = g_strdup_printf("url(#%s)", mask_node->attribute("id")); @@ -1902,7 +1902,7 @@ void SvgBuilder::setSoftMask(GfxState * /*state*/, double * /*bbox*/, bool /*alp void SvgBuilder::clearSoftMask(GfxState * /*state*/) { if (_state_stack.back().softmask) { - _state_stack.back().softmask = NULL; + _state_stack.back().softmask = nullptr; popGroup(); } } diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index ed2a4d48e..499724a4c 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -94,7 +94,7 @@ public: // Property setting void setDocumentSize(double width, double height); // Document size in px - void setAsLayer(char *layer_name=NULL); + void setAsLayer(char *layer_name=nullptr); void setGroupOpacity(double opacity); Inkscape::XML::Node *getPreferences() { return _preferences; diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 15acb97ec..2215fbb3e 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -59,11 +59,11 @@ namespace Internal static void err(const char *fmt, ...) { va_list args; - g_log(NULL, G_LOG_LEVEL_WARNING, "Pov-out err: "); + g_log(nullptr, G_LOG_LEVEL_WARNING, "Pov-out err: "); va_start(args, fmt); - g_logv(NULL, G_LOG_LEVEL_WARNING, fmt, args); + g_logv(nullptr, G_LOG_LEVEL_WARNING, fmt, args); va_end(args); - g_log(NULL, G_LOG_LEVEL_WARNING, "\n"); + g_log(nullptr, G_LOG_LEVEL_WARNING, "\n"); } @@ -211,7 +211,7 @@ void PovOutput::segment(int segNr, */ bool PovOutput::doHeader() { - time_t tim = time(NULL); + time_t tim = time(nullptr); out("/*###################################################################\n"); out("### This PovRay document was generated by Inkscape\n"); out("### http://www.inkscape.org\n"); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index c4e12c174..f4e28e7ed 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -76,7 +76,7 @@ static void pruneExtendedNamespaces( Inkscape::XML::Node *repr ) } // Can't change the set we're interating over while we are iterating. for ( std::vector<gchar const*>::iterator it = attrsRemoved.begin(); it != attrsRemoved.end(); ++it ) { - repr->setAttribute(*it, 0); + repr->setAttribute(*it, nullptr); } } @@ -225,11 +225,11 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) prefs->setBool("/dialogs/import/ask", !mod->get_param_bool("do_not_ask") ); } - SPDocument * doc = SPDocument::createNewDoc (NULL, TRUE, TRUE); + SPDocument * doc = SPDocument::createNewDoc (nullptr, TRUE, TRUE); if (link_svg.compare("include") != 0 && is_import) { bool embed = ( link_svg.compare( "embed" ) == 0 ); SPDocument * ret = SPDocument::createNewDoc(uri, TRUE); - SPNamedView *nv = sp_document_namedview(doc, NULL); + SPNamedView *nv = sp_document_namedview(doc, nullptr); Glib::ustring display_unit = nv->display_units->abbr; if (display_unit.empty()) { display_unit = "px"; @@ -259,7 +259,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) sp_embed_svg(image_node, uri); } } else { - gchar* _uri = g_filename_to_uri(uri, NULL, NULL); + gchar* _uri = g_filename_to_uri(uri, nullptr, nullptr); if(_uri) { image_node->setAttribute("xlink:href", _uri); g_free(_uri); @@ -292,7 +292,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) return SPDocument::createNewDocFromMem(contents, length, 1); } catch (Gio::Error &e) { g_warning("Could not load contents of non-local URI %s\n", uri); - return NULL; + return nullptr; } } else { uri = path.c_str(); @@ -329,8 +329,8 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) void Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { - g_return_if_fail(doc != NULL); - g_return_if_fail(filename != NULL); + g_return_if_fail(doc != nullptr); + g_return_if_fail(filename != nullptr); Inkscape::XML::Document *rdoc = doc->rdoc; bool const exportExtensions = ( !mod->get_id() diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index b650e2876..765e67648 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -245,7 +245,7 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #endif if (!libvisio::VisioDocument::isSupported(&input)) { - return NULL; + return nullptr; } RVNGStringVector output; @@ -256,11 +256,11 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #else if (!libvisio::VisioDocument::generateSVG(&input, output)) { #endif - return NULL; + return nullptr; } if (output.empty()) { - return NULL; + return nullptr; } std::vector<RVNGString> tmpSVGOutput; @@ -274,12 +274,12 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // If only one page is present, import that one without bothering user if (tmpSVGOutput.size() > 1) { - VsdImportDialog *dlg = 0; + VsdImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new VsdImportDialog(tmpSVGOutput); if (!dlg->showDialog()) { delete dlg; - return NULL; + return nullptr; } } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 45f59ec03..5941aaf1e 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -82,7 +82,7 @@ Wmf::~Wmf (void) //The destructor bool Wmf::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(PRINT_WMF)) + if (nullptr == Inkscape::Extension::db.get(PRINT_WMF)) return FALSE; return TRUE; } @@ -121,8 +121,8 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->finish(); /* Release arena */ mod->base->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // deleted by invoke_hide /* end */ mod->set_param_string("destination", oldoutput); @@ -138,7 +138,7 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena Inkscape::Extension::Extension * ext; ext = Inkscape::Extension::db.get(PRINT_WMF); - if (ext == NULL) + if (ext == nullptr) return; bool new_val = mod->get_param_bool("textToPath"); @@ -162,7 +162,7 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena ext->set_param_bool("textToPath", new_val); // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); print_document_to_file(doc, filename); @@ -452,11 +452,11 @@ uint32_t Wmf::add_dib_image(PWMF_CALLBACK_DATA d, const char *dib, uint32_t iUsa int dibparams = U_BI_UNKNOWN; // type of image not yet determined MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table uint32_t numCt; int32_t width, height, colortype, invert; // if needed these values will be set by wget_DIB_params if(iUsage == U_DIB_RGB_COLORS){ @@ -484,7 +484,7 @@ uint32_t Wmf::add_dib_image(PWMF_CALLBACK_DATA d, const char *dib, uint32_t iUsa } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG || dibparams==U_BI_PNG){ // image was binary png or jpg in source file base64String = g_base64_encode((guchar*) px, numCt ); } @@ -551,10 +551,10 @@ uint32_t Wmf::add_bm16_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char * char xywh[64]; // big enough MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const U_RGBQUAD *ct = NULL; // color table, always NULL here + char *rgba_px = nullptr; // RGBA pixels + const U_RGBQUAD *ct = nullptr; // color table, always NULL here int32_t width, height, colortype, numCt, invert; numCt = 0; width = Bm16.Width; // bitmap width in pixels. @@ -582,7 +582,7 @@ uint32_t Wmf::add_bm16_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char * free(rgba_px); } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(mempng.buffer){ // image was Bm16 in source file, converted to png in this routine base64String = g_base64_encode((guchar*) mempng.buffer, mempng.size ); free(mempng.buffer); @@ -658,7 +658,7 @@ int Wmf::in_clips(PWMF_CALLBACK_DATA d, const char *test){ void Wmf::add_clips(PWMF_CALLBACK_DATA d, const char *clippath, unsigned int logic){ int op = combine_ops_to_livarot(logic); Geom::PathVector combined_vect; - char *combined = NULL; + char *combined = nullptr; if (op >= 0 && d->dc[d->level].clip_id) { unsigned int real_idx = d->dc[d->level].clip_id - 1; Geom::PathVector old_vect = sp_svg_read_pathv(d->clips.strings[real_idx]); @@ -967,7 +967,7 @@ void Wmf::select_pen(PWMF_CALLBACK_DATA d, int index) { int width; - char *record = NULL; + char *record = nullptr; U_PEN up; if (index < 0 && index >= d->n_obj){ return; } @@ -1153,7 +1153,7 @@ Wmf::select_brush(PWMF_CALLBACK_DATA d, int index) void Wmf::select_font(PWMF_CALLBACK_DATA d, int index) { - char *record = NULL; + char *record = nullptr; const char *memfont; const char *facename; U_FONT font; @@ -1221,7 +1221,7 @@ Wmf::select_font(PWMF_CALLBACK_DATA d, int index) int Wmf::insertable_object(PWMF_CALLBACK_DATA d) { int index = d->low_water; // Start looking from here, it may already have been filled - while(index < d->n_obj && d->wmf_obj[index].record != NULL){ index++; } + while(index < d->n_obj && d->wmf_obj[index].record != nullptr){ index++; } if(index >= d->n_obj)return(-1); // this is a big problem, percolate it back up so the program can get out of this gracefully d->low_water = index; // Could probably be index+1 return(index); @@ -1265,7 +1265,7 @@ Wmf::delete_object(PWMF_CALLBACK_DATA d, int index) // files too big to fit into memory. if (d->wmf_obj[index].record) free(d->wmf_obj[index].record); - d->wmf_obj[index].record = NULL; + d->wmf_obj[index].record = nullptr; if(index < d->low_water)d->low_water = index; } } @@ -1321,12 +1321,12 @@ void Wmf::common_dib_to_image(PWMF_CALLBACK_DATA d, const char *dib, tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // color table uint32_t numCt; int32_t width, height, colortype, invert; // if needed these values will be set in wget_DIB_params if(iUsage == U_DIB_RGB_COLORS){ @@ -1367,7 +1367,7 @@ void Wmf::common_dib_to_image(PWMF_CALLBACK_DATA d, const char *dib, } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG){ // image was binary jpg in source file tmp_image << " xlink:href=\"data:image/jpeg;base64,"; base64String = g_base64_encode((guchar*) px, numCt ); @@ -1422,11 +1422,11 @@ void Wmf::common_bm16_to_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const U_RGBQUAD *ct = NULL; // color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const U_RGBQUAD *ct = nullptr; // color table int32_t width, height, colortype, numCt, invert; numCt = 0; @@ -1470,7 +1470,7 @@ void Wmf::common_bm16_to_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char free(sub_px); } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(mempng.buffer){ // image was Bm16 in source file, converted to png in this routine tmp_image << " xlink:href=\"data:image/png;base64,"; base64String = g_base64_encode((guchar*) mempng.buffer, mempng.size ); @@ -1541,14 +1541,14 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK int wDbgComment=0; int wDbgFinal=0; char const* wDbgString = getenv( "INKSCAPE_DBG_WMF" ); - if ( wDbgString != NULL ) { + if ( wDbgString != nullptr ) { if(strstr(wDbgString,"RECORD")){ wDbgRecord = 1; } if(strstr(wDbgString,"COMMENT")){ wDbgComment = 1; } if(strstr(wDbgString,"FINAL")){ wDbgFinal = 1; } } /* initialize the tsp for text reassembly */ - tsp.string = NULL; + tsp.string = nullptr; tsp.ori = 0.0; /* degrees */ tsp.fs = 12.0; /* font size */ tsp.x = 0.0; @@ -1592,10 +1592,10 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK // Init the new wmf_obj list elements to null, provided the // dynamic allocation succeeded. - if ( d->wmf_obj != NULL ) + if ( d->wmf_obj != nullptr ) { for( int i=0; i < d->n_obj; ++i ) - d->wmf_obj[i].record = NULL; + d->wmf_obj[i].record = nullptr; } //if if(!Placeable.Inch){ Placeable.Inch= 1440; } @@ -2445,7 +2445,7 @@ std::cout << "BEFORE DRAW" } if(d->dc[old_level].font_name){ free(d->dc[old_level].font_name); // else memory leak - d->dc[old_level].font_name = NULL; + d->dc[old_level].font_name = nullptr; } old_level--; } @@ -2557,9 +2557,9 @@ std::cout << "BEFORE DRAW" /* Rotation issues are handled entirely in libTERE now */ - uint32_t *dup_wt = NULL; + uint32_t *dup_wt = nullptr; - dup_wt = U_Latin1ToUtf32le(text, cChars, NULL); + dup_wt = U_Latin1ToUtf32le(text, cChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(cChars); msdepua(dup_wt); //convert everything in Microsoft's private use area. For Symbol, Wingdings, Dingbats @@ -2570,12 +2570,12 @@ std::cout << "BEFORE DRAW" } char *ansi_text; - ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, NULL); + ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, nullptr); free(dup_wt); // Empty text or starts with an invalid escape/control sequence, which is bogus text. Throw it out before g_markup_escape_text can make things worse if(*((uint8_t *)ansi_text) <= 0x1F){ free(ansi_text); - ansi_text=NULL; + ansi_text=nullptr; } if (ansi_text) { @@ -3101,18 +3101,18 @@ SPDocument * Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { - if (uri == NULL) { - return NULL; + if (uri == nullptr) { + return nullptr; } // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); WMF_CALLBACK_DATA d; d.n_obj = 0; //these might not be set otherwise if the input file is corrupt - d.wmf_obj=NULL; + d.wmf_obj=nullptr; // Default font, WMF spec says device can pick whatever it wants. // WMF files that do not specify a font are unlikely to look very good! @@ -3150,10 +3150,10 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) size_t length; char *contents; - if(wmf_readdata(uri, &contents, &length))return(NULL); + if(wmf_readdata(uri, &contents, &length))return(nullptr); // set up the text reassembly system - if(!(d.tri = trinfo_init(NULL)))return(NULL); + if(!(d.tri = trinfo_init(nullptr)))return(nullptr); (void) trinfo_load_ft_opts(d.tri, 1, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP, FT_KERNING_UNSCALED); @@ -3163,7 +3163,7 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; - SPDocument *doc = NULL; + SPDocument *doc = nullptr; if (good) { doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); } diff --git a/src/extension/internal/wmf-inout.h b/src/extension/internal/wmf-inout.h index 02280f6d8..a9831a7c6 100644 --- a/src/extension/internal/wmf-inout.h +++ b/src/extension/internal/wmf-inout.h @@ -30,7 +30,7 @@ typedef struct wmf_object { wmf_object() : type(0), level(0), - record(NULL) + record(nullptr) {}; int type; int level; @@ -41,7 +41,7 @@ typedef struct wmf_strings { wmf_strings() : size(0), count(0), - strings(NULL) + strings(nullptr) {}; int size; // number of slots allocated in strings int count; // number of slots used in strings @@ -51,7 +51,7 @@ typedef struct wmf_strings { typedef struct wmf_device_context { wmf_device_context() : // SPStyle: class with constructor - font_name(NULL), + font_name(nullptr), clip_id(0), stroke_set(false), stroke_mode(0), stroke_idx(0), stroke_recidx(0), fill_set(false), fill_mode(0), fill_idx(0), fill_recidx(0), @@ -65,7 +65,7 @@ typedef struct wmf_device_context { textAlign(0) // worldTransform, cur { - font_name = NULL; + font_name = nullptr; sizeWnd = point16_set( 0.0, 0.0 ); sizeView = point16_set( 0.0, 0.0 ); winorg = point16_set( 0.0, 0.0 ); @@ -126,7 +126,7 @@ typedef struct wmf_callback_data { dwRop2(U_R2_COPYPEN), dwRop3(0), id(0), drawtype(0), // hatches, images, gradients, struct w/ constructor - tri(NULL), + tri(nullptr), n_obj(0), low_water(0) //wmf_obj diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index cdc59298b..d98d28b09 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -77,8 +77,8 @@ namespace Internal { /* globals */ static double PX2WORLD; // value set in begin() static bool FixPPTCharPos, FixPPTDashLine, FixPPTGrad2Polys, FixPPTPatternAsHatch; -static WMFTRACK *wt = NULL; -static WMFHANDLES *wht = NULL; +static WMFTRACK *wt = nullptr; +static WMFHANDLES *wht = nullptr; void PrintWmf::smuggle_adxky_out(const char *string, int16_t **adx, double *ky, int *rtl, int *ndx, float scale) { @@ -87,7 +87,7 @@ void PrintWmf::smuggle_adxky_out(const char *string, int16_t **adx, double *ky, int16_t *ladx; const char *cptr = &string[strlen(string) + 1]; // this works because of the first fake terminator - *adx = NULL; + *adx = nullptr; *ky = 0.0; // set a default value sscanf(cptr, "%7d", ndx); if (!*ndx) { @@ -403,8 +403,8 @@ int PrintWmf::create_brush(SPStyle const *style, U_COLORREF *fcolor) } else if (SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style))) { // must be a gradient // currently we do not do anything with gradients, the code below just sets the color to the average of the stops SPPaintServer *paintserver = style->fill.value.href->getObject(); - SPLinearGradient *lg = NULL; - SPRadialGradient *rg = NULL; + SPLinearGradient *lg = nullptr; + SPRadialGradient *rg = nullptr; if (SP_IS_LINEARGRADIENT(paintserver)) { lg = SP_LINEARGRADIENT(paintserver); @@ -524,7 +524,7 @@ void PrintWmf::destroy_brush() int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform) { - char *rec = NULL; + char *rec = nullptr; uint32_t pen; uint32_t penstyle; U_COLORREF penColor; @@ -642,7 +642,7 @@ int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform) // delete the defined pen object void PrintWmf::destroy_pen() { - char *rec = NULL; + char *rec = nullptr; // WMF lets any object be deleted whenever, and the chips fall where they may... if (hpen) { rec = wdeleteobject_set(&hpen, wht); @@ -676,7 +676,7 @@ unsigned int PrintWmf::fill( fill_transform = tf; - if (create_brush(style, NULL)) { + if (create_brush(style, nullptr)) { /* Handle gradients. Uses modified livarot as 2geom boolops is currently broken. Can handle gradients with multiple stops. @@ -861,7 +861,7 @@ unsigned int PrintWmf::stroke( Geom::OptRect const &/*pbox*/, Geom::OptRect const &/*dbox*/, Geom::OptRect const &/*bbox*/) { - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); use_stroke = true; @@ -940,7 +940,7 @@ bool PrintWmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff int moves = 0; int lines = 0; int curves = 0; - char *rec = NULL; + char *rec = nullptr; for (Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { moves++; @@ -1126,7 +1126,7 @@ unsigned int PrintWmf::image( SPStyle const * /*style*/) /** provides indirect link to image object */ { double x1, y1, dw, dh; - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); rec = U_WMRSETSTRETCHBLTMODE_set(U_COLORONCOLOR); @@ -1189,7 +1189,7 @@ unsigned int PrintWmf::image( // may also be called with a simple_shape or an empty path, whereupon it just returns without doing anything unsigned int PrintWmf::print_pathv(Geom::PathVector const &pathv, const Geom::Affine &transform) { - char *rec = NULL; + char *rec = nullptr; U_POINT16 *pt16hold, *pt16ptr; uint16_t *n16hold; uint16_t *n16ptr; @@ -1349,7 +1349,7 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te return 0; } - char *rec = NULL; + char *rec = nullptr; int ccount, newfont; int fix90n = 0; uint32_t hfont = 0; @@ -1379,14 +1379,14 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } char *text2 = strdup(text); // because U_Utf8ToUtf16le calls iconv which does not like a const char * - uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, NULL); + uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, nullptr); free(text2); //translates Unicode as Utf16le to NonUnicode, if possible. If any translate, all will, and all to //the same font, because of code in Layout::print UnicodeToNon(unicode_text, &ccount, &newfont); // The preceding hopefully handled conversions to symbol, wingdings or zapf dingbats. Now slam everything // else down into latin1, which is all WMF can handle. If the language isn't English expect terrible results. - char *latin1_text = U_Utf16leToLatin1(unicode_text, 0, NULL); + char *latin1_text = U_Utf16leToLatin1(unicode_text, 0, nullptr); free(unicode_text); // in some cases a UTF string may reduce to NO latin1 characters, which returns NULL @@ -1439,9 +1439,9 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te // of the special fonts. char *facename; if (!newfont) { - facename = U_Utf8ToLatin1(style->font_family.value, 0, NULL); + facename = U_Utf8ToLatin1(style->font_family.value, 0, nullptr); } else { - facename = U_Utf8ToLatin1(FontName(newfont), 0, NULL); + facename = U_Utf8ToLatin1(FontName(newfont), 0, nullptr); } // Scale the text to the minimum stretch. (It tends to stay within bounding rectangles even if diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 2f3bfe27b..0953e5696 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -111,7 +111,7 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); // printf("I'm giving up not supported\n"); delete input; - return NULL; + return nullptr; } #if WITH_LIBWPG03 @@ -120,7 +120,7 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u if (!libwpg::WPGraphics::parse(input, &generator) || vec.empty() || vec[0].empty()) { delete input; - return NULL; + return nullptr; } RVNGString output("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"); |
