cleanup: const and type hygeine in tabcompletion module
This commit is contained in:
@@ -12,4 +12,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define MONTAUK_BUILD_NUMBER 110
|
#define MONTAUK_BUILD_NUMBER 112
|
||||||
|
|||||||
@@ -48,18 +48,17 @@ int find_first_slash_pos(const char* string) {
|
|||||||
/*
|
/*
|
||||||
i.e., "shell.elf" => "shell"
|
i.e., "shell.elf" => "shell"
|
||||||
*/
|
*/
|
||||||
const char* strip_elf_extension(const char* path) {
|
const char* strip_elf_extension(char* path) {
|
||||||
size_t len = montauk::slen(path);
|
size_t len = montauk::slen(path);
|
||||||
|
|
||||||
char* p = (char* ) path;
|
path[len - 4] = '\0';
|
||||||
p[len - 4] = '\0';
|
|
||||||
|
|
||||||
return (const char*)p;
|
return (const char*)path;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* build_montauk_path(
|
const char* build_montauk_path(
|
||||||
char* buffer,
|
char* buffer,
|
||||||
int max,
|
size_t max,
|
||||||
|
|
||||||
int volume_number,
|
int volume_number,
|
||||||
const char* subpath
|
const char* subpath
|
||||||
@@ -79,7 +78,7 @@ const char* build_montauk_path(
|
|||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
for (int i = 0; i < vn_length; i++) {
|
for (size_t i = 0; i < vn_length; i++) {
|
||||||
buffer[pos] = volume_number_str[i];
|
buffer[pos] = volume_number_str[i];
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
@@ -87,7 +86,7 @@ const char* build_montauk_path(
|
|||||||
buffer[pos] = ':'; pos++;
|
buffer[pos] = ':'; pos++;
|
||||||
buffer[pos] = '/'; pos++;
|
buffer[pos] = '/'; pos++;
|
||||||
|
|
||||||
for (int i = 0; i < subpath_length; i++) {
|
for (size_t i = 0; i < subpath_length; i++) {
|
||||||
buffer[pos] = subpath[i];
|
buffer[pos] = subpath[i];
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user