Fixed some lingering string problems in windows platform layer

master
Allen Webster 2019-07-25 17:58:25 -07:00
parent dd51779a04
commit f52738b5e6
4 changed files with 54 additions and 3 deletions

View File

@ -3593,6 +3593,51 @@ string_remove_last_folder(String_Const_u32 str){
return(str);
}
static String_Const_char
string_remove_front_of_path(String_Const_char str){
imem slash_pos = string_find_last_slash(str);
if (slash_pos < 0){
str.size = 0;
}
else{
str.size = slash_pos + 1;
}
return(str);
}
static String_Const_u8
string_remove_front_of_path(String_Const_u8 str){
imem slash_pos = string_find_last_slash(str);
if (slash_pos < 0){
str.size = 0;
}
else{
str.size = slash_pos + 1;
}
return(str);
}
static String_Const_u16
string_remove_front_of_path(String_Const_u16 str){
imem slash_pos = string_find_last_slash(str);
if (slash_pos < 0){
str.size = 0;
}
else{
str.size = slash_pos + 1;
}
return(str);
}
static String_Const_u32
string_remove_front_of_path(String_Const_u32 str){
imem slash_pos = string_find_last_slash(str);
if (slash_pos < 0){
str.size = 0;
}
else{
str.size = slash_pos + 1;
}
return(str);
}
static String_Const_char
string_front_of_path(String_Const_char str){
imem slash_pos = string_find_last_slash(str);

View File

@ -149,6 +149,11 @@ ft__bad_rect_pack_next(FT_Bad_Rect_Pack *pack, Vec2_i32 dim){
return(result);
}
internal void
ft__bad_rect_store_finish(FT_Bad_Rect_Pack *pack){
ft__bad_rect_pack_end_line(pack);
}
internal void
ft__glyph_bounds_store_uv_raw(Vec3_i32 p, Vec2_i32 dim, Glyph_Bounds *bounds){
bounds->uv = Rf32((f32)p.x, (f32)p.y, (f32)dim.x, (f32)dim.y);
@ -288,6 +293,7 @@ ft__font_make_face(Arena *arena, Face_Description *description){
Vec2_i32 dim = glyph_bitmaps[i].dim;
ft__glyph_bounds_store_uv_raw(ft__bad_rect_pack_next(&pack, dim), dim, &face->bounds[i]);
}
ft__bad_rect_store_finish(&pack);
Texture_Kind texture_kind = TextureKind_Mono;
u32 texture = sysfunc.get_texture(pack.dim, texture_kind);

View File

@ -1105,7 +1105,6 @@ Sys_CLI_Call_Sig(system_cli_call, path, script_name, cli_out){
char cmd[] = "c:\\windows\\system32\\cmd.exe";
char *env_variables = 0;
char command_line[2048];
Arena *scratch = &shared_vars.scratch;
@ -1140,7 +1139,7 @@ Sys_CLI_Call_Sig(system_cli_call, path, script_name, cli_out){
startup.wShowWindow = SW_HIDE;
PROCESS_INFORMATION info = {};
if (CreateProcess_utf8(&shared_vars.scratch, (u8*)cmd, (u8*)command_line, 0, 0, TRUE, 0, env_variables, (u8*)path, &startup, &info)){
if (CreateProcess_utf8(&shared_vars.scratch, (u8*)cmd, s.str, 0, 0, TRUE, 0, env_variables, (u8*)path, &startup, &info)){
success = true;
CloseHandle(info.hThread);
*(HANDLE*)&cli_out->proc = info.hProcess;

View File

@ -125,6 +125,7 @@ Sys_Set_File_List_Sig(system_set_file_list){
u8 dir_space[MAX_PATH + 32];
umem directory_original_length = cstring_length(directory);
block_copy(dir_space, directory, directory_original_length);
dir_space[directory_original_length] = 0;
String_Const_u8 dir = SCu8(dir_space, directory_original_length);
HANDLE dir_handle = CreateFile_utf8(&shared_vars.scratch, dir.str, FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, 0);
@ -285,7 +286,7 @@ Sys_Get_Canonical_Sig(system_get_canonical){
}
else{
String_Const_u8 src_str = SCu8(filename, len);
String_Const_u8 path_str = string_remove_last_folder(src_str);
String_Const_u8 path_str = string_remove_front_of_path(src_str);
String_Const_u8 front_str = string_front_of_path(src_str);
memcpy(src_space, path_str.str, path_str.size);