XGameSave: a read result into a small buffer is E_GS_PROVIDED_BUFFER_TOO_SMALL
XGameSaveReadBlobDataResult lists E_GS_PROVIDED_BUFFER_TOO_SMALL among its errors, and the synchronous read already returns it; the result passed on XAsyncGetResult's E_NOT_SUFFICIENT_BUFFER instead.
This commit is contained in:
1 parent
d2a4bae1f4
commit
28c1b0735c
1 file changed
+9
@@ -786,6 +786,11 @@ extern "system" fn read_result(
|
||||
) -> HRESULT {
|
||||
let mut used = 0;
|
||||
let hr = xasync::XAsyncGetResult(block, (&raw const READ).cast(), size, out.cast(), &mut used);
|
||||
// The documented error for a small buffer; the result stays for a
|
||||
// retry with a larger one.
|
||||
if hr == xasync::E_NOT_SUFFICIENT_BUFFER {
|
||||
return BUFFER_TOO_SMALL;
|
||||
}
|
||||
if hr < 0 {
|
||||
return hr;
|
||||
}
|
||||
@@ -1209,6 +1214,10 @@ mod tests {
|
||||
);
|
||||
let mut buffer = vec![0u64; size.div_ceil(8)];
|
||||
let mut count = 0;
|
||||
assert_eq!(
|
||||
read_result(this, &mut b, 8, buffer.as_mut_ptr().cast(), &mut count),
|
||||
BUFFER_TOO_SMALL
|
||||
);
|
||||
assert_eq!(
|
||||
read_result(this, &mut b, size, buffer.as_mut_ptr().cast(), &mut count),
|
||||
S_OK
|
||||
|
||||
Reference in new issue
Block a user