mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Fix two things -Wconditional-uninitialized warned about
Rather minor stuff: * Initliaze first case to 0. * The other (saved_errno), move the error output it is for in-scope and not need at all.
This commit is contained in:
parent
3a08a24259
commit
acfd380176
2 changed files with 6 additions and 7 deletions
|
@ -189,7 +189,7 @@ static wcstring str2wcs_internal(const char *in, const size_t in_len) {
|
||||||
mbstate_t state = {};
|
mbstate_t state = {};
|
||||||
while (in_pos < in_len) {
|
while (in_pos < in_len) {
|
||||||
bool use_encode_direct = false;
|
bool use_encode_direct = false;
|
||||||
size_t ret;
|
size_t ret = 0;
|
||||||
wchar_t wc = 0;
|
wchar_t wc = 0;
|
||||||
|
|
||||||
if ((in[in_pos] & 0xF8) == 0xF8) {
|
if ((in[in_pos] & 0xF8) == 0xF8) {
|
||||||
|
|
|
@ -570,7 +570,6 @@ bool env_universal_t::open_temporary_file(const wcstring &directory, wcstring *o
|
||||||
assert(!string_suffixes_string(L"/", directory));
|
assert(!string_suffixes_string(L"/", directory));
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
int saved_errno;
|
|
||||||
const wcstring tmp_name_template = directory + L"/fishd.tmp.XXXXXX";
|
const wcstring tmp_name_template = directory + L"/fishd.tmp.XXXXXX";
|
||||||
wcstring tmp_name;
|
wcstring tmp_name;
|
||||||
|
|
||||||
|
@ -587,16 +586,16 @@ bool env_universal_t::open_temporary_file(const wcstring &directory, wcstring *o
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
saved_errno = errno;
|
|
||||||
success = result_fd != -1;
|
success = result_fd != -1;
|
||||||
*out_fd = result_fd;
|
*out_fd = result_fd;
|
||||||
|
|
||||||
|
if (!success && attempt == 9) {
|
||||||
|
report_error(errno, L"Unable to open temporary file '%s'", narrow_str);
|
||||||
|
}
|
||||||
|
|
||||||
*out_path = str2wcstring(narrow_str);
|
*out_path = str2wcstring(narrow_str);
|
||||||
free(narrow_str);
|
free(narrow_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
|
||||||
report_error(saved_errno, L"Unable to open file '%ls'", out_path->c_str());
|
|
||||||
}
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue