mp3.c
branchtrunk
changeset 29 640ce9201139
parent 25 887faebaba0a
child 30 f8a59739816b
     1.1 --- a/mp3.c	Mon Aug 17 20:55:55 2009 +0800
     1.2 +++ b/mp3.c	Mon Aug 17 20:56:48 2009 +0800
     1.3 @@ -803,8 +803,7 @@
     1.4    if(si) {
     1.5      Item(tr("Filename"),name);
     1.6      if(si->HasInfo() && si->Total>0) {
     1.7 -      char *buf=0;
     1.8 -      asprintf(&buf,"%02d:%02d",si->Total/60,si->Total%60);
     1.9 +      char *buf=aprintf("%02d:%02d",si->Total/60,si->Total%60);
    1.10        Item(tr("Length"),buf);
    1.11        free(buf);
    1.12        Item(tr("Title"),si->Title);
    1.13 @@ -823,8 +822,7 @@
    1.14  {
    1.15    cOsdItem *item;
    1.16    if(num>=0.0) {
    1.17 -    char *buf=0;
    1.18 -    asprintf(&buf,format?format:"%.f",num);
    1.19 +    char *buf=aprintf(format?format:"%.f",num);
    1.20      item=Item(name,buf);
    1.21      free(buf);
    1.22      }
    1.23 @@ -834,8 +832,7 @@
    1.24  
    1.25  cOsdItem *cMenuID3Info::Item(const char *name, const char *text)
    1.26  {
    1.27 -  char *buf=0;
    1.28 -  asprintf(&buf,"%s:\t%s",name,text?text:"");
    1.29 +  char *buf=aprintf("%s:\t%s",name,text?text:"");
    1.30    cOsdItem *item = new cOsdItem(buf,osBack);
    1.31    item->SetSelectable(false);
    1.32    free(buf);
    1.33 @@ -939,13 +936,13 @@
    1.34  
    1.35  void cMenuPlayListItem::Set(void)
    1.36  {
    1.37 -  char *buffer=0;
    1.38 +  char *buffer;
    1.39    cSongInfo *si=song->Info(false);
    1.40    if(showID3 && !si) si=song->Info();
    1.41    if(showID3 && si && si->Title)
    1.42 -    asprintf(&buffer, "%d.\t%s",song->Index()+1,*TitleArtist(si->Title,si->Artist));
    1.43 +    buffer=aprintf("%d.\t%s",song->Index()+1,*TitleArtist(si->Title,si->Artist));
    1.44    else
    1.45 -    asprintf(&buffer, "%d.\t<%s>",song->Index()+1,song->Name());
    1.46 +    buffer=aprintf("%d.\t<%s>",song->Index()+1,song->Name());
    1.47    SetText(buffer,false);
    1.48  }
    1.49  
    1.50 @@ -1109,8 +1106,7 @@
    1.51    free(newname); newname=0;
    1.52  
    1.53    oldname=Oldname;
    1.54 -  char *buf=NULL;
    1.55 -  asprintf(&buf,"%s\t%s",tr("Old name:"),oldname);
    1.56 +  char *buf=aprintf("%s\t%s",tr("Old name:"),oldname);
    1.57    cOsdItem *old = new cOsdItem(buf,osContinue);
    1.58    old->SetSelectable(false);
    1.59    Add(old);
    1.60 @@ -1157,8 +1153,7 @@
    1.61  
    1.62  void cMenuMP3Item::Set(void)
    1.63  {
    1.64 -  char *buffer=0;
    1.65 -  asprintf(&buffer," %s",playlist->BaseName());
    1.66 +  char *buffer=aprintf(" %s",playlist->BaseName());
    1.67    SetText(buffer,false);
    1.68  }
    1.69  
    1.70 @@ -1440,7 +1435,7 @@
    1.71    static char *help_str=0;
    1.72    
    1.73    free(help_str);    //                                     for easier orientation, this is column 80|
    1.74 -  asprintf(&help_str,"  -m CMD,   --mount=CMD    use CMD to mount/unmount/eject mp3 sources\n"
    1.75 +  help_str=aprintf(  "  -m CMD,   --mount=CMD    use CMD to mount/unmount/eject mp3 sources\n"
    1.76                       "                           (default: %s)\n"
    1.77                       "  -n CMD,   --network=CMD  execute CMD before & after network access\n"
    1.78                       "                           (default: %s)\n"