Skip to content

Commit

Permalink
Revert "replace size_t to dsize_t"
Browse files Browse the repository at this point in the history
This reverts commit fb1c248.
  • Loading branch information
kassane committed Jan 15, 2025
1 parent fb1c248 commit 2005c4e
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions src/cimgui/cimgui.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ module cimgui.cimgui;
// get dcimgui headers to module - @system (unsafe) functions by default
public import cimgui.dcimgui;

version (Windows)
alias dsize_t = ulong;
version (D_BetterC)
{
// No conflict with object.size_t (DRT)
}
else
alias dsize_t = size_t;
{
// replace object.size_t to cimgui.dcimgui.size_t
version (Windows) alias size_t = ulong;
}

scope ImGuiContext_t* CreateContext(scope const(ImFontAtlas_t)* shared_font_atlas) @trusted
{
Expand Down Expand Up @@ -801,22 +806,22 @@ void TextLinkOpenURLEx(scope const(char)* label, scope const(char)* url) @truste
igTextLinkOpenURLEx(label, url);
}

void Image(dsize_t user_texture_id, const ImVec2_t image_size) @trusted
void Image(size_t user_texture_id, const ImVec2_t image_size) @trusted
{
igImage(user_texture_id, image_size);
}

void ImageEx(dsize_t user_texture_id, const ImVec2_t image_size, const ImVec2_t uv0, const ImVec2_t uv1, const ImVec4_t tint_col, const ImVec4_t border_col) @trusted
void ImageEx(size_t user_texture_id, const ImVec2_t image_size, const ImVec2_t uv0, const ImVec2_t uv1, const ImVec4_t tint_col, const ImVec4_t border_col) @trusted
{
igImageEx(user_texture_id, image_size, uv0, uv1, tint_col, border_col);
}

bool ImageButton(scope const(char)* str_id, dsize_t user_texture_id, const ImVec2_t image_size) @trusted
bool ImageButton(scope const(char)* str_id, size_t user_texture_id, const ImVec2_t image_size) @trusted
{
return igImageButton(str_id, user_texture_id, image_size);
}

bool ImageButtonEx(scope const(char)* str_id, dsize_t user_texture_id, const ImVec2_t image_size, const ImVec2_t uv0, const ImVec2_t uv1, const ImVec4_t bg_col, const ImVec4_t tint_col) @trusted
bool ImageButtonEx(scope const(char)* str_id, size_t user_texture_id, const ImVec2_t image_size, const ImVec2_t uv0, const ImVec2_t uv1, const ImVec4_t bg_col, const ImVec4_t tint_col) @trusted
{
return igImageButtonEx(str_id, user_texture_id, image_size, uv0, uv1, bg_col, tint_col);
}
Expand Down Expand Up @@ -1149,34 +1154,34 @@ bool VSliderScalarEx(scope const(char)* label, ImVec2_t size, int data_type, sco
return igVSliderScalarEx(label, size, data_type, p_data, p_min, p_max, format, flags);
}

bool InputText(scope const(char)* label, scope char* buf, dsize_t buf_size, int flags) @trusted
bool InputText(scope const(char)* label, scope char* buf, size_t buf_size, int flags) @trusted
{
return igInputText(label, buf, buf_size, flags);
}

