]> Kevux Git Server - fll/commitdiff
Update: int8_t and uint8_t are always size 1, so avoid sizeof(int8_t) and sizeof...
authorKevin Day <thekevinday@gmail.com>
Sun, 15 Sep 2019 03:41:48 +0000 (22:41 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 15 Sep 2019 03:41:48 +0000 (22:41 -0500)
level_0/f_file/c/file.h
level_0/f_utf/c/utf.c
level_1/fl_directory/c/directory.c
level_1/fl_fss/c/fss.h
level_1/fl_serialized/c/serialized.c
level_1/fl_string/c/string.c
level_2/fll_execute/c/execute.c
level_3/firewall/c/firewall.c
level_3/firewall/c/private-firewall.h

index 66b86e2..24be5b8 100644 (file)
@@ -85,7 +85,7 @@ extern "C" {
     f_file_mode mode;
   } f_file;
 
-  #define f_file_initialize { 0, sizeof(int8_t), 0, (f_file_mode) f_file_read_only }
+  #define f_file_initialize { 0, 1, 0, (f_file_mode) f_file_read_only }
 #endif // _di_f_file_
 
 /**
index 840911b..86ec9ac 100644 (file)
@@ -1633,7 +1633,7 @@ extern "C" {
     *max_width = width;
 
     if (f_utf_is_big_endian()) {
-      memcpy(*character, &utf_character, sizeof(int8_t) * width);
+      memcpy(*character, &utf_character, width);
     }
     else {
       uint32_t utf = 0;
@@ -1651,7 +1651,7 @@ extern "C" {
         utf = (f_macro_utf_character_to_char_4(utf_character) << 24) | (f_macro_utf_character_to_char_3(utf_character) << 16) | (f_macro_utf_character_to_char_2(utf_character) << 8) | f_macro_utf_character_to_char_1(utf_character);
       }
 
-      memcpy(*character, &utf, sizeof(int8_t) * width);
+      memcpy(*character, &utf, width);
     }
 
     return f_none;
index 3e7d760..4b26f8e 100644 (file)
@@ -37,7 +37,7 @@ extern "C" {
             return status;
           }
 
-          memcpy(names->array[names->used].string, listing[counter]->d_name, sizeof(int8_t) * size);
+          memcpy(names->array[names->used].string, listing[counter]->d_name, size);
           names->array[names->used].used = size;
           names->used++;
         }
index 4dede3c..ccf0bc5 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
  *   The number of steps to decrement the start position.
  *   The steps refer to characters and not integers.
  *   Essentially this number is considered against the width of every character found.
- *   (For ASCII each step would be (sizeof(int8_t)).
+ *   (For ASCII each step would be (sizeof(int8_t), which is 1).
  *   (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)).
  *
  * @return
@@ -113,7 +113,7 @@ extern "C" {
  *   The number of steps to increment the start position.
  *   The steps refer to characters and not integers.
  *   Essentially this number is considered against the width of every character found.
- *   (For ASCII each step would be (sizeof(int8_t)).
+ *   (For ASCII each step would be (sizeof(int8_t), which is 1).
  *   (For UTF-8 character of width 3, each step would be (3 * sizeof(int8_t)).
  *
  * @return
index dabd7be..1a5a79f 100644 (file)
@@ -19,12 +19,12 @@ extern "C" {
     }
 
     if (serialized->used == 0) {
-      memcpy(serialized->string + serialized->used, value.string, sizeof(int8_t) * value.used);
+      memcpy(serialized->string + serialized->used, value.string, value.used);
       serialized->used += value.used;
     }
     else {
-      memcpy(serialized->string + serialized->used, f_serialized_simple_splitter_string, sizeof(int8_t));
-      memcpy(serialized->string + serialized->used + 1, value.string, sizeof(int8_t) * value.used);
+      memcpy(serialized->string + serialized->used, f_serialized_simple_splitter_string, 1);
+      memcpy(serialized->string + serialized->used + 1, value.string, value.used);
       serialized->used += value.used + 1;
     }
 
index c960bb2..008bfcd 100644 (file)
@@ -30,7 +30,7 @@ extern "C" {
         return status;
       }
 
-      memcpy(result->string, buffer.string + location.start, sizeof(int8_t) * size);
+      memcpy(result->string, buffer.string + location.start, size);
       result->used = size;
 
       return f_none;
index 01f0c2f..9914b40 100644 (file)
@@ -65,7 +65,7 @@ extern "C" {
         return status;
       }
 
-      memcpy(fixed_arguments[i + 1], arguments.array[i].string, sizeof(int8_t) * arguments.array[i].used);
+      memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used);
       fixed_arguments[i + 1][arguments.array[i].used] = f_string_eos;
     } // for
 
@@ -145,7 +145,7 @@ extern "C" {
         return status;
       }
 
-      memcpy(fixed_arguments[i + 1], arguments.array[i].string, sizeof(int8_t) * arguments.array[i].used);
+      memcpy(fixed_arguments[i + 1], arguments.array[i].string, arguments.array[i].used);
       fixed_arguments[i + 1][arguments.array[i].used] = f_string_eos;
     } // for
 
index 089ec06..33ce463 100644 (file)
@@ -534,9 +534,9 @@ extern "C" {
                 return status;
               }
 
-              memcpy((void *)file_path.string, network_path, sizeof(int8_t) * network_path_length);
-              memcpy((void *)(file_path.string + network_path_length), data->devices.array[i].string, sizeof(int8_t) * data->devices.array[i].used);
-              memcpy((void *)(file_path.string + network_path_length + data->devices.array[i].used), firewall_file_suffix, sizeof(int8_t) * firewall_file_suffix_length);
+              memcpy((void *)file_path.string, network_path, network_path_length);
+              memcpy((void *)(file_path.string + network_path_length), data->devices.array[i].string, data->devices.array[i].used);
+              memcpy((void *)(file_path.string + network_path_length + data->devices.array[i].used), firewall_file_suffix, firewall_file_suffix_length);
 
               file_path.used = network_path_length + data->devices.array[i].used + firewall_file_suffix_length;
               file_path.string[file_path.used] = 0;
index 4114896..1ba3f9d 100644 (file)
@@ -74,7 +74,7 @@ typedef struct {
   f_macro_fss_contents_delete(status, contents);
 
 #define firewall_macro_concat_string(destination, source, length) \
-  memcpy((void *)(destination), source, sizeof(int8_t) * length);
+  memcpy((void *)(destination), source, length);
 
 #define firewall_macro_rule_contents_has_incorrect_items(index, total_items) \
   local.rule_contents.array[index].used <= 0 || local.rule_contents.array[index].used > total_items