mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Refactor of IO functions
Related-To: NEO-4562 Signed-off-by: Konstanty Misiak <konstanty.misiak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c0f0472b6e
commit
1f37e69fd2
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user