/* Reduce the maximal size of Stream's Buffer (MaxBufferSize field). */
EFI_STATUS EFIAPI AmlStreamReduceMaxBufferSize(IN AML_STREAM *Stream, IN UINT32 Diff)
/* Reduce the maximal size of Stream's Buffer (MaxBufferSize field). */
EFI_STATUS EFIAPI AmlStreamReduceMaxBufferSize(IN AML_STREAM *Stream, IN UINT32 Diff)
{
  if (!IS_STREAM (Stream)       ||
      (Diff == 0)               ||
      ((Stream->MaxBufferSize - Diff) <= Stream->Index))
  {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  Stream->MaxBufferSize -= Diff;
  return EFI_SUCCESS;
}