Ver código fonte

Remove strcpy compile warning

Scott Lahteine 4 anos atrás
pai
commit
d853a70556
1 arquivos alterados com 5 adições e 6 exclusões
  1. 5
    6
      Marlin/src/gcode/queue.cpp

+ 5
- 6
Marlin/src/gcode/queue.cpp Ver arquivo

@@ -216,13 +216,12 @@ bool GCodeQueue::process_injected_command() {
216 216
     gcode.process_parsed_command();
217 217
   }
218 218
 
219
-  #pragma GCC diagnostic push
220
-  #pragma GCC diagnostic ignored "-Wrestrict"
221
-
222 219
   // Copy the next command into place
223
-  strcpy(injected_commands, &injected_commands[i + (c != '\0')]);
224
-
225
-  #pragma GCC diagnostic pop
220
+  for (
221
+    uint8_t d = 0, s = i + !!c;                     // dst, src
222
+    (injected_commands[d] = injected_commands[s]);  // copy, exit if 0
223
+    d++, s++                                        // next dst, src
224
+  );
226 225
 
227 226
   return true;
228 227
 }

Carregando…
Cancelar
Salvar