aboutsummaryrefslogtreecommitdiffstats
path: root/windows.c
diff options
context:
space:
mode:
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/windows.c b/windows.c
index 02b396f76..5441b39b6 100644
--- a/windows.c
+++ b/windows.c
@@ -176,7 +176,7 @@ int subsurface_rename(const char *path, const char *newpath)
{
int ret = -1;
if (!path || !newpath)
- return -1;
+ return ret;
wchar_t *wpath = utf8_to_utf16(path);
wchar_t *wnewpath = utf8_to_utf16(newpath);
@@ -192,13 +192,11 @@ int subsurface_open(const char *path, int oflags, mode_t mode)
{
int ret = -1;
if (!path)
- return -1;
+ return ret;
wchar_t *wpath = utf8_to_utf16(path);
- if (wpath) {
+ if (wpath)
ret = _wopen(wpath, oflags, mode);
- free((void *)wpath);
- return ret;
- }
+ free((void *)wpath);
return ret;
}
@@ -215,9 +213,8 @@ FILE *subsurface_fopen(const char *path, const char *mode)
wmode[i] = (wchar_t)mode[i];
wmode[len] = 0;
ret = _wfopen(wpath, wmode);
- free((void *)wpath);
- return ret;
}
+ free((void *)wpath);
return ret;
}
@@ -228,11 +225,9 @@ void *subsurface_opendir(const char *path)
if (!path)
return ret;
wchar_t *wpath = utf8_to_utf16(path);
- if (wpath) {
+ if (wpath)
ret = _wopendir(wpath);
- free((void *)wpath);
- return (void *)ret;
- }
+ free((void *)wpath);
return (void *)ret;
}