diff options
-rw-r--r-- | dw/findtext.cc | 3 | ||||
-rw-r--r-- | dw/fltkplatform.cc | 3 | ||||
-rw-r--r-- | dw/fltkui.cc | 23 | ||||
-rw-r--r-- | dw/hyphenator.cc | 3 | ||||
-rw-r--r-- | dw/image.cc | 3 | ||||
-rw-r--r-- | dw/layout.cc | 5 | ||||
-rw-r--r-- | dw/style.cc | 3 | ||||
-rw-r--r-- | dw/textblock.cc | 2 | ||||
-rw-r--r-- | lout/misc.cc | 8 | ||||
-rw-r--r-- | lout/misc.hh | 3 | ||||
-rw-r--r-- | lout/object.cc | 5 | ||||
-rw-r--r-- | src/css.cc | 2 | ||||
-rw-r--r-- | src/dialog.cc | 3 | ||||
-rw-r--r-- | src/form.cc | 3 | ||||
-rw-r--r-- | src/tipwin.cc | 9 | ||||
-rw-r--r-- | test/dw/Makefile.am | 1 | ||||
-rw-r--r-- | test/dw/dw_anchors_test.cc | 3 | ||||
-rw-r--r-- | test/dw/form.cc | 11 | ||||
-rw-r--r-- | test/unit/Makefile.am | 9 |
19 files changed, 63 insertions, 39 deletions
diff --git a/dw/findtext.cc b/dw/findtext.cc index 94b963ea..0a4d25c5 100644 --- a/dw/findtext.cc +++ b/dw/findtext.cc @@ -20,6 +20,7 @@ #include "core.hh" +#include "dlib/dlib.h" #include "../lout/debug.hh" #include "../lout/msg.h" @@ -87,7 +88,7 @@ FindtextState::Result FindtextState::search (const char *key, bool caseSens, newKey = true; if (this->key) free(this->key); - this->key = strdup (key); + this->key = dStrdup (key); this->caseSens = caseSens; if (nexttab) diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index 0b7ee2e9..f5d686c4 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -19,6 +19,7 @@ #include <stdio.h> +#include "dlib/dlib.h" #include "../lout/msg.h" #include "../lout/debug.hh" #include "fltkcore.hh" @@ -145,7 +146,7 @@ void FltkFont::initSystemFonts () int k = Fl::set_fonts ("-*-iso10646-1"); for (int i = 0; i < k; i++) { int t; - char *name = strdup (Fl::get_font_name ((Fl_Font) i, &t)); + char *name = dStrdup (Fl::get_font_name ((Fl_Font) i, &t)); // normalize font family names (strip off "bold", "italic") if (t & FL_ITALIC) diff --git a/dw/fltkui.cc b/dw/fltkui.cc index e454f85b..c650712a 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -22,6 +22,7 @@ #include "fltkcore.hh" #include "fltkflatview.hh" #include "fltkcomplexbutton.hh" +#include "dlib/dlib.h" #include "../lout/msg.h" #include "../lout/misc.hh" @@ -112,7 +113,7 @@ void CustInput2::set_placeholder(const char *str) { if (placeholder) free(placeholder); - placeholder = strdup(str); + placeholder = dStrdup(str); if ((Fl::focus() != this) && !*value()) { show_placeholder(); @@ -276,7 +277,7 @@ void CustTextEditor::set_placeholder(const char *str) { if (placeholder) free(placeholder); - placeholder = strdup(str); + placeholder = dStrdup(str); if ((Fl::focus() != this) && buffer()->length() == 0) { show_placeholder(); @@ -315,7 +316,7 @@ char* CustTextEditor::value() */ if (text_copy) free(text_copy); - text_copy = showing_placeholder ? strdup("") : buffer()->text(); + text_copy = showing_placeholder ? dStrdup("") : buffer()->text(); return text_copy; } @@ -625,7 +626,7 @@ FltkLabelButtonResource::FltkLabelButtonResource (FltkPlatform *platform, const char *label): FltkSpecificResource <dw::core::ui::LabelButtonResource> (platform) { - this->label = strdup (label); + this->label = dStrdup (label); init (platform); } @@ -717,7 +718,7 @@ const char *FltkLabelButtonResource::getLabel () void FltkLabelButtonResource::setLabel (const char *label) { free((char *)this->label); - this->label = strdup (label); + this->label = dStrdup (label); widget->label (this->label); queueResize (true); @@ -866,9 +867,9 @@ FltkEntryResource::FltkEntryResource (FltkPlatform *platform, int size, { this->size = size; this->password = password; - this->label = label ? strdup(label) : NULL; + this->label = label ? dStrdup(label) : NULL; this->label_w = 0; - this->placeholder = placeholder ? strdup(placeholder) : NULL; + this->placeholder = placeholder ? dStrdup(placeholder) : NULL; initText = NULL; editable = false; @@ -994,7 +995,7 @@ void FltkEntryResource::setText (const char *text) { if (initText) free((char *)initText); - initText = strdup (text); + initText = dStrdup (text); ((CustInput2*)widget)->value (initText); } @@ -1052,7 +1053,7 @@ FltkMultiLineTextResource::FltkMultiLineTextResource (FltkPlatform *platform, MSG_WARN("numRows = %d is set to 1.\n", numRows); numRows = 1; } - this->placeholder = placeholder ? strdup(placeholder) : NULL; + this->placeholder = placeholder ? dStrdup(placeholder) : NULL; init (platform); } @@ -1492,7 +1493,7 @@ void FltkOptionMenuResource::addItem (const char *str, { Fl_Menu_Item *item = newItem(); - item->text = strdup(str); + item->text = dStrdup(str); if (enabled == false) item->flags = FL_MENU_INACTIVE; @@ -1513,7 +1514,7 @@ void FltkOptionMenuResource::pushGroup (const char *name, bool enabled) { Fl_Menu_Item *item = newItem(); - item->text = strdup(name); + item->text = dStrdup(name); if (enabled == false) item->flags = FL_MENU_INACTIVE; diff --git a/dw/hyphenator.cc b/dw/hyphenator.cc index 739590dc..1530074f 100644 --- a/dw/hyphenator.cc +++ b/dw/hyphenator.cc @@ -21,6 +21,7 @@ #include "hyphenator.hh" +#include "dlib/dlib.h" #include "../lout/misc.hh" #include "../lout/unicode.hh" #include <limits.h> @@ -395,7 +396,7 @@ TrieBuilder::~TrieBuilder () void TrieBuilder::insert (const char *key, const char *value) { dataList->increase (); - dataList->getLastRef ()->key = (unsigned char *) strdup(key); + dataList->getLastRef ()->key = (unsigned char *) dStrdup(key); dataList->getLastRef ()->value = dataZone->strdup (value); } diff --git a/dw/image.cc b/dw/image.cc index 82118949..fc914f44 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -20,6 +20,7 @@ #include "image.hh" +#include "dlib/dlib.h" #include "../lout/msg.h" #include "../lout/misc.hh" #include "../lout/debug.hh" @@ -146,7 +147,7 @@ Image::Image(const char *altText) { DBG_OBJ_CREATE ("dw::Image"); registerName ("dw::Image", &CLASS_ID); - this->altText = altText ? strdup (altText) : NULL; + this->altText = altText ? dStrdup (altText) : NULL; altTextWidth = -1; // not yet calculated buffer = NULL; bufWidth = bufHeight = -1; diff --git a/dw/layout.cc b/dw/layout.cc index 5b3000c0..96653643 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -22,6 +22,7 @@ #include "core.hh" +#include "dlib/dlib.h" #include "../lout/msg.h" #include "../lout/debug.hh" #include "../lout/misc.hh" @@ -735,7 +736,7 @@ void Layout::setAnchor (const char *anchor) if (requestedAnchor) free (requestedAnchor); - requestedAnchor = anchor ? strdup (anchor) : NULL; + requestedAnchor = anchor ? dStrdup (anchor) : NULL; updateAnchor (); } @@ -754,7 +755,7 @@ char *Layout::addAnchor (Widget *widget, const char* name, int y) return NULL; else { Anchor *anchor = new Anchor (); - anchor->name = strdup (name); + anchor->name = dStrdup (name); anchor->widget = widget; anchor->y = y; diff --git a/dw/style.cc b/dw/style.cc index f362710e..5d0bcbe3 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -23,6 +23,7 @@ #include <ctype.h> #include <math.h> +#include "dlib/dlib.h" #include "core.hh" #include "../lout/msg.h" @@ -426,7 +427,7 @@ Font::~Font () void Font::copyAttrs (FontAttrs *attrs) { - name = strdup (attrs->name); + name = dStrdup (attrs->name); size = attrs->size; weight = attrs->weight; style = attrs->style; diff --git a/dw/textblock.cc b/dw/textblock.cc index 870ff9e6..df34dd95 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -2553,7 +2553,7 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style) } /** - * Add an anchor to the page. "name" is copied, so no strdup is necessary for + * Add an anchor to the page. "name" is copied, so no dStrdup is necessary for * the caller. * * Return true on success, and false, when this anchor had already been diff --git a/lout/misc.cc b/lout/misc.cc index bffc68f7..c6e057fa 100644 --- a/lout/misc.cc +++ b/lout/misc.cc @@ -32,10 +32,10 @@ namespace misc { const char *prgName = PRGNAME; -void init (int argc, char *argv[]) -{ - prgName = strdup (argv[0]); -} +//void init (int argc, char *argv[]) +//{ +// prgName = dStrdup (argv[0]); +//} // ------------------ diff --git a/lout/misc.hh b/lout/misc.hh index 80f227f8..1108c1eb 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -6,6 +6,7 @@ #include <stdlib.h> #include <string.h> #include <assert.h> +#include "dlib/dlib.h" namespace lout { @@ -586,7 +587,7 @@ public: * A copy is kept in the buffer, so the caller does not have to care * about memory management. */ - inline void append(const char *str) { appendNoCopy(strdup(str)); } + inline void append(const char *str) { appendNoCopy(dStrdup(str)); } inline void appendInt(int n) { char buf[32]; sprintf (buf, "%d", n); append (buf); } inline void appendPointer(void *p) diff --git a/lout/object.cc b/lout/object.cc index e4e0152a..5c2ee433 100644 --- a/lout/object.cc +++ b/lout/object.cc @@ -20,6 +20,7 @@ #include "object.hh" +#include "dlib/dlib.h" #include <stdio.h> #include <stdint.h> #include <config.h> @@ -83,7 +84,7 @@ const char *Object::toString() /** \todo garbage! */ misc::StringBuffer sb; intoStringBuffer(&sb); - char *s = strdup(sb.getChars()); + char *s = dStrdup(sb.getChars()); return s; } @@ -291,7 +292,7 @@ void ConstString::intoStringBuffer(misc::StringBuffer *sb) // String // ------------ -String::String (const char *str): ConstString (str ? strdup(str) : NULL) +String::String (const char *str): ConstString (str ? dStrdup(str) : NULL) { } @@ -91,7 +91,7 @@ void CssPropertyList::apply (CssPropertyList *props) { if (props->ownerOfStrings && (getRef (i)->type == CSS_TYPE_STRING || getRef (i)->type == CSS_TYPE_SYMBOL)) - value.strVal = strdup(value.strVal); + value.strVal = dStrdup(value.strVal); props->set ((CssPropertyName) getRef (i)->name, (CssValueType) getRef (i)->type, diff --git a/src/dialog.cc b/src/dialog.cc index 34928095..ac007315 100644 --- a/src/dialog.cc +++ b/src/dialog.cc @@ -32,6 +32,7 @@ #include "dialog.hh" #include "misc.h" #include "prefs.h" +#include "dlib/dlib.h" /* * Local Data @@ -190,7 +191,7 @@ const char *a_Dialog_input(const char *title, const char *msg) source = (char *)dList_nth_data(prefs.search_urls, i); if (!source || a_Misc_parse_search_url(source, &label, &url) < 0) continue; - pm[j++].label(FL_NORMAL_LABEL, strdup(label)); + pm[j++].label(FL_NORMAL_LABEL, dStrdup(label)); } } ch->tooltip("Select search engine"); diff --git a/src/form.cc b/src/form.cc index 8234c0a3..93bd4864 100644 --- a/src/form.cc +++ b/src/form.cc @@ -19,6 +19,7 @@ #include "dw/core.hh" #include "dw/textblock.hh" +#include "dlib/dlib.h" #include "misc.h" #include "msg.h" #include "prefs.h" @@ -829,7 +830,7 @@ void Html_tag_open_optgroup(DilloHtml *html, const char *tag, int tagsize) if (!label) { BUG_MSG("<optgroup> requires label attribute."); - label = strdup(""); + label = dStrdup(""); } DilloHtmlOptgroup *opt = diff --git a/src/tipwin.cc b/src/tipwin.cc index c2f37431..235e5f56 100644 --- a/src/tipwin.cc +++ b/src/tipwin.cc @@ -27,6 +27,7 @@ #include "prefs.h" #include "tipwin.hh" +#include "dlib/dlib.h" /* * Forward declarations @@ -132,7 +133,7 @@ TipWinButton::TipWinButton(int x, int y, int w, int h, const char *l) : Fl_Button(x, y, w, h, l) { tipwin = my_tipwin(); - mytooltip = strdup("empty"); + mytooltip = dStrdup("empty"); } TipWinButton::~TipWinButton(void) @@ -161,7 +162,7 @@ int TipWinButton::handle(int e) void TipWinButton::set_tooltip(const char *s) { free(mytooltip); - mytooltip = strdup(s); + mytooltip = dStrdup(s); } @@ -209,7 +210,7 @@ TipWinInput::TipWinInput (int x, int y, int w, int h, const char *l) : Fl_Input(x,y,w,h,l) { tipwin = my_tipwin(); - mytooltip = strdup("empty"); + mytooltip = dStrdup("empty"); } TipWinInput::~TipWinInput(void) @@ -239,6 +240,6 @@ int TipWinInput::handle(int e) void TipWinInput::set_tooltip(const char *s) { free(mytooltip); - mytooltip = strdup(s); + mytooltip = dStrdup(s); } diff --git a/test/dw/Makefile.am b/test/dw/Makefile.am index 39bb8440..d3aff074 100644 --- a/test/dw/Makefile.am +++ b/test/dw/Makefile.am @@ -10,6 +10,7 @@ LDADD = \ $(top_builddir)/dw/libDw-fltk.a \ $(top_builddir)/dw/libDw-core.a \ $(top_builddir)/lout/liblout.a \ + $(top_builddir)/dlib/libDlib.a \ @LIBFLTK_LIBS@ @LIBX11_LIBS@ check_PROGRAMS = \ diff --git a/test/dw/dw_anchors_test.cc b/test/dw/dw_anchors_test.cc index e88cecb6..258acc0e 100644 --- a/test/dw/dw_anchors_test.cc +++ b/test/dw/dw_anchors_test.cc @@ -24,6 +24,7 @@ #include <FL/Fl_Window.H> #include <FL/Fl.H> +#include "dlib/dlib.h" #include "dw/core.hh" #include "dw/fltkcore.hh" #include "dw/fltkviewport.hh" @@ -111,7 +112,7 @@ int main(int argc, char **argv) char buf[16]; strcpy (buf, numbers[i]); buf[0] = lout::misc::AsciiToupper (buf[0]); - buttonLabel[i] = strdup(buf); + buttonLabel[i] = dStrdup(buf); Fl_Button *button = new Fl_Button(0, 20 * i, 50, 20, buttonLabel[i]); button->callback (anchorCallback, (void*)(long)i); button->when (FL_WHEN_RELEASE); diff --git a/test/dw/form.cc b/test/dw/form.cc index 82938a16..93c65d39 100644 --- a/test/dw/form.cc +++ b/test/dw/form.cc @@ -20,6 +20,7 @@ #include "form.hh" +#include "dlib/dlib.h" namespace form { @@ -27,7 +28,7 @@ using namespace dw::core::ui; Form::ResourceDecorator::ResourceDecorator (const char *name) { - this->name = strdup (name); + this->name = dStrdup (name); } Form::ResourceDecorator::~ResourceDecorator () @@ -58,7 +59,7 @@ Form::RadioButtonResourceDecorator::RadioButtonResourceDecorator n++; this->values = new const char*[n + 1]; for (int i = 0; i < n; i++) - this->values[i] = strdup (values[i]); + this->values[i] = dStrdup (values[i]); this->values[n] = 0; } @@ -108,7 +109,7 @@ Form::SelectionResourceDecorator::SelectionResourceDecorator n++; this->values = new const char*[n + 1]; for(int i = 0; i < n; i++) - this->values[i] = strdup (values[i]); + this->values[i] = dStrdup (values[i]); this->values[n] = 0; } @@ -153,8 +154,8 @@ Form::FormClickedReceiver::FormClickedReceiver (Form *form, const char *name, const char *value) { this->form = form; - this->name = strdup (name); - this->value = strdup (value); + this->name = dStrdup (name); + this->value = dStrdup (value); } Form::FormClickedReceiver::~FormClickedReceiver () diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index 67095f36..bcf3e3cb 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -27,8 +27,14 @@ EXTRA_DIST = \ hyph-de.pat containers_SOURCES = containers.cc +containers_LDADD = \ + $(top_builddir)/lout/liblout.a \ + $(top_builddir)/dlib/libDlib.a notsosimplevector_SOURCES = notsosimplevector.cc identity_SOURCES = identity.cc +identity_LDADD = \ + $(top_builddir)/lout/liblout.a \ + $(top_builddir)/dlib/libDlib.a cookies_SOURCES = cookies.c cookies_LDADD = \ $(top_builddir)/dpip/libDpip.a \ @@ -36,6 +42,7 @@ cookies_LDADD = \ shapes_SOURCES = shapes.cc shapes_LDADD = \ $(top_builddir)/dw/libDw-core.a \ + $(top_builddir)/dlib/libDlib.a \ $(top_builddir)/lout/liblout.a unicode_test_SOURCES = unicode_test.cc unicode_test_LDADD = \ @@ -47,6 +54,7 @@ liang_LDADD = \ $(top_builddir)/dw/libDw-fltk.a \ $(top_builddir)/dw/libDw-core.a \ $(top_builddir)/lout/liblout.a \ + $(top_builddir)/dlib/libDlib.a \ @LIBFLTK_LIBS@ @LIBX11_LIBS@ trie_SOURCES = trie.cc trie_LDADD = \ @@ -54,4 +62,5 @@ trie_LDADD = \ $(top_builddir)/dw/libDw-fltk.a \ $(top_builddir)/dw/libDw-core.a \ $(top_builddir)/lout/liblout.a \ + $(top_builddir)/dlib/libDlib.a \ @LIBFLTK_LIBS@ @LIBX11_LIBS@ |