This source file includes following definitions.
- halide_create_temp_file
#include "HalideRuntime.h"
#ifdef BITS_64
#define WIN32API
#else
#define WIN32API __stdcall
#endif
#define MAX_PATH 260
extern "C" {
extern uint32_t WIN32API GetTempPathA(uint32_t, char *);
extern uint32_t WIN32API GetTempFileNameA(const char *, const char *, uint32_t, char *);
WEAK int halide_create_temp_file(void *user_context, const char *prefix, const char *suffix,
char *path_buf, size_t path_buf_size) {
if (!prefix || !suffix || !path_buf) {
return halide_error_code_internal_error;
}
char tmp_dir_path[MAX_PATH];
uint32_t ret = GetTempPathA(MAX_PATH, tmp_dir_path);
if (ret != 0) {
return halide_error_code_internal_error;
}
if (strlen(suffix) > 0) {
return halide_error_code_internal_error;
}
if (path_buf_size < MAX_PATH) {
return halide_error_code_internal_error;
}
ret = GetTempFileNameA(tmp_dir_path, prefix, 0, path_buf);
if (ret != 0) {
return halide_error_code_internal_error;
}
return 0;
}
}