Commits

shuerhaaken committed 6a323e2

more work on new image api

Comments (0)

Files changed (26)

bindings/c/taginfo_c.cc

 }
 
 
-char * taginfo_image_get_data(const TagInfo_Image * img, int * image_data_length) {
-    image_data_length = 0;
+TagInfo_Image * taginfo_image_new() {
+    Image * i = new Image();
+    return reinterpret_cast<TagInfo_Image *>(i);
+}
+
+char * taginfo_image_get_data(const TagInfo_Image * img, unsigned int * bin_data_length) {
     if(!img)
         return NULL;
     const Image *i = reinterpret_cast<const Image *>(img);
-    return i->get_data(*image_data_length);
+    return i->get_data(*bin_data_length);
+}
+
+void taginfo_image_set_data(TagInfo_Image * img, char * bin_data, unsigned int bin_data_length) {
+    if(!img || bin_data_length <= 0)
+        return;
+    Image *i = reinterpret_cast<Image *>(img);
+    i->set_data(bin_data, bin_data_length);
 }
 
 TagInfo_ImageType taginfo_image_get_image_type(const TagInfo_Image * img) {
     return static_cast<TagInfo_ImageType>(i->get_image_type());
 }
 
+void taginfo_image_set_image_type(TagInfo_Image * img, TagInfo_ImageType itype) {
+    if(!img)
+        return;
+    Image *i = reinterpret_cast<Image *>(img);
+    i->set_image_type(static_cast<ImageType>(itype));
+}
+
 TagInfo_ImageFileType taginfo_image_get_image_file_type(const TagInfo_Image * img) {
     if(!img)
-        return TAG_INFO_IMAGE_FILE_TYPE_UNKNOWN,;
+        return TAG_INFO_IMAGE_FILE_TYPE_UNKNOWN;
     const Image *i = reinterpret_cast<const Image *>(img);
     return static_cast<TagInfo_ImageFileType>(i->get_image_file_type());
 }
 
+void taginfo_image_set_image_file_type(TagInfo_Image * img, TagInfo_ImageFileType image_f_type) {
+    if(!img)
+        return;
+    Image *i = reinterpret_cast<Image *>(img);
+    i->set_image_file_type(static_cast<ImageFileType>(image_f_type));
+}
+
+char * taginfo_image_get_description(const TagInfo_Image * img) {
+    if(!img)
+        return NULL;
+    const Image *i = reinterpret_cast<const Image *>(img);
+    return ::strdup(i->get_description().toCString(false));
+}
+
+void taginfo_image_set_description(TagInfo_Image * img, const char * new_description) {
+    if(!img)
+        return;
+    Image *i = reinterpret_cast<Image *>(img);
+    String s = String();
+    if(!new_description)
+        i->set_description(s);
+    else
+        i->set_description(new_description);
+}
+
+
 /*!
  * Frees a TagInfo_Image object.
  */
 \param lyrics Lyrics string
 */
 //! \param info A TagInfo_Info object
-BOOL taginfo_info_set_lyrics(TagInfo_Info *info, const char * lyrics) {
+void taginfo_info_set_lyrics(TagInfo_Info *info, const char * lyrics) {
     Info *i = reinterpret_cast<Info *>(info);
-    return i->set_lyrics(String(lyrics, String::UTF8));
+    i->set_lyrics(String(lyrics));
 }
 //*****************/LYRICS***************************************************************
 

bindings/c/taginfo_c.h

 //! TagInfo_Info is an abstraction for accessing media file tags. 
 //! The caller should destroy TagInfo_Info with taginfo_info_free() after usage. Internal data will then automatically be removed.
 typedef struct { 
-    //#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    //int dummy; 
-    //#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 } TagInfo_Info;
 
 
 //! TagInfo_Image contains image data and image information. 
 //! The caller should destroy TagInfo_Image with taginfo_image_free() after usage. Internal data will then automatically be removed.
 typedef struct {
-    //! Pointer to the image data array
-    char *                  data;
-    //! Size of the image data array
-    unsigned long           data_length;
-    //! Content of the image
-    TagInfo_ImageType       image_type;
-    //! File format of the image
-    TagInfo_ImageFileType   image_file_type;
-    //! Description string of the image
-    char *                  description;
 } TagInfo_Image;
 
 
                                     const char* const* data,
                                     int data_length);
 
-// IMAGE
+// IMAGE Extraction
 TagInfo_Image ** taginfo_info_get_images(const TagInfo_Info *info,
                                          int *image_count);
 void taginfo_info_set_images(TagInfo_Info *info,
                              const TagInfo_Image ** images,
                              const int image_count);
-char * taginfo_image_get_data(const TagInfo_Image * image, int * image_data_length);
 
-TagInfo_ImageType taginfo_image_get_image_type(const TagInfo_Image * image);
 
-TagInfo_ImageFileType taginfo_image_get_image_file_type(const TagInfo_Image * image);
+
+// IMAGE API
+TagInfo_Image * taginfo_image_new();
+
+char * taginfo_image_get_data(const TagInfo_Image * img, unsigned int * bin_data_length);
+void taginfo_image_set_data(TagInfo_Image * img, char * bin_data, unsigned int bin_data_length);
+
+TagInfo_ImageType taginfo_image_get_image_type(const TagInfo_Image * img);
+void taginfo_image_set_image_type(TagInfo_Image * img, TagInfo_ImageType itype);
+
+TagInfo_ImageFileType taginfo_image_get_image_file_type(const TagInfo_Image * img);
+void taginfo_image_set_image_file_type(TagInfo_Image * img, TagInfo_ImageFileType image_f_type);
+
+char * taginfo_image_get_description(const TagInfo_Image * img);
+void taginfo_image_set_description(TagInfo_Image * img, const char * new_description);
 
 // LYRICS
 char * taginfo_info_get_lyrics(const TagInfo_Info *info);
-BOOL taginfo_info_set_lyrics(TagInfo_Info *info,
+void taginfo_info_set_lyrics(TagInfo_Info *info,
                              const char *lyrics);
 
 

bindings/vala/libtaginfo_c.vapi

 	}
 	
 	[Compact]
-	[CCode (free_function = "taginfo_image_free")]
+	[CCode (free_function = "taginfo_image_free", cprefix = "taginfo_image_")]
 	public class Image
 	{
-		[CCode (array_length_cname = "data_length", array_length_type = "ulong")]
-		public uint8[]          data;
-		public ImageType        image_type;
-		public ImageFileType    image_file_type;
-		public string           description;
+		public Image();
+		
+		[CCode (array_length_cname = "bin_data_length", array_length_type = "unsigned int")]
+		public uint8[] get_data();
+		public void set_data([CCode (array_length_cname = "bin_data_length", array_length_type = "unsigned int")] uint8[] data);
+		
+		public ImageType get_image_type();
+		public void set_image_type(ImageType itype);
+		
+		public ImageFileType get_image_file_type();
+		public void set_image_file_type(ImageFileType image_f_type);
+		
+		public string get_description();
+		public void set_description(string new_description);
 	}
 	
 	[Compact]
 		//creation method using mimetype
 		public static Info create_from_mime (string filename, string mimetype);
 		
+		// Info <-> File mappings
 		public bool load ();
-		
 		public bool save ();
 		
+		// TAG ACCESS
 		public string album {
 			[CCode (cname = "taginfo_info_get_album")]
 			owned get;
 			[CCode (cname = "taginfo_info_set_year")]
 			set;
 		}
+		
+		//PROPERTIES
 		public int length {
 			[CCode (cname = "taginfo_info_get_length")]
 			get;
 		public void     set_images (Image[] images);
 		
 		// LYRICS ACCESS
-		string get_lyrics();
-		bool   set_lyrics(string lyrics);
+		public string lyrics {
+			[CCode (cname = "taginfo_info_get_lyrics")]
+			owned get;
+			[CCode (cname = "taginfo_info_set_lyrics")]
+			set;
+		}
 	}
 }
 

libtaginfo/apetaginfo.cc

         taglib_apetag->removeItem(APE_TAG_COVER_ART_PUBLISHER_LOGO);
         
         for(int p = 0; p < image_count; p++) {
-cout << "sjdf 1" << endl;
             if(images[p]->get_data().isEmpty())
                 continue;
-cout << "sjdf 2" << endl;
             ByteVector image_vect(images[p]->get_data());
 //            memcpy(ImgData.data(), images[p]->data, images[p]->data_length);
             
 }
 
 
-String ApeTagInfo::get_lyrics(void) const {
+String ApeTagInfo::get_lyrics() const {
     if(taglib_apetag->itemListMap().contains(APE_TAG_LYRICS))
         return taglib_apetag->itemListMap()[APE_TAG_LYRICS].toStringList().front();
     return String();
 }
 
 
-bool ApeTagInfo::set_lyrics(const String &lyrics) {
+void ApeTagInfo::set_lyrics(const String &lyrics) {
     if(taglib_apetag) {
-        taglib_apetag->addValue(APE_TAG_LYRICS, lyrics);
-        return true;
+        taglib_apetag->removeItem(APE_TAG_LYRICS);
+        if(!lyrics.isEmpty())
+            taglib_apetag->addValue(APE_TAG_LYRICS, lyrics);
+        return;
     }
-    return false;
 }
 

libtaginfo/asfinfo.cc

 }
 
 
-bool AsfInfo::set_lyrics(const String &lyrics) {
+void AsfInfo::set_lyrics(const String &lyrics) {
     if(asf_tag) {
         asf_tag->removeItem(LYRICS);
-        asf_tag->setAttribute(LYRICS, lyrics);
-        return true;
+        if(!lyrics.isEmpty())
+            asf_tag->setAttribute(LYRICS, lyrics);
     }
-    return false;
 }
 
 

libtaginfo/id3info.cc

 }
 
 
-bool Id3Info::set_lyrics(const String &lyrics) {
+void Id3Info::set_lyrics(const String &lyrics) {
     if(taglib_tagId3v2) {
         ID3v2::UnsynchronizedLyricsFrame * lyrics_frame;
         ID3v2::FrameList frameList = taglib_tagId3v2->frameListMap()[LYRICS];
             lyrics_frame->setText(lyrics);
             taglib_tagId3v2->addFrame(lyrics_frame);
         }
-        return true;
     }
-    return false;
 }
 
 

libtaginfo/image.cc

     return bytes;
 }
 
-char * Image::get_data(int &image_data_length) const {
+char * Image::get_data(uint &image_data_length) const {
     image_data_length = bytes.size();
     char * idat;
     memcpy(idat, bytes.data(), bytes.size());
     bytes = image_data;
 }
 
-void Image::set_data(const char * image_data, const int image_data_length) {
+void Image::set_data(const char * image_data, const uint image_data_length) {
     ByteVector v(image_data, image_data_length);
     bytes = v;
 }

libtaginfo/info.cc

     return String();
 }
 //! Set an embedded Lyrics String to be saved to Info object.
-bool Info::set_lyrics(const String &lyrics) {
-    return false;
+void Info::set_lyrics(const String &lyrics) {
 }
 

libtaginfo/mp4info.cc

 #include <mp4file.h>
 #include <mp4coverart.h>
 
+
+#define LYRICS              "\xa9lyr"
+#define COPYRIGHT           "\xa9" "cpy"
+#define HOMEPAGE            "\xa9src"
+#define COMPOSER            "\xA9wrt"
+#define ORIGINAL_ARTIST     "\xa9prf"
+#define ENCODER             "\xa9too"
+
 using namespace TagInfo;
 
 
 // MP4
 
 
-
 Mp4Info::Mp4Info(const String &filename) : Info(filename) {
     if(file_name.isEmpty()) {
         valid = false;
                 track_number = mp4_tag->itemListMap()["trkn"].toIntPair().first;
                 track_count  = mp4_tag->itemListMap()["trkn"].toIntPair().second;
             }
-            if(mp4_tag->itemListMap().contains("\xA9wrt")) {
-                composer = mp4_tag->itemListMap()["\xa9wrt"].toStringList().front();
+            if(mp4_tag->itemListMap().contains(COMPOSER)) {
+                composer = mp4_tag->itemListMap()[COMPOSER].toStringList().front();
             }
-            if(mp4_tag->itemListMap().contains("\xa9prf")) {
-                original_artist = mp4_tag->itemListMap()["\xa9prf"].toStringList().front();
+            if(mp4_tag->itemListMap().contains(ORIGINAL_ARTIST)) {
+                original_artist = mp4_tag->itemListMap()[ORIGINAL_ARTIST].toStringList().front();
             }
-            if(mp4_tag->itemListMap().contains("\xa9" "cpy")) {
-                copyright = mp4_tag->itemListMap()["\xa9" "cpy"].toStringList().front();
+            if(mp4_tag->itemListMap().contains(COPYRIGHT)) {
+                copyright = mp4_tag->itemListMap()[COPYRIGHT].toStringList().front();
             }
-            if(mp4_tag->itemListMap().contains("\xa9too")) {
-                encoder = mp4_tag->itemListMap()["\xa9too"].toStringList().front();
+            if(mp4_tag->itemListMap().contains(ENCODER)) {
+                encoder = mp4_tag->itemListMap()[ENCODER].toStringList().front();
             }
-            if(mp4_tag->itemListMap().contains("\xa9src")) {
-                homepage = mp4_tag->itemListMap()["\xa9src"].toStringList().front();
+            if(mp4_tag->itemListMap().contains(HOMEPAGE)) {
+                homepage = mp4_tag->itemListMap()[HOMEPAGE].toStringList().front();
             }
             if(mp4_tag->itemListMap().contains("disk")) {
                 volume_number = mp4_tag->itemListMap()["disk"].toIntPair().first;
             if(changedflag & CHANGED_DATA_ALBUMARTIST)
                 mp4_tag->itemListMap()["aART"] = StringList(album_artist);
             if(changedflag & CHANGED_COMPOSER_TAG)
-                mp4_tag->itemListMap()["\xA9wrt"] = StringList(composer);
+                mp4_tag->itemListMap()[COMPOSER] = StringList(composer);
             if(changedflag & CHANGED_ORIGINALARTIST_TAG)
-                mp4_tag->itemListMap()["\xa9prf"] = StringList(original_artist);
+                mp4_tag->itemListMap()[ORIGINAL_ARTIST] = StringList(original_artist);
             if(changedflag & CHANGED_TRACK_NUMBER) {
                 if(!(changedflag & CHANGED_TRACK_COUNT)) {
                     // prevent overwrite in save_base_tags()
             
             
             if(changedflag & CHANGED_COPYRIGHT_TAG)
-                mp4_tag->itemListMap()["\xa9" "cpy"] = StringList(copyright);
+                mp4_tag->itemListMap()[COPYRIGHT] = StringList(copyright);
             if(changedflag & CHANGED_ENCODER_TAG)
-                mp4_tag->itemListMap()["\xa9too"] = StringList(encoder);
+                mp4_tag->itemListMap()[ENCODER] = StringList(encoder);
             if(changedflag & CHANGED_HOMEPAGE_TAG)
-                mp4_tag->itemListMap()["\xa9src"] = StringList(homepage);
+                mp4_tag->itemListMap()[HOMEPAGE] = StringList(homepage);
             
             save_base_tags((Tag *)mp4_tag);
         }
 
 String Mp4Info::get_lyrics(void) const {
     if(mp4_tag) {
-            if(mp4_tag->itemListMap().contains("\xa9lyr"))
-                return mp4_tag->itemListMap()[ "\xa9lyr" ].toStringList().front();
+        if(mp4_tag->itemListMap().contains(LYRICS))
+            return mp4_tag->itemListMap()[ LYRICS ].toStringList().front();
     }
     return String();
 }
 
 
-bool Mp4Info::set_lyrics(const String &lyrics) {
+void Mp4Info::set_lyrics(const String &lyrics) {
     if(mp4_tag) {
-            if(mp4_tag->itemListMap().contains("\xa9lyr")) {
-            mp4_tag->itemListMap().erase("\xa9lyr");
-        }
-        if(!lyrics.isEmpty()) {
-            mp4_tag->itemListMap()[ "\xa9lyr" ] = StringList(lyrics);
-        }
-        return true;
+        if(mp4_tag->itemListMap().contains(LYRICS))
+            mp4_tag->itemListMap().erase(LYRICS);
+        if(!lyrics.isEmpty()) 
+            mp4_tag->itemListMap()[ LYRICS ] = StringList(lyrics);
     }
-    return false;
 }
 
 

libtaginfo/taginfo.h

             virtual void     set_images(const Image ** images, const int image_count);
 
             virtual String   get_lyrics(void) const;
-            virtual bool     set_lyrics(const String &lyrics);
+            virtual void     set_lyrics(const String &lyrics);
             
             // CREATION METHODS
             static Info * create(const String &filename);

libtaginfo/taginfo_apetags.h

             virtual void     set_images(const Image ** images, const int image_count);
             
             virtual String   get_lyrics(void) const;
-            virtual bool     set_lyrics(const String &lyrics);
+            virtual void     set_lyrics(const String &lyrics);
     };
     
     

libtaginfo/taginfo_asftags.h

             virtual void     set_images(const Image ** images, const int image_count);
             
             virtual String   get_lyrics(void) const;
-            virtual bool     set_lyrics(const String &lyrics);
+            virtual void     set_lyrics(const String &lyrics);
     };
 }
 

libtaginfo/taginfo_id3tags.h

             virtual void     set_images(const Image ** images, const int image_count);
             
             virtual String   get_lyrics(void) const;
-            virtual bool     set_lyrics(const String &lyrics);
+            virtual void     set_lyrics(const String &lyrics);
     };
     
     

libtaginfo/taginfo_image.h

             //! Get image binary data
             //! \param image_data_length is the return location for the length of the binary data array
             //! \return Byte array with binary data
-            char * get_data(int &image_data_length) const;
+            char * get_data(uint &image_data_length) const;
             
             //! Set image binary data
             //! \param image_data The Byte array with binary image data
             //! \param image_data_length is the length of the binary image data array
-            void set_data(const char * image_data, const int image_data_length);
+            void set_data(const char * image_data, const uint image_data_length);
             
             //! Set image binary data
             //! \param image_data ByteVector with binary image data

libtaginfo/taginfo_mp4tags.h

             virtual void     set_images(const Image ** images, const int image_count);
             
             virtual String   get_lyrics(void) const;
-            virtual bool     set_lyrics(const String &lyrics);
+            virtual void     set_lyrics(const String &lyrics);
     };
 }
 

libtaginfo/taginfo_xiphtags.h

             virtual void     set_images(const Image ** images, const int image_count);
             
             virtual String get_lyrics(void) const;
-            virtual bool   set_lyrics(const String &lyrics);
+            virtual void   set_lyrics(const String &lyrics);
     };
     
     // FILE TYPES

libtaginfo/xiphinfo.cc

 
 
 String XiphInfo::get_lyrics(void) const {
-    if(xiphcomment && xiphcomment->contains(LYRICS)) {
+    if(xiphcomment && xiphcomment->contains(LYRICS))
         return xiphcomment->fieldListMap()[ LYRICS ].front();
-    }
     return String();
 }
 
 
-bool XiphInfo::set_lyrics(const String &lyrics) {
+void XiphInfo::set_lyrics(const String &lyrics) {
     if(xiphcomment) {
         xiphcomment->removeField(LYRICS);
-        if(!lyrics.isEmpty()) {
+        if(!lyrics.isEmpty())
             xiphcomment->addField(LYRICS, lyrics, true);
-        }
-        return true;
     }
-    return false;
 }
 

tests/lyrics_aif/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            //std::cout << "##6" << res << std::endl;
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;

tests/lyrics_ape/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            //std::cout << "##6" << res << std::endl;
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;

tests/lyrics_asf/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;

tests/lyrics_flac/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;

tests/lyrics_m4a/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            //std::cout << "##6" << res << std::endl;
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;

tests/lyrics_mp3/main.cc

     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics)) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;

tests/lyrics_mpc/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            //std::cout << "##6" << res << std::endl;
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;

tests/lyrics_ogg/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;

tests/lyrics_speex/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
-            delete info;
-            return EXIT_FAILURE;
-        }
+        info->set_lyrics(lyrics);
         info->save();
     }
     delete info;
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;