Skip to content

Commit

Permalink
[cddb] use uint32_t for the disc id rather than unsigned long and oth…
Browse files Browse the repository at this point in the history
…er permutations - it has to be 32 bits. fixes #13933.
  • Loading branch information
Jonathan Marshall committed Jan 8, 2013
1 parent ed80802 commit 6dc15cd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions xbmc/network/cddb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ bool Xcddb::queryCDinfo(CCdInfo* pInfo, int inexact_list_select)
return false;
}

unsigned long discid = pInfo->GetCddbDiscId();
uint32_t discid = pInfo->GetCddbDiscId();


//##########################################################
Expand Down Expand Up @@ -354,7 +354,7 @@ int Xcddb::cddb_sum(int n)
}

//-------------------------------------------------------------------------------------------------------------------
unsigned long Xcddb::calc_disc_id(int tot_trks, toc cdtoc[])
uint32_t Xcddb::calc_disc_id(int tot_trks, toc cdtoc[])
{
int i = 0, t = 0, n = 0;

Expand Down Expand Up @@ -749,7 +749,7 @@ void Xcddb::setCacheDir(const CStdString& pCacheDir )
}

//-------------------------------------------------------------------------------------------------------------------
bool Xcddb::queryCache( unsigned long discid )
bool Xcddb::queryCache( uint32_t discid )
{
if (cCacheDir.size() == 0)
return false;
Expand All @@ -770,7 +770,7 @@ bool Xcddb::queryCache( unsigned long discid )
}

//-------------------------------------------------------------------------------------------------------------------
bool Xcddb::writeCacheFile( const char* pBuffer, unsigned long discid )
bool Xcddb::writeCacheFile( const char* pBuffer, uint32_t discid )
{
if (cCacheDir.size() == 0)
return false;
Expand Down Expand Up @@ -820,15 +820,15 @@ bool Xcddb::queryCDinfo(CCdInfo* pInfo)

int lead_out = pInfo->GetTrackCount();
int real_track_count = pInfo->GetTrackCount();
unsigned long discid = pInfo->GetCddbDiscId();
uint32_t discid = pInfo->GetCddbDiscId();
unsigned long frames[100];


//##########################################################
//
if ( queryCache(discid) )
{
CLog::Log(LOGDEBUG, "Xcddb::queryCDinfo discid [%08lx] already cached", discid);
CLog::Log(LOGDEBUG, "Xcddb::queryCDinfo discid [%08x] already cached", discid);
return true;
}

Expand Down Expand Up @@ -927,7 +927,7 @@ bool Xcddb::queryCDinfo(CCdInfo* pInfo)
strcat(query_buffer, "cddb query");
{
char tmp_buffer[256];
sprintf(tmp_buffer, " %08lx", discid);
sprintf(tmp_buffer, " %08x", discid);
strcat(query_buffer, tmp_buffer);
}
{
Expand Down Expand Up @@ -1065,7 +1065,7 @@ bool Xcddb::isCDCached( CCdInfo* pInfo )
return XFILE::CFile::Exists(GetCacheFile(pInfo->GetCddbDiscId()));
}

CStdString Xcddb::GetCacheFile(unsigned int disc_id) const
CStdString Xcddb::GetCacheFile(uint32_t disc_id) const
{
CStdString strFileName;
strFileName.Format("%x.cddb", disc_id);
Expand Down
8 changes: 4 additions & 4 deletions xbmc/network/cddb.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ class Xcddb
void getDiskArtist(CStdString& strdisk_artist) const;
void getDiskTitle(CStdString& strdisk_title) const;
const CStdString& getTrackExtended(int track) const;
unsigned long calc_disc_id(int nr_of_tracks, toc cdtoc[]);
uint32_t calc_disc_id(int nr_of_tracks, toc cdtoc[]);
const CStdString& getInexactArtist(int select) const;
const CStdString& getInexactTitle(int select) const;
bool queryCache( unsigned long discid );
bool writeCacheFile( const char* pBuffer, unsigned long discid );
bool queryCache( uint32_t discid );
bool writeCacheFile( const char* pBuffer, uint32_t discid );
bool isCDCached( int nr_of_tracks, toc cdtoc[] );
bool isCDCached( MEDIA_DETECT::CCdInfo* pInfo );

Expand Down Expand Up @@ -121,7 +121,7 @@ class Xcddb
void addInexactList(const char *list);
void addInexactListLine(int line_cnt, const char *line, int len);
const CStdString& getInexactCommand(int select) const;
CStdString GetCacheFile(unsigned int disc_id) const;
CStdString GetCacheFile(uint32_t disc_id) const;
/*! \brief Trim and convert some text to UTF8
\param untrimmedText original text to trim and convert
\return a utf8 version of the trimmed text
Expand Down
2 changes: 1 addition & 1 deletion xbmc/storage/cdioSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ UINT CCdIoSupport::MsfSeconds(msf_t *msf)
// the total length of the disk, and
// the number of tracks.

ULONG CCdIoSupport::CddbDiscId()
uint32_t CCdIoSupport::CddbDiscId()
{
CSingleLock lock(*m_cdio);

Expand Down
8 changes: 4 additions & 4 deletions xbmc/storage/cdioSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class CCdInfo
int GetFirstDataTrack() { return m_nFirstData; }
int GetDataTrackCount() { return m_nNumData; }
int GetAudioTrackCount() { return m_nNumAudio; }
ULONG GetCddbDiscId() { return m_ulCddbDiscId; }
uint32_t GetCddbDiscId() { return m_ulCddbDiscId; }
int GetDiscLength() { return m_nLength; }
CStdString GetDiscLabel(){ return m_strDiscLabel; }

Expand Down Expand Up @@ -229,7 +229,7 @@ class CCdInfo
void SetTrackInformation( int nTrack, trackinfo nInfo ) { if ( nTrack > 0 && nTrack <= 99 ) m_ti[nTrack - 1] = nInfo; }
void SetDiscCDTextInformation( xbmc_cdtext_t cdtext ) { m_cdtext = cdtext; }

void SetCddbDiscId( ULONG ulCddbDiscId ) { m_ulCddbDiscId = ulCddbDiscId; }
void SetCddbDiscId( uint32_t ulCddbDiscId ) { m_ulCddbDiscId = ulCddbDiscId; }
void SetDiscLength( int nLength ) { m_nLength = nLength; }
bool HasCDDBInfo() { return m_bHasCDDBInfo; }
void SetNoCDDBInfo() { m_bHasCDDBInfo = false; }
Expand All @@ -244,7 +244,7 @@ class CCdInfo
int m_nNumTrack;
int m_nFirstTrack;
trackinfo m_ti[100];
ULONG m_ulCddbDiscId;
uint32_t m_ulCddbDiscId;
int m_nLength; // Disclength can be used for cddb query, also see trackinfo.nFrames
bool m_bHasCDDBInfo;
CStdString m_strDiscLabel;
Expand Down Expand Up @@ -313,7 +313,7 @@ class CCdIoSupport
int GetJolietLevel( void );
int GuessFilesystem(int start_session, track_t track_num);

ULONG CddbDiscId();
uint32_t CddbDiscId();
int CddbDecDigitSum(int n);
UINT MsfSeconds(msf_t *msf);

Expand Down

0 comments on commit 6dc15cd

Please sign in to comment.