CDVD: Warning fixes for clang-cl

This commit is contained in:
Stenzek 2022-12-25 15:56:57 +10:00 committed by refractionpcsx2
parent ca92d4ea3d
commit c4345f9a85
8 changed files with 32 additions and 16 deletions

View File

@ -21,6 +21,15 @@
#include "common/Path.h"
#include "common/StringUtil.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#include "libchdr/chd.h"
#ifdef __clang__
#pragma clang diagnostic pop
#endif
ChdFileReader::~ChdFileReader()
{
Close();

View File

@ -15,9 +15,10 @@
#pragma once
#include "ThreadedFileReader.h"
#include "libchdr/chd.h"
#include <vector>
typedef struct _chd_file chd_file;
class ChdFileReader : public ThreadedFileReader
{
DeclareNoncopyableObject(ChdFileReader);

View File

@ -15,7 +15,8 @@
#pragma once
#include "zlib_indexed.h"
#include "common/Pcsx2Types.h"
#include <list>
class ChunksCache
{

View File

@ -26,6 +26,7 @@
#include "ThreadedFileReader.h"
#include "ChunksCache.h"
#include <zlib.h>
struct CsoHeader;
typedef struct z_stream_s z_stream;

View File

@ -126,7 +126,7 @@ static std::string ApplyTemplate(const std::string& name, const std::string& bas
std::string::size_type first = trimmedTemplate.find(INDEX_TEMPLATE_KEY);
if (first == std::string::npos // not found
|| first != trimmedTemplate.rfind(INDEX_TEMPLATE_KEY) // more than one instance
|| !canEndWithKey && first == trimmedTemplate.length() - std::strlen(INDEX_TEMPLATE_KEY))
|| (!canEndWithKey && first == trimmedTemplate.length() - std::strlen(INDEX_TEMPLATE_KEY)))
{
Console.Error("Invalid %s template '%s'.\n"
"Template must contain exactly one '%s' and must not end with it. Aborting.",

View File

@ -131,10 +131,13 @@ uint sectorSeekReadDelay = 0x800; // for calculated seek delays
static void AddIrqQueue(u8 irq, u32 ecycle);
#if 0
// Unused
static __fi int GetCDSpeed()
{
return 1 + ((cdr.Mode >> 7) & 0x1);
}
#endif
static __fi void StartReading(u32 type)
{

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "CDVD/CDVDdiscReader.h"
#include "CDVD/CDVD.h"
#include "common/Console.h"
#include <winioctl.h>
#include <ntddcdvd.h>
@ -30,6 +31,8 @@
#include <cstdlib>
#include <stdexcept>
#include "fmt/format.h"
IOCtlSrc::IOCtlSrc(std::string filename)
: m_filename(std::move(filename))
{
@ -123,8 +126,8 @@ bool IOCtlSrc::ReadSectors2048(u32 sector, u32 count, u8* buffer) const
if (!SetFilePointerEx(m_device, offset, nullptr, FILE_BEGIN))
{
fprintf(stderr, " * CDVD SetFilePointerEx failed: sector %u: error %u\n",
sector, GetLastError());
Console.Error(fmt::format(" * CDVD SetFilePointerEx failed: sector {}: error {}",
sector, GetLastError()));
return false;
}
@ -134,13 +137,13 @@ bool IOCtlSrc::ReadSectors2048(u32 sector, u32 count, u8* buffer) const
{
if (bytes_read == bytes_to_read)
return true;
fprintf(stderr, " * CDVD ReadFile: sectors %u-%u: %u bytes read, %u bytes expected\n",
sector, sector + count - 1, bytes_read, bytes_to_read);
Console.Error(fmt::format(" * CDVD ReadFile: sectors {}-{}: {} bytes read, {} bytes expected",
sector, sector + count - 1, bytes_read, bytes_to_read));
}
else
{
fprintf(stderr, " * CDVD ReadFile failed: sectors %u-%u: error %u\n",
sector, sector + count - 1, GetLastError());
Console.Error(fmt::format(" * CDVD ReadFile failed: sectors {}-{}: error {}",
sector, sector + count - 1, GetLastError()));
}
return false;
@ -219,7 +222,7 @@ bool IOCtlSrc::ReadDVDInfo()
// So lets just give it 32 bytes to play with, it seems happy enough with that.
// Refraction
std::array<u8, 32> buffer;
DVD_READ_STRUCTURE dvdrs{{0}, DvdPhysicalDescriptor, 0, 0};
DVD_READ_STRUCTURE dvdrs{{}, DvdPhysicalDescriptor, 0, 0};
if (!DeviceIoControl(m_device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs),
buffer.data(), buffer.size(), &unused, nullptr))

View File

@ -108,8 +108,6 @@ Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
#include "common/FileSystem.h"
#define local static
//#define SPAN (1048576L) /* desired distance between access points */
#define WINSIZE 32768U /* sliding window size */
#define CHUNK (64 * 1024) /* file input buffer size */
@ -155,7 +153,7 @@ typedef struct access Access;
#endif
/* Deallocate an index built by build_index() */
local void free_index(struct access* index)
static inline void free_index(struct access* index)
{
if (index != NULL)
{
@ -166,7 +164,7 @@ local void free_index(struct access* index)
/* Add an entry to the access point list. If out of memory, deallocate the
existing list and return NULL. */
local struct access* addpoint(struct access* index, int bits,
static inline struct access* addpoint(struct access* index, int bits,
s64 in, s64 out, unsigned left, unsigned char* window)
{
struct point* next;
@ -223,7 +221,7 @@ local struct access* addpoint(struct access* index, int bits,
returns the number of access points on success (>= 1), Z_MEM_ERROR for out
of memory, Z_DATA_ERROR for an error in the input file, or Z_ERRNO for a
file read error. On success, *built points to the resulting index. */
local int build_index(FILE* in, s64 span, struct access** built)
static inline int build_index(FILE* in, s64 span, struct access** built)
{
int ret;
s64 totin, totout, totPrinted; /* our own total counters to avoid 4GB limit */
@ -361,7 +359,7 @@ static inline s64 getInOffset(zstate* state)
should not return a data error unless the file was modified since the index
was generated. extract() may also return Z_ERRNO if there is an error on
reading or seeking the input file. */
local int extract(FILE* in, struct access* index, s64 offset,
static inline int extract(FILE* in, struct access* index, s64 offset,
unsigned char* buf, int len, zstate* state)
{
int ret, skip;