msg.run ();
if (free_reason) {
- free ((char*) reason);
+ free (const_cast<char*> (reason));
}
}
const char* q;
p = (const char *) malloc (txt.length() + 1);
- txt.copy ((char *) p, txt.length(), 0);
- ((char*)p)[txt.length()] = '\0';
+ txt.copy (const_cast<char *> (p), txt.length(), 0);
+ const_cast<char*>(p)[txt.length()] = '\0';
while (p)
{
_external_ui_feature.URI = LV2_EXTERNAL_UI_URI;
_external_ui_feature.data = &_external_ui_host;
- features_src = features = (LV2_Feature**)_lv2->features();
+ features_src = features = const_cast<LV2_Feature**>(_lv2->features());
features_count = 2;
while (*features++) {
features_count++;
*features++ = *features_src++;
}
} else {
- features_dst = (LV2_Feature**)_lv2->features();
+ features_dst = const_cast<LV2_Feature**>(_lv2->features());
}
if (!ui_host) {
Glib::RefPtr<const Pango::Layout> layout = foobar.get_layout();
- PangoFontDescription *pfd = (PangoFontDescription *)pango_layout_get_font_description((PangoLayout *)layout->gobj());
+ PangoFontDescription *pfd = (PangoFontDescription *)pango_layout_get_font_description(const_cast<PangoLayout *>(layout->gobj()));
if (!pfd) {
/* layout inherited its font description from a PangoContext */
- PangoContext* ctxt = (PangoContext*) pango_layout_get_context ((PangoLayout*) layout->gobj());
+ PangoContext* ctxt = (PangoContext*) pango_layout_get_context (const_cast<PangoLayout*>(layout->gobj()));
pfd = pango_context_get_font_description (ctxt);
return Pango::FontDescription (pfd); /* make a copy */
}
lrdf_statement pattern;
pattern.subject = strdup(Glib::filename_to_uri(member).c_str());
- pattern.predicate = (char*)TAG;
+ pattern.predicate = const_cast<char*>(TAG);
pattern.object = 0;
pattern.object_type = lrdf_literal;
vector<string>::const_iterator i;
for (i = tags.begin(); i != tags.end(); ++i){
pattern = new lrdf_statement;
- pattern->subject = (char*)"?";
- pattern->predicate = (char*)TAG;
+ pattern->subject = const_cast<char*>("?");
+ pattern->predicate = const_cast<char*>(TAG);
pattern->object = strdup((*i).c_str());
pattern->next = old;
_name, time_frames + source_start, i->event_type(), i->size()));
if (tracker) {
- Evoral::MIDIEvent<Evoral::MusicalTime>& ev (*(Evoral::MIDIEvent<Evoral::MusicalTime>*) (&(*i)));
+ Evoral::MIDIEvent<Evoral::MusicalTime>& ev (*(reinterpret_cast<Evoral::MIDIEvent<Evoral::MusicalTime>*>
+ (const_cast<Evoral::Event<Evoral::MusicalTime>*> (&(*i)))));
if (ev.is_note_on()) {
DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("\t%1 track note on %2 @ %3 velocity %4\n", _name, (int) ev.note(), time_frames, (int) ev.velocity()));
tracker->add (ev.note(), ev.channel());
snprintf(buf, sizeof(buf), "%s%" PRIu32, LADSPA_BASE, plugin_id);
pattern.subject = buf;
- pattern.predicate = (char*)RDF_TYPE;
+ pattern.predicate = const_cast<char*>(RDF_TYPE);
pattern.object = 0;
pattern.object_type = lrdf_uri;
}
pattern.subject = matches1->object;
- pattern.predicate = (char*)(LADSPA_BASE "hasLabel");
+ pattern.predicate = const_cast<char*>(LADSPA_BASE "hasLabel");
pattern.object = 0;
pattern.object_type = lrdf_literal;
} else if (keyname == "editor") {
sk = EditorSort;
} else {
- RouteSortOrderKey sk = (RouteSortOrderKey) string_2_enum (remaining.substr (0, equal), sk);
+ sk = (RouteSortOrderKey) string_2_enum (remaining.substr (0, equal), sk);
}
set_order_key (sk, n);
const Evoral::Event<double> beat_ev (ev.event_type(),
ev_time_beats,
ev.size(),
- (uint8_t*)ev.buffer());
+ const_cast<uint8_t*>(ev.buffer()));
_model->append (beat_ev, event_id);
}
sf_info.format = 0; // libsndfile says to clear this before sf_open().
- if ((sf = sf_open ((char*) path.c_str(), SFM_READ, &sf_info)) == 0) {
+ if ((sf = sf_open (const_cast<char*>(path.c_str()), SFM_READ, &sf_info)) == 0) {
char errbuf[256];
error_msg = sf_error_str (0, errbuf, sizeof (errbuf) - 1);
return false;
~UIRequest () {
if (type == ErrorMessage && msg) {
/* msg was strdup()'ed */
- free ((char *)msg);
+ free (const_cast<char *>(msg));
}
}
};
setlocale (LC_NUMERIC, old);
if (old) {
- free ((char*)old);
+ free (const_cast<char*>(old));
}
}
const XMLPropertyList& properties() const { return _proplist; }
XMLProperty* property(const char*);
XMLProperty* property(const std::string&);
- const XMLProperty* property(const char* n) const { return ((XMLNode*)this)->property(n); }
- const XMLProperty* property(const std::string& n) const { return ((XMLNode*)this)->property(n); }
+ const XMLProperty* property(const char* n) const { return const_cast<XMLNode*>(this)->property(n); }
+ const XMLProperty* property(const std::string& n) const { return const_cast<XMLNode*>(this)->property(n); }
XMLProperty* add_property(const char* name, const std::string& value);
XMLProperty* add_property(const char* name, const char* value = "");
delete _root;
_root = 0;
- doc = xmlParseMemory((char*)buffer.c_str(), buffer.length());
+ doc = xmlParseMemory(const_cast<char*>(buffer.c_str()), buffer.length());
if (!doc) {
return false;
}
char buf[256];
long long unsigned int res = 0;
- if (0<read_string((char*)"/proc/meminfo", buf, sizeof (buf))) {
+ if (0<read_string(const_cast<char*>("/proc/meminfo"), buf, sizeof (buf))) {
if (strncmp (buf, "MemTotal:", 9) == 0) {
if (sscanf (buf, "%*s %llu", &res) != 1) {
perror ("parse error in /proc/meminfo");
# warnings flags
#
- conf.env.append_value('CFLAGS', "-Wall")
- conf.env.append_value('CXXFLAGS', [ '-Wall', '-Woverloaded-virtual'])
+ conf.env.append_value('CFLAGS', [ '-Wall',
+ '-Wpointer-arith',
+ '-Wcast-qual',
+ '-Wcast-align',
+ '-Wstrict-prototypes',
+ '-Wmissing-prototypes'
+ ])
+
+ conf.env.append_value('CXXFLAGS', [ '-Wall',
+ '-Wpointer-arith',
+ '-Wcast-qual',
+ '-Wcast-align',
+ '-Woverloaded-virtual'
+ ])
#