• R/O
  • SSH

libctools: Commit

This library contains code that extends and simplifies different operations
for C language based programs.


Commit MetaInfo

Revisióne3f4d7fa39d4b33e5ee606e333ac78dc12671ced (tree)
Tiempo2022-08-30 05:38:22
AutorSergey Gusarov <laborer2008@gmai...>
CommiterSergey Gusarov

Log Message

io.c: Fixed MSVC++ build

Cambiar Resumen

Diferencia incremental

diff -r a102e98f1741 -r e3f4d7fa39d4 src/os/io.c
--- a/src/os/io.c Mon Aug 29 23:24:33 2022 +0300
+++ b/src/os/io.c Mon Aug 29 23:38:22 2022 +0300
@@ -242,18 +242,25 @@
242242
243243 bool createPathDirs(const char* const path, const bool informAboutError) CT_NOEXCEPT
244244 {
245- bool status = true;
245+# ifdef CT_OS_WINDOWS
246+ const char kPathBegining[] = ":\\";
247+# endif
246248
247- char* copyPath = copyPathString(path);
248- const size_t kPathLength = ctStrLen(copyPath);
249+ bool status;
250+
251+ char* copyPath;
252+ size_t pathLength;
249253 size_t i = 0;
250254
251- CT_CHECK_PTR_AND_RETURN_RES(path, true);
255+ status = true;
256+ CT_CHECK_PTR_AND_RETURN_RES(path, status);
257+
258+ copyPath = copyPathString(path);
259+ CT_CHECK_PTR_AND_RETURN_RES(copyPath, status);
260+
261+ pathLength = ctStrLen(copyPath);
252262
253263 # ifdef CT_OS_WINDOWS
254- // TODO: test it
255- const char kPathBegining[] = ":\\";
256-
257264 if (strncmp(path + 1, kPathBegining, sizeof(kPathBegining)) == 0)
258265 i += (1 + sizeof(kPathBegining));
259266 # elif defined CT_OS_UNIX
@@ -262,9 +269,7 @@
262269 # error Unimplemented at all
263270 # endif
264271
265- CT_CHECK_PTR_AND_RETURN_RES(copyPath, status);
266-
267- while (i < kPathLength)
272+ while (i < pathLength)
268273 {
269274 if (copyPath[i] == kDirSeparator)
270275 {
@@ -279,7 +284,7 @@
279284 i++;
280285 }
281286
282- if (i >= kPathLength)
287+ if (i >= pathLength)
283288 {
284289 // Loop correctly finished. Create the tail
285290 status = createDir(path, informAboutError);
Show on old repository browser