From c8457d39edec947159b761dd535d57849ff7a39f Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 13 Mar 2016 15:02:14 +0100 Subject: [PATCH] Fix a bunch of compiler warnings, delete some unused code --- Common/MemArena.cpp | 19 +++++++------------ Common/MemoryUtil.cpp | 8 ++++---- Core/HLE/sceKernelModule.cpp | 25 +------------------------ Core/HLE/sceMpeg.cpp | 22 +++------------------- Core/HLE/sceSfmt19937.cpp | 1 + GPU/Common/FramebufferCommon.cpp | 2 +- GPU/Software/SoftGpu.cpp | 4 ++-- ext/native/image/zim_save.cpp | 2 ++ ext/native/ui/viewgroup.cpp | 2 +- 9 files changed, 22 insertions(+), 63 deletions(-) diff --git a/Common/MemArena.cpp b/Common/MemArena.cpp index df5cc7282b..82861775bc 100644 --- a/Common/MemArena.cpp +++ b/Common/MemArena.cpp @@ -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 diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index 9b6261faac..386ac610c3 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -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__ diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 79adae43e8..16df1406c3 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -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 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; diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index d7e998ace6..40f31d864d 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -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){ diff --git a/Core/HLE/sceSfmt19937.cpp b/Core/HLE/sceSfmt19937.cpp index 320a665e47..d0cc399094 100644 --- a/Core/HLE/sceSfmt19937.cpp +++ b/Core/HLE/sceSfmt19937.cpp @@ -17,6 +17,7 @@ // Mersenne Twister random number generator module. +#define SFMT_MEXP 19937 #include "ext/sfmt19937/SFMT.h" #include "Common/Log.h" diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 0c4795073e..fa80112310 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -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; } } } diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index cc60152cac..0a9e9cb1f0 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -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) { diff --git a/ext/native/image/zim_save.cpp b/ext/native/image/zim_save.cpp index ba753a79be..9a807bcd22 100644 --- a/ext/native/image/zim_save.cpp +++ b/ext/native/image/zim_save.cpp @@ -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]; diff --git a/ext/native/ui/viewgroup.cpp b/ext/native/ui/viewgroup.cpp index 9a5fbc2af8..dd9a41b9df 100644 --- a/ext/native/ui/viewgroup.cpp +++ b/ext/native/ui/viewgroup.cpp @@ -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);