mirror of https://github.com/vitalif/GPX
stpncpy replaced with memcpy
To make compiling under windows easier, references to stpncpy have been removed and replaced with memcpy.master
parent
f99a6f5fde
commit
f77f3c5fd4
10
gpx.c
10
gpx.c
|
@ -126,7 +126,7 @@ int programState; // gcode program state used to trigger start and end
|
|||
int dittoPrinting; // enable ditto printing
|
||||
int buildPercent; // override build percent
|
||||
unsigned line_number; // the current line number in the gcode file
|
||||
static char buffer[256]; // the statically allocated parse-in-place buffer
|
||||
static char buffer[300]; // the statically allocated parse-in-place buffer
|
||||
double scale[2]; // A & B scaling for n x 0.01 mm change in nominal diameter
|
||||
|
||||
FILE *in; // the gcode input file stream
|
||||
|
@ -1339,7 +1339,9 @@ int main(int argc, char * argv[])
|
|||
}
|
||||
// or just append .ini if no extension is present
|
||||
else {
|
||||
filename = stpncpy(buffer, filename, 256 - 5);
|
||||
size_t sl = strlen(filename);
|
||||
memcpy(buffer, filename, sl);
|
||||
filename = buffer + sl;
|
||||
}
|
||||
*filename++ = '.';
|
||||
*filename++ = 'i';
|
||||
|
@ -1396,7 +1398,9 @@ int main(int argc, char * argv[])
|
|||
}
|
||||
// or just append one if no .gcode extension is present
|
||||
else {
|
||||
filename = stpncpy(buffer, filename, 256 - 5);
|
||||
size_t sl = strlen(filename);
|
||||
memcpy(buffer, filename, sl);
|
||||
filename = buffer + sl;
|
||||
}
|
||||
*filename++ = '.';
|
||||
*filename++ = 'x';
|
||||
|
|
3
ini.c
3
ini.c
|
@ -53,8 +53,7 @@ static char* find_char_or_comment(const char* s, char c)
|
|||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
||||
{
|
||||
//strncpy(dest, src, size);
|
||||
bcopy(src, dest, size);
|
||||
strncpy(dest, src, size);
|
||||
dest[size - 1] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue