Exemple #1
0
/* [JEC] old id3lib versions may have used index_t for itemNum but size_t is what it wants now and seems safe enough. */
static size_t local__ID3Field_GetASCII_wrapper(const ID3Field *field, char *buffer, size_t maxChars, size_t itemNum)
{

	/* Defined by id3lib:   ID3LIB_MAJOR_VERSION, ID3LIB_MINOR_VERSION, ID3LIB_PATCH_VERSION
	 * Defined by autoconf: ID3LIB_MAJOR,         ID3LIB_MINOR,         ID3LIB_PATCH
	 *
	 * <= 3.7.12 : first item num is 1 for ID3Field_GetASCII
	 *  = 3.7.13 : first item num is 0 for ID3Field_GetASCII
	 * >= 3.8.0  : doesn't need item num for ID3Field_GetASCII
	 */
#    if (ID3LIB_MAJOR >= 3)
		 /* (>= 3.x.x) */
#        if (ID3LIB_MINOR <= 7)
			 /* (3.0.0 to 3.7.x) */
#            if (ID3LIB_PATCH >= 13)
				 /* (>= 3.7.13) */
				 return ID3Field_GetASCII(field, buffer, maxChars, itemNum);
#            else
				 return ID3Field_GetASCII(field, buffer, maxChars, itemNum+1);
#            endif
#        else
			 /* (>= to 3.8.0) */
			 /*return ID3Field_GetASCII(field, buffer, maxChars); */
			 return ID3Field_GetASCIIItem(field, buffer, maxChars, itemNum);
#        endif
#    else
		 /* Not tested (< 3.x.x) */
		 return ID3Field_GetASCII(field, buffer, maxChars, itemNum+1);
#    endif
}
Exemple #2
0
/* get the text field from a frame from a tag. */
static size_t get_text_field_from_tag(ID3Tag *id3tag, ID3_FrameID frameid,
				      ID3_FieldID fieldid, char *buffer, int nth)
{
  int length = 0;
  ID3Field *field = get_id3_field(id3tag, frameid, fieldid);
  
  if (field != NULL) {
    /* got the field. now get the text item in it. its possible that
     * there are multiple text fields in it. lets just get the first
     * one.*/
    length = ID3Field_GetASCIIItem(field, buffer, MAX_STRING_LEN, nth);
  } else {
    length = 0;
  }

  return length;
}