74template <
typename Character>
81 buffer_pointer = _calloc_crt_t(Character,
L_tmpnam).detach();
84 return buffer_pointer;
87template <
typename Character>
93 Character*
const buffer = get_tmpfile_buffer_nolock<Character>(
buffer_id);
112 if (temp_path_length == 0 || temp_path_length > max_supported_temp_path_length)
144template <
typename Character>
146static
bool __cdecl generate_tmpfile_file_name(
153 Character*
const dot =
reinterpret_cast<Character*
>(stdio_traits::tcsrchr(
file_name,
'.'));
158 Character*
const unique_id = dot + 1;
159 size_t const unique_id_count = file_name_count - (unique_id -
file_name);
161 uint64_t const next_identifier = stdio_traits::tcstoull(unique_id,
nullptr, 36) + 1;
162 if (next_identifier == 0)
165#pragma warning(disable:__WARNING_POSTCONDITION_NULLTERMINATION_VIOLATION)
166 _ERRCHECK(stdio_traits::ulltot_s(next_identifier, unique_id, unique_id_count, 36));
178 return &
ptd->_tmpnam_narrow_buffer;
187 return &
ptd->_tmpnam_wide_buffer;
192template <
typename Character>
202 Character*
const global_buffer = get_tmpfile_buffer_nolock<Character>(
buffer_id);
203 size_t const global_buffer_count =
L_tmpnam;
212 if (global_buffer[0] == 0)
214 initialize_tmpfile_buffer_nolock<Character>(
buffer_id);
216 else if (!generate_tmpfile_file_name(global_buffer, global_buffer_count))
222 while (stdio_traits::taccess_s(global_buffer, 0) == 0)
224 if (!generate_tmpfile_file_name(global_buffer, global_buffer_count))
244#pragma warning(suppress:__WARNING_POSTCONDITION_NULLTERMINATION_VIOLATION)
254 if (ptd_buffer ==
nullptr)
259 if (*ptd_buffer ==
nullptr)
261 *ptd_buffer = _calloc_crt_t(Character, global_buffer_count).detach();
262 if (*ptd_buffer ==
nullptr)
268 _ERRCHECK(stdio_traits::tcscpy_s(*ptd_buffer, global_buffer_count, global_buffer));
278template <
typename Character>
295 if (return_value != 0)
298 errno = return_value;
323 size_t const global_buffer_count =
L_tmpnam;
332 if (*global_buffer == 0)
339 else if (!generate_tmpfile_file_name(global_buffer, global_buffer_count))
345 if (!local_stream.
valid())
369 if (!generate_tmpfile_file_name(global_buffer, global_buffer_count))
395 local_stream->
_cnt = 0;
396 local_stream->
_base =
nullptr;
397 local_stream->
_ptr =
nullptr;
399 local_stream->
_file = fh;
407 if (local_stream->
_file == -1)
430 return_value = common_tmpfile_nolock(
stream, sh_flag);
431 if (return_value != 0)
433 errno = return_value;
462 wchar_t*
result =
nullptr;
476 wchar_t*
result =
nullptr;
struct outqueuenode * tail
bool set_flags(long const flags) const
FILE * public_stream() const
void __cdecl __acrt_unlock(_In_ __acrt_lock_id lock)
__acrt_ptd *__cdecl __acrt_getptd_noexit(void)
void __cdecl __acrt_stdio_free_stream(__crt_stdio_stream _Stream)
__crt_stdio_stream __cdecl __acrt_stdio_allocate_stream()
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
result_buffer_count char *const result_buffer
__acrt_lock(__acrt_heap_lock)
GLuint GLuint GLsizei count
#define _VALIDATE_RETURN_NOERRNO(expr, retexpr)
#define _VALIDATE_RETURN_ERRCODE(expr, errorcode)
#define _Outptr_result_z_
#define _Inout_updates_z_(s)
#define _Out_writes_opt_z_(s)
_Check_return_opt_ _CRTIMP int __cdecl _close(_In_ int _FileHandle)
_Check_return_wat_ _CRTIMP errno_t __cdecl _sopen_s(_Out_ int *_FileHandle, _In_z_ const char *_Filename, _In_ int _OpenFlag, _In_ int _ShareFlag, _In_ int _PermissionMode)
errno_t __cdecl tmpnam_s(char *const result_buffer, size_t const result_buffer_count)
errno_t __cdecl tmpfile_s(FILE **const stream)
static wchar_t * wide_tmpfile_buffer_pointers[static_cast< size_t >(buffer_id::count)]
static char * narrow_tmpfile_buffer_pointers[static_cast< size_t >(buffer_id::count)]
_In_ size_t const file_name_count throw()
size_t const result_buffer_count
static char **__cdecl get_tmpnam_ptd_buffer(char)
errno_t __cdecl _wtmpnam_s(wchar_t *const result_buffer, size_t const result_buffer_count)
unsigned __acrt_tmpfile_used
char *__cdecl tmpnam(char *const result_buffer)
void __acrt_force_use_of_tmpfile()
wchar_t *__cdecl _wtmpnam(wchar_t *const result_buffer)
void __cdecl __acrt_stdio_free_tmpfile_name_buffers_nolock()
static char *&__cdecl get_tmpfile_buffer_pointer_nolock(buffer_id const id, char)
DWORD WINAPI GetCurrentProcessId(void)
size_t const buffer_count