]> git.sesse.net Git - kdenlive/commitdiff
Remove some unneeded qstrdup calls. MLT already does a strdup.
authorTill Theato <root@ttill.de>
Sun, 26 Sep 2010 09:21:08 +0000 (09:21 +0000)
committerTill Theato <root@ttill.de>
Sun, 26 Sep 2010 09:21:08 +0000 (09:21 +0000)
svn path=/trunk/kdenlive/; revision=4935

src/docclipbase.cpp
src/dvdwizardvob.cpp
src/geometryval.cpp
thumbnailer/westleypreview.cpp

index 38c8cbfdfec97d064afeb43f519ce5fa080d222d..31c0ca252114371c191a9ae448f878743e57ad9e 100644 (file)
@@ -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()) {
index e49c3c3f8c036de516daec79406ad7ab29b89bab..39e7d373109d20608f6f3b0a4873f7a360c8573c 100644 (file)
@@ -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);
index 45f0f206735e040d91718c815ec27d7ad56ec051..5182c83d7efa449e284b2daae31737019ecdcd6b 100644 (file)
@@ -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
index ceb77b352903f5649e3def7f03965627e677c32d..0ce57323a73c33d150f113c8d74724ca8ff211f2 100644 (file)
@@ -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()) {