From 9c79de184482d59cb31bc2582f9bde93886b4ffb Mon Sep 17 00:00:00 2001 From: HookedBehemoth Date: Tue, 14 Jan 2020 03:34:05 +0100 Subject: [PATCH] wrap all out calls with temporary in values --- nx/source/services/capsa.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/nx/source/services/capsa.c b/nx/source/services/capsa.c index e011b543..100c1644 100644 --- a/nx/source/services/capsa.c +++ b/nx/source/services/capsa.c @@ -97,8 +97,10 @@ static Result _capsaLoadAlbumScreenshot(u64 *width, u64 *height, const CapsAlbum .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out | SfBufferAttr_HipcMapTransferAllowsNonSecure, SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, .buffers = { { image, image_size }, { workbuf, workbuf_size } }, ); - *width = out.width; - *height = out.height; + if (R_SUCCEEDED(rc)) { + if (width) *width = out.width; + if (height) *height = out.height; + } return rc; } @@ -125,8 +127,10 @@ static Result _capsaLoadAlbumScreenshotEx(u64 *width, u64 *height, const CapsAlb .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out | SfBufferAttr_HipcMapTransferAllowsNonSecure, SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, .buffers = { { image, image_size }, { workbuf, workbuf_size } }, ); - *width = out.width; - *height = out.height; + if (R_SUCCEEDED(rc)) { + if (width) *width = out.width; + if (height) *height = out.height; + } return rc; } @@ -154,9 +158,11 @@ Result _capsaLoadAlbumScreenShotEx0(u64 *width, u64 *height, CapsScreenShotAttri .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out | SfBufferAttr_HipcMapTransferAllowsNonSecure, SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, .buffers = { { image, image_size }, { workbuf, workbuf_size } }, ); - *attr = out.attr; - *width = out.width; - *height = out.height; + if (R_SUCCEEDED(rc)) { + if (attr) *attr = out.attr; + if (width) *width = out.width; + if (height) *height = out.height; + } return rc; } @@ -251,7 +257,9 @@ Result capsaGetLastOverlayMovieThumbnail(CapsOverlayThumbnailData *data, void* i Result capsaGetAutoSavingStorage(CapsAlbumStorage *storage) { u8 tmpval = 0; Result rc = serviceDispatchOut(&g_capsaSrv, 401, tmpval); - *storage = tmpval; + if (R_SUCCEEDED(rc)) { + if (storage) *storage = tmpval; + } return rc; }