comparison src/tee/tee.c @ 29094:1fe2d79f7309 v8.2.5068

patch 8.2.5068: gcc 12.1 warning when building tee Commit: https://github.com/vim/vim/commit/68093d36bf87caf2c2ba7404c06d14ef8416c27a Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 8 13:11:45 2022 +0100 patch 8.2.5068: gcc 12.1 warning when building tee Problem: Gcc 12.1 warning when building tee. Solution: Change type to size_t. (John Marriott)
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 Jun 2022 14:15:02 +0200
parents ba435f6bc1ad
children
comparison
equal deleted inserted replaced
29093:ef9f05324fea 29094:1fe2d79f7309
80 80
81 int 81 int
82 main(int argc, char *argv[]) 82 main(int argc, char *argv[])
83 { 83 {
84 int append = 0; 84 int append = 0;
85 int numfiles; 85 size_t numfiles;
86 int maxfiles; 86 int maxfiles;
87 FILE **filepointers; 87 FILE **filepointers;
88 int i; 88 int i;
89 char buf[BUFSIZ]; 89 char buf[BUFSIZ];
90 int n; 90 int n;
119 exit(1); 119 exit(1);
120 } 120 }
121 filepointers = calloc(numfiles, sizeof(FILE *)); 121 filepointers = calloc(numfiles, sizeof(FILE *));
122 if (filepointers == NULL) 122 if (filepointers == NULL)
123 { 123 {
124 fprintf(stderr, "Error allocating memory for %d files\n", numfiles); 124 fprintf(stderr, "Error allocating memory for %ld files\n",
125 (long)numfiles);
125 exit(1); 126 exit(1);
126 } 127 }
127 for (i = 0; i < numfiles; i++) 128 for (i = 0; i < numfiles; i++)
128 { 129 {
129 filepointers[i] = fopen(argv[i+optind], append ? "ab" : "wb"); 130 filepointers[i] = fopen(argv[i+optind], append ? "ab" : "wb");