Refactor of IO functions

Related-To: NEO-4562

Signed-off-by: Konstanty Misiak <konstanty.misiak@intel.com>
This commit is contained in:
Konstanty Misiak
2023-02-13 09:55:24 +00:00
committed by Compute-Runtime-Automation
parent c0f0472b6e
commit 1f37e69fd2
13 changed files with 27 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,6 +18,7 @@ ftellFuncPtr ftellPtr = &mockFtell;
rewindFuncPtr rewindPtr = &mockRewind;
freadFuncPtr freadPtr = &mockFread;
fwriteFuncPtr fwritePtr = &mockFwrite;
fflushFuncPtr fflushPtr = &mockFflush;
uint32_t mockFopenCalled = 0;
FILE *mockFopenReturned = reinterpret_cast<FILE *>(0x40);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -42,7 +42,7 @@ inline FILE *mockFopen(const char *filename, const char *mode) {
inline int mockVfptrinf(FILE *stream, const char *format, va_list arg) {
mockVfptrinfCalled++;
if (mockVfptrinfUseStdioFunction) {
if (stream == stdout || stream == stderr || mockVfptrinfUseStdioFunction) {
return vfprintf(stream, format, arg);
}
return 0x10;
@@ -85,5 +85,12 @@ inline size_t mockFwrite(const void *ptr, size_t size, size_t nmemb, FILE *strea
return mockFwriteReturn;
}
inline int mockFflush(FILE *stream) {
if (stream == stdout || stream == stderr)
return fflush(stream);
return 0;
}
} // namespace IoFunctions
} // namespace NEO