Fixes for places that used Text$find()
This commit is contained in:
parent
63a5032ca0
commit
33f1af8e71
@ -439,9 +439,11 @@ public Text_t Path$write_unique_bytes(Path_t path, Array_t bytes)
|
||||
char buf[PATH_MAX] = {};
|
||||
strcpy(buf, path_str);
|
||||
|
||||
int64_t suffixlen = 0;
|
||||
(void)Text$find(path, Pattern("{0+!X}{end}"), I(1), &suffixlen);
|
||||
if (suffixlen < 0) suffixlen = 0;
|
||||
// Count the number of trailing characters leading up to the last "X"
|
||||
// (e.g. "foo_XXXXXX.tmp" would yield suffixlen = 4)
|
||||
size_t suffixlen = 0;
|
||||
while (suffixlen < len && buf[len - 1 - suffixlen] != 'X')
|
||||
++suffixlen;
|
||||
|
||||
int fd = mkstemps(buf, suffixlen);
|
||||
if (fd == -1)
|
||||
|
@ -441,7 +441,7 @@ public void end_test(const void *expr, const TypeInfo_t *type, const char *expec
|
||||
Text_t expr_plain = USE_COLOR ? generic_as_text(expr, false, type) : expr_text;
|
||||
bool success = Text$equal(&expr_plain, &expected_text);
|
||||
if (!success) {
|
||||
Int_t colon = Text$find(expected_text, Text(":"), I_small(1), NULL);
|
||||
Int_t colon = Text$find(expected_text, Text(":"), I_small(1));
|
||||
if (colon.small != I_small(0).small) {
|
||||
Text_t with_type = Text$concat(expr_plain, Text(" : "), type_name);
|
||||
success = Text$equal(&with_type, &expected_text);
|
||||
|
Loading…
Reference in New Issue
Block a user