Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup][linux] remove unused symbols #13764

Merged
merged 4 commits into from
Apr 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions xbmc/cores/DllLoader/exports/emu_msvcrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ extern "C"
void dll_clearerr(FILE* stream);
int dll_initterm(PFV * start, PFV * end);
uintptr_t dll_beginthread(void( *start_address )( void * ),unsigned stack_size,void *arglist);
HANDLE dll_beginthreadex(LPSECURITY_ATTRIBUTES lpThreadAttributes, DWORD dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress, void* lpParameter, DWORD dwCreationFlags,
#ifdef TARGET_FREEBSD
long* lpThreadId);
#else
unsigned int lpThreadId);
#endif
int dll_stati64(const char *path, struct _stati64 *buffer);
int dll_stat64(const char *path, struct __stat64 *buffer);
#ifdef TARGET_WINDOWS
Expand Down
4 changes: 0 additions & 4 deletions xbmc/platform/linux/ConvUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
#include <ctype.h>
#include <errno.h>

void OutputDebugString(LPCTSTR lpOutputString)
{
}

DWORD GetLastError()
{
return errno;
Expand Down
15 changes: 1 addition & 14 deletions xbmc/platform/linux/PlatformDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ typedef void* HMODULE;

typedef unsigned int DWORD;
#define INVALID_HANDLE_VALUE ((HANDLE)~0U)
#ifdef UNICODE
typedef const wchar_t* LPCTSTR;
#else
typedef const char* LPCTSTR;
#endif

#define MAXWORD 0xffff

Expand All @@ -147,9 +142,7 @@ typedef union _LARGE_INTEGER
DWORD HighPart;
} u;
unsigned long long QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;

void OutputDebugString(LPCTSTR lpOutputString);
} ULARGE_INTEGER;

// Date / Time

Expand Down Expand Up @@ -258,12 +251,6 @@ typedef struct _WIN32_FIND_DATA

#define FILE_ATTRIBUTE_DIRECTORY 0x00000010

typedef struct _SECURITY_ATTRIBUTES {
DWORD nLength;
void* lpSecurityDescriptor;
int bInheritHandle;
} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;

#define FILE_BEGIN 0
#define FILE_CURRENT 1
#define FILE_END 2
Expand Down
146 changes: 0 additions & 146 deletions xbmc/platform/linux/XFileUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,120 +49,6 @@

#include "utils/log.h"

HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess,
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
// Fail on unsupported items
if (lpSecurityAttributes != NULL )
{
CLog::Log(LOGERROR, "CreateFile does not support security attributes");
return INVALID_HANDLE_VALUE;
}

if (hTemplateFile != (HANDLE) 0)
{
CLog::Log(LOGERROR, "CreateFile does not support template file");
return INVALID_HANDLE_VALUE;
}

int flags = 0, mode=S_IRUSR | S_IRGRP | S_IROTH;
if (dwDesiredAccess & FILE_WRITE_DATA)
{
flags = O_RDWR;
mode |= S_IWUSR;
}
else if ( (dwDesiredAccess & FILE_READ_DATA) == FILE_READ_DATA)
flags = O_RDONLY;
else
{
CLog::Log(LOGERROR, "CreateFile does not permit access other than read and/or write");
return INVALID_HANDLE_VALUE;
}

switch (dwCreationDisposition)
{
case OPEN_ALWAYS:
flags |= O_CREAT;
break;
case TRUNCATE_EXISTING:
flags |= O_TRUNC;
mode |= S_IWUSR;
break;
case CREATE_ALWAYS:
flags |= O_CREAT|O_TRUNC;
mode |= S_IWUSR;
break;
case CREATE_NEW:
flags |= O_CREAT|O_TRUNC|O_EXCL;
mode |= S_IWUSR;
break;
case OPEN_EXISTING:
break;
}

int fd = 0;

