Commits

shuerhaaken committed add746a

avoid asprintf

Comments (0)

Files changed (6)

+commit 593f07b216c5e388b58b8de7c83beb4ca4f20458
+Author: Jörn Magens <shuerhaaken@googlemail.com>
+Date:   Thu Mar 21 11:56:19 2013 +0100
+
+    fixes; extend C test; extend vala binding; Comments
+
 commit d9b7e1c55e663372cc5609d1cca276e340ffa59a
 Author: Jörn Magens <shuerhaaken@googlemail.com>
 Date:   Thu Mar 21 11:21:36 2013 +0100

libtaginfo/apeinfo.cc

                 taglib_apetag->addValue(APE_TAG_ALBUMARTIST, album_artist);
             
             if(changedflag & CHANGED_DATA_RATING) {
-                char* str;
+//                char* str;
                 taglib_apetag->addValue(APE_TAG_RATING, format("%u", rating_to_popularity(rating)));
                 /*if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) {
                     taglib_apetag->addValue(APE_TAG_RATING, str);
                     free (str);
                     str = NULL;
                 }*/
+                taglib_apetag->addValue("PLAY_COUNTER", format("%u", playcount)); // TODO
                 
-                if(asprintf (&str, "%u", playcount) >= 0) {
-                    taglib_apetag->addValue("PLAY_COUNTER", str);
-                    free (str);
-                }
+//                if(asprintf (&str, "%u", playcount) >= 0) {
+//                    taglib_apetag->addValue("PLAY_COUNTER", str);
+//                    free (str);
+//                }
             }
             if(changedflag & CHANGED_TRACK_LABELS)
                 check_ape_label_frame(taglib_apetag, "TRACK_LABELS",  track_labels_string);

libtaginfo/mpcinfo.cc

                 taglib_apetag->addValue("ALBUM ARTIST", album_artist);
             
             if(changedflag & CHANGED_DATA_RATING) {
-                char* str;
-                
-                if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) { //TODO
-                    taglib_apetag->addValue("RATING", str);
-                    free (str);
-                    str = NULL;
-                }
-                
-                if(asprintf (&str, "%u", playcount) >= 0) {
-                    taglib_apetag->addValue("PLAY_COUNTER", str);
-                    free (str);
-                }
+//                char* str;
+                taglib_apetag->addValue("RATING", format("%u", rating_to_popularity(rating))); // TODO
+//                if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) { //TODO
+//                    taglib_apetag->addValue("RATING", str);
+//                    free (str);
+//                    str = NULL;
+//                }
+                taglib_apetag->addValue("PLAY_COUNTER", format("%u", playcount));
+//                if(asprintf (&str, "%u", playcount) >= 0) {
+//                    taglib_apetag->addValue("PLAY_COUNTER", str);
+//                    free (str);
+//                }
             }
             // Labels
             if(changedflag & CHANGED_TRACK_LABELS)

libtaginfo/ogginfo.cc

                 xiphcomment->addField("ALBUMARTIST", album_artist);
             
             if(changedflag & CHANGED_DATA_RATING) {
-                char* str;
-                if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) {
-                    xiphcomment->addField("RATING", str);
-                    free(str);
-                }
-                
-                if(asprintf (&str, "%u", playcount) >= 0) {
-                    xiphcomment->addField("PLAY_COUNTER", str);
-                    free(str);
-                }
+                xiphcomment->addField("RATING", format("%u", rating_to_popularity(rating)));
+                xiphcomment->addField("PLAY_COUNTER", format("%u", playcount));
+//                char* str;
+//                if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) {
+//                    xiphcomment->addField("RATING", str);
+//                    free(str);
+//                }
+//                
+//                if(asprintf (&str, "%u", playcount) >= 0) {
+//                    xiphcomment->addField("PLAY_COUNTER", str);
+//                    free(str);
+//                }
             }
             // The Labels
             if(changedflag & CHANGED_TRACK_LABELS)

libtaginfo/speexinfo.cc

                 xiphcomment->addField("ALBUMARTIST", album_artist);
             
             if(changedflag & CHANGED_DATA_RATING) {
-                char* str;
-                if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) {
-                    xiphcomment->addField("RATING", str);
-                    free(str);
-                }
-                
-                if(asprintf (&str, "%u", playcount) >= 0) {
-                    xiphcomment->addField("PLAY_COUNTER", str);
-                    free(str);
-                }
+                xiphcomment->addField("RATING", format("%u", rating_to_popularity(rating)));
+                xiphcomment->addField("PLAY_COUNTER", format("%u", playcount));
+//                char* str;
+//                if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) {
+//                    xiphcomment->addField("RATING", str);
+//                    free(str);
+//                }
+//                
+//                if(asprintf (&str, "%u", playcount) >= 0) {
+//                    xiphcomment->addField("PLAY_COUNTER", str);
+//                    free(str);
+//                }
             }
             // The Labels
             if(changedflag & CHANGED_TRACK_LABELS)

libtaginfo/wavpackinfo.cc

             if(changedflag & CHANGED_DATA_ALBUMARTIST)
                 taglib_apetag->addValue("ALBUM ARTIST", album_artist);
             if(changedflag & CHANGED_DATA_RATING) {
-                char* str;
-                
-                if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) {
-                    taglib_apetag->addValue("RATING", str);
-                    free(str);
-                    str = NULL;
-                }
-                
-                if(asprintf (&str, "%u", playcount) >= 0) {
-                    taglib_apetag->addValue("PLAY_COUNTER", str);
-                    free(str);
-                }
+                taglib_apetag->addValue("RATING", format("%u", rating_to_popularity(rating)));
+                taglib_apetag->addValue("PLAY_COUNTER", format("%u", playcount));
+//                char* str;
+//                
+//                if(asprintf (&str, "%u", rating_to_popularity(rating)) >= 0) {
+//                    taglib_apetag->addValue("RATING", str);
+//                    free(str);
+//                    str = NULL;
+//                }
+//                
+//                if(asprintf (&str, "%u", playcount) >= 0) {
+//                    taglib_apetag->addValue("PLAY_COUNTER", str);
+//                    free(str);
+//                }
             }
             // The Labels
             if(changedflag & CHANGED_ARTIST_LABELS)
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.