mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-17 06:12:15 +02:00
fix outdated comments, correct do/while bug
This commit is contained in:
parent
a51dd09421
commit
9d1e718bea
@ -19,7 +19,7 @@
|
||||
|
||||
namespace ams::jpegdec::impl {
|
||||
|
||||
#define CAPSRV_ABORT_UNLESS(expr) { \
|
||||
#define CAPSRV_ABORT_UNLESS(expr) do { \
|
||||
const bool __capsrv_assert_res = (expr); \
|
||||
AMS_ASSERT(__capsrv_assert_res); \
|
||||
AMS_ABORT_UNLESS(__capsrv_assert_res); \
|
||||
|
@ -31,8 +31,12 @@ namespace ams::jpegdec {
|
||||
const u8 *jpeg = in.GetPointer();
|
||||
size_t jpeg_size = in.GetSize();
|
||||
|
||||
memset(g_workmem, 0, sizeof(g_workmem));
|
||||
memset(bmp, 0, bmp_size);
|
||||
/* Clear the work memory and out buffer. */
|
||||
std::memset(g_workmem, 0, sizeof(g_workmem));
|
||||
std::memset(bmp, 0, bmp_size);
|
||||
|
||||
/* Clear output memory on decode failure. */
|
||||
auto clear_guard = SCOPE_GUARD { std::memset(bmp, 0, bmp_size); };
|
||||
|
||||
R_UNLESS(util::IsAligned(width, 0x10), capsrv::ResultAlbumOutOfRange());
|
||||
R_UNLESS(util::IsAligned(height, 0x4), capsrv::ResultAlbumOutOfRange());
|
||||
@ -62,16 +66,12 @@ namespace ams::jpegdec {
|
||||
.bmp_size = bmp_size,
|
||||
};
|
||||
|
||||
/* Clear output memory on decode failure. */
|
||||
/* NOTE: Nintendo does not do this. */
|
||||
auto clear_guard = SCOPE_GUARD { std::memset(bmp, 0, bmp_size); };
|
||||
|
||||
/* Decode the jpeg. */
|
||||
R_TRY(impl::DecodeJpeg(decode_output, decode_input, g_workmem, sizeof(g_workmem)));
|
||||
clear_guard.Cancel();
|
||||
|
||||
/* Clear the work memory. */
|
||||
/* NOTE: Nintendo does not do this. */
|
||||
std::memset(g_workmem, 0, sizeof(g_workmem));
|
||||
|
||||
return ResultSuccess();
|
||||
|
Loading…
Reference in New Issue
Block a user