if (dwFlagsAndAttributes & FILE_FLAG_NO_BUFFERING)
flags |= O_SYNC;

// we always open files with fileflag O_NONBLOCK to support
// cdrom devices, but we then turn it of for actual reads
// apparently it's used for multiple things, read mode
// and how opens are handled. devices must be opened
// with this flag set to work correctly
flags |= O_NONBLOCK;

std::string strResultFile(lpFileName);

fd = open(lpFileName, flags, mode);

// Important to check reason for fail. Only if its
// "file does not exist" shall we try to find the file
if (fd == -1 && errno == ENOENT)
{
// Failed to open file. maybe due to case sensitivity.
// Try opening the same name in lower case.
std::string igFileName = CSpecialProtocol::TranslatePathConvertCase(lpFileName);
fd = open(igFileName.c_str(), flags, mode);
if (fd != -1)
{
CLog::Log(LOGWARNING,"%s, successfully opened <%s> instead of <%s>", __FUNCTION__, igFileName.c_str(), lpFileName);
strResultFile = igFileName;
}
}

if (fd == -1)
{
if (errno == 20)
CLog::Log(LOGWARNING,"%s, error %d opening file <%s>, flags:%x, mode:%x. ", __FUNCTION__, errno, lpFileName, flags, mode);
return INVALID_HANDLE_VALUE;
}

// turn of nonblocking reads/writes as we don't
// support this anyway currently
fcntl(fd, F_GETFL, &flags);
fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);

HANDLE result = new CXHandle(CXHandle::HND_FILE);
result->fd = fd;

#if (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) && defined(HAS_DVD_DRIVE)
// special case for opening the cdrom device
if (strcmp(lpFileName, MEDIA_DETECT::CLibcdio::GetInstance()->GetDeviceFileName())==0)
result->m_bCDROM = true;
else
#endif
result->m_bCDROM = false;

// if FILE_FLAG_DELETE_ON_CLOSE then "unlink" the file (delete)
// the file will be deleted when the last open descriptor is closed.
if (dwFlagsAndAttributes & FILE_FLAG_DELETE_ON_CLOSE)
unlink(strResultFile.c_str());

return result;
}

int ReadFile(HANDLE hFile, void* lpBuffer, DWORD nNumberOfBytesToRead,
unsigned int* lpNumberOfBytesRead, void* lpOverlapped)
{
Expand Down Expand Up @@ -237,38 +123,6 @@ uint32_t SetFilePointer(HANDLE hFile, int32_t lDistanceToMove,
return (DWORD)currOff;
}

// uses statfs
int GetDiskFreeSpaceEx(
LPCTSTR lpDirectoryName,
PULARGE_INTEGER lpFreeBytesAvailable,
PULARGE_INTEGER lpTotalNumberOfBytes,
PULARGE_INTEGER lpTotalNumberOfFreeBytes
)

{
#if defined(TARGET_ANDROID) || defined(TARGET_DARWIN)
struct statfs fsInfo;
// is 64-bit on android and darwin (10.6SDK + any iOS)
if (statfs(CSpecialProtocol::TranslatePath(lpDirectoryName).c_str(), &fsInfo) != 0)
return false;
#else
struct statfs64 fsInfo;
if (statfs64(CSpecialProtocol::TranslatePath(lpDirectoryName).c_str(), &fsInfo) != 0)
return false;
#endif

if (lpFreeBytesAvailable)
lpFreeBytesAvailable->QuadPart = static_cast<unsigned long long>(fsInfo.f_bavail) * static_cast<unsigned long long>(fsInfo.f_bsize);

if (lpTotalNumberOfBytes)
lpTotalNumberOfBytes->QuadPart = static_cast<unsigned long long>(fsInfo.f_blocks) * static_cast<unsigned long long>(fsInfo.f_bsize);

if (lpTotalNumberOfFreeBytes)
lpTotalNumberOfFreeBytes->QuadPart = static_cast<unsigned long long>(fsInfo.f_bfree) * static_cast<unsigned long long>(fsInfo.f_bsize);

return 1;
}

uint32_t GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation )
{
if (lpTimeZoneInformation == NULL)
Expand Down
13 changes: 0 additions & 13 deletions xbmc/platform/linux/XFileUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
#include "PlatformDefs.h"
#include "XHandlePublic.h"

#define CreateFileA CreateFile
HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);

