Migrate more strings

FossilOrigin-Name: 5ef6284dcf38a9367998d964d81cf7cf8340d76c87d58efaa350c9d930ccb416
This commit is contained in:
Jonathan Schleifer 2025-03-07 19:55:34 +00:00
parent 2a2c5ee6ee
commit 570b9e3bb3
5 changed files with 76 additions and 68 deletions

View file

@ -511,32 +511,43 @@ resetcomplete()
}
void
complete(char *s)
complete(OFString *s_)
{
if (*s != '/') {
string t;
strcpy_s(t, s);
strcpy_s(s, "/");
strcat_s(s, t);
}
if (!s[1])
return;
if (!completesize) {
completesize = (int)strlen(s) - 1;
completeidx = 0;
}
__block int idx = 0;
[idents enumerateKeysAndObjectsUsingBlock:^(
OFString *name, Ident *ident, bool *stop) {
if (strncmp(ident.name.UTF8String, s + 1, completesize) == 0 &&
idx++ == completeidx) {
@autoreleasepool {
std::unique_ptr<char> copy(strdup(s_.UTF8String));
char *s = copy.get();
if (*s != '/') {
string t;
strcpy_s(t, s);
strcpy_s(s, "/");
strcat_s(s, ident.name.UTF8String);
strcat_s(s, t);
}
}];
completeidx++;
if (completeidx >= idx)
completeidx = 0;
if (!s[1])
return;
if (!completesize) {
completesize = strlen(s) - 1;
completeidx = 0;
}
__block int idx = 0;
[idents enumerateKeysAndObjectsUsingBlock:^(
OFString *name, Ident *ident, bool *stop) {
if (strncmp(ident.name.UTF8String, s + 1,
completesize) == 0 &&
idx++ == completeidx) {
strcpy_s(s, "/");
strcat_s(s, ident.name.UTF8String);
}
}];
completeidx++;
if (completeidx >= idx)
completeidx = 0;
}
}
bool