fix: clear the GCC warnings in ProfileOutput, fopen, Ajm batch jobs and the SHA-256 test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d9484c719b
commit
2bdb979e69
|
|
@ -56,6 +56,8 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void Print(const char* text) { Print("%s", text); }
|
||||
|
||||
template<typename... TArgs>
|
||||
void Print(const char* format, TArgs... args) {
|
||||
std::array<char, 2048> local{};
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ static_assert(sizeof(PackedJob) == 32);
|
|||
int Append(AjmBatchInfo* info, const JobHeader& header, const AjmBuffer* inputs, const AjmBuffer* outputs) {
|
||||
if (!info || !info->p_buffer) return SCE_AJM_ERROR_INVALID_PARAMETER;
|
||||
if (header.inputCount > 0xffu || header.outputCount > 0xffu || header.parameterSize > sizeof(header.parameters) || header.sidebandSize > 0xffffffffu) return SCE_AJM_ERROR_INVALID_PARAMETER;
|
||||
if ((header.inputCount && !inputs) || (header.outputCount && !outputs)) return SCE_AJM_ERROR_INVALID_PARAMETER;
|
||||
const std::size_t parameterBytes = (header.parameterSize + 7u) & ~std::size_t{7};
|
||||
const std::size_t bytes = sizeof(PackedJob) + (header.inputCount + header.outputCount) * sizeof(AjmBuffer) + parameterBytes;
|
||||
if (info->offset > info->size || bytes > info->size - info->offset) return SCE_AJM_ERROR_OUT_OF_RESOURCES;
|
||||
|
|
@ -200,9 +201,9 @@ int Append(AjmBatchInfo* info, const JobHeader& header, const AjmBuffer* inputs,
|
|||
const PackedJob record{static_cast<std::uint8_t>(header.kind), static_cast<std::uint8_t>(header.inputCount), static_cast<std::uint8_t>(header.outputCount), static_cast<std::uint8_t>(header.parameterSize), header.instance, header.flags, header.sideband, static_cast<std::uint32_t>(header.sidebandSize), static_cast<std::uint32_t>(bytes)};
|
||||
std::memcpy(cursor, &record, sizeof(record));
|
||||
cursor += sizeof(record);
|
||||
if (header.inputCount) std::memcpy(cursor, inputs, header.inputCount * sizeof(AjmBuffer));
|
||||
if (inputs) std::memcpy(cursor, inputs, header.inputCount * sizeof(AjmBuffer));
|
||||
cursor += header.inputCount * sizeof(AjmBuffer);
|
||||
if (header.outputCount) std::memcpy(cursor, outputs, header.outputCount * sizeof(AjmBuffer));
|
||||
if (outputs) std::memcpy(cursor, outputs, header.outputCount * sizeof(AjmBuffer));
|
||||
cursor += header.outputCount * sizeof(AjmBuffer);
|
||||
if (header.parameterSize) std::memcpy(cursor, header.parameters, header.parameterSize);
|
||||
info->offset += bytes;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ FileStream* APS5_VABI fopen_nid_postfix(const char* filename, const char* mode)
|
|||
if (!filename || !mode) throw std::runtime_error(std::string(__func__) + ": " + FOPEN_MSG_NULL_ARG);
|
||||
const std::filesystem::path fpath = ResolvePath_nid_no_patch(filename);
|
||||
const auto abs_path = fpath.string();
|
||||
std::unique_ptr<std::FILE, decltype(&std::fclose)> handle(std::fopen(abs_path.c_str(), NativeFileMode(mode).c_str()), std::fclose);
|
||||
std::unique_ptr<std::FILE, int (*)(std::FILE*)> handle(std::fopen(abs_path.c_str(), NativeFileMode(mode).c_str()), std::fclose);
|
||||
if (!handle) {
|
||||
const int error = errno;
|
||||
if (error == ENOENT) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ int APS5_VABI sceAjmBatchJobInitialize(AjmBatchInfo*, std::uint32_t, const void*
|
|||
int APS5_VABI sceAjmBatchJobDecode(AjmBatchInfo*, std::uint32_t, const void*, std::size_t, void*, std::size_t, void*);
|
||||
int APS5_VABI sceAjmBatchJobDecodeSingle(AjmBatchInfo*, std::uint32_t, const void*, std::size_t, void*, std::size_t, void*);
|
||||
int APS5_VABI sceAjmBatchJobRun(AjmBatchInfo*, std::uint32_t, std::uint64_t, const void*, std::size_t, void*, std::size_t, void*, std::size_t);
|
||||
int APS5_VABI sceAjmBatchJobRunSplit(AjmBatchInfo*, std::uint32_t, std::uint64_t, const AjmBuffer*, std::size_t, const AjmBuffer*, std::size_t, void*, std::size_t);
|
||||
int APS5_VABI sceAjmBatchJobSetGaplessDecode(AjmBatchInfo*, std::uint32_t, const void*, int, void*);
|
||||
int APS5_VABI sceAjmBatchJobControl(AjmBatchInfo*, std::uint32_t, std::uint64_t, const void*, std::size_t, void*, std::size_t);
|
||||
int APS5_VABI sceAjmBatchJobGetGaplessDecode(AjmBatchInfo*, std::uint32_t, void*);
|
||||
|
|
@ -971,6 +972,10 @@ int main() {
|
|||
const std::uint8_t badHeader[4] = {0xFD, 0x72, 0x1F, 0xF0};
|
||||
Require(sceAjmDecAt9ParseConfigData(badHeader, &info) == invalidParameter);
|
||||
Require(sceAjmDecAt9ParseConfigData(nullptr, &info) == invalidParameter);
|
||||
std::vector<std::uint8_t> batch(4096);
|
||||
AjmBatchInfo batchInfo{};
|
||||
Require(sceAjmBatchInitialize(batch.data(), batch.size(), &batchInfo) == 0);
|
||||
Require(sceAjmBatchJobRunSplit(&batchInfo, 0, 0, nullptr, 1, nullptr, 0, nullptr, 0) == invalidParameter && batchInfo.offset == 0);
|
||||
TestMp3ParseFrame();
|
||||
TestMp3ParseOfl();
|
||||
TestMp3(context);
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ void cpuExecution() {
|
|||
for (std::uint8_t src = 0; src < 16; ++src)
|
||||
executeSha256(harness, *matcher, {{opcode, dst, src}}, random, 2);
|
||||
for (int sequence = 0; sequence < 256; ++sequence) {
|
||||
std::vector<Sha256Step> steps(2 + random() % 2);
|
||||
std::vector<Sha256Step> steps(2 + random() % 2, Sha256Step{});
|
||||
for (auto& step : steps) step = {static_cast<std::uint8_t>(0xCB + random() % 3), static_cast<std::uint8_t>(random() % 16), static_cast<std::uint8_t>(random() % 16)};
|
||||
executeSha256(harness, *matcher, steps, random, 2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue