| --- libgd-2.3.0/src/annotate.c.orig 2020-03-24 14:40:28.948198600 +0300 |
| +++ libgd-2.3.0/src/annotate.c 2020-03-24 14:40:39.318399700 +0300 |
| @@ -15,6 +15,60 @@ |
| */ |
| |
| enum { left, center, right }; |
| + |
| +#ifdef _WIN32 |
| +size_t getline(char **lineptr, size_t *n, FILE *stream) { |
| + char *bufptr = NULL; |
| + char *p = bufptr; |
| + size_t size; |
| + int c; |
| + |
| + if (lineptr == NULL) { |
| + return -1; |
| + } |
| + if (stream == NULL) { |
| + return -1; |
| + } |
| + if (n == NULL) { |
| + return -1; |
| + } |
| + bufptr = *lineptr; |
| + size = *n; |
| + |
| + c = fgetc(stream); |
| + if (c == EOF) { |
| + return -1; |
| + } |
| + if (bufptr == NULL) { |
| + bufptr = malloc(128); |
| + if (bufptr == NULL) { |
| + return -1; |
| + } |
| + size = 128; |
| + } |
| + p = bufptr; |
| + while(c != EOF) { |
| + if ((p - bufptr) > (size - 1)) { |
| + size = size + 128; |
| + bufptr = realloc(bufptr, size); |
| + if (bufptr == NULL) { |
| + return -1; |
| + } |
| + } |
| + *p++ = c; |
| + if (c == '\n') { |
| + break; |
| + } |
| + c = fgetc(stream); |
| + } |
| + |
| + *p++ = '\0'; |
| + *lineptr = bufptr; |
| + *n = size; |
| + |
| + return p - bufptr - 1; |
| +} |
| +#endif |
| |
| int main(int argc, char *argv[]) |
| { |