This library contains code that extends and simplifies different operations
for C language based programs.
Revisión | e3f4d7fa39d4b33e5ee606e333ac78dc12671ced (tree) |
---|---|
Tiempo | 2022-08-30 05:38:22 |
Autor | Sergey Gusarov <laborer2008@gmai...> |
Commiter | Sergey Gusarov |
io.c: Fixed MSVC++ build
@@ -242,18 +242,25 @@ | ||
242 | 242 | |
243 | 243 | bool createPathDirs(const char* const path, const bool informAboutError) CT_NOEXCEPT |
244 | 244 | { |
245 | - bool status = true; | |
245 | +# ifdef CT_OS_WINDOWS | |
246 | + const char kPathBegining[] = ":\\"; | |
247 | +# endif | |
246 | 248 | |
247 | - char* copyPath = copyPathString(path); | |
248 | - const size_t kPathLength = ctStrLen(copyPath); | |
249 | + bool status; | |
250 | + | |
251 | + char* copyPath; | |
252 | + size_t pathLength; | |
249 | 253 | size_t i = 0; |
250 | 254 | |
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); | |
252 | 262 | |
253 | 263 | # ifdef CT_OS_WINDOWS |
254 | - // TODO: test it | |
255 | - const char kPathBegining[] = ":\\"; | |
256 | - | |
257 | 264 | if (strncmp(path + 1, kPathBegining, sizeof(kPathBegining)) == 0) |
258 | 265 | i += (1 + sizeof(kPathBegining)); |
259 | 266 | # elif defined CT_OS_UNIX |
@@ -262,9 +269,7 @@ | ||
262 | 269 | # error Unimplemented at all |
263 | 270 | # endif |
264 | 271 | |
265 | - CT_CHECK_PTR_AND_RETURN_RES(copyPath, status); | |
266 | - | |
267 | - while (i < kPathLength) | |
272 | + while (i < pathLength) | |
268 | 273 | { |
269 | 274 | if (copyPath[i] == kDirSeparator) |
270 | 275 | { |
@@ -279,7 +284,7 @@ | ||
279 | 284 | i++; |
280 | 285 | } |
281 | 286 | |
282 | - if (i >= kPathLength) | |
287 | + if (i >= pathLength) | |
283 | 288 | { |
284 | 289 | // Loop correctly finished. Create the tail |
285 | 290 | status = createDir(path, informAboutError); |