Fix a bunch of compiler warnings, delete some unused code

This commit is contained in:
Henrik Rydgard 2016-03-13 15:02:14 +01:00
parent ec6559537b
commit c8457d39ed
9 changed files with 22 additions and 63 deletions

View file

@ -38,7 +38,6 @@
// Hopefully this ABI will never change...
#define ASHMEM_DEVICE "/dev/ashmem"
/*
@ -48,8 +47,7 @@
* `name' is an optional label to give the region (visible in /proc/pid/maps)
* `size' is the size of the region, in page-aligned bytes
*/
int ashmem_create_region(const char *name, size_t size)
{
int ashmem_create_region(const char *name, size_t size) {
int fd, ret;
fd = open(ASHMEM_DEVICE, O_RDWR);
@ -58,7 +56,6 @@ int ashmem_create_region(const char *name, size_t size)
if (name) {
char buf[ASHMEM_NAME_LEN];
strncpy(buf, name, sizeof(buf));
ret = ioctl(fd, ASHMEM_SET_NAME, buf);
if (ret < 0)
@ -77,20 +74,18 @@ error:
return ret;
}
int ashmem_set_prot_region(int fd, int prot)
{
int ashmem_set_prot_region(int fd, int prot) {
return ioctl(fd, ASHMEM_SET_PROT_MASK, prot);
}
int ashmem_pin_region(int fd, size_t offset, size_t len)
{
struct ashmem_pin pin = { offset, len };
int ashmem_pin_region(int fd, size_t offset, size_t len) {
// Even on 64-bit, it seems these arguments are 32-bit and thus need a cast to avoid warnings.
struct ashmem_pin pin = { (uint32_t)offset, (uint32_t)len };
return ioctl(fd, ASHMEM_PIN, &pin);
}
int ashmem_unpin_region(int fd, size_t offset, size_t len)
{
struct ashmem_pin pin = { offset, len };
int ashmem_unpin_region(int fd, size_t offset, size_t len) {
struct ashmem_pin pin = { (uint32_t)offset, (uint32_t)len };
return ioctl(fd, ASHMEM_UNPIN, &pin);
}
#endif // Android

View file

@ -38,14 +38,14 @@
#endif
static int hint_location;
#ifdef __APPLE__
#define PAGE_MASK (4096-1)
#define MEM_PAGE_MASK (4096-1)
#elif defined(_WIN32)
static SYSTEM_INFO sys_info;
#define PAGE_MASK (uintptr_t)(sys_info.dwPageSize - 1)
#define MEM_PAGE_MASK (uintptr_t)(sys_info.dwPageSize - 1)
#else
#define PAGE_MASK (getpagesize() - 1)
#define MEM_PAGE_MASK (getpagesize() - 1)
#endif
#define round_page(x) ((((uintptr_t)(x)) + PAGE_MASK) & ~(PAGE_MASK))
#define round_page(x) ((((uintptr_t)(x)) + MEM_PAGE_MASK) & ~(MEM_PAGE_MASK))
#endif
#ifdef __SYMBIAN32__

View file

@ -303,7 +303,7 @@ public:
return;
}
DEBUG_LOG(LOADER, "Importing %s : %08x", GetFuncName(func.moduleName, func.nid), func.stubAddr);
WARN_LOG(LOADER, "Importing %s : %08x", GetFuncName(func.moduleName, func.nid), func.stubAddr);
// Add the symbol to the symbol map for debugging.
char temp[256];
@ -1376,29 +1376,6 @@ static Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, bool fromT
return module;
}
static bool __KernelLoadPBP(FileLoader *fileLoader, std::string *error_string)
{
PBPReader pbp(fileLoader);
if (!pbp.IsValid()) {
ERROR_LOG(LOADER, "%s is not a valid homebrew PSP1.0 PBP", fileLoader->Path().c_str());
*error_string = "Not a valid homebrew PBP";
return false;
}
std::vector<u8> elfData;
if (!pbp.GetSubFile(PBP_EXECUTABLE_PSP, &elfData)) {
return false;
}
u32 magic;
u32 error;
Module *module = __KernelLoadELFFromPtr(&elfData[0], PSP_GetDefaultLoadAddress(), false, error_string, &magic, error);
if (!module) {
return false;
}
mipsr4k.pc = module->nm.entry_addr;
return true;
}
static Module *__KernelLoadModule(u8 *fileptr, SceKernelLMOption *options, std::string *error_string)
{
Module *module = 0;

View file

@ -124,9 +124,12 @@ void SceMpegAu::write(u32 addr) {
Memory::WriteStruct(addr, this);
}
/*
// Currently unused
static int getMaxAheadTimestamp(const SceMpegRingBuffer &ringbuf) {
return std::max(maxAheadTimestamp, 700 * ringbuf.packets); // empiric value from JPCSP, thanks!
}
*/
const u8 defaultMpegheader[2048] = {0x50,0x53,0x4d,0x46,0x30,0x30,0x31,0x35,0x00,0x00,0x08,0x00,0x00,
0x10,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -722,25 +725,6 @@ static int sceMpegFreeAvcEsBuf(u32 mpeg, int esBuf)
return 0;
}
// this function is used for dumping a video frame into a file.
// you can use it when you want to output the decoded frame.
static void SaveFrame(AVFrame *pFrame, int width, int height)
{
FILE *pFile;
char szFilename[] = "frame.ppm";
int y;
pFile = fopen(szFilename, "wb");
if (!pFile)
return;
// width * 4 is for 32-bit RGBA format.
// You could change to your desired format as width*(4:32-bit,3:24-bit, 2:16-bit,1:8-bit)
for (y = 0; y < height; y++)
fwrite(pFrame->data[0] + y * pFrame->linesize[0], 1, width * 4, pFile);
fclose(pFile);
}
// check the existence of pmp media context
static bool isContextExist(u32 ctxAddr){
for (auto it = pmp_ContextList.begin(); it != pmp_ContextList.end(); ++it){

View file

@ -17,6 +17,7 @@
// Mersenne Twister random number generator module.
#define SFMT_MEXP 19937
#include "ext/sfmt19937/SFMT.h"
#include "Common/Log.h"

View file

@ -505,7 +505,7 @@ void FramebufferManagerCommon::NotifyVideoUpload(u32 addr, int size, int width,
ResizeFramebufFBO(vfb, width, size / (bpp * width));
vfb->fb_stride = width;
// This might be a bit wider than necessary, but we'll redetect on next render.
vfb->width = vfb->width = width;
vfb->width = width;
}
}
}

View file

@ -401,13 +401,13 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
}
void *control_points = Memory::GetPointer(gstate_c.vertexAddr);
void *indices = NULL;
// void *indices = NULL;
if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) {
if (!Memory::IsValidAddress(gstate_c.indexAddr)) {
ERROR_LOG_REPORT(G3D, "Software: Bad index address %08x!", gstate_c.indexAddr);
break;
}
indices = Memory::GetPointer(gstate_c.indexAddr);
// indices = Memory::GetPointer(gstate_c.indexAddr);
}
if (gstate.getPatchPrimitiveType() != GE_PATCHPRIM_TRIANGLES) {

View file

@ -121,7 +121,9 @@ void Convert(const uint8_t *image_data, int width, int height, int pitch, int fl
int blockh = height/4;
*data_size = blockw * blockh * 8;
*data = new uint8_t[*data_size];
#ifndef ANDROID
#pragma omp parallel for
#endif
for (int y = 0; y < blockh; y++) {
for (int x = 0; x < blockw; x++) {
uint32_t block[16];

View file

@ -1125,7 +1125,7 @@ TabHolder::TabHolder(Orientation orientation, float stripSize, LayoutParams *lay
EventReturn TabHolder::OnTabClick(EventParams &e) {
// We have e.b set when it was an explicit click action.
// In that case, we make the view gone and then visible - this scrolls scrollviews to the top.
if (currentTab_ != e.a || e.b) {
if (currentTab_ != (int)e.a || e.b != 0) {
tabs_[currentTab_]->SetVisibility(V_GONE);
currentTab_ = e.a;
tabs_[currentTab_]->SetVisibility(V_VISIBLE);