Skip to content

Commit 3ce39a5

Browse files
committed
chore: 修复由于rebase导致的函数名错误
1 parent 4137da9 commit 3ce39a5

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

‎lib/xy.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,7 @@ xy_path_extend (const char *path)
19331933
if (!drive && !unc)
19341934
return xy_strdup (path);
19351935

1936-
wchar_t *wpath = _xy_win_wstr (path);
1936+
wchar_t *wpath = xy_utf8_to_wstr (path);
19371937
if (!wpath)
19381938
return xy_strdup (path);
19391939

@@ -1959,7 +1959,7 @@ xy_path_extend (const char *path)
19591959
}
19601960
free (wfull);
19611961

1962-
char *ret = _xy_win_utf8 (wout);
1962+
char *ret = xy_wstr_to_utf8 (wout);
19631963
free (wout);
19641964

19651965
return ret ? ret : xy_strdup (path);

‎src/framework/file-update-win32.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ file_update_stage (const FileUpdate_t *op, StagedFileUpdate_t *stage)
285285
{
286286
char *norm = xy_normalize_path (op->norm_path);
287287
if (!norm) { errno = ENOMEM; return false; }
288-
wchar_t *wnorm = _xy_win_wstr (norm);
288+
wchar_t *wnorm = xy_utf8_to_wstr (norm);
289289
free (norm);
290290
if (!wnorm) { errno = ENOMEM; return false; }
291291

@@ -314,7 +314,7 @@ file_update_stage (const FileUpdate_t *op, StagedFileUpdate_t *stage)
314314
CloseHandle (access);
315315

316316
stage->target_w = target;
317-
stage->target = _xy_win_utf8 (target);
317+
stage->target = xy_wstr_to_utf8 (target);
318318
if (!stage->target) { errno = ENOMEM; goto done; }
319319

320320
stage->has_id = true;
@@ -333,13 +333,13 @@ file_update_stage (const FileUpdate_t *op, StagedFileUpdate_t *stage)
333333
if (!file_update_win32_write_temp_file (target, op->new_content, op->new_len,
334334
true, info.dwFileAttributes,
335335
&stage->replacement_w)) goto done;
336-
stage->replacement = _xy_win_utf8 (stage->replacement_w);
336+
stage->replacement = xy_wstr_to_utf8 (stage->replacement_w);
337337
if (!stage->replacement) { errno = ENOMEM; goto done; }
338338

339339
if (!file_update_win32_write_temp_file (target, op->old_content, op->old_len,
340340
true, info.dwFileAttributes,
341341
&stage->rollback_w)) goto done;
342-
stage->rollback = _xy_win_utf8 (stage->rollback_w);
342+
stage->rollback = xy_wstr_to_utf8 (stage->rollback_w);
343343
if (!stage->rollback) { errno = ENOMEM; goto done; }
344344
}
345345
else
@@ -412,12 +412,12 @@ file_update_stage (const FileUpdate_t *op, StagedFileUpdate_t *stage)
412412
free (full);
413413

414414
stage->target_w = target;
415-
stage->target = _xy_win_utf8 (target);
415+
stage->target = xy_wstr_to_utf8 (target);
416416
if (!stage->target) { errno = ENOMEM; goto done; }
417417

418418
if (!file_update_win32_write_temp_file (target, op->new_content, op->new_len,
419419
false, 0, &stage->replacement_w)) goto done;
420-
stage->replacement = _xy_win_utf8 (stage->replacement_w);
420+
stage->replacement = xy_wstr_to_utf8 (stage->replacement_w);
421421
if (!stage->replacement) { errno = ENOMEM; goto done; }
422422
}
423423
ok = true;
@@ -526,4 +526,4 @@ file_update_identity (const StagedFileUpdate_t *a, const StagedFileUpdate_t *b)
526526
return FileUpdate_Different;
527527
}
528528

529-
#endif /* XY_Build_On_Windows */
529+
#endif /* XY_Build_On_Windows */

‎test/file-update.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ init_test_root (void)
126126
assert (0 == _wmktemp_s (tmpl, MAX_PATH));
127127
assert (CreateDirectoryW (tmpl, NULL));
128128

129-
char *utf8 = _xy_win_utf8 (tmpl);
129+
char *utf8 = xy_wstr_to_utf8 (tmpl);
130130
assert (NULL != utf8 && strlen (utf8) < sizeof (Test_Root));
131131
strcpy (Test_Root, utf8);
132132
free (utf8);
@@ -136,7 +136,7 @@ static size_t
136136
get_TestRootDir_entries_count (void)
137137
{
138138
char *pattern = xy_path_join (Test_Root, "*");
139-
wchar_t *wpattern = _xy_win_wstr (pattern);
139+
wchar_t *wpattern = xy_utf8_to_wstr (pattern);
140140
free (pattern);
141141
assert (NULL != wpattern);
142142

@@ -154,7 +154,7 @@ get_TestRootDir_entries_count (void)
154154
{
155155
if (0 == wcscmp (data.cFileName, L".") || 0 == wcscmp (data.cFileName, L"..")) continue;
156156
/* 暂存及回滚临时文件不能在成功或已处理的失败后残留。 */
157-
char *name = _xy_win_utf8 (data.cFileName);
157+
char *name = xy_wstr_to_utf8 (data.cFileName);
158158
assert (NULL != name);
159159
assert (NULL == strstr (name, ".chsrc-"));
160160
free (name);
@@ -169,7 +169,7 @@ get_TestRootDir_entries_count (void)
169169
static void
170170
cleanup_test_root (void)
171171
{
172-
wchar_t *root = _xy_win_wstr (Test_Root);
172+
wchar_t *root = xy_utf8_to_wstr (Test_Root);
173173
assert (NULL != root);
174174
remove_tree_w (root);
175175
free (root);
@@ -537,7 +537,7 @@ test_readonly_target_rejected (void)
537537
{
538538
char *path = new_path ("readonly-config");
539539
overwrite_file_with_bytes (path, "old", 3);
540-
wchar_t *wpath = _xy_win_wstr (path);
540+
wchar_t *wpath = xy_utf8_to_wstr (path);
541541
assert (NULL != wpath);
542542
assert (SetFileAttributesW (wpath, FILE_ATTRIBUTE_READONLY));
543543

@@ -603,7 +603,7 @@ test_long_path_target (void)
603603
assert (strlen (dir) > 300);
604604

605605
/* 逐级创建;CreateDirectoryW 支持 \\?\ 前缀 */
606-
wchar_t *wdir = _xy_win_wstr (dir);
606+
wchar_t *wdir = xy_utf8_to_wstr (dir);
607607
assert (NULL != wdir);
608608
size_t wlen = wcslen (wdir);
609609
wchar_t *buf = xy_malloc0 ((wlen + 1) * sizeof (wchar_t));
@@ -627,14 +627,14 @@ test_long_path_target (void)
627627
assert_file_with_bytes (path, "deep", 4);
628628
free (op.old_content);
629629

630-
wchar_t *wpath = _xy_win_wstr (path);
630+
wchar_t *wpath = xy_utf8_to_wstr (path);
631631
assert (NULL != wpath && DeleteFileW (wpath));
632632
free (wpath);
633633

634634
char *root = xy_normalize_path (Test_Root);
635635
while (strlen (dir) > strlen (root))
636636
{
637-
wchar_t *wdeep = _xy_win_wstr (dir);
637+
wchar_t *wdeep = xy_utf8_to_wstr (dir);
638638
assert (NULL != wdeep);
639639
RemoveDirectoryW (wdeep);
640640
free (wdeep);

0 commit comments

Comments
 (0)