diff --git a/libmediation/fs/directory.cpp b/libmediation/fs/directory.cpp index aedab27..fe818ba 100644 --- a/libmediation/fs/directory.cpp +++ b/libmediation/fs/directory.cpp @@ -5,7 +5,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #else #include @@ -13,25 +13,15 @@ #include #include #include -#include +#include #endif using namespace std; -#ifdef SOLARIS -typedef struct mydirent -{ - ino_t d_ino; /* "inode number" of entry */ - off_t d_off; /* offset of disk directory entry */ - unsigned short d_reclen; /* length of this record */ - char d_name[PATH_MAX]; /* name of file */ -} mydirent_t; -#endif - char getDirSeparator() { -#ifdef WIN32 +#ifdef _WIN32 return '\\'; #else return '/'; @@ -43,7 +33,7 @@ string extractFileDir( const string& fileName ) size_t index = fileName.find_last_of('/'); if( index != string::npos ) return fileName.substr( 0, index+1 ); -#ifdef WIN32 +#ifdef _WIN32 index = fileName.find_last_of('\\'); if( index != string::npos ) return fileName.substr( 0, index+1 ); @@ -55,10 +45,10 @@ string extractFileDir( const string& fileName ) bool fileExists( const string& fileName ) { bool fileExists = false; -#ifdef WIN32 +#ifdef _WIN32 struct _stat64 buf; fileExists = _stat64( fileName.c_str(), &buf ) == 0; -#else // LINUX +#else struct stat64 buf; fileExists = stat64( fileName.c_str(), &buf ) == 0; #endif @@ -69,10 +59,10 @@ bool fileExists( const string& fileName ) uint64_t getFileSize ( const std::string& fileName ) { bool res = false; -#ifdef WIN32 +#ifdef _WIN32 struct _stat64 fileStat; res = _stat64( fileName.c_str(), &fileStat ) == 0; -#else // LINUX +#else struct stat64 fileStat; res = stat64( fileName.c_str(), &fileStat ) == 0; #endif @@ -98,13 +88,13 @@ bool createDir( if( dirEnd != string::npos ) { string parentDir = dirName.substr( 0, dirEnd ); -#if defined(LINUX) || defined(SOLARIS) || defined(MAC) +#if __linux__ == 1 || (defined(__APPLE__) && defined(__MACH__)) if( mkdir( parentDir.c_str(), S_IREAD | S_IWRITE | S_IEXEC ) == -1 ) { if( errno != EEXIST ) return false; } -#elif defined(WIN32) +#elif defined(_WIN32) if (parentDir.size() == 0 || parentDir[parentDir.size()-1] == ':' || parentDir == string("\\\\.") || parentDir == string("\\\\.\\") || // UNC patch prefix (strStartWith(parentDir, "\\\\.\\") && parentDir[parentDir.size()-1] == '}')) // UNC patch prefix @@ -119,16 +109,16 @@ bool createDir( } } -#if defined(LINUX) || defined(SOLARIS) || defined(MAC) +#if __linux__ == 1 || (defined(__APPLE__) && defined(__MACH__)) return mkdir( dirName.c_str(), S_IREAD | S_IWRITE | S_IEXEC ) == 0; -#elif defined(WIN32) +#elif defined(_WIN32) return CreateDirectory( dirName.c_str(), 0 ) != 0; #endif } bool deleteFile( const string& fileName ) { -#if defined(LINUX) || defined(SOLARIS) || defined(MAC) +#if __linux__ == 1 || (defined(__APPLE__) && defined(__MACH__)) return unlink( fileName.c_str() ) == 0; #else if( DeleteFile(fileName.c_str()) ) @@ -147,7 +137,7 @@ bool deleteFile( const string& fileName ) //----------------------------------------------------------------------------- -#if defined(WIN32) +#if defined(_WIN32) /** windows implementation */ //----------------------------------------------------------------------------- #include @@ -205,7 +195,7 @@ bool findDirs( return true; } -#elif defined(LINUX) || defined(MAC) +#elif __linux__ == 1 || (defined(__APPLE__) && defined(__MACH__)) #include bool findFiles( diff --git a/libmediation/fs/file.h b/libmediation/fs/file.h index bd0cfdf..323a307 100644 --- a/libmediation/fs/file.h +++ b/libmediation/fs/file.h @@ -5,7 +5,7 @@ #include #include "../types/types.h" -#ifdef WIN32 +#ifdef _WIN32 #pragma warning( disable : 4290 ) #endif diff --git a/libmediation/fs/osdep/file_unix.cpp b/libmediation/fs/osdep/file_unix.cpp index 0e6a927..a469952 100644 --- a/libmediation/fs/osdep/file_unix.cpp +++ b/libmediation/fs/osdep/file_unix.cpp @@ -13,10 +13,10 @@ #include #include #include - -#ifdef MAC -#define O_LARGEFILE 0 -#endif + +#if defined(__APPLE__) && defined(__MACH__) +#define O_LARGEFILE 0 +#endif void makeUnixOpenFlags( @@ -159,20 +159,20 @@ uint64_t File::seek( int64_t offset, SeekMethod whence ) break; } m_pos = offset; -#ifdef MAC +#if defined(__APPLE__) && defined(__MACH__) return lseek( (long)m_impl, offset, sWhence ); -#else +#else return lseek64( (long)m_impl, offset, sWhence ); -#endif +#endif } bool File::truncate( uint64_t newFileSize ) { -#ifdef MAC +#if defined(__APPLE__) && defined(__MACH__) return ftruncate( (long)m_impl, newFileSize ) == 0; -#else +#else return ftruncate64( (long)m_impl, newFileSize ) == 0; -#endif +#endif } void File::sync() diff --git a/libmediation/types/types.cpp b/libmediation/types/types.cpp index f539951..bac7415 100644 --- a/libmediation/types/types.cpp +++ b/libmediation/types/types.cpp @@ -6,7 +6,7 @@ #include #include -#ifndef WIN32 +#ifndef _WIN32 #include #include #include @@ -41,7 +41,7 @@ uint64_t my_htonll( const uint64_t& original ) // Simple types conversion int64_t strToInt64( const char* const str ) { -#ifdef WIN32 +#ifdef _WIN32 return _atoi64( str ); #else return strtoll( str, 0, 10 ); @@ -50,7 +50,7 @@ int64_t strToInt64( const char* const str ) uint64_t strToInt64u( const char* const str ) { -#ifdef WIN32 +#ifdef _WIN32 return _atoi64( str ); #else return strtoull( str, 0, 10 ); diff --git a/libmediation/types/types.h b/libmediation/types/types.h index 6ad3ef5..2556c98 100644 --- a/libmediation/types/types.h +++ b/libmediation/types/types.h @@ -9,7 +9,7 @@ #define override -#ifdef WIN32 +#ifdef _WIN32 #define strcasecmp stricmp #endif char* strnstr(const char *s1, const char *s2, size_t len); diff --git a/tsMuxer/bufferedFileReader.cpp b/tsMuxer/bufferedFileReader.cpp index 8356eed..d2bff6c 100644 --- a/tsMuxer/bufferedFileReader.cpp +++ b/tsMuxer/bufferedFileReader.cpp @@ -4,7 +4,7 @@ #include "vod_common.h" #include "vodCoreException.h" -#ifdef WIN32 +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include #endif @@ -19,7 +19,7 @@ bool FileReaderData::openStream() if ( !rez ) { -#ifdef WIN32 +#ifdef _WIN32 char msgBuf [ 32*1024 ]; memset ( msgBuf, 0, sizeof(msgBuf) ); diff --git a/tsMuxer/iso_writer.cpp b/tsMuxer/iso_writer.cpp index 12ba77e..d6963b2 100644 --- a/tsMuxer/iso_writer.cpp +++ b/tsMuxer/iso_writer.cpp @@ -4,7 +4,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 # include #endif diff --git a/tsMuxer/main.cpp b/tsMuxer/main.cpp index fcfff95..a4c4b28 100644 --- a/tsMuxer/main.cpp +++ b/tsMuxer/main.cpp @@ -594,7 +594,7 @@ int main(int argc, char** argv) LTRACE(LT_INFO, 2, ""); -#ifdef WIN32 +#ifdef _WIN32 char buffer[1024*16]; CharToOemA(itemName.c_str(), buffer); LTRACE(LT_INFO, 2, "File #" << strPadLeft(int32ToStr(i),5,'0') << " name=" << buffer); @@ -752,7 +752,7 @@ int main(int argc, char** argv) } catch(runtime_error& e) { if (argc == 2) LTRACE2(LT_ERROR, "Error: "); -#ifdef WIN32 +#ifdef _WIN32 char buffer[1024*16]; CharToOemA(e.what(), buffer); LTRACE(LT_ERROR, 2, buffer); @@ -763,7 +763,7 @@ int main(int argc, char** argv) } catch(VodCoreException& e) { if (argc == 2) LTRACE2(LT_ERROR, "Error: "); -#ifdef WIN32 +#ifdef _WIN32 char buffer[1024*16]; CharToOemA(e.m_errStr.c_str(), buffer); LTRACE(LT_ERROR, 2, buffer); diff --git a/tsMuxer/metaDemuxer.cpp b/tsMuxer/metaDemuxer.cpp index 8e8d48b..7da9eba 100644 --- a/tsMuxer/metaDemuxer.cpp +++ b/tsMuxer/metaDemuxer.cpp @@ -1160,7 +1160,7 @@ void METADemuxer::updateReport(bool checkTime) void METADemuxer::lineBack() { -#ifdef WIN32 +#ifdef _WIN32 HANDLE consoleOutput; CONSOLE_SCREEN_BUFFER_INFO csbi; consoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); diff --git a/tsMuxer/mpegStreamReader.cpp b/tsMuxer/mpegStreamReader.cpp index 3fd7865..f12a117 100644 --- a/tsMuxer/mpegStreamReader.cpp +++ b/tsMuxer/mpegStreamReader.cpp @@ -1,5 +1,5 @@ -#ifndef WIN32 +#ifndef _WIN32 #endif #include #include "mpegStreamReader.h" diff --git a/tsMuxer/mpegVideo.cpp b/tsMuxer/mpegVideo.cpp index 593a85e..da28da1 100644 --- a/tsMuxer/mpegVideo.cpp +++ b/tsMuxer/mpegVideo.cpp @@ -1,5 +1,5 @@ -#ifndef WIN32 +#ifndef _WIN32 #endif #include #include "mpegVideo.h" diff --git a/tsMuxer/osdep/textSubtitlesRenderFT.cpp b/tsMuxer/osdep/textSubtitlesRenderFT.cpp index 3a9766d..286a435 100644 --- a/tsMuxer/osdep/textSubtitlesRenderFT.cpp +++ b/tsMuxer/osdep/textSubtitlesRenderFT.cpp @@ -1,6 +1,6 @@ -#if !defined(WIN32) || defined(WIN32_DEBUG_FREETYPE) +#if !defined(_WIN32) || defined(WIN32_DEBUG_FREETYPE) -#ifdef WIN32 +#ifdef _WIN32 #pragma comment(lib, "../../freetype/lib/freetype.lib") #endif @@ -15,13 +15,11 @@ #include #include -#ifdef WIN32 +#if defined(_WIN32) const static char FONT_ROOT[] = "c:/WINDOWS/Fonts"; // for debug only -#endif -#ifdef LINUX +#elif __linux__ == 1 const static char FONT_ROOT[] = "/usr/share/fonts/"; -#endif -#ifdef MAC +#elif defined(__APPLE__) && defined(__MACH__) const static char FONT_ROOT[] = "/Library/Fonts/"; #endif diff --git a/tsMuxer/psgStreamReader.h b/tsMuxer/psgStreamReader.h index 84eaf97..084962e 100644 --- a/tsMuxer/psgStreamReader.h +++ b/tsMuxer/psgStreamReader.h @@ -15,7 +15,7 @@ public: struct BitmapInfo { int Width; int Height; -#ifdef WIN32 +#ifdef _WIN32 RGBQUAD* buffer; // rgb triple buffer #else text_subtitles::RGBQUAD* buffer; diff --git a/tsMuxer/singleFileMuxer.cpp b/tsMuxer/singleFileMuxer.cpp index dab8ea9..459630f 100644 --- a/tsMuxer/singleFileMuxer.cpp +++ b/tsMuxer/singleFileMuxer.cpp @@ -148,7 +148,7 @@ void SingleFileMuxer::openDstFile() //if (!createDir(dstFileName, true)) // THROW(ERR_CANT_CREATE_FILE, "Can't create output directory " << dstFileName); int systemFlags = 0; -#ifdef WIN32 +#ifdef _WIN32 if (m_owner->isAsyncMode()) systemFlags += FILE_FLAG_NO_BUFFERING; #endif @@ -198,7 +198,7 @@ void SingleFileMuxer::writeOutBuffer(StreamInfo* streamInfo) streamInfo->m_part++; int systemFlags = 0; streamInfo->m_bufLen = 0; -#ifdef WIN32 +#ifdef _WIN32 if (m_owner->isAsyncMode()) systemFlags += FILE_FLAG_NO_BUFFERING; #endif diff --git a/tsMuxer/srtStreamReader.cpp b/tsMuxer/srtStreamReader.cpp index f83839d..0c20a10 100644 --- a/tsMuxer/srtStreamReader.cpp +++ b/tsMuxer/srtStreamReader.cpp @@ -97,7 +97,7 @@ bool SRTStreamReader::detectSrcFormat(uint8_t* dataStart, int len, int& prefixLe m_short_R = my_htons(0x0d00); } else { -#ifdef WIN32 +#ifdef _WIN32 m_srcFormat = UtfConverter::sfANSI; // default value for win32 #else //m_srcFormat = UtfConverter::sfDefault; diff --git a/tsMuxer/textSubtitles.cpp b/tsMuxer/textSubtitles.cpp index b08c756..e043ea0 100644 --- a/tsMuxer/textSubtitles.cpp +++ b/tsMuxer/textSubtitles.cpp @@ -1,6 +1,6 @@ #include "textSubtitles.h" -#ifdef WIN32 +#ifdef _WIN32 # include # include "osdep/textSubtitlesRenderWin32.h" # ifdef WIN32_DEBUG_FREETYPE @@ -40,7 +40,7 @@ TextToPGSConverter::TextToPGSConverter(bool sourceIsText): /*TextSubtitlesRender m_minLine = 0; m_maxLine = 0; if (sourceIsText) { -#ifdef WIN32 +#ifdef _WIN32 #ifdef WIN32_DEBUG_FREETYPE m_textRender = new TextSubtitlesRenderFT; #else diff --git a/tsMuxer/textSubtitles.h b/tsMuxer/textSubtitles.h index f9d35c4..a0c6eff 100644 --- a/tsMuxer/textSubtitles.h +++ b/tsMuxer/textSubtitles.h @@ -1,7 +1,7 @@ #ifndef __TEXT_SUBTITLES_H #define __TEXT_SUBTITLES_H -#ifdef WIN32 +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include "windows.h" #endif diff --git a/tsMuxer/textSubtitlesRender.h b/tsMuxer/textSubtitlesRender.h index 6c297e2..cbdef4c 100644 --- a/tsMuxer/textSubtitlesRender.h +++ b/tsMuxer/textSubtitlesRender.h @@ -5,7 +5,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include "windows.h" #endif @@ -15,7 +15,7 @@ namespace text_subtitles const static int DEFAULT_BROWSER_STYLE_FS = 3; const static double BROWSER_FONT_STYLE_INC_COEFF = 1.4142135623730950488016887242097; // example: font 2 > font1 to 20% -#ifndef WIN32 +#ifndef _WIN32 struct RGBQUAD { uint8_t rgbBlue; uint8_t rgbGreen; diff --git a/tsMuxer/tsMuxer.cpp b/tsMuxer/tsMuxer.cpp index d06c537..9a35d4b 100644 --- a/tsMuxer/tsMuxer.cpp +++ b/tsMuxer/tsMuxer.cpp @@ -17,7 +17,7 @@ #include #include "iso_writer.h" -#ifdef WIN32 +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include #endif @@ -1376,7 +1376,7 @@ void TSMuxer::openDstFile() m_muxFile = m_fileFactory ? m_fileFactory->createFile() : new File(); int systemFlags = 0; -#ifdef WIN32 +#ifdef _WIN32 if (m_owner->isAsyncMode()) systemFlags += FILE_FLAG_NO_BUFFERING; #endif diff --git a/tsMuxer/tsPacket.cpp b/tsMuxer/tsPacket.cpp index b36c513..7011f0a 100644 --- a/tsMuxer/tsPacket.cpp +++ b/tsMuxer/tsPacket.cpp @@ -1,5 +1,5 @@ -#ifndef WIN32 +#ifndef _WIN32 #endif #include "tsPacket.h" #include "bitStream.h" diff --git a/tsMuxer/utf8Converter.cpp b/tsMuxer/utf8Converter.cpp index 9b361d2..9cb2317 100644 --- a/tsMuxer/utf8Converter.cpp +++ b/tsMuxer/utf8Converter.cpp @@ -6,7 +6,7 @@ #include "vod_common.h" #include "memory.h" -#ifdef WIN32 +#ifdef _WIN32 #include #else #include @@ -70,7 +70,7 @@ namespace UtfConverter { if (widesize == 0) return L""; -#ifdef WIN32 +#if defined(_WIN32) else if (srcFormat == sfANSI) { wchar_t* widestringnative = new wchar_t[widesize+1]; @@ -80,8 +80,7 @@ namespace UtfConverter delete [] widestringnative; return resultstring; } -#endif -#ifdef LINUX +#elif __linux__ == 1 /* else if (srcFormat == sfDefault) { diff --git a/tsMuxerGUI/tsmuxerwindow.cpp b/tsMuxerGUI/tsmuxerwindow.cpp index eb00a73..a0c5752 100644 --- a/tsMuxerGUI/tsmuxerwindow.cpp +++ b/tsMuxerGUI/tsmuxerwindow.cpp @@ -7,10 +7,6 @@ #include #include -#ifdef WIN32 -#include "windows.h" -#endif - const char fileDialogFilter[] = "All supported media files (*.aac *.mpv *.mpa *.avc *.mvc *.264 *.h264 *.ac3 *.dts *.ts *.m2ts *.mts *.ssif *.mpg *.mpeg *.vob *.evo *.mkv *.mka *.mks *.mp4 *.m4a *.mov *.sup *.wav *.w64 *.pcm *.m1v *.m2v *.vc1 *.hevc *.hvc *.265 *.h265 *.mpls *.mpl *.srt);;\ AC3/E-AC3 (*.ac3 *.ddp);;\