From: Till Theato Date: Sun, 26 Sep 2010 09:21:08 +0000 (+0000) Subject: Remove some unneeded qstrdup calls. MLT already does a strdup. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=5bbf2530d027fd053cb42bb50fd56b63acb6bb99;p=kdenlive Remove some unneeded qstrdup calls. MLT already does a strdup. svn path=/trunk/kdenlive/; revision=4935 --- diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index 38c8cbfd..31c0ca25 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -519,9 +519,7 @@ Mlt::Producer *DocClipBase::audioProducer(int track) if (m_properties.contains("threads")) m_audioTrackProducers.at(track)->set("threads", m_properties.value("threads").toInt()); m_audioTrackProducers.at(track)->set("video_index", -1); if (m_properties.contains("audio_index")) m_audioTrackProducers.at(track)->set("audio_index", m_properties.value("audio_index").toInt()); - char *tmp = (char *) qstrdup(QString(getId() + '_' + QString::number(track) + "_audio").toUtf8().data()); - m_audioTrackProducers.at(track)->set("id", tmp); - delete[] tmp; + m_audioTrackProducers.at(track)->set("id", QString(getId() + '_' + QString::number(track) + "_audio").toUtf8().data()); } return m_audioTrackProducers.at(track); } @@ -540,9 +538,7 @@ Mlt::Producer *DocClipBase::videoProducer() if (m_properties.contains("threads")) m_videoOnlyProducer->set("threads", m_properties.value("threads").toInt()); m_videoOnlyProducer->set("audio_index", -1); if (m_properties.contains("video_index")) m_videoOnlyProducer->set("video_index", m_properties.value("video_index").toInt()); - char *tmp = (char *) qstrdup(QString(getId() + "_video").toUtf8().data()); - m_videoOnlyProducer->set("id", tmp); - delete[] tmp; + m_videoOnlyProducer->set("id", QString(getId() + "_video").toUtf8().data()); } return m_videoOnlyProducer; } @@ -584,9 +580,7 @@ Mlt::Producer *DocClipBase::producer(int track) if (m_properties.contains("threads")) m_baseTrackProducers[track]->set("threads", m_properties.value("threads").toInt()); if (m_properties.contains("video_index")) m_baseTrackProducers[track]->set("video_index", m_properties.value("video_index").toInt()); if (m_properties.contains("audio_index")) m_baseTrackProducers[track]->set("audio_index", m_properties.value("audio_index").toInt()); - char *tmp = (char *) qstrdup(QString(getId() + '_' + QString::number(track)).toUtf8().data()); - m_baseTrackProducers[track]->set("id", tmp); - delete[] tmp; + m_baseTrackProducers[track]->set("id", QString(getId() + '_' + QString::number(track)).toUtf8().data()); if (KdenliveSettings::dropbframes() && m_baseTrackProducers.at(i)->get("skip_loop_filter") && strcmp(m_baseTrackProducers.at(i)->get("skip_loop_filter"), "all") == 0) { m_baseTrackProducers[track]->set("skip_loop_filter", "all"); m_baseTrackProducers[track]->set("skip_frame", "bidir"); @@ -643,9 +637,7 @@ void DocClipBase::slotRefreshProducer() if (m_baseTrackProducers.count() == 0) return; kDebug() << "//////////// REFRESH CLIP !!!!!!!!!!!!!!!!"; if (m_clipType == SLIDESHOW) { - /*char *tmp = (char *) qstrdup(getProperty("resource").toUtf8().data()); - Mlt::Producer producer(*(m_clipProducer->profile()), tmp); - delete[] tmp; + /*Mlt::Producer producer(*(m_clipProducer->profile()), getProperty("resource").toUtf8().data()); delete m_clipProducer; m_clipProducer = new Mlt::Producer(producer.get_producer()); if (!getProperty("out").isEmpty()) m_clipProducer->set_in_and_out(getProperty("in").toInt(), getProperty("out").toInt());*/ @@ -710,10 +702,7 @@ void DocClipBase::slotRefreshProducer() if (filter && strcmp(filter->get("mlt_service"), "luma") == 0) { filter->set("cycle", getProperty("ttl").toInt()); filter->set("duration", getProperty("luma_duration").toInt()); - QString resource = getProperty("luma_file"); - char *tmp = (char *) qstrdup(resource.toUtf8().data()); - filter->set("luma.resource", tmp); - delete[] tmp; + filter->set("luma.resource", getProperty("luma_file").toUtf8().data()); if (!getProperty("softness").isEmpty()) { int soft = getProperty("softness").toInt(); filter->set("luma.softness", (double) soft / 100.0); @@ -723,10 +712,7 @@ void DocClipBase::slotRefreshProducer() Mlt::Filter *filter = new Mlt::Filter(*(m_baseTrackProducers.at(0)->profile()), "luma"); filter->set("cycle", getProperty("ttl").toInt()); filter->set("duration", getProperty("luma_duration").toInt()); - QString resource = getProperty("luma_file"); - char *tmp = (char *) qstrdup(resource.toUtf8().data()); - filter->set("luma.resource", tmp); - delete[] tmp; + filter->set("luma.resource", getProperty("luma_file").toUtf8().data()); if (!getProperty("softness").isEmpty()) { int soft = getProperty("softness").toInt(); filter->set("luma.softness", (double) soft / 100.0); @@ -901,18 +887,12 @@ void DocClipBase::setProperty(const QString &key, const QString &value) } else if (key == "out") setDuration(GenTime(value.toInt(), KdenliveSettings::project_fps())); //else if (key == "transparency") m_clipProducer->set("transparency", value.toInt()); else if (key == "colour") { - char *tmp = (char *) qstrdup(value.toUtf8().data()); - setProducerProperty("colour", tmp); - delete[] tmp; + setProducerProperty("colour", value.toUtf8().data()); } else if (key == "templatetext") { - char *tmp = (char *) qstrdup(value.toUtf8().data()); - setProducerProperty("templatetext", tmp); - delete[] tmp; + setProducerProperty("templatetext", value.toUtf8().data()); setProducerProperty("force_reload", 1); } else if (key == "xmldata") { - char *tmp = (char *) qstrdup(value.toUtf8().data()); - setProducerProperty("xmldata", tmp); - delete[] tmp; + setProducerProperty("xmldata", value.toUtf8().data()); setProducerProperty("force_reload", 1); } else if (key == "force_aspect_ratio") { if (value.isEmpty()) { diff --git a/src/dvdwizardvob.cpp b/src/dvdwizardvob.cpp index e49c3c3f..39e7d373 100644 --- a/src/dvdwizardvob.cpp +++ b/src/dvdwizardvob.cpp @@ -109,18 +109,14 @@ void DvdWizardVob::slotAddVobFile(KUrl url, const QString &chapters) break; } - char *tmp = (char*) qstrdup(profilename.toUtf8().data()); - Mlt::Profile profile(tmp); - delete[] tmp; + Mlt::Profile profile(profilename.toUtf8().data()); QTreeWidgetItem *item = new QTreeWidgetItem(m_view.vobs_list, QStringList() << url.path() << QString() << KIO::convertSize(fileSize)); item->setData(0, Qt::UserRole, fileSize); item->setIcon(0, KIcon("video-x-generic")); QPixmap pix(60, 45); - tmp = (char *) qstrdup(url.path().toUtf8().data()); - Mlt::Producer *producer = new Mlt::Producer(profile, tmp); - delete[] tmp; + Mlt::Producer *producer = new Mlt::Producer(profile, url.path().toUtf8().data()); if (producer->is_blank() == false) { int width = 45.0 * profile.dar(); @@ -173,16 +169,12 @@ void DvdWizardVob::changeFormat() break; } - char *tmp = (char*) qstrdup(profilename.toUtf8().data()); - Mlt::Profile profile(tmp); - delete[] tmp; + Mlt::Profile profile(profilename.toUtf8().data()); QPixmap pix(180, 135); for (int i = 0; i < max; i++) { QTreeWidgetItem *item = m_view.vobs_list->topLevelItem(i); - tmp = (char *) qstrdup(item->text(0).toUtf8().data()); - Mlt::Producer *producer = new Mlt::Producer(profile, tmp); - delete[] tmp; + Mlt::Producer *producer = new Mlt::Producer(profile, item->text(0).toUtf8().data()); if (producer->is_blank() == false) { //pix = KThumb::getFrame(producer, 0, 135 * profile.dar(), 135); diff --git a/src/geometryval.cpp b/src/geometryval.cpp index 45f0f206..5182c83d 100644 --- a/src/geometryval.cpp +++ b/src/geometryval.cpp @@ -384,10 +384,10 @@ void Geometryval::setupParam(const QDomElement par, int minFrame, int maxFrame) label_opacity->setHidden(true); spinTransp->setHidden(true); } - char *tmp = (char *) qstrdup(val.toUtf8().data()); - if (m_geom) m_geom->parse(tmp, maxFrame - minFrame, m_profile.width, m_profile.height); - else m_geom = new Mlt::Geometry(tmp, maxFrame - minFrame, m_profile.width, m_profile.height); - delete[] tmp; + if (m_geom) + m_geom->parse(val.toUtf8().data(), maxFrame - minFrame, m_profile.width, m_profile.height); + else + m_geom = new Mlt::Geometry(val.toUtf8().data(), maxFrame - minFrame, m_profile.width, m_profile.height); //kDebug() << " / / UPDATING TRANSITION VALUE: " << m_geom->serialise(); //read param her and set rect diff --git a/thumbnailer/westleypreview.cpp b/thumbnailer/westleypreview.cpp index ceb77b35..0ce57323 100644 --- a/thumbnailer/westleypreview.cpp +++ b/thumbnailer/westleypreview.cpp @@ -62,9 +62,7 @@ MltPreview::~MltPreview() bool MltPreview::create(const QString &path, int width, int height, QImage &img) { Mlt::Profile *profile = new Mlt::Profile("dv_pal"); - char *tmp = (char *) qstrdup(path.toUtf8().data()); - Mlt::Producer *producer = new Mlt::Producer(*profile, tmp); - delete[] tmp; + Mlt::Producer *producer = new Mlt::Producer(*profile, path.toUtf8().data()); if (producer->is_blank()) {