Merge pull request #1119 from mariusgreuel/pr-pointer-truncation

Fix pointer truncation for Windows x64
This commit is contained in:
Stefan Rueger 2022-10-11 14:43:41 +01:00 committed by GitHub
commit 929441eb82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -23,6 +23,7 @@
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
@ -1083,8 +1084,8 @@ static int cmd_quell(PROGRAMMER *pgm, AVRPART *p, int argc, char *argv[]) {
return 0;
}
static int tokenize(char *s, char ***argv) {
int i, n, l, k, nargs, offset;
static int tokenize(char * s, char ***argv) {
int i, n, l, nargs;
int len, slen;
char *buf;
int bufsize;
@ -1145,7 +1146,7 @@ static int tokenize(char *s, char ***argv) {
bufv = bufv_tmp;
nbuf = &buf[l];
/* correct bufv pointers */
k = buf - bufp;
ptrdiff_t k = buf - bufp;
for (i=0; i<n; i++) {
bufv[i] = bufv[i] + k;
}
@ -1166,7 +1167,7 @@ static int tokenize(char *s, char ***argv) {
q = (char *)&av[n+1];
memcpy(q, buf, l);
for (i=0; i<n; i++) {
offset = bufv[i] - buf;
ptrdiff_t offset = bufv[i] - buf;
av[i] = q + offset;
}
av[i] = NULL;