diff options
author | jmarshallnz <jmarshallnz@svn> | 2009-09-29 03:30:18 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2009-09-29 03:30:18 +0000 |
commit | 43643ac594572bfbc1d88dd3a9a5fd070274f447 (patch) | |
tree | b8136aed902bbad657b08351b900441f9ccdd398 | |
parent | 3f7bf496776da9bd0bc1e2295c82fefd19716c55 (diff) |
changed: type change of the day: long long -> int64_t where reasonable, and removed a few long/int64_t overloads.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23236 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | guilib/XBTF.h | 2 | ||||
-rw-r--r-- | guilib/XBTFReader.cpp | 2 | ||||
-rw-r--r-- | xbmc/FileItem.h | 4 | ||||
-rw-r--r-- | xbmc/FileSystem/RarManager.cpp | 2 | ||||
-rw-r--r-- | xbmc/StringUtils.cpp | 4 | ||||
-rw-r--r-- | xbmc/StringUtils.h | 2 | ||||
-rw-r--r-- | xbmc/VideoInfoTag.h | 2 | ||||
-rw-r--r-- | xbmc/lib/UnrarXLib/UnrarX.hpp | 6 | ||||
-rw-r--r-- | xbmc/lib/UnrarXLib/rar.cpp | 6 | ||||
-rw-r--r-- | xbmc/lib/sqLite/qry_dat.cpp | 197 | ||||
-rw-r--r-- | xbmc/lib/sqLite/qry_dat.h | 51 | ||||
-rw-r--r-- | xbmc/linux/XFileUtils.cpp | 4 | ||||
-rw-r--r-- | xbmc/utils/Archive.cpp | 27 | ||||
-rw-r--r-- | xbmc/utils/Archive.h | 6 |
14 files changed, 140 insertions, 175 deletions
diff --git a/guilib/XBTF.h b/guilib/XBTF.h index 1a24630c5a..0752dc2325 100644 --- a/guilib/XBTF.h +++ b/guilib/XBTF.h @@ -83,7 +83,7 @@ public: void SetFormat(uint32_t format); std::vector<CXBTFFrame>& GetFrames(); - unsigned long long GetHeaderSize() const; + uint64_t GetHeaderSize() const; private: char m_path[256]; diff --git a/guilib/XBTFReader.cpp b/guilib/XBTFReader.cpp index 6a0f990a6c..151f742508 100644 --- a/guilib/XBTFReader.cpp +++ b/guilib/XBTFReader.cpp @@ -80,7 +80,7 @@ bool CXBTFReader::Open(const CStdString& fileName) { CXBTFFile file; unsigned int u32; - unsigned long long u64; + uint64_t u64; READ_STR(file.GetPath(), 256, m_file); READ_U32(u32, m_file); diff --git a/xbmc/FileItem.h b/xbmc/FileItem.h index bb8d7e8bda..7052f2259f 100644 --- a/xbmc/FileItem.h +++ b/xbmc/FileItem.h @@ -251,8 +251,8 @@ public: CStdString m_strTitle; int m_iprogramCount; int m_idepth; - long m_lStartOffset; - long m_lEndOffset; + int m_lStartOffset; + int m_lEndOffset; LockType m_iLockMode; CStdString m_strLockCode; int m_iHasLock; // 0 - no lock 1 - lock, but unlocked 2 - locked diff --git a/xbmc/FileSystem/RarManager.cpp b/xbmc/FileSystem/RarManager.cpp index 472a73e999..bd29489f35 100644 --- a/xbmc/FileSystem/RarManager.cpp +++ b/xbmc/FileSystem/RarManager.cpp @@ -151,7 +151,7 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString& #endif //g_charsetConverter.unknownToUTF8(strPath); - long long iOffset = -1; + int64_t iOffset = -1; if (iRes != 2) { if (pFile) diff --git a/xbmc/StringUtils.cpp b/xbmc/StringUtils.cpp index 0b968384f4..2c565110d7 100644 --- a/xbmc/StringUtils.cpp +++ b/xbmc/StringUtils.cpp @@ -129,13 +129,13 @@ int StringUtils::FindNumber(const CStdString& strInput, const CStdString &strFin // Compares separately the numeric and alphabetic parts of a string. // returns negative if left < right, positive if left > right // and 0 if they are identical (essentially calculates left - right) -long long StringUtils::AlphaNumericCompare(const char *left, const char *right) +int64_t StringUtils::AlphaNumericCompare(const char *left, const char *right) { unsigned char *l = (unsigned char *)left; unsigned char *r = (unsigned char *)right; unsigned char *ld, *rd; unsigned char lc, rc; - long long lnum, rnum; + int64_t lnum, rnum; while (*l != 0 && *r != 0) { // check if we have a numerical value diff --git a/xbmc/StringUtils.h b/xbmc/StringUtils.h index 41bb0e3616..b1a5b01a78 100644 --- a/xbmc/StringUtils.h +++ b/xbmc/StringUtils.h @@ -43,7 +43,7 @@ public: static void JoinString(const CStdStringArray &strings, const CStdString& delimiter, CStdString& result); static int SplitString(const CStdString& input, const CStdString& delimiter, CStdStringArray &results, unsigned int iMaxStrings = 0); static int FindNumber(const CStdString& strInput, const CStdString &strFind); - static long long AlphaNumericCompare(const char *left, const char *right); + static int64_t AlphaNumericCompare(const char *left, const char *right); static long TimeStringToSeconds(const CStdString &timeString); static void RemoveCRLF(CStdString& strLine); static void SecondsToTimeString( long lSeconds, CStdString& strHMS, TIME_FORMAT format = TIME_FORMAT_GUESS); diff --git a/xbmc/VideoInfoTag.h b/xbmc/VideoInfoTag.h index 2542cfc04d..5aaf6ee780 100644 --- a/xbmc/VideoInfoTag.h +++ b/xbmc/VideoInfoTag.h @@ -85,7 +85,7 @@ public: int m_iSeason; int m_iEpisode; int m_iDbId; - long m_iFileId; + int m_iFileId; int m_iSpecialSortSeason; int m_iSpecialSortEpisode; int m_iTrack; diff --git a/xbmc/lib/UnrarXLib/UnrarX.hpp b/xbmc/lib/UnrarXLib/UnrarX.hpp index 64a99a71ac..c2f7c03697 100644 --- a/xbmc/lib/UnrarXLib/UnrarX.hpp +++ b/xbmc/lib/UnrarXLib/UnrarX.hpp @@ -9,14 +9,14 @@ struct RAR20_archive_entry /* These infos about files are */ wchar_t *NameW; unsigned short NameSize; unsigned long PackSize; - long long UnpSize; + int64_t UnpSize; unsigned char HostOS; /* MSDOS=0,OS2=1,WIN32=2,UNIX=3 */ unsigned long FileCRC; unsigned long FileTime; unsigned char UnpVer; unsigned char Method; unsigned long FileAttr; - long long iOffset; + int64_t iOffset; }; /* used to list archives */ @@ -34,7 +34,7 @@ typedef struct archivelist or NULL for all files. libpassword - Password (for encrypted archives) \*-------------------------------------------------------------------------*/ -int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libpassword = NULL, long long* iOffset=NULL, bool bShowProgress=false); +int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libpassword = NULL, int64_t* iOffset=NULL, bool bShowProgress=false); /*-------------------------------------------------------------------------*\ List the files in a RAR file diff --git a/xbmc/lib/UnrarXLib/rar.cpp b/xbmc/lib/UnrarXLib/rar.cpp index 9431d4b1a1..851655e173 100644 --- a/xbmc/lib/UnrarXLib/rar.cpp +++ b/xbmc/lib/UnrarXLib/rar.cpp @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) or NULL for all files. libpassword - Password (for encrypted archives) \*-------------------------------------------------------------------------*/ -int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libpassword, long long* iOffset, bool bShowProgress) +int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libpassword, int64_t* iOffset, bool bShowProgress) { InitCRC(); int bRes = 1; @@ -243,7 +243,7 @@ int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libp pExtract->GetDataIO().m_pDlgProgress = NULL;//(CGUIDialogProgress*)m_gWindowManager.GetWindow(WINDOW_DIALOG_PROGRESS); } - long long iOff=0; + int64_t iOff=0; bool bSeeked = false; while (1) { @@ -355,7 +355,7 @@ int urarlib_list(char *rarfile, ArchiveList_struct **ppList, char *libpassword, { if (pArc->IsOpened() && pArc->IsArchive(true)) { - long long iOffset = pArc->NextBlockPos; + int64_t iOffset = pArc->NextBlockPos; while(pArc->ReadHeader()>0) { if (pArc->GetHeaderType() == FILE_HEAD) diff --git a/xbmc/lib/sqLite/qry_dat.cpp b/xbmc/lib/sqLite/qry_dat.cpp index 1fb8cfa98c..e62d2646ec 100644 --- a/xbmc/lib/sqLite/qry_dat.cpp +++ b/xbmc/lib/sqLite/qry_dat.cpp @@ -79,21 +79,15 @@ field_value::field_value(const unsigned short us) { is_null = false; } -field_value::field_value(const long l) { - long_value = l; - field_type = ft_Long; - is_null = false; -} - field_value::field_value(const int i) { - long_value = (long)i; - field_type = ft_Long; + int_value = i; + field_type = ft_Int; is_null = false; } -field_value::field_value(const unsigned long ul) { - ulong_value = ul; - field_type = ft_ULong; +field_value::field_value(const unsigned int ui) { + uint_value = ui; + field_type = ft_UInt; is_null = false; } @@ -109,7 +103,7 @@ field_value::field_value(const double d) { is_null = false; } -field_value::field_value(const long long i) { +field_value::field_value(const int64_t i) { int64_value = i; field_type = ft_Int64; is_null = false; @@ -137,12 +131,12 @@ field_value::field_value (const field_value & fv) { set_asUShort(fv.get_asUShort()); break; } - case ft_Long: { - set_asLong(fv.get_asLong()); + case ft_Int: { + set_asInt(fv.get_asLong()); break; } - case ft_ULong: { - set_asULong(fv.get_asULong()); + case ft_UInt: { + set_asUInt(fv.get_asUInt()); break; } case ft_Float: { @@ -197,14 +191,14 @@ string field_value::get_asString() const { sprintf(t,"%i",ushort_value); return tmp = t; } - case ft_Long: { + case ft_Int: { char t[12]; - sprintf(t,"%ld",long_value); + sprintf(t,"%ld",int_value); return tmp = t; } - case ft_ULong: { + case ft_UInt: { char t[12]; - sprintf(t,"%lu",ulong_value); + sprintf(t,"%lu",uint_value); return tmp = t; } case ft_Float: { @@ -252,11 +246,11 @@ bool field_value::get_asBool() const { case ft_UShort: { return (bool)ushort_value; } - case ft_Long: { - return (bool)long_value; + case ft_Int: { + return (bool)int_value; } - case ft_ULong: { - return (bool)ulong_value; + case ft_UInt: { + return (bool)uint_value; } case ft_Float: { return (bool)float_value; @@ -298,14 +292,14 @@ char field_value::get_asChar() const { sprintf(t,"%i",ushort_value); return t[0]; } - case ft_Long: { + case ft_Int: { char t[12]; - sprintf(t,"%ld",long_value); + sprintf(t,"%ld",int_value); return t[0]; } - case ft_ULong: { + case ft_UInt: { char t[12]; - sprintf(t,"%lu",ulong_value); + sprintf(t,"%lu",uint_value); return t[0]; } case ft_Float: { @@ -346,11 +340,11 @@ short field_value::get_asShort() const { case ft_UShort: { return (short)ushort_value; } - case ft_Long: { - return (short)long_value; + case ft_Int: { + return (short)int_value; } - case ft_ULong: { - return (short)ulong_value; + case ft_UInt: { + return (short)uint_value; } case ft_Float: { return (short)float_value; @@ -384,11 +378,11 @@ unsigned short field_value::get_asUShort() const { case ft_UShort: { return ushort_value; } - case ft_Long: { - return (unsigned short)long_value; + case ft_Int: { + return (unsigned short)int_value; } - case ft_ULong: { - return (unsigned short)ulong_value; + case ft_UInt: { + return (unsigned short)uint_value; } case ft_Float: { return (unsigned short)float_value; @@ -404,78 +398,79 @@ unsigned short field_value::get_asUShort() const { } } -long field_value::get_asLong() const { +int field_value::get_asLong() const +{ + return get_asInteger(); +} + +int field_value::get_asInteger() const { switch (field_type) { case ft_String: { - return (long)atoi(str_value.c_str()); + return (int)atoi(str_value.c_str()); } case ft_Boolean:{ - return (long)bool_value; + return (int)bool_value; } case ft_Char: { - return (long)char_value; + return (int)char_value; } case ft_Short: { - return (long)short_value; + return (int)short_value; } case ft_UShort: { - return (long)ushort_value; + return (int)ushort_value; } - case ft_Long: { - return long_value; + case ft_Int: { + return int_value; } - case ft_ULong: { - return (long)ulong_value; + case ft_UInt: { + return (int)uint_value; } case ft_Float: { - return (long)float_value; + return (int)float_value; } case ft_Double: { - return (long)double_value; + return (int)double_value; } case ft_Int64: { - return (long)int64_value; + return (int)int64_value; } default: return 0; } } -int field_value::get_asInteger() const{ - return (int)get_asLong(); -} - -unsigned long field_value::get_asULong() const { +unsigned int field_value::get_asUInt() const { switch (field_type) { case ft_String: { - return (unsigned long)atoi(str_value.c_str()); + return (unsigned int)atoi(str_value.c_str()); } case ft_Boolean:{ - return (unsigned long)bool_value; + return (unsigned int)bool_value; } case ft_Char: { - return (unsigned long)char_value; + return (unsigned int)char_value; } case ft_Short: { - return (unsigned long)short_value; + return (unsigned int)short_value; } case ft_UShort: { - return (unsigned long)ushort_value; + return (unsigned int)ushort_value; } - case ft_Long: { - return (unsigned long)long_value; + case ft_Int: { + return (unsigned int)int_value; } - case ft_ULong: { - return ulong_value; + case ft_UInt: { + return uint_value; } case ft_Float: { - return (unsigned long)float_value; + return (unsigned int)float_value; } case ft_Double: { - return (unsigned long)double_value; + return (unsigned int)double_value; } case ft_Int64: { - return (unsigned long)int64_value; + return (unsigned int)int64_value; } default: return 0; @@ -499,11 +494,11 @@ float field_value::get_asFloat() const { case ft_UShort: { return (float)ushort_value; } - case ft_Long: { - return (float)long_value; + case ft_Int: { + return (float)int_value; } - case ft_ULong: { - return (float)ulong_value; + case ft_UInt: { + return (float)uint_value; } case ft_Float: { return float_value; @@ -536,11 +531,11 @@ double field_value::get_asDouble() const { case ft_UShort: { return (double)ushort_value; } - case ft_Long: { - return (double)long_value; + case ft_Int: { + return (double)int_value; } - case ft_ULong: { - return (double)ulong_value; + case ft_UInt: { + return (double)uint_value; } case ft_Float: { return (double)float_value; @@ -556,34 +551,34 @@ double field_value::get_asDouble() const { } } -long long field_value::get_asInt64() const { +int64_t field_value::get_asInt64() const { switch (field_type) { case ft_String: { return _atoi64(str_value.c_str()); } case ft_Boolean:{ - return (long long)bool_value; + return (int64_t)bool_value; } case ft_Char: { - return (long long)char_value; + return (int64_t)char_value; } case ft_Short: { - return (long long)short_value; + return (int64_t)short_value; } case ft_UShort: { - return (long long)ushort_value; + return (int64_t)ushort_value; } - case ft_Long: { - return (long long)long_value; + case ft_Int: { + return (int64_t)int_value; } - case ft_ULong: { - return (long long)ulong_value; + case ft_UInt: { + return (int64_t)uint_value; } case ft_Float: { - return (long long)float_value; + return (int64_t)float_value; } case ft_Double: { - return (long long)double_value; + return (int64_t)double_value; } case ft_Int64: { return int64_value; @@ -625,13 +620,13 @@ field_value& field_value::operator= (const field_value & fv) { return *this; break; } - case ft_Long: { - set_asLong(fv.get_asLong()); + case ft_Int: { + set_asInt(fv.get_asInteger()); return *this; break; } - case ft_ULong: { - set_asULong(fv.get_asULong()); + case ft_UInt: { + set_asUInt(fv.get_asUInt()); return *this; break; } @@ -682,20 +677,16 @@ void field_value::set_asUShort(const unsigned short us) { ushort_value = us; field_type = ft_UShort; } - -void field_value::set_asLong(const long l) { - long_value = l; - field_type = ft_Long; -} -void field_value::set_asInteger(const int i) { - long_value = (long)i; - field_type = ft_Long; +void field_value::set_asInt(const int i) { + int_value = i; + field_type = ft_Int; } -void field_value::set_asULong(const unsigned long ul) { - long_value = ul; - field_type = ft_ULong;} +void field_value::set_asUInt(const unsigned int ui) { + int_value = ui; + field_type = ft_UInt; +} void field_value::set_asFloat(const float f) { float_value = f; @@ -705,7 +696,7 @@ void field_value::set_asDouble(const double d) { double_value = d; field_type = ft_Double;} -void field_value::set_asInt64(const long long i) { +void field_value::set_asInt64(const int64_t i) { int64_value = i; field_type = ft_Int64;} @@ -732,8 +723,8 @@ string field_value::gft() { tmp.assign("short"); return tmp; } - case ft_Long: { - tmp.assign("long"); + case ft_Int: { + tmp.assign("int"); return tmp; } case ft_Float: { diff --git a/xbmc/lib/sqLite/qry_dat.h b/xbmc/lib/sqLite/qry_dat.h index 5ff1af9049..be48b5563b 100644 --- a/xbmc/lib/sqLite/qry_dat.h +++ b/xbmc/lib/sqLite/qry_dat.h @@ -45,8 +45,8 @@ enum fType { ft_WideString, ft_Short, ft_UShort, - ft_Long, - ft_ULong, + ft_Int, + ft_UInt, ft_Float, ft_Double, ft_LongDouble, @@ -65,11 +65,11 @@ private: char char_value; short short_value; unsigned short ushort_value; - long long_value; - unsigned long ulong_value; + int int_value; + unsigned int uint_value; float float_value; double double_value; - long long int64_value; + int64_t int64_value; void *object_value; } ; @@ -82,15 +82,13 @@ public: field_value(const char c); field_value(const short s); field_value(const unsigned short us); - field_value(const long l); - field_value(const unsigned long ul); - field_value(const int i); + field_value(const int l); + field_value(const unsigned int ul); field_value(const float f); field_value(const double d); - field_value(const long long i); + field_value(const int64_t i); field_value(const field_value & fv); ~field_value(); - fType get_fType() const {return field_type;} bool get_isNull() const {return is_null;} @@ -99,12 +97,12 @@ public: char get_asChar() const; short get_asShort() const; unsigned short get_asUShort() const; - long get_asLong() const; + int get_asLong() const; int get_asInteger() const; - unsigned long get_asULong() const; + unsigned int get_asUInt() const; float get_asFloat() const; double get_asDouble() const; - long long get_asInt64() const; + int64_t get_asInt64() const; field_value& operator= (const char *s) {set_asString(s); return *this;} @@ -116,17 +114,15 @@ public: {set_asShort(s); return *this;} field_value& operator= (const unsigned short us) {set_asUShort(us); return *this;} - field_value& operator= (const long l) - {set_asLong(l); return *this;} - field_value& operator= (const unsigned long l) - {set_asULong(l); return *this;} - field_value& operator= (const int i) - {set_asLong(i); return *this;} + field_value& operator= (const int l) + {set_asInt(l); return *this;} + field_value& operator= (const unsigned int l) + {set_asUInt(l); return *this;} field_value& operator= (const float f) {set_asFloat(f); return *this;} field_value& operator= (const double d) {set_asDouble(d); return *this;} - field_value& operator= (const long long i) + field_value& operator= (const int64_t i) {set_asInt64(i); return *this;} field_value& operator= (const field_value & fv); @@ -153,12 +149,12 @@ public: return os << fv.get_asUShort(); break; } - case ft_Long: { - return os << fv.get_asLong(); + case ft_Int: { + return os << fv.get_asInteger(); break; } - case ft_ULong: { - return os << fv.get_asULong(); + case ft_UInt: { + return os << fv.get_asUInt(); break; } case ft_Float: { @@ -187,12 +183,11 @@ public: void set_asChar(const char c); void set_asShort(const short s); void set_asUShort(const unsigned short us); - void set_asInteger(const int i); - void set_asLong(const long l); - void set_asULong(const unsigned long l); + void set_asInt(const int l); + void set_asUInt(const unsigned int l); void set_asFloat(const float f); void set_asDouble(const double d); - void set_asInt64(const long long i); + void set_asInt64(const int64_t i); fType get_field_type(); std::string gft(); diff --git a/xbmc/linux/XFileUtils.cpp b/xbmc/linux/XFileUtils.cpp index a95e3e9afd..13c9cf3b50 100644 --- a/xbmc/linux/XFileUtils.cpp +++ b/xbmc/linux/XFileUtils.cpp @@ -413,8 +413,8 @@ BOOL CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExi // Read and write chunks of 16K char buf[16384]; - long long bytesRead = 1; - long long bytesWritten = 1; + int64_t bytesRead = 1; + int64_t bytesWritten = 1; while (bytesRead > 0 && bytesWritten > 0) { diff --git a/xbmc/utils/Archive.cpp b/xbmc/utils/Archive.cpp index 330ec057ce..3b9d7d8aa0 100644 --- a/xbmc/utils/Archive.cpp +++ b/xbmc/utils/Archive.cpp @@ -109,9 +109,9 @@ CArchive& CArchive::operator<<(unsigned int i) return *this; } -CArchive& CArchive::operator<<(long long i64) +CArchive& CArchive::operator<<(int64_t i64) { - int size = sizeof(long long); + int size = sizeof(int64_t); if (m_BufferPos + size >= BUFFER_MAX) FlushBuffer(); @@ -121,18 +121,6 @@ CArchive& CArchive::operator<<(long long i64) return *this; } -CArchive& CArchive::operator<<(long l) -{ - int size = sizeof(long); - if (m_BufferPos + size >= BUFFER_MAX) - FlushBuffer(); - - memcpy(&m_pBuffer[m_BufferPos], &l, size); - m_BufferPos += size; - - return *this; -} - CArchive& CArchive::operator<<(bool b) { int size = sizeof(bool); @@ -252,16 +240,9 @@ CArchive& CArchive::operator>>(unsigned int& i) return *this; } -CArchive& CArchive::operator>>(long long& i64) -{ - m_pFile->Read((void*)&i64, sizeof(long long)); - - return *this; -} - -CArchive& CArchive::operator>>(long& l) +CArchive& CArchive::operator>>(int64_t& i64) { - m_pFile->Read((void*)&l, sizeof(long)); + m_pFile->Read((void*)&i64, sizeof(int64_t)); return *this; } diff --git a/xbmc/utils/Archive.h b/xbmc/utils/Archive.h index 33d5355462..59da588bde 100644 --- a/xbmc/utils/Archive.h +++ b/xbmc/utils/Archive.h @@ -48,8 +48,7 @@ public: CArchive& operator<<(double d); CArchive& operator<<(int i); CArchive& operator<<(unsigned int i); - CArchive& operator<<(long long i64); - CArchive& operator<<(long l); + CArchive& operator<<(int64_t i64); CArchive& operator<<(bool b); CArchive& operator<<(char c); CArchive& operator<<(const CStdString& str); @@ -62,8 +61,7 @@ public: CArchive& operator>>(double& d); CArchive& operator>>(int& i); CArchive& operator>>(unsigned int& i); - CArchive& operator>>(long long& i64); - CArchive& operator>>(long& l); + CArchive& operator>>(int64_t& i64); CArchive& operator>>(bool& b); CArchive& operator>>(char& c); CArchive& operator>>(CStdString& str); |