extern (C) bool InputTextEx(scope const(char)* label, scope char* buf, dsize_t buf_size, int flags, int function(
extern (C) bool InputTextEx(scope const(char)* label, scope char* buf, size_t buf_size, int flags, int function(
const ImGuiInputTextCallbackData_t* data) callback, scope void* user_data) @trusted
{
return igInputTextEx(label, buf, buf_size, flags, callback, user_data);
}

bool InputTextMultiline(scope const(char)* label, scope char* buf, dsize_t buf_size) @trusted
bool InputTextMultiline(scope const(char)* label, scope char* buf, size_t buf_size) @trusted
{
return igInputTextMultiline(label, buf, buf_size);
}

extern (C) bool InputTextMultilineEx(scope const(char)* label, scope char* buf, dsize_t buf_size, ImVec2_t size, int flags, int function(
extern (C) bool InputTextMultilineEx(scope const(char)* label, scope char* buf, size_t buf_size, ImVec2_t size, int flags, int function(
const ImGuiInputTextCallbackData_t* data) callback, scope void* user_data) @trusted
{
return igInputTextMultilineEx(label, buf, buf_size, size, flags, callback, user_data);
}

bool InputTextWithHint(scope const(char)* label, scope const(char)* hint, scope char* buf, dsize_t buf_size, int flags) @trusted
bool InputTextWithHint(scope const(char)* label, scope const(char)* hint, scope char* buf, size_t buf_size, int flags) @trusted
{
return igInputTextWithHint(label, hint, buf, buf_size, flags);
}

extern (C) bool InputTextWithHintEx(scope const(char)* label, scope const(char)* hint, scope char* buf, dsize_t buf_size, int flags, int function(
extern (C) bool InputTextWithHintEx(scope const(char)* label, scope const(char)* hint, scope char* buf, size_t buf_size, int flags, int function(
const ImGuiInputTextCallbackData_t* data) callback, scope void* user_data) @trusted
{
return igInputTextWithHintEx(label, hint, buf, buf_size, flags, callback, user_data);
Expand Down Expand Up @@ -1881,7 +1886,7 @@ bool BeginDragDropSource(int flags) @trusted
return igBeginDragDropSource(flags);
}

bool SetDragDropPayload(scope const(char)* type, scope const(void)* data, dsize_t sz, int cond) @trusted
bool SetDragDropPayload(scope const(char)* type, scope const(void)* data, size_t sz, int cond) @trusted
{
return igSetDragDropPayload(type, data, sz, cond);
}
Expand Down Expand Up @@ -2296,7 +2301,7 @@ void LoadIniSettingsFromDisk(scope const(char)* ini_filename) @trusted
igLoadIniSettingsFromDisk(ini_filename);
}

void LoadIniSettingsFromMemory(scope const(char)* ini_data, dsize_t ini_size) @trusted
void LoadIniSettingsFromMemory(scope const(char)* ini_data, size_t ini_size) @trusted
{
igLoadIniSettingsFromMemory(ini_data, ini_size);
}
Expand All @@ -2306,7 +2311,7 @@ void SaveIniSettingsToDisk(scope const(char)* ini_filename) @trusted
igSaveIniSettingsToDisk(ini_filename);
}

scope const(char)* SaveIniSettingsToMemory(scope dsize_t* out_ini_size) @trusted
scope const(char)* SaveIniSettingsToMemory(scope size_t* out_ini_size) @trusted
{
return igSaveIniSettingsToMemory(out_ini_size);
}
Expand All @@ -2326,7 +2331,7 @@ void DebugStartItemPicker() @trusted
igDebugStartItemPicker();
}

bool DebugCheckVersionAndDataLayout(scope const(char)* version_str, dsize_t sz_io, dsize_t sz_style, dsize_t sz_vec2, dsize_t sz_vec4, dsize_t sz_drawvert, dsize_t sz_drawidx) @trusted
bool DebugCheckVersionAndDataLayout(scope const(char)* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx) @trusted
{
return igDebugCheckVersionAndDataLayout(version_str, sz_io, sz_style, sz_vec2, sz_vec4, sz_drawvert, sz_drawidx);
}
Expand All @@ -2338,19 +2343,19 @@ void DebugLogV(scope const(char)* fmt, __builtin_va_list args) @trusted
igDebugLogV(fmt, args);
}

extern (C) void SetAllocatorFunctions(scope void* function(dsize_t sz, void* user_data) alloc_func, void function(
extern (C) void SetAllocatorFunctions(scope void* function(size_t sz, void* user_data) alloc_func, void function(
void* ptr, void* user_data) free_func, scope void* user_data) @trusted
{
igSetAllocatorFunctions(alloc_func, free_func, user_data);
}

extern (C) void GetAllocatorFunctions(scope void* function(dsize_t sz, void* user_data)* p_alloc_func, void function(
extern (C) void GetAllocatorFunctions(scope void* function(size_t sz, void* user_data)* p_alloc_func, void function(
void* ptr, void* user_data)* p_free_func, scope void** p_user_data) @trusted
{
igGetAllocatorFunctions(p_alloc_func, p_free_func, p_user_data);
}

scope void* MemAlloc(dsize_t size) @trusted
scope void* MemAlloc(size_t size) @trusted
{
return igMemAlloc(size);
}
Expand Down Expand Up @@ -2769,7 +2774,7 @@ void applyRequests(
ImGuiSelectionExternalStorage_ApplyRequests(self, ms_io);
}

dsize_t getTexID(scope const(ImDrawCmd_t)* self) @trusted
size_t getTexID(scope const(ImDrawCmd_t)* self) @trusted
{
return ImDrawCmd_GetTexID(cast(ImDrawCmd_t*) self);
}
Expand Down

0 comments on commit 2005c4e

Please sign in to comment.