shuerhaaken avatar shuerhaaken committed 633613e

add checks

Comments (0)

Files changed (27)

libtaginfo/aiffinfo.cc

         taglib_file = new RIFF::AIFF::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+        }
         taglib_tagId3v2 = ((RIFF::AIFF::File *) taglib_file)->tag();
         if(!taglib_tagId3v2 || taglib_tagId3v2->isEmpty()) { 
             // Use fallback for id3v1 or extended header

libtaginfo/apeinfo.cc

         taglib_file = new APE::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+        }
         taglib_apetag = ((APE::File *) taglib_file)->APETag(true);
         if(!taglib_apetag || taglib_apetag->isEmpty()) { // Use fallback
             taglib_tag = ((APE::File *) taglib_file)->tag();

libtaginfo/apetaginfo.cc

 #include <apetag.h>
 
 
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
 #define APE_TAG_DISK                "DISC"
 #define APE_TAG_DISKNO              "DISCNUMBER"
 #define APE_TAG_COMPILATION         "COMPILATION"
 #define APE_TAG_COVER_ART_BAND_LOGO         "COVER ART (BAND LOGO)"
 #define APE_TAG_COVER_ART_PUBLISHER_LOGO    "COVER ART (PUBLISHER LOGO)"
 
+#endif
 
 using namespace TagInfo;
 using namespace TagLib;
             if(taglib_apetag->itemListMap().contains(APE_TAG_TRACK) && !taglib_apetag->itemListMap()[APE_TAG_TRACK].isEmpty()) {
                 StringList list = taglib_apetag->itemListMap()[APE_TAG_TRACK].toStringList().front().split("/");
                 if(list.size() == 2) {
-                    track_number = atol(list.front().toCString(false)); 
-                    track_count  = atol(list.back().toCString(false));
+                    track_number = list.front().toInt();
+                    track_count  = list.back().toInt();
                 }
                 else if(list.size() == 1) {
-                    track_number = atol(list.front().toCString(false)); 
+                    track_number = list.front().toInt();
                 }
             }
             if(taglib_apetag->itemListMap().contains(APE_TAG_DISK) && !taglib_apetag->itemListMap()[APE_TAG_DISK].isEmpty()) {
                 StringList list = taglib_apetag->itemListMap()[APE_TAG_DISK].toStringList().front().split("/");
                 if(list.size() == 2) {
-                    volume_number = atol(list.front().toCString(false)); 
-                    volume_count  = atol(list.back().toCString(false));
+                    volume_number = list.front().toInt();
+                    volume_count  = list.back().toInt();
                 }
                 else if(list.size() == 1) {
-                    track_number = atol(list.front().toCString(false)); 
+                    track_number = list.front().toInt();
                 }
             }
             else if(taglib_apetag->itemListMap().contains(APE_TAG_DISKNO)) {
-                volume_number = 
-                  atol(taglib_apetag->itemListMap()[APE_TAG_DISKNO].toStringList().front().toCString(false));
+                volume_number = taglib_apetag->itemListMap()[APE_TAG_DISKNO].toStringList().front().toInt();
             }
             if(taglib_apetag->itemListMap().contains(APE_TAG_BPM)) {
-                beats_per_minute = 
-                  atol(taglib_apetag->itemListMap()[APE_TAG_BPM].toStringList().front().toCString(false));
+                beats_per_minute = taglib_apetag->itemListMap()[APE_TAG_BPM].toStringList().front().toInt();
             }
             if(taglib_apetag->itemListMap().contains(APE_TAG_COMPILATION)) {
                 is_compilation = 
             
             // Rating 
             if(taglib_apetag->itemListMap().contains(APE_TAG_RATING)) {
-                long rat = 0;
-                rat = atol(taglib_apetag->itemListMap()[APE_TAG_RATING].toStringList().front().toCString(true));
+                int rat = 0;
+                rat = taglib_apetag->itemListMap()[APE_TAG_RATING].toStringList().front().toInt();
                 if(rat) {
-                    if(rat > 5) {
+                    if(rat > 5)
                         rating = popularity_to_rating(rat);
-                    }
-                    else {
+                    else
                         rating = rat;
-                    }
                 }
             }
             if(taglib_apetag->itemListMap().contains(APE_TAG_PLAYCNT)) {
-                playcount = 
-                    atol(taglib_apetag->itemListMap()[APE_TAG_PLAYCNT].toStringList().front().toCString(false));
+                playcount = taglib_apetag->itemListMap()[APE_TAG_PLAYCNT].toStringList().front().toInt();
                 if(playcount < 0)
                     playcount = 0;
             }
                     // prevent overwrite in save_base_tags()
                     changedflag &= ~(CHANGED_TRACK_NUMBER);
                     changedflag &= ~(CHANGED_TRACK_COUNT);
-                    taglib_apetag->addValue(APE_TAG_TRACK, format("%d/%d", track_number, track_count), true);
+                    String v;
+                    v += String::number(track_number);
+                    v += String('/');
+                    v += String::number(track_count);
+                    taglib_apetag->addValue(APE_TAG_TRACK, v, true);
                 }
             }
             if(changedflag & CHANGED_TRACK_COUNT) {
                 // prevent overwrite in save_base_tags()
                 changedflag &= ~(CHANGED_TRACK_NUMBER);
                 changedflag &= ~(CHANGED_TRACK_COUNT);
-                taglib_apetag->addValue(APE_TAG_TRACK, format("%d/%d", track_number, track_count), true);
+                String v;
+                v += String::number(track_number);
+                v += String('/');
+                v += String::number(track_count);
+                taglib_apetag->addValue(APE_TAG_TRACK, v, true);
             }
             if(changedflag & CHANGED_DATA_VOL_NUM) {
                 if(!(changedflag & CHANGED_DATA_VOL_CNT)) {
                     // prevent overwrite in save_base_tags()
                     changedflag &= ~(CHANGED_DATA_VOL_NUM);
-                    taglib_apetag->addValue(APE_TAG_DISK, format("%u", volume_number), true);
-                    taglib_apetag->addValue(APE_TAG_DISKNO, format("%u", volume_number), true);
+                    String vn = String::number(volume_number);
+                    taglib_apetag->addValue(APE_TAG_DISK, vn, true);
+                    taglib_apetag->addValue(APE_TAG_DISKNO, vn, true);
                 }
                 else {
                     // prevent overwrite in save_base_tags()
                     changedflag &= ~(CHANGED_DATA_VOL_NUM);
                     changedflag &= ~(CHANGED_DATA_VOL_CNT);
-                    taglib_apetag->addValue(APE_TAG_DISK, format("%u/%u", volume_number, volume_count), true);
+                    String v;
+                    v += String::number(volume_number);
+                    v += String('/');
+                    v += String::number(volume_count);
+                    taglib_apetag->addValue(APE_TAG_DISK, v, true);
                 }
             }
             if(changedflag & CHANGED_BPM_TAG) {
-                taglib_apetag->addValue(APE_TAG_BPM, format("%d", beats_per_minute), true);
+                String vn = String::number(beats_per_minute);
+                taglib_apetag->addValue(APE_TAG_BPM, vn, true);
             }
             if(changedflag & CHANGED_DATA_VOL_CNT) {
                 // prevent overwrite in save_base_tags()
                 changedflag &= ~(CHANGED_DATA_VOL_NUM);
                 changedflag &= ~(CHANGED_DATA_VOL_CNT);
-                taglib_apetag->addValue(APE_TAG_DISK, format("%d/%d", volume_number, volume_count), true);
+                String v;
+                v += String::number(volume_number);
+                v += String('/');
+                v += String::number(volume_count);
+                taglib_apetag->addValue(APE_TAG_DISK, v, true);
             }
             
             if(changedflag & CHANGED_IS_COMPILATION_TAG) {
                 set_item(taglib_apetag, APE_TAG_ALBUMARTIST, album_artist, true);
             
             if(changedflag & CHANGED_DATA_RATING)
-                taglib_apetag->addValue(APE_TAG_RATING, format("%u", rating_to_popularity(rating)), true);
+                taglib_apetag->addValue(APE_TAG_RATING, String::number(rating_to_popularity(rating)), true);
             
             if(changedflag & CHANGED_DATA_PLAYCOUNT)
-                taglib_apetag->addValue(APE_TAG_PLAYCNT, format("%u", playcount), true);
+                taglib_apetag->addValue(APE_TAG_PLAYCNT, String::number(playcount), true);
             
             if(changedflag & CHANGED_TRACK_LABELS)
                 set_item(taglib_apetag, TRACK_LABELS, track_labels_string, true);

libtaginfo/asfinfo.cc

         taglib_file = new ASF::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         asf_tag = ((ASF::File *) taglib_file)->tag();
         if(!asf_tag)
             valid = false;
             if(asf_tag->attributeListMap().contains(VOLUME_NUMBER) && !asf_tag->attributeListMap()[ VOLUME_NUMBER ].isEmpty()) {
                 StringList list = asf_tag->attributeListMap()[ VOLUME_NUMBER ].front().toString().split("/");
                 if(list.size() == 2) {
-                    volume_number = atol(list.front().toCString(false));
-                    volume_count  = atol(list.back().toCString(false));
+                    volume_number = list.front().toInt();
+                    volume_count  = list.back().toInt(); 
                 }
                 else if(list.size() == 1) {
-                    volume_number = atol(list.front().toCString(false));
+                    volume_number = list.front().toInt();
                 }
             }
             if(asf_tag->attributeListMap().contains(COMPOSER)) {
             if(changedflag & CHANGED_DATA_VOL_NUM || changedflag & CHANGED_DATA_VOL_CNT) {
                 asf_tag->removeItem(VOLUME_NUMBER);
                 if(volume_count != 0) {
-                    if(volume_number != 0)
-                        asf_tag->setAttribute(VOLUME_NUMBER, format("%u/%u", volume_number, volume_count));
-                    else
-                        asf_tag->setAttribute(VOLUME_NUMBER, format("%u", volume_number));
+                    if(volume_number != 0) {
+                        String v;
+                        v+=String::number(volume_number);
+                        v+=String('/');
+                        v+=String::number(volume_count);
+                        asf_tag->setAttribute(VOLUME_NUMBER, v);
+                    }
+                    else {
+                        asf_tag->setAttribute(VOLUME_NUMBER, String::number(volume_number));
+                    }
                 }
             }
             if(changedflag & CHANGED_TRACK_COUNT) {

libtaginfo/flacinfo.cc

     else {
         taglib_file = new FLAC::File(file_name.toCString(false), true, AudioProperties::Fast);
         if(taglib_file) {
+            if(!taglib_file->isOpen()) {
+                cout << "Cannot open file '" << file_name << "'" << endl;
+                valid = false;
+                return;
+            }
             flac_file = ((FLAC::File *) taglib_file);
         }
         else {

libtaginfo/id3info.cc

             if(taglib_tagId3v2->frameListMap().contains(VOLUME) && !taglib_tagId3v2->frameListMap()[VOLUME].isEmpty()) {
                 StringList list = taglib_tagId3v2->frameListMap()[ VOLUME ].front()->toString().split("/");
                 if(list.size() == 2) {
-                    volume_number = atol(list.front().toCString(false));
-                    volume_count  = atol(list.back().toCString(false));
+                    volume_number = list.front().toInt();
+                    volume_count  = list.back().toInt();
                 }
                 else if(list.size() == 1) {
-                    volume_number = atol(list.front().toCString(false));
+                    volume_number = list.front().toInt();
                 }
             }
             if(taglib_tagId3v2->frameListMap().contains(TRACKNUMBER) && !taglib_tagId3v2->frameListMap()[TRACKNUMBER].isEmpty()) {
                 StringList list = taglib_tagId3v2->frameListMap()[ TRACKNUMBER ].front()->toString().split("/");
                 if(list.size() == 2)
-                    track_count = atol(list.back().toCString(false));
+                    track_count = list.back().toInt();
             }
             if(taglib_tagId3v2->frameListMap().contains(COMPOSER)) {
                 composer = taglib_tagId3v2->frameListMap()[ COMPOSER ].front()->toString();
                 copyright = taglib_tagId3v2->frameListMap()[ COPYRIGHT ].front()->toString();
             }
             if(taglib_tagId3v2->frameListMap().contains(BPM_TAG)) {
-                beats_per_minute = atol(taglib_tagId3v2->frameListMap()[ BPM_TAG ].front()->toString().toCString(false));
+                beats_per_minute = taglib_tagId3v2->frameListMap()[ BPM_TAG ].front()->toString().toInt();
             }
             if(taglib_tagId3v2->frameListMap().contains(ENCODER)) {
                 encoder = taglib_tagId3v2->frameListMap()[ ENCODER ].front()->toString();
             if(changedflag & CHANGED_DATA_VOL_NUM || changedflag & CHANGED_DATA_VOL_CNT) {
                 taglib_tagId3v2->removeFrames(VOLUME);
                 frame = new ID3v2::TextIdentificationFrame(VOLUME);
-                frame->setText(format("%u/%u", volume_number, volume_count));
+                String v;
+                v += String::number(volume_number);
+                v += String('/');
+                v += String::number(volume_count);
+                frame->setText(v);
                 taglib_tagId3v2->addFrame(frame);
             }
             if(changedflag & CHANGED_COMPOSER_TAG) {
                     changedflag &= ~(CHANGED_TRACK_NUMBER);
                     changedflag &= ~(CHANGED_TRACK_COUNT);
                     frame = new ID3v2::TextIdentificationFrame(TRACKNUMBER);
-                    frame->setText(format("%d/%d", track_number, track_count));
+                    String v;
+                    v += String::number(track_number);
+                    v += String('/');
+                    v += String::number(track_count);
+                    frame->setText(v);
                     taglib_tagId3v2->addFrame(frame);
                 }
             }
                 changedflag &= ~(CHANGED_TRACK_COUNT);
                 taglib_tagId3v2->removeFrames(TRACKNUMBER);
                 frame = new ID3v2::TextIdentificationFrame(TRACKNUMBER);
-                frame->setText(format("%d/%d", track_number, track_count));
+                String v;
+                v += String::number(track_number);
+                v += String('/');
+                v += String::number(track_count);
+                frame->setText(v);
                 taglib_tagId3v2->addFrame(frame);
             }
             if(changedflag & CHANGED_ORIGINALARTIST_TAG) {
             if(changedflag & CHANGED_BPM_TAG) {
                 taglib_tagId3v2->removeFrames(BPM_TAG);
                 frame = new ID3v2::TextIdentificationFrame(BPM_TAG);
-                frame->setText(format("%d", beats_per_minute));
+                frame->setText(String::number(beats_per_minute));
                 taglib_tagId3v2->addFrame(frame);
             }
             if(changedflag & CHANGED_ENCODER_TAG) {
         if(!frameList.isEmpty()) {
             ID3v2::UnsynchronizedLyricsFrame * lyrics_frame = 
                 static_cast<ID3v2::UnsynchronizedLyricsFrame * >(frameList.front());
-            if(lyrics_frame)
+            if(lyrics_frame) {
                 return lyrics_frame->text();
+            }
         }
         return String();
     }

libtaginfo/info.cc

         format = MEDIA_FILE_TYPE_OGA; 
     else if(fnex == "MP4")
         format = MEDIA_FILE_TYPE_MP4; 
+    else if(fnex == "3G2")
+        format = MEDIA_FILE_TYPE_MP4; 
+    else if(fnex == "M4R")
+        format = MEDIA_FILE_TYPE_MP4; 
     else if(fnex == "ASF")
         format = MEDIA_FILE_TYPE_ASF; 
     else if(fnex == "M4A")
 #endif /* TAGLIB_ONE_NINE */
     else if(fnex == "MOD")
         format = MEDIA_FILE_TYPE_MOD; 
+    else if(fnex == "WOW")
+        format = MEDIA_FILE_TYPE_MOD; 
+    else if(fnex == "MODULE")
+        format = MEDIA_FILE_TYPE_MOD; 
+    else if(fnex == "NST")
+        format = MEDIA_FILE_TYPE_MOD; 
     else if(fnex == "IT")
         format = MEDIA_FILE_TYPE_IT; 
     else if(fnex == "S3M")
 //Tag access functions
 
 //! Set the title tag.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_title is a String.
 /*!
  * Set the genre tag.
  */
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 void Info::set_genre(const String new_genre) {
     genre = new_genre;
 
 
 //! Set volume number of a media track. (like CD 2 of 3)
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param number as int
 }
 
 //! Set volume count of a media track. (like CD 2 of 3)
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param count as int
 }
 
 //! Set the artist tag of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_artist as String
 
 //! Set the original artist tag of a media track.
 //! For some implementations this is the performer tag 
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_artist as String
 }
 
 //! Set the encoder tag of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_encoder as String
 }
 
 //! Set the homepage tag of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_homepage as String
 }
 
 //! Set the copyright tag of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_copyright as String
 }
 
 //! Set wether the media file is part of a compilation/various artists album, or not.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 void Info::set_is_compilation(bool compilation) {
     is_compilation = compilation;
 }
 
 //! Set the album artist tag of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_album_artist as String
 }
 
 //! Set the album tag of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_album as String
 }
 
 //! Set the composer tag of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_composer as String
 }
 
 //! Set the comments tag of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_comments as String
 }
 
 //! Set the track number of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_track_number as int
 
 //! Set the track count of a media track.
 //! This is the amount of tracks of the album the media file was taken from.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_track_count as int
 }
 
 //! Set the year of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_year as int
 }
 
 //! Set BPM of a media track.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_bpm speed in BPM as int
 }
 //! Set the playcount tag of a media track.
 //! Some implementations may not support this tag
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_playcount as int
 }
 //! Set the rating tag of a media track.
 //! rating 1 - 5 ;  0 -> not set
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
 \param new_rating as integer
 }
 
 //! Set a list of embedded track labels.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 void Info::set_track_labels_list(const StringList &new_track_labels_list) {
     track_labels = new_track_labels_list;
 }
 
 //! Set a list of embedded artist labels.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 void Info::set_artist_labels_list(const StringList &new_artist_labels_list) {
     artist_labels = new_artist_labels_list;
 }
 
 //! Set a list of embedded album labels.
