too-short.patch

short changed to size_t - tautolog, 04/16/2014 11:37 PM

Download (2.65 KB)

View differences:

usr.bin/patch/patch.c
1016 1016
	LINENUM		pat_lines = pch_ptrn_lines() - fuzz;
1017 1017
	const char	*ilineptr;
1018 1018
	const char	*plineptr;
1019
	short		plinelen;
1019
	size_t		plinelen;
1020 1020

  
1021 1021
	for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) {
1022 1022
		ilineptr = ifetch(iline, offset >= 0);
usr.bin/patch/pch.c
56 56
static LINENUM	p_context = 3;	/* # of context lines */
57 57
static LINENUM	p_input_line = 0;	/* current line # from patch file */
58 58
static char	**p_line = NULL;/* the text of the hunk */
59
static short	*p_len = NULL;	/* length of each line */
59
static size_t	*p_len = NULL;	/* length of each line */
60 60
static char	*p_char = NULL;	/* +, -, and ! */
61 61
static int	hunkmax = INITHUNKMAX;	/* size of above arrays to begin with */
62 62
static int	p_indent;	/* indent to patch */
......
134 134
	if (p_line == NULL)
135 135
		p_line = calloc((size_t) hunkmax, sizeof(char *));
136 136
	if (p_len == NULL)
137
		p_len = calloc((size_t) hunkmax, sizeof(short));
137
		p_len = calloc((size_t) hunkmax, sizeof(size_t));
138 138
	if (p_char == NULL)
139 139
		p_char = calloc((size_t) hunkmax, sizeof(char));
140 140
}
......
147 147
{
148 148
	int		new_hunkmax;
149 149
	char		**new_p_line;
150
	short		*new_p_len;
150
	size_t		*new_p_len;
151 151
	char		*new_p_char;
152 152

  
153 153
	new_hunkmax = hunkmax * 2;
......
159 159
	if (new_p_line == NULL)
160 160
		free(p_line);
161 161

  
162
	new_p_len = realloc(p_len, new_hunkmax * sizeof(short));
162
	new_p_len = realloc(p_len, new_hunkmax * sizeof(size_t));
163 163
	if (new_p_len == NULL)
164 164
		free(p_len);
165 165

  
......
1218 1218
pch_swap(void)
1219 1219
{
1220 1220
	char	**tp_line;	/* the text of the hunk */
1221
	short	*tp_len;	/* length of each line */
1221
	size_t	*tp_len;	/* length of each line */
1222 1222
	char	*tp_char;	/* +, -, and ! */
1223 1223
	LINENUM	i;
1224 1224
	LINENUM	n;
......
1375 1375
/*
1376 1376
 * Return the length of a particular patch line.
1377 1377
 */
1378
short
1378
size_t
1379 1379
pch_line_len(LINENUM line)
1380 1380
{
1381 1381
	return p_len[line];
usr.bin/patch/pch.h
46 46
bool		another_hunk(void);
47 47
bool		pch_swap(void);
48 48
char		*pfetch(LINENUM);
49
short		pch_line_len(LINENUM);
49
size_t		pch_line_len(LINENUM);
50 50
LINENUM		pch_first(void);
51 51
LINENUM		pch_ptrn_lines(void);
52 52
LINENUM		pch_newfirst(void);