Last bit of string cleanup. string.h finally gone.
This commit is contained in:
@@ -56,34 +56,13 @@ Entry* DiscImageDevice::ResolvePath(const char* path) {
|
||||
GDFXEntry* gdfx_entry = gdfx_->root_entry();
|
||||
|
||||
// Walk the path, one separator at a time.
|
||||
// We copy it into the buffer and shift it left over and over.
|
||||
char remaining[poly::max_path];
|
||||
xestrcpya(remaining, poly::countof(remaining), path);
|
||||
while (remaining[0]) {
|
||||
char* next_slash = strchr(remaining, '\\');
|
||||
if (next_slash == remaining) {
|
||||
// Leading slash - shift
|
||||
xestrcpya(remaining, poly::countof(remaining), remaining + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make the buffer just the name.
|
||||
if (next_slash) {
|
||||
*next_slash = 0;
|
||||
}
|
||||
|
||||
// Look up in the entry.
|
||||
gdfx_entry = gdfx_entry->GetChild(remaining);
|
||||
auto path_parts = poly::split_path(path);
|
||||
for (auto& part : path_parts) {
|
||||
gdfx_entry = gdfx_entry->GetChild(part.c_str());
|
||||
if (!gdfx_entry) {
|
||||
// Not found.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Shift the buffer down, unless we are at the end.
|
||||
if (!next_slash) {
|
||||
break;
|
||||
}
|
||||
xestrcpya(remaining, poly::countof(remaining), next_slash + 1);
|
||||
}
|
||||
|
||||
Entry::Type type = gdfx_entry->attributes & X_FILE_ATTRIBUTE_DIRECTORY ?
|
||||
|
||||
@@ -56,34 +56,13 @@ Entry* STFSContainerDevice::ResolvePath(const char* path) {
|
||||
STFSEntry* stfs_entry = stfs_->root_entry();
|
||||
|
||||
// Walk the path, one separator at a time.
|
||||
// We copy it into the buffer and shift it left over and over.
|
||||
char remaining[poly::max_path];
|
||||
xestrcpya(remaining, poly::countof(remaining), path);
|
||||
while (remaining[0]) {
|
||||
char* next_slash = strchr(remaining, '\\');
|
||||
if (next_slash == remaining) {
|
||||
// Leading slash - shift
|
||||
xestrcpya(remaining, poly::countof(remaining), remaining + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make the buffer just the name.
|
||||
if (next_slash) {
|
||||
*next_slash = 0;
|
||||
}
|
||||
|
||||
// Look up in the entry.
|
||||
stfs_entry = stfs_entry->GetChild(remaining);
|
||||
auto path_parts = poly::split_path(path);
|
||||
for (auto& part : path_parts) {
|
||||
stfs_entry = stfs_entry->GetChild(part.c_str());
|
||||
if (!stfs_entry) {
|
||||
// Not found.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Shift the buffer down, unless we are at the end.
|
||||
if (!next_slash) {
|
||||
break;
|
||||
}
|
||||
xestrcpya(remaining, poly::countof(remaining), next_slash + 1);
|
||||
}
|
||||
|
||||
Entry::Type type = stfs_entry->attributes & X_FILE_ATTRIBUTE_DIRECTORY ?
|
||||
|
||||
@@ -219,7 +219,7 @@ X_STATUS XThread::Create() {
|
||||
}
|
||||
|
||||
char thread_name[32];
|
||||
xesnprintfa(thread_name, poly::countof(thread_name), "XThread%04X", handle());
|
||||
snprintf(thread_name, poly::countof(thread_name), "XThread%04X", handle());
|
||||
set_name(thread_name);
|
||||
|
||||
uint32_t proc_mask = creation_params_.creation_flags >> 24;
|
||||
|
||||
@@ -111,11 +111,6 @@ void xe_xex2_release(xe_xex2_ref xex) {
|
||||
xe_ref_release((xe_ref)xex, (xe_ref_dealloc_t)xe_xex2_dealloc);
|
||||
}
|
||||
|
||||
const xechar_t* xe_xex2_get_name(xe_xex2_ref xex) {
|
||||
// TODO(benvanik): get name.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const xe_xex2_header_t* xe_xex2_get_header(xe_xex2_ref xex) {
|
||||
return &xex->header;
|
||||
}
|
||||
@@ -264,8 +259,8 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
for (size_t i = 0, j = 0; i < string_table_size;) {
|
||||
assert_true(j <= 0xFF);
|
||||
if (j == name_index) {
|
||||
xestrcpya(library->name, poly::countof(library->name),
|
||||
string_table + i);
|
||||
std::strncpy(library->name, string_table + i,
|
||||
poly::countof(library->name));
|
||||
break;
|
||||
}
|
||||
if (string_table[i] == 0) {
|
||||
|
||||
@@ -51,7 +51,6 @@ xe_xex2_ref xe_xex2_load(xe::Memory* memory,
|
||||
xe_xex2_ref xe_xex2_retain(xe_xex2_ref xex);
|
||||
void xe_xex2_release(xe_xex2_ref xex);
|
||||
|
||||
const xechar_t *xe_xex2_get_name(xe_xex2_ref xex);
|
||||
const xe_xex2_header_t *xe_xex2_get_header(xe_xex2_ref xex);
|
||||
const PESection* xe_xex2_get_pe_section(xe_xex2_ref xex, const char* name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user