]> 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 66b86e226460342cde7fa34247608db6188e324c..24be5b8a0e81bbf20627f4044764d263aee45877 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 840911ba1901776b68b0755eb4a8fdf71209c50c..86ec9ac104a64f4164e4ca431402f6022da4b4f0 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 3e7d760ca12f234ce1123bafd9ca717c6cd525f3..4b26f8ed643d27cc31b8b0ff4776263d623d0bde 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 4dede3c6499f98e02c2f9deee0e5739abc3f01e0..ccf0bc50885aee2fca866f34242aa106423ae5d5 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 dabd7beb48968c9cf6e055e0bb6cf5aa74c5cb3f..1a5a79f1bfa50a1494252329b033d68869aa540f 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 c960bb2b870fb1e5457e1af0ab734505122e7336..008bfcdacce77c5e514b91783124f2e55c7342d6 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 01f0c2f5c7eb57d4e366b3332f55b664acfbd8ca..9914b40e64630be97f2b79f062c9435b2d642a51 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 089ec06030d8689b56f4343c4372500d6cb8762e..33ce463d7e022700efa1fc3193e15d525f6dc539 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 41148966af326286e421b8350d5a8f8f9890f875..1ba3f9da77840811f8698aafaafeba677738b6b2 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