-//! This function will set the according ChangedData flag
+//! This function will set the according ChangedFlags flag
 //! This will not be saved to file before save() is called on the Info object.
 void Info::set_album_labels_list(const StringList &new_album_labels_list) {
     album_labels = new_album_labels_list;

libtaginfo/inforef.cc

 /*!
  * Check wether the info object pointers could be created internally
  */
-bool InfoRef::is_null() const {
-    return i == NULL;
+bool InfoRef::is_valid() const {
+    return i == NULL || !i->is_valid();
 }
 
 /*!

libtaginfo/itinfo.cc

     else {
         taglib_file = new IT::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
-    if(taglib_file) {
+    if(taglib_file && taglib_file->isOpen()) {
         taglib_tagMod = (Mod::Tag *)((IT::File *) taglib_file)->tag();
         if(!taglib_tagMod || taglib_tagMod->isEmpty()) { 
             taglib_tag = ((IT::File *) taglib_file)->tag();

libtaginfo/modinfo.cc

         taglib_file = new TagLib::Mod::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         taglib_tagMod = (TagLib::Mod::Tag *)((TagLib::Mod::File *) taglib_file)->tag();
         if(!taglib_tagMod || taglib_tagMod->isEmpty()) { 
             taglib_tag = ((TagLib::Mod::File *) taglib_file)->tag();

libtaginfo/mp3info.cc

         taglib_file = new MPEG::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         taglib_tagId3v2 = ((MPEG::File *) taglib_file)->ID3v2Tag(true);
         if(!taglib_tagId3v2 || taglib_tagId3v2->isEmpty()) { 
             // Use fallback for id3v1 or extended header

libtaginfo/mp4info.cc

         taglib_file = new MP4::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         mp4_tag = ((MP4::File *) taglib_file)->tag();
         if(!mp4_tag || mp4_tag->isEmpty()) {
             if(!mp4_tag)
             // Rating
             if(mp4_tag->itemListMap().contains(RATING)) {
                 int rat = 0;
-                rat = atol(mp4_tag->itemListMap()[RATING].toStringList().front().toCString(false));
+                rat = mp4_tag->itemListMap()[RATING].toStringList().front().toInt();
                 if(rat) {
-                    if(rat > 5) {
+                    if(rat > 5)
                         rating = popularity_to_rating(rat);
-                    }
-                    else {
+                    else
                         rating = rat;
-                    }
                 }
             }
             if(mp4_tag->itemListMap().contains(BPM_TAG)) {
                 beats_per_minute = mp4_tag->itemListMap()[BPM_TAG].toInt();
             }
             if(mp4_tag->itemListMap().contains(PLAYCOUNT)) {
-                playcount = mp4_tag->itemListMap()[PLAYCOUNT].toInt(); //atol(mp4_tag->itemListMap()[PLAYCOUNT].toStringList().front().toCString(false));
+                playcount = mp4_tag->itemListMap()[PLAYCOUNT].toInt();
             }
             // Labels
             if(track_labels.size() == 0) {
             if(changedflag & CHANGED_IS_COMPILATION_TAG)
                 mp4_tag->itemListMap()[COMPILATION] = MP4::Item(is_compilation);
             if(changedflag & CHANGED_DATA_RATING) {
-                mp4_tag->itemListMap().insert(RATING, MP4::Item(format("%d", rating_to_popularity(rating))));
+                mp4_tag->itemListMap().insert(RATING, MP4::Item(String::number(rating_to_popularity(rating))));
             }
             if(changedflag & CHANGED_DATA_PLAYCOUNT) {
                 mp4_tag->itemListMap().insert(PLAYCOUNT, MP4::Item(playcount));

libtaginfo/mpcinfo.cc

         taglib_file = new MPC::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         taglib_apetag = ((MPC::File *) taglib_file)->APETag();
         if(!taglib_apetag || taglib_apetag->isEmpty()) { // Use fallback for id3v1 or extended header
             //printf("Use fallback! %s\n", filename.c_str());

libtaginfo/ogginfo.cc

         taglib_file = new Ogg::Vorbis::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         xiphcomment = ((Ogg::Vorbis::File *) taglib_file)->tag();
         if(!xiphcomment || xiphcomment->isEmpty()) {
             taglib_tag = ((Ogg::Vorbis::File *) taglib_file)->tag();

libtaginfo/opusinfo.cc

         taglib_file = new Ogg::Opus::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         xiphcomment = ((Ogg::Opus::File *) taglib_file)->tag();
         if(!xiphcomment || xiphcomment->isEmpty()) {
             taglib_tag = ((Ogg::Opus::File *) taglib_file)->tag();

libtaginfo/s3minfo.cc

         taglib_file = new S3M::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         taglib_tagMod = (Mod::Tag *)((S3M::File *) taglib_file)->tag();
         if(!taglib_tagMod || taglib_tagMod->isEmpty()) { 
             taglib_tag = ((S3M::File *) taglib_file)->tag();

libtaginfo/speexinfo.cc

         taglib_file = new Ogg::Speex::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         xiphcomment = ((Ogg::Speex::File *) taglib_file)->tag();
         if(!xiphcomment || xiphcomment->isEmpty()) {
             taglib_tag = ((Ogg::Speex::File *) taglib_file)->tag();

libtaginfo/taginfo.h

     * Info is an abstract base class for media tag reading/writing  
     */
     class Info {
-        protected :
-            //! Constructor to be called from implementations
-            Info(const String &filename = "");
-
-            //! \a TagLib::FileRef of the media file
-            TagLib::FileRef * taglib_fileref;
-            
-            //! \a TagLib::File of the media file
-            TagLib::File *    taglib_file;
-            
-            //! \a TagLib::Tag of the media file
-            TagLib::Tag *     taglib_tag;
-
-            //! The path of the media file
-            String file_name;
-            
-            //Tags
-
-            //! Title of the Info object 
-            String title;
-            //! Genre of the Info object 
-            String genre;
-            //! Artist of the Info object 
-            String artist;
-            //! Album artist of the Info object 
-            String album_artist;
-            //! Album of the Info object
-            String album;
-            //! Composer of the Info object
-            String composer;
-            //! Comments of the Info object
-            String comments;
-            //! Homepage of the Info object
-            String homepage;
-            //! Encoder of the Info object
-            String encoder;
-            //! Copyright of the Info object
-            String copyright;
-            //! Original artist of the Info object
-            String original_artist;
-            //! Track number of the Info object
-            int    track_number;
-            //! Track count of the Info object
-            int    track_count;
-            //! Year of the Info object
-            int    year;
-            //! Whether the media file is part of a compilation
-            bool   is_compilation;
-            //! Speed in beats per minute
-            int beats_per_minute;
-            //! Volume number of the Info object
-            int    volume_number;
-            //! Volume count of the Info object
-            int    volume_count;
-            
-            
-            //Audioproperties
-            //! Lenght in seconds
-            int    length_seconds;
-            //! Bitrate
-            int    bitrate;
-            //! Sample rate
-            int    samplerate;
-            //! Channel count
-            int    channels;
-            
-            //Extras
-            //! Play count
-            int    playcount;
-            //! Rating (1 - 5 stars, 0 not set) 
-            int    rating;
-            
-            //! User defined track labels
-            StringList track_labels;
-            //! User defined track labels as string with "|" as delimiter
-            String     track_labels_string;
-            //! User defined artist labels
-            StringList artist_labels;
-            //! User defined artist labels as string with "|" as delimiter
-            String     artist_labels_string;
-            //! User defined album labels
-            StringList album_labels;
-            //! User defined album labels as string with "|" as delimiter
-            String     album_labels_string;
-            
-            //! The setters for the tags on the info object will set these ChangedData flags
-            ulong changedflag;
-            
-            //! Whether there is image data available
-            bool has_image;
-            
-            //! Whether the info object is valid
-            bool valid;
-            
-            //! Load the abstact basic tags from TagLib::Tag
-            //! This will only do something if \param tag is not NULL
-            void   load_base_tags(TagLib::Tag * tag);
-            
-            //! Save the abstact basic tags to TagLib::Tag
-            //! This will only do something if \param tag is not NULL
-            void   save_base_tags(TagLib::Tag * tag);
-            
         public:
+            virtual ~Info();
             
             // CREATION METHODS
             static Info * create(const String &filename);
             
             
             
-            virtual ~Info();
-            
             /*!
              * Loads tags and properties from the Info object of a file.
              * String returns are coming as TagLib::String.
 
             virtual String    get_lyrics(void) const;
             virtual void      set_lyrics(const String &lyrics);
+            
+            
+        protected :
+            //! Constructor to be called from derrived classes
+            Info(const String &filename = "");
+
+            //! \a TagLib::FileRef of the media file
+            TagLib::FileRef * taglib_fileref;
+            
+            //! \a TagLib::File of the media file
+            TagLib::File *    taglib_file;
+            
+            //! \a TagLib::Tag of the media file
+            TagLib::Tag *     taglib_tag;
+
+            //! The path of the media file
+            String file_name;
+            
+            //Tags
+
+            //! Title of the Info object 
+            String title;
+            //! Genre of the Info object 
+            String genre;
+            //! Artist of the Info object 
+            String artist;
+            //! Album artist of the Info object 
+            String album_artist;
+            //! Album of the Info object
+            String album;
+            //! Composer of the Info object
+            String composer;
+            //! Comments of the Info object
+            String comments;
+            //! Homepage of the Info object
+            String homepage;
+            //! Encoder of the Info object
+            String encoder;
+            //! Copyright of the Info object
+            String copyright;
+            //! Original artist of the Info object
+            String original_artist;
+            //! Track number of the Info object
+            int    track_number;
+            //! Track count of the Info object
+            int    track_count;
+            //! Year of the Info object
+            int    year;
+            //! Whether the media file is part of a compilation
+            bool   is_compilation;
+            //! Speed in beats per minute
+            int beats_per_minute;
+            //! Volume number of the Info object
+            int    volume_number;
+            //! Volume count of the Info object
+            int    volume_count;
+            
+            
+            //Audioproperties
+            //! Lenght in seconds
+            int    length_seconds;
+            //! Bitrate
+            int    bitrate;
+            //! Sample rate
+            int    samplerate;
+            //! Channel count
+            int    channels;
+            
+            //Extras
+            //! Play count
+            int    playcount;
+            //! Rating (1 - 5 stars, 0 not set) 
+            int    rating;
+            
+            //! User defined track labels
+            StringList track_labels;
+            //! User defined track labels as string with "|" as delimiter
+            String     track_labels_string;
+            //! User defined artist labels
+            StringList artist_labels;
+            //! User defined artist labels as string with "|" as delimiter
+            String     artist_labels_string;
+            //! User defined album labels
+            StringList album_labels;
+            //! User defined album labels as string with "|" as delimiter
+            String     album_labels_string;
+            
+            //! The setters for the tags on the info object will set these ChangedFlags flags
+            ulong changedflag;
+            
+            //! Whether there is image data available
+            bool has_image;
+            
+            //! Whether the info object is valid
+            bool valid;
+            
+            //! Load the abstact basic tags from TagLib::Tag
+            //! This will only do something if \param tag is not NULL
+            void   load_base_tags(TagLib::Tag * tag);
+            
+            //! Save the abstact basic tags to TagLib::Tag
+            //! This will only do something if \param tag is not NULL
+            void   save_base_tags(TagLib::Tag * tag);
     };
+
+    //! A simple, value based wrapper round Info
     
-    /* InfoRef exists to provide a minimal, generic and value-based wrapper around
+    /* ! InfoRef exists to provide a minimal, generic and value-based wrapper around
      * a Info.  It is lightweight and suitable for pass-by-value use.  
      * This hides the TagInfo::Info memory management.
      */
             ~InfoRef();
             
             Info * info() const;
-            bool is_null() const;
+            bool is_valid() const;
             bool load() const;
             bool save();
             

libtaginfo/taginfo_internal.h

 
 #include "taginfo.h"
 
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
 #include <tag.h>
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 
 namespace TagInfo {
     
-    //! \enum ChangedData Internal change flags for implementations
-    enum ChangedData {
+    //! \enum ChangedFlags Internal change flags for implementations
+    enum ChangedFlags {
         //! Nothing changed
         CHANGED_DATA_NONE          = 0,
         //! Artist tag changed
 }
 
 
-inline String format(const char* fmt, ...) {
-    char buffer[BUFFERSIZE] = {'\0'};
-    va_list vl;
-    va_start(vl, fmt);
-    int nsize = vsnprintf(buffer, BUFFERSIZE, fmt, vl);
-    if(nsize < 0) {
-        cout << "Error: String allocation failed in taginfo format function." << endl;
-        va_end(vl);
-        String ret = String("");
-        return ret;
-    }
-    else {
-        va_end(vl);
-        String ret(buffer);
-        return ret;
-    }
-}
-
-
-inline string dirname_of(const string& fname) {
-     size_t pos = fname.find_last_of("\\/");
-     return (string::npos == pos) ? "" : fname.substr(0, pos);
-}
-
-
-inline void find_and_replace(string& source, const string& find, const string& replace) {
-    size_t fLen = find.size();
-    size_t rLen = replace.size();
-    
-    for(size_t pos = 0; (pos = source.find(find, pos)) != source.npos; pos += rLen) {
-        source.replace(pos, fLen, replace);
-    }
-}
-
-
 inline int popularity_to_rating(const int popularity) {
     if(popularity <= 0)
         return 0;

libtaginfo/trueaudioinfo.cc

         taglib_file = new TrueAudio::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         taglib_tagId3v2 = ((TrueAudio::File *) taglib_file)->ID3v2Tag(true);
         if(!taglib_tagId3v2 || taglib_tagId3v2->isEmpty()) { // Use fallback for id3v1 or extended header
             //printf("Use fallback! %s\n", filename.toCString(false));

libtaginfo/waveinfo.cc

         taglib_file = new RIFF::WAV::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         taglib_tagId3v2 = (ID3v2::Tag *)((RIFF::WAV::File *) taglib_file)->tag();
         if(!taglib_tagId3v2 || taglib_tagId3v2->isEmpty()) {
             // Use fallback for id3v1 or extended header

libtaginfo/wavpackinfo.cc

         taglib_file = new WavPack::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         taglib_apetag = ((WavPack::File *) taglib_file)->APETag(true);
         if(!taglib_apetag || taglib_apetag->isEmpty()) {
             taglib_tag = ((WavPack::File *) taglib_file)->tag();

libtaginfo/xiphinfo.cc

                 original_artist = xiphcomment->fieldListMap()[PERFORMER].front();
             }
             if(xiphcomment->fieldListMap().contains(DISCNUMBER)) {
-                volume_number = atol(xiphcomment->fieldListMap()[DISCNUMBER].front().toCString(false));
+                volume_number = xiphcomment->fieldListMap()[DISCNUMBER].front().toInt();
             }
             if(xiphcomment->fieldListMap().contains(DISCTOTAL)) {
-                volume_count = atol(xiphcomment->fieldListMap()[DISCTOTAL].front().toCString(false));
+                volume_count = xiphcomment->fieldListMap()[DISCTOTAL].front().toInt();
             }
             else if(xiphcomment->fieldListMap().contains("TOTALDISC")) {
-                volume_count = atol(xiphcomment->fieldListMap()["TOTALDISC"].front().toCString(false));
+                volume_count = xiphcomment->fieldListMap()["TOTALDISC"].front().toInt();
             }
             if(xiphcomment->fieldListMap().contains(BPM_TAG)) {
-                beats_per_minute = atol(xiphcomment->fieldListMap()[BPM_TAG].front().toCString(false));
+                beats_per_minute = xiphcomment->fieldListMap()[BPM_TAG].front().toInt();
             }
             if(xiphcomment->fieldListMap().contains(TRACKTOTAL)) {
-                track_count = atol(xiphcomment->fieldListMap()[TRACKTOTAL].front().toCString(false));
+                track_count = xiphcomment->fieldListMap()[TRACKTOTAL].front().toInt();
             }
             if(xiphcomment->fieldListMap().contains(COMPILATION)) {
                 is_compilation = xiphcomment->fieldListMap()[COMPILATION].front() == String("1");
             }
             // Rating
             if(xiphcomment->fieldListMap().contains(RATING)) {
-                long rat = 0;
-                rat = atol(xiphcomment->fieldListMap()[RATING].front().toCString(true));
+                int rat = 0;
+                rat = xiphcomment->fieldListMap()[RATING].front().toInt();
                 if(rat) {
-                    if(rat > 5) {
+                    if(rat > 5)
                         rating = popularity_to_rating(rat);
-                    }
-                    else {
+                    else
                         rating = rat;
-                    }
                 }
             }
             if(xiphcomment->fieldListMap().contains(PLAY_COUNTER)) {
-                long PlayCount = 0;
-                PlayCount = atol(xiphcomment->fieldListMap()[PLAY_COUNTER].front().toCString(true));
-                playcount = PlayCount;
+                playcount = xiphcomment->fieldListMap()[PLAY_COUNTER].front().toInt();
             }
             // Labels
             if(track_labels.size() == 0) {
     if(xiphcomment) {
         if(changedflag) {
             if(changedflag & CHANGED_DATA_VOL_NUM)
-                xiphcomment->addField(DISCNUMBER, format("%u", volume_number), true);
+                xiphcomment->addField(DISCNUMBER, String::number(static_cast<int>(volume_number)), true);
             if(changedflag & CHANGED_DATA_VOL_CNT)
-                xiphcomment->addField(DISCTOTAL, format("%u", volume_count), true);
+                xiphcomment->addField(DISCTOTAL, String::number(static_cast<int>(volume_count)), true);
             if(changedflag & CHANGED_COMPOSER_TAG)
                 xiphcomment->addField(COMPOSER, composer, true);
             if(changedflag & CHANGED_ORIGINALARTIST_TAG)
                 xiphcomment->addField(PERFORMER, original_artist, true);
             if(changedflag & CHANGED_TRACK_COUNT)
-                xiphcomment->addField(TRACKTOTAL, format("%d", track_count), true);
+                xiphcomment->addField(TRACKTOTAL, String::number(static_cast<int>(track_count)), true);
             if(changedflag & CHANGED_IS_COMPILATION_TAG) {
                 if(is_compilation) {
                     xiphcomment->addField(COMPILATION, "1", true);
             if(changedflag & CHANGED_DATA_ALBUMARTIST)
                 xiphcomment->addField(ALBUMARTIST, album_artist, true);
             if(changedflag & CHANGED_DATA_RATING)
-                xiphcomment->addField(RATING, format("%u", rating_to_popularity(rating)), true);
+                xiphcomment->addField(RATING, String::number(static_cast<int>(rating_to_popularity(rating))), true);
             if(changedflag & CHANGED_DATA_PLAYCOUNT)
-                xiphcomment->addField(PLAY_COUNTER, format("%u", playcount), true);
+                xiphcomment->addField(PLAY_COUNTER, String::number(static_cast<int>(playcount)), true);
             if(changedflag & CHANGED_BPM_TAG)
-                xiphcomment->addField(BPM_TAG, format("%u", beats_per_minute), true);
+                xiphcomment->addField(BPM_TAG, String::number(static_cast<int>(beats_per_minute)), true);
             
             // The Labels
             if(changedflag & CHANGED_TRACK_LABELS)
             }
             if(i < types_cnt) {
                 itype = pic_types[i];
-                image->set_image_type((ImageType) atol(itype.toCString(false)));
+                image->set_image_type((ImageType) itype.toInt());
             }
             if(i < descr_cnt) {
                 description = pic_descr[i];
                 xiphcomment->addField(COVERART, 
                                       b64Encoded.toCString(false),
                                       false);
-                xiphcomment->addField(COVERARTTYPE, format("%d", (int)image->get_image_type()), false);
+                xiphcomment->addField(COVERARTTYPE, String::number(static_cast<int>(image->get_image_type())), false);
                 
                 if(!image->get_description().isEmpty())
                     xiphcomment->addField(COVERARTDESCRIPTION, image->get_description(), false);

libtaginfo/xminfo.cc

         taglib_file = new XM::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
+        if(!taglib_file->isOpen()) {
+            cout << "Cannot open file '" << file_name << "'" << endl;
+            valid = false;
+            return;
+        }
         taglib_tagMod = (Mod::Tag *)((XM::File *) taglib_file)->tag();
         if(!taglib_tagMod || taglib_tagMod->isEmpty()) { 
             taglib_tag = ((XM::File *) taglib_file)->tag();

tests/basic/main.cc

 
 using namespace TagInfo;
 
-int main( void )
-{
-    Info * info;
-    
-    std::string val = TESTDIR "samples/sample.flac";
-    //std::cout << std::endl << "val: " << val << std::endl;
-    info = Info::create( val );
-    if( info )
-    {
-        delete info;
+int main( void ) {
+    InfoRef iref(TESTDIR "samples/sample.flac");
+    if(!iref.is_valid()) {
         return EXIT_SUCCESS;
     }
     return EXIT_FAILURE;

tests/lyrics_aif/main.cc

 
 using namespace TagInfo;
 
+void set_lyrics(const String &target, const String &lyrics) {
+    InfoRef iref(target);
+    if(!iref.is_valid()) {
+        Info * info = iref.info();
+        info->set_lyrics(lyrics);
+        iref.save();
+    }
+}
+
+String get_lyrics(const String &target) {
+    String res;
+    InfoRef iref(target);
+    if(!iref.is_valid()) {
+        if(iref.load()) {
+            Info * info = iref.info();
+            res = info->get_lyrics();
+        }
+    }
+    return res;
+}
 
 int main( void ) {
-    Info * info;
     std::string val   = TESTDIR "samples/sample.aif";
     
-    //std::cout << std::endl << "val: " << val << std::endl;
-    std::string target = "/tmp/out_01.aif";
+    const String target = "/tmp/out_99.aif";
     
     std::ifstream  src(val.c_str());
-    std::ofstream  dst(target.c_str());
+    std::ofstream  dst(target.toCString(false));
     dst << src.rdbuf();
     
-    char* data;
-    int data_length;
-    
-    struct stat filestatus;
-    
+    const String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
-    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    set_lyrics(target, lyrics);
     
-    info = Info::create(target);
-    if(info) {
-        info->set_lyrics(lyrics);
-        info->save();
-    }
-    delete info;
-    info = NULL;
-    
-    info = Info::create(target);
-    char* read;
-    if(info) {
-        if(info->load()) {
-            String res = info->get_lyrics();
-            if(lyrics != res) {
-                delete info;
-                if(remove(target.c_str()) != 0 ) {
-                    return EXIT_FAILURE;
-                }
-            }
-            if(remove(target.c_str()) != 0 )
-                return EXIT_FAILURE;
-            return EXIT_SUCCESS;
-        }
-        delete info;
-        if(remove(target.c_str()) != 0 )
+    String l = get_lyrics(target);
+
+    if(lyrics != l) {
+        if(remove(target.toCString(false)) != 0 ) {
+            cout << "tmp file removal failed for " << target << endl;
             return EXIT_FAILURE;
+        }
         return EXIT_FAILURE;
     }
     else {
-        delete info;
-        if(remove(target.c_str()) != 0 )
+        if(remove(target.toCString(false)) != 0 ) {
+            cout << "tmp file removal failed for " << target << endl;
             return EXIT_FAILURE;
-        return EXIT_FAILURE;
+        }
+        return EXIT_SUCCESS;
     }
-    return EXIT_FAILURE;
 }
 

tests/write_mp3/main.cc

     arlabels.append("Ärtißztá");
     arlabels.append("user label1 äiiüé");
     
-    if( !iref.is_null() ) {
-        iref.info()->set_artist("artißt");
-        iref.info()->set_genre("gen re");
-        iref.info()->set_composer("cömpozér");
-        iref.info()->set_year(1982);
-        iref.info()->set_rating(2);
-        iref.info()->set_beats_per_minute(180);
-        iref.info()->set_title("titlöe");
-        iref.info()->set_original_artist ("ürgar t");
-        iref.info()->set_homepage("ööö");
-        iref.info()->set_encoder("encödr");
-        iref.info()->set_track_number(2);
-        iref.info()->set_track_count(5);
-        iref.info()->set_volume_number(1);
-        iref.info()->set_volume_count(3);
-        iref.info()->set_copyright("Cöpppyright");
-        iref.info()->set_album_artist("äöé");
-        iref.info()->set_is_compilation(true);
-        iref.info()->set_comments("Cömmméé\nèntß");
-        iref.info()->set_album_labels_list(allabels);
-        iref.info()->set_artist_labels_list(arlabels);
-        iref.info()->set_track_labels_list(trlabels);
+    if( !iref.is_valid() ) {
+        Info * info = iref.info();
+        info->set_artist("artißt");
+        info->set_genre("gen re");
+        info->set_composer("cömpozér");
+        info->set_year(1982);
+        info->set_rating(2);
+        info->set_beats_per_minute(180);
+        info->set_title("titlöe");
+        info->set_original_artist ("ürgar t");
+        info->set_homepage("ööö");
+        info->set_encoder("encödr");
+        info->set_track_number(2);
+        info->set_track_count(5);
+        info->set_volume_number(1);
+        info->set_volume_count(3);
+        info->set_copyright("Cöpppyright");
+        info->set_album_artist("äöé");
+        info->set_is_compilation(true);
+        info->set_comments("Cömmméé\nèntß");
+        info->set_album_labels_list(allabels);
+        info->set_artist_labels_list(arlabels);
+        info->set_track_labels_list(trlabels);
         iref.save();
     }
     InfoRef iref2(target);
-    if( !iref2.is_null() ) {
+    if( !iref2.is_valid() ) {
         if( iref2.load() ) {
+            Info * info = iref2.info();
             //std::cout << "info->get_track_number(): " << info->get_track_number() << std::endl;
             //std::cout << "info->get_track_count(): " << info->get_track_count() << std::endl;
-            if(iref2.info()->get_artist() == "artißt" &&
-               iref2.info()->get_genre() == "gen re" &&
-               iref2.info()->get_composer() == "cömpozér" &&
-               iref2.info()->get_year() == 1982 &&
-               iref2.info()->get_rating() == 2 &&
-               iref2.info()->get_beats_per_minute() == 180 &&
-               iref2.info()->get_title() == "titlöe" &&
-               iref2.info()->get_original_artist () == "ürgar t" &&
-               iref2.info()->get_homepage() == "ööö" &&
-               iref2.info()->get_encoder() == "encödr" &&
-               iref2.info()->get_track_number() == 2 &&
-               iref2.info()->get_track_count() == 5 &&
-               iref2.info()->get_volume_number() == 1 &&
-               iref2.info()->get_volume_count() == 3 &&
-               iref2.info()->get_copyright() == "Cöpppyright" &&
-               iref2.info()->get_album_artist() == "äöé" &&
-               iref2.info()->get_is_compilation() &&
-               iref2.info()->get_comments() == "Cömmméé\nèntß" &&
-               check_list_equal(iref2.info()->get_artist_labels_list(), arlabels) &&
-               check_list_equal(iref2.info()->get_album_labels_list(), allabels) &&
-               check_list_equal(iref2.info()->get_track_labels_list(), trlabels)    ) {
+            if(info->get_artist() == "artißt" &&
+               info->get_genre() == "gen re" &&
+               info->get_composer() == "cömpozér" &&
+               info->get_year() == 1982 &&
+               info->get_rating() == 2 &&
+               info->get_beats_per_minute() == 180 &&
+               info->get_title() == "titlöe" &&
+               info->get_original_artist () == "ürgar t" &&
+               info->get_homepage() == "ööö" &&
+               info->get_encoder() == "encödr" &&
+               info->get_track_number() == 2 &&
+               info->get_track_count() == 5 &&
+               info->get_volume_number() == 1 &&
+               info->get_volume_count() == 3 &&
+               info->get_copyright() == "Cöpppyright" &&
+               info->get_album_artist() == "äöé" &&
+               info->get_is_compilation() &&
+               info->get_comments() == "Cömmméé\nèntß" &&
+               check_list_equal(info->get_artist_labels_list(), arlabels) &&
+               check_list_equal(info->get_album_labels_list(), allabels) &&
+               check_list_equal(info->get_track_labels_list(), trlabels)    ) {
                 if(remove(target.toCString(false)) != 0 )
                     return EXIT_FAILURE;
                 return EXIT_SUCCESS;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.