int WriteFile(HANDLE hFile, const void * lpBuffer, DWORD nNumberOfBytesToWrite, unsigned int* lpNumberOfBytesWritten, void* lpOverlapped);
int ReadFile( HANDLE hFile, void* lpBuffer, DWORD nNumberOfBytesToRead, unsigned int* lpNumberOfBytesRead, void* unsupportedlpOverlapped);

Expand All @@ -38,11 +33,3 @@ int SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove,PLARGE_INTEGER
uint32_t GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation );
int _stat64(const char *path, struct __stat64 *buffer);
int _fstat64(int fd, struct __stat64 *buffer);

// uses statfs
int GetDiskFreeSpaceEx(
LPCTSTR lpDirectoryName,
PULARGE_INTEGER lpFreeBytesAvailable,
PULARGE_INTEGER lpTotalNumberOfBytes,
PULARGE_INTEGER lpTotalNumberOfFreeBytes
);
5 changes: 0 additions & 5 deletions xbmc/platform/linux/XTimeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,4 @@ int TimeTToFileTime(time_t timeT, FILETIME* lpLocalFileTime) {
return 1;
}

void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
{
TimeTToFileTime(time(NULL), lpSystemTimeAsFileTime);
}

#endif
1 change: 0 additions & 1 deletion xbmc/platform/linux/XTimeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ int SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime)
long CompareFileTime(const FILETIME* lpFileTime1, const FILETIME* lpFileTime2);
int FileTimeToSystemTime( const FILETIME* lpFileTime, LPSYSTEMTIME lpSystemTime);
int LocalFileTimeToFileTime( const FILETIME* lpLocalFileTime, LPFILETIME lpFileTime);
void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);

int FileTimeToTimeT(const FILETIME* lpLocalFileTime, time_t *pTimeT);
int TimeTToFileTime(time_t timeT, FILETIME* lpLocalFileTime);
3 changes: 0 additions & 3 deletions xbmc/storage/IoSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ int CIoSupport::ReadSector(HANDLE hDevice, DWORD dwSector, char* lpczBuffer)
{
CLog::Log(LOGERROR, "CD: ReadSector Request to read sector %d\n", (int)dwSector);
CLog::Log(LOGERROR, "CD: ReadSector error: %s\n", strerror(errno));
OutputDebugString("CD Read error\n");
return (-1);
}

Expand All @@ -159,7 +158,6 @@ int CIoSupport::ReadSector(HANDLE hDevice, DWORD dwSector, char* lpczBuffer)
// error reading sector
CLog::Log(LOGERROR, "CD: ReadSector Request to read sector %d\n", (int)dwSector);
CLog::Log(LOGERROR, "CD: ReadSector error: %s\n", strerror(errno));
OutputDebugString("CD Read error\n");
return (-1);
}

Expand Down Expand Up @@ -241,7 +239,6 @@ int CIoSupport::ReadSectorMode2(HANDLE hDevice, DWORD dwSector, char* lpczBuffer
CLog::Log(LOGERROR, "CD: ReadSectorMode2 Request to read sector %d\n", (int)dwSector);
CLog::Log(LOGERROR, "CD: ReadSectorMode2 error: %s\n", strerror(errno));
CLog::Log(LOGERROR, "CD: ReadSectorMode2 minute %d, second %d, frame %d\n", m, s, f);
OutputDebugString("CD Read error\n");
return -1;
}
#elif defined(TARGET_WINDOWS_STORE)
Expand Down