Merge pull request #19468 from hrydgard/german-static-const-override

Code cleanup: Add some const and static modifiers
This commit is contained in:
Henrik Rydgård 2024-09-17 17:35:06 +02:00 committed by GitHub
commit a6dbb4dfdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 34 additions and 47 deletions

View file

@ -1934,7 +1934,7 @@ inline int64_t abs64(int64_t x) {
return x >= 0 ? x : -x;
}
int Count(bool part[4]) {
static int Count(const bool part[4]) {
int cnt = 0;
for (int i = 0; i < 4; i++) {
if (part[i])

View file

@ -456,7 +456,7 @@ public:
void AddNewLit(u32 val);
bool TrySetValue_TwoOp(ARMReg reg, u32 val);
CCFlags GetCC() { return CCFlags(condition >> 28); }
CCFlags GetCC() const { return CCFlags(condition >> 28); }
void SetCC(CCFlags cond = CC_AL);
// Special purpose instructions

View file

@ -74,7 +74,7 @@ public:
size_t size() const { return data_.size(); }
bool empty() const { return size() == 0; }
void clear() { data_.resize(0); }
bool IsVoid() { return void_; }
bool IsVoid() const { return void_; }
protected:
// TODO: Find a better internal representation, like a cord.

View file

@ -73,7 +73,7 @@ void ppsspp_md5_starts( md5_context *ctx )
ctx->state[3] = 0x10325476;
}
static void ppsspp_md5_process( md5_context *ctx, unsigned char data[64] )
static void ppsspp_md5_process( md5_context *ctx, const unsigned char data[64] )
{
unsigned long X[16], A, B, C, D;

View file

@ -74,7 +74,7 @@ void sha1_starts( sha1_context *ctx )
ctx->state[4] = 0xC3D2E1F0;
}
static void sha1_process( sha1_context *ctx, unsigned char data[64] )
static void sha1_process( sha1_context *ctx, const unsigned char data[64] )
{
unsigned long temp, W[16], A, B, C, D, E;

View file

@ -204,10 +204,6 @@ void PathBrowser::ResetPending() {
pendingPath_.clear();
}
bool PathBrowser::IsListingReady() {
return ready_;
}
std::string PathBrowser::GetFriendlyPath() const {
// Show relative to memstick root if there.
if (path_.StartsWith(aliasMatch_)) {

View file

@ -23,7 +23,9 @@ public:
void Refresh() {
HandlePath();
}
bool IsListingReady();
bool IsListingReady() const {
return ready_;
}
bool GetListing(std::vector<File::FileInfo> &fileInfo, const char *filter = nullptr, bool *cancel = nullptr);
bool CanNavigateUp();

View file

@ -86,7 +86,6 @@ public:
// Utility for users of this class, not used internally.
enum { INVALID_OFFSET = 0xFFFFFFFF };
private:
// Needs context in case of defragment.
void Begin() {
buf_ = 0;
@ -105,7 +104,6 @@ private:
Unmap();
}
public:
void Map();
void Unmap();

View file

@ -376,14 +376,6 @@ public:
deleter_.pushBuffers.push_back(pushbuffer);
}
void BeginPushBuffer(GLPushBuffer *pushbuffer) {
pushbuffer->Begin();
}
void EndPushBuffer(GLPushBuffer *pushbuffer) {
pushbuffer->End();
}
bool IsInRenderPass() const {
return curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER;
}

View file

@ -799,12 +799,12 @@ OpenGLContext::~OpenGLContext() {
void OpenGLContext::BeginFrame(DebugFlags debugFlags) {
renderManager_.BeginFrame(debugFlags & DebugFlags::PROFILE_TIMESTAMPS);
FrameData &frameData = frameData_[renderManager_.GetCurFrame()];
renderManager_.BeginPushBuffer(frameData.push);
frameData.push->Begin();
}
void OpenGLContext::EndFrame() {
FrameData &frameData = frameData_[renderManager_.GetCurFrame()];
renderManager_.EndPushBuffer(frameData.push); // upload the data!
frameData.push->End(); // upload the data!
renderManager_.Finish();
Invalidate(InvalidationFlags::CACHED_RENDER_STATE);
}

View file

@ -286,9 +286,9 @@ private:
void ResizeReadbackBuffer(CachedReadback *readback, VkDeviceSize requiredSize);
void ApplyMGSHack(std::vector<VKRStep *> &steps);
void ApplySonicHack(std::vector<VKRStep *> &steps);
void ApplyRenderPassMerge(std::vector<VKRStep *> &steps);
static void ApplyMGSHack(std::vector<VKRStep *> &steps);
static void ApplySonicHack(std::vector<VKRStep *> &steps);
static void ApplyRenderPassMerge(std::vector<VKRStep *> &steps);
static void SetupTransferDstWriteAfterWrite(VKRImage &img, VkImageAspectFlags aspect, VulkanBarrierBatch *recordBarrier);

View file

@ -450,9 +450,9 @@ public:
class Framebuffer : public RefCountedObject {
public:
Framebuffer() : RefCountedObject("Framebuffer") {}
int Width() { return width_; }
int Height() { return height_; }
int Layers() { return layers_; }
int Width() const { return width_; }
int Height() const { return height_; }
int Layers() const { return layers_; }
int MultiSampleLevel() { return multiSampleLevel_; }
virtual void UpdateTag(const char *tag) {}

View file

@ -66,7 +66,7 @@ inline int TranslateKeyCodeToAxis(int keyCode, int *direction) {
class InputMapping {
private:
inline int TranslateKeyCodeFromAxis(int axisId, int direction) {
static inline int TranslateKeyCodeFromAxis(int axisId, int direction) {
return AXIS_BIND_NKCODE_START + axisId * 2 + (direction < 0 ? 1 : 0);
}
public:

View file

@ -253,7 +253,7 @@ void MIPSEmitter::QuickCallFunction(MIPSReg scratchreg, const void *func) {
}
}
FixupBranch MIPSEmitter::MakeFixupBranch(FixupBranchType type) {
FixupBranch MIPSEmitter::MakeFixupBranch(FixupBranchType type) const {
FixupBranch b;
b.ptr = code_;
b.type = type;

View file

@ -258,7 +258,7 @@ protected:
static void SetJumpTarget(const FixupBranch &branch, const void *dst);
static bool BInRange(const void *src, const void *dst);
static bool JInRange(const void *src, const void *dst);
FixupBranch MakeFixupBranch(FixupBranchType type);
FixupBranch MakeFixupBranch(FixupBranchType type) const;
void ApplyDelaySlot(std::function<void ()> delaySlot);
private:

View file

@ -114,7 +114,7 @@ public:
}
private:
bool IsHttpsUrl(const std::string &url);
static bool IsHttpsUrl(const std::string &url);
std::vector<std::shared_ptr<Request>> downloads_;
// These get copied to downloads_ in Update(). It's so that callbacks can add new downloads

View file

@ -37,7 +37,7 @@ void TextDrawer::SetFontScale(float xscale, float yscale) {
fontScaleY_ = yscale;
}
float TextDrawer::CalculateDPIScale() {
float TextDrawer::CalculateDPIScale() const {
if (ignoreGlobalDpi_)
return dpiScale_;
float scale = g_display.dpi_scale_y;

View file

@ -58,7 +58,7 @@ public:
// Use for housekeeping like throwing out old strings.
void OncePerFrame();
float CalculateDPIScale();
float CalculateDPIScale() const;
void SetForcedDPIScale(float dpi) {
dpiScale_ = dpi;
ignoreGlobalDpi_ = true;

View file

@ -129,7 +129,7 @@ struct AtlasHeader {
struct Atlas {
~Atlas();
bool Load(const uint8_t *data, size_t data_size);
bool IsMetadataLoaded() {
bool IsMetadataLoaded() const {
return images != nullptr;
}

View file

@ -13,10 +13,10 @@ float ToRadians(float deg) {
return (float)(deg * M_PI / 180.0f);
}
bool IsMatrixIdentity(float* matrix) {
bool IsMatrixIdentity(const float *matrix4x4) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
float value = matrix[i * 4 + j];
float value = matrix4x4[i * 4 + j];
// Other number than zero on non-diagonale
if ((i != j) && (fabs(value) > EPSILON)) return false;

View file

@ -9,7 +9,7 @@
float ToDegrees(float rad);
float ToRadians(float deg);
bool IsMatrixIdentity(float* matrix);
bool IsMatrixIdentity(const float *matrix4x4);
// XrPosef
XrPosef XrPosef_Identity();

View file

@ -205,8 +205,7 @@ void PSPDialog::FinishFadeOut() {
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
}
u32 PSPDialog::CalcFadedColor(u32 inColor)
{
u32 PSPDialog::CalcFadedColor(u32 inColor) const {
u32 alpha = inColor >> 24;
alpha = alpha * fadeValue / 255;
return (inColor & 0x00FFFFFF) | (alpha << 24);

View file

@ -114,7 +114,7 @@ protected:
void StartFade(bool fadeIn_);
void UpdateFade(int animSpeed);
virtual void FinishFadeOut();
u32 CalcFadedColor(u32 inColor);
u32 CalcFadedColor(u32 inColor) const;
DialogStatus pendingStatus = SCE_UTILITY_STATUS_NONE;
u64 pendingStatusTicks = 0;

View file

@ -227,8 +227,8 @@ protected:
}
private:
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le>& em_address);
void ConvertUCS2ToUTF8(std::string& _string, const char16_t *input);
static void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le>& em_address);
static void ConvertUCS2ToUTF8(std::string& _string, const char16_t *input);
void RenderKeyboard();
int NativeKeyboard();

View file

@ -150,16 +150,16 @@ void DrawEngineGLES::ClearInputLayoutMap() {
void DrawEngineGLES::BeginFrame() {
FrameData &frameData = frameData_[render_->GetCurFrame()];
render_->BeginPushBuffer(frameData.pushIndex);
render_->BeginPushBuffer(frameData.pushVertex);
frameData.pushIndex->Begin();
frameData.pushVertex->Begin();
lastRenderStepId_ = -1;
}
void DrawEngineGLES::EndFrame() {
FrameData &frameData = frameData_[render_->GetCurFrame()];
render_->EndPushBuffer(frameData.pushIndex);
render_->EndPushBuffer(frameData.pushVertex);
frameData.pushIndex->End();
frameData.pushVertex->End();
tessDataTransferGLES->EndFrame();
}