diff th_file.c @ 735:31bc1ed07cf5

Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Dec 2022 12:14:39 +0200
parents 29e44a58bc73
children 32dab9b6058a
line wrap: on
line diff
--- a/th_file.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_file.c	Wed Dec 07 12:14:39 2022 +0200
@@ -101,12 +101,12 @@
 #endif
 
 
-BOOL th_stat_path(const char *path, th_stat_data *data)
+bool th_stat_path(const char *path, th_stat_data *data)
 {
 #if defined(TH_PLAT_WINDOWS)
     WIN32_FILE_ATTRIBUTE_DATA fdata;
     if (!GetFileAttributesExA(path, GetFileExInfoStandard, &fdata))
-        return FALSE;
+        return false;
 
     data->size   = (((uint64_t) fdata.nFileSizeHigh) << 32ULL) | ((uint64_t) fdata.nFileSizeLow);
     data->ctime  = th_convert_windows_time(fdata.ftCreationTime);
@@ -125,7 +125,7 @@
 
     struct stat sb;
     if (stat(path, &sb) < 0)
-        return FALSE;
+        return false;
 
     data->size   = sb.st_size;
     data->ctime  = sb.st_ctime;
@@ -150,15 +150,15 @@
 
 #endif
 
-    return TRUE;
+    return true;
 }
 
 
-BOOL th_mkdir_path(const char *cpath, const int mode)
+bool th_mkdir_path(const char *cpath, const int mode)
 {
     char save, *path = th_strdup(cpath);
     size_t start = 0, end;
-    BOOL res = FALSE;
+    bool res = false;
 
 #if defined(TH_PLAT_WINDOWS)
     (void) mode;
@@ -180,7 +180,7 @@
         if (path[start] != 0)
         {
             th_stat_data sdata;
-            BOOL exists = th_stat_path(path, &sdata);
+            bool exists = th_stat_path(path, &sdata);
             if (exists && (sdata.flags & TH_IS_DIR) == 0)
                 goto error;
 
@@ -201,7 +201,7 @@
         start = end + 1;
     } while (save != 0);
 
-    res = TRUE;
+    res = true;
 
 error:
     th_free(path);