| line |
true |
false |
branch |
|
31
|
36746 |
0 |
ENSURE_SIZE(buf, initial_size); |
|
|
47 |
36699 |
ENSURE_SIZE(buf, initial_size); |
|
|
0 |
47 |
ENSURE_SIZE(buf, initial_size); |
|
42
|
0 |
30601 |
if (buf->ptr == git_str__oom) |
|
45
|
23792 |
6809 |
if (buf->asize == 0 && buf->size != 0) { |
|
|
0 |
23792 |
if (buf->asize == 0 && buf->size != 0) { |
|
50
|
2 |
30599 |
if (!target_size) |
|
53
|
646 |
29955 |
if (target_size <= buf->asize) |
|
56
|
23790 |
6165 |
if (buf->asize == 0) { |
|
67
|
1084 |
5081 |
if ((new_size = (new_size << 1) - (new_size >> 1)) < target_size) |
|
75
|
0 |
29955 |
if (new_size < buf->size) { |
|
76
|
0 |
0 |
if (mark_oom) { |
|
77
|
0 |
0 |
if (buf->ptr && buf->ptr != git_str__initstr) |
|
|
0 |
0 |
if (buf->ptr && buf->ptr != git_str__initstr) |
|
88
|
0 |
29955 |
if (!new_ptr) { |
|
89
|
0 |
0 |
if (mark_oom) { |
|
90
|
0 |
0 |
if (buf->ptr && (buf->ptr != git_str__initstr)) |
|
|
0 |
0 |
if (buf->ptr && (buf->ptr != git_str__initstr)) |
|
101
|
0 |
29955 |
if (buf->size >= buf->asize) |
|
117
|
0 |
205 |
if (GIT_ADD_SIZET_OVERFLOW(&newsize, buffer->size, additional_size)) { |
|
|
0 |
205 |
if (GIT_ADD_SIZET_OVERFLOW(&newsize, buffer->size, additional_size)) { |
|
127
|
584 |
32199 |
if (!buf) return; |
|
129
|
20377 |
11822 |
if (buf->asize > 0 && buf->ptr != NULL && buf->ptr != git_str__oom) |
|
|
20377 |
0 |
if (buf->asize > 0 && buf->ptr != NULL && buf->ptr != git_str__oom) |
|
|
20377 |
0 |
if (buf->asize > 0 && buf->ptr != NULL && buf->ptr != git_str__oom) |
|
139
|
613 |
13123 |
if (!buf->ptr) { |
|
144
|
8224 |
5512 |
if (buf->asize > 0) |
|
152
|
7275 |
11 |
if (len == 0 || data == NULL) { |
|
|
0 |
7275 |
if (len == 0 || data == NULL) { |
|
155
|
6127 |
1148 |
if (data != buf->ptr) { |
|
156
|
0 |
6127 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, len, 1); |
|
|
0 |
6127 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, len, 1); |
|
157
|
6127 |
0 |
ENSURE_SIZE(buf, alloclen); |
|
|
3382 |
2745 |
ENSURE_SIZE(buf, alloclen); |
|
|
0 |
3382 |
ENSURE_SIZE(buf, alloclen); |
|
162
|
7275 |
0 |
if (buf->asize > buf->size) |
|
171
|
2941 |
0 |
return git_str_set(buf, string, string ? strlen(string) : 0); |
|
177
|
0 |
22350 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, 2); |
|
|
0 |
22350 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, 2); |
|
178
|
22350 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
2422 |
19928 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
2422 |
ENSURE_SIZE(buf, new_size); |
|
187
|
0 |
16 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len); |
|
|
0 |
16 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len); |
|
188
|
0 |
16 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
|
0 |
16 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
189
|
16 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
1 |
15 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
1 |
ENSURE_SIZE(buf, new_size); |
|
198
|
13277 |
637 |
if (len) { |
|
201
|
0 |
13277 |
GIT_ASSERT_ARG(data); |
|
203
|
0 |
13277 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len); |
|
|
0 |
13277 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len); |
|
204
|
0 |
13277 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
|
0 |
13277 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
205
|
13277 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
6468 |
6809 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
6468 |
ENSURE_SIZE(buf, new_size); |
|
215
|
0 |
7846 |
GIT_ASSERT_ARG(string); |
|
227
|
0 |
187 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&new_size, len, 2); |
|
|
0 |
187 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&new_size, len, 2); |
|
228
|
0 |
187 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
|
0 |
187 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
230
|
0 |
187 |
if (git_str_grow_by(str, new_size) < 0) |
|
235
|
1496 |
187 |
for (i = 0; i < len; i++) { |
|
256
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&blocks, blocks, 1); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&blocks, blocks, 1); |
|
257
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 4); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 4); |
|
258
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size); |
|
260
|
0 |
0 |
ENSURE_SIZE(buf, alloclen); |
|
|
0 |
0 |
ENSURE_SIZE(buf, alloclen); |
|
|
0 |
0 |
ENSURE_SIZE(buf, alloclen); |
|
264
|
0 |
0 |
for (len -= extra; len > 0; len -= 3) { |
|
275
|
0 |
0 |
if (extra > 0) { |
|
277
|
0 |
0 |
b = (extra > 1) ? *read++ : 0; |
|
281
|
0 |
0 |
*write++ = (extra > 1) ? base64_encode[(b & 0x0f) << 2] : '='; |
|
317
|
0 |
0 |
if (len % 4) { |
|
322
|
0 |
0 |
GIT_ASSERT_ARG(len % 4 == 0); |
|
323
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, (len / 4 * 3), buf->size); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, (len / 4 * 3), buf->size); |
|
324
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
325
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
327
|
0 |
0 |
for (i = 0; i < len; i += 4) { |
|
328
|
0 |
0 |
if ((a = base64_decode[(unsigned char)base64[i]]) < 0 || |
|
|
0 |
0 |
if ((a = base64_decode[(unsigned char)base64[i]]) < 0 || |
|
329
|
0 |
0 |
(b = base64_decode[(unsigned char)base64[i+1]]) < 0 || |
|
330
|
0 |
0 |
(c = base64_decode[(unsigned char)base64[i+2]]) < 0 || |
|
355
|
0 |
2 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 5); |
|
|
0 |
2 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 5); |
|
356
|
0 |
2 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size); |
|
|
0 |
2 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size); |
|
357
|
0 |
2 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1); |
|
|
0 |
2 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1); |
|
359
|
2 |
0 |
ENSURE_SIZE(buf, alloclen); |
|
|
0 |
2 |
ENSURE_SIZE(buf, alloclen); |
|
|
0 |
0 |
ENSURE_SIZE(buf, alloclen); |
|
361
|
8 |
2 |
while (len) { |
|
366
|
32 |
6 |
for (i = 24; i >= 0; i -= 8) { |
|
370
|
2 |
30 |
if (--len == 0) |
|
374
|
40 |
8 |
for (i = 4; i >= 0; i--) { |
|
381
|
40 |
8 |
for (i = 0; i < 5; i++) |
|
418
|
0 |
0 |
if (base85_len % 5 || |
|
|
0 |
0 |
if (base85_len % 5 || |
|
424
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, output_len, buf->size); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, output_len, buf->size); |
|
425
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
426
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
428
|
0 |
0 |
while (output_len) { |
|
435
|
0 |
0 |
if (--de < 0) |
|
439
|
0 |
0 |
} while (--cnt); |
|
442
|
0 |
0 |
if (--de < 0) |
|
446
|
0 |
0 |
if (0xffffffff / 85 < acc || |
|
|
0 |
0 |
if (0xffffffff / 85 < acc || |
|
452
|
0 |
0 |
cnt = (output_len < 4) ? (int)output_len : 4; |
|
457
|
0 |
0 |
} while (--cnt); |
|
481
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, str_len); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, str_len); |
|
482
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
483
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
0 |
ENSURE_SIZE(buf, new_size); |
|
485
|
0 |
0 |
for (str_pos = 0; str_pos < str_len; buf->size++, str_pos++) { |
|
486
|
0 |
0 |
if (str[str_pos] == '%' && |
|
|
0 |
0 |
if (str[str_pos] == '%' && |
|
487
|
0 |
0 |
str_len > str_pos + 2 && |
|
488
|
0 |
0 |
isxdigit(str[str_pos + 1]) && |
|
507
|
0 |
5673 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&expected_size, strlen(format), 2); |
|
|
0 |
5673 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&expected_size, strlen(format), 2); |
|
508
|
0 |
5673 |
GIT_ERROR_CHECK_ALLOC_ADD(&expected_size, expected_size, buf->size); |
|
|
0 |
5673 |
GIT_ERROR_CHECK_ALLOC_ADD(&expected_size, expected_size, buf->size); |
|
509
|
5673 |
0 |
ENSURE_SIZE(buf, expected_size); |
|
|
814 |
4859 |
ENSURE_SIZE(buf, expected_size); |
|
|
0 |
814 |
ENSURE_SIZE(buf, expected_size); |
|
523
|
0 |
5954 |
if (len < 0) { |
|
529
|
5673 |
281 |
if ((size_t)len + 1 <= buf->asize - buf->size) { |
|
534
|
0 |
281 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len); |
|
|
0 |
281 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len); |
|
535
|
0 |
281 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
|
0 |
281 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1); |
|
536
|
281 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
281 |
0 |
ENSURE_SIZE(buf, new_size); |
|
|
0 |
281 |
ENSURE_SIZE(buf, new_size); |
|
558
|
0 |
1104 |
GIT_ASSERT_ARG(data); |
|
559
|
0 |
1104 |
GIT_ASSERT_ARG(datasize); |
|
560
|
0 |
1104 |
GIT_ASSERT_ARG(buf); |
|
564
|
1104 |
0 |
if (buf->size == 0 || buf->asize <= 0) |
|
|
0 |
1104 |
if (buf->size == 0 || buf->asize <= 0) |
|
568
|
0 |
1104 |
if (copylen > datasize - 1) |
|
583
|
0 |
0 |
if (end > buf->ptr && end <= buf->ptr + buf->size) { |
|
|
0 |
0 |
if (end > buf->ptr && end <= buf->ptr + buf->size) { |
|
593
|
1634 |
3271 |
if (len >= buf->size) |
|
597
|
3271 |
0 |
if (buf->size < buf->asize) |
|
603
|
5 |
0 |
if (buf->size > amount) |
|
612
|
0 |
0 |
if (idx >= 0) |
|
633
|
2992 |
0 |
if (buf->asize == 0 || buf->ptr == git_str__oom) |
|
|
0 |
2992 |
if (buf->asize == 0 || buf->ptr == git_str__oom) |
|
645
|
7 |
58 |
if (ptr) { |
|
648
|
0 |
7 |
if (asize) |
|
649
|
0 |
0 |
buf->asize = (asize < buf->size) ? buf->size + 1 : asize; |
|
654
|
65 |
0 |
ENSURE_SIZE(buf, asize); |
|
|
0 |
65 |
ENSURE_SIZE(buf, asize); |
|
|
0 |
0 |
ENSURE_SIZE(buf, asize); |
|
660
|
0 |
107 |
if (git_str_is_allocated(buf)) |
|
663
|
29 |
78 |
if (!size) { |
|
679
|
0 |
0 |
if (buf->size > 0 && buf->ptr[buf->size - 1] != separator) |
|
|
0 |
0 |
if (buf->size > 0 && buf->ptr[buf->size - 1] != separator) |
|
685
|
0 |
0 |
for (i = 0; i < nbuf; ++i) { |
|
689
|
0 |
0 |
segment = va_arg(ap, const char *); |
|
690
|
0 |
0 |
if (!segment) |
|
695
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, segment_len); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, segment_len); |
|
697
|
0 |
0 |
if (segment_len == 0 || segment[segment_len - 1] != separator) |
|
|
0 |
0 |
if (segment_len == 0 || segment[segment_len - 1] != separator) |
|
698
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, 1); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, 1); |
|
703
|
0 |
0 |
if (total_size == 0) |
|
706
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, 1); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, 1); |
|
707
|
0 |
0 |
if (git_str_grow_by(buf, total_size) < 0) |
|
713
|
0 |
0 |
if (buf->size > 0 && out[-1] != separator) |
|
|
0 |
0 |
if (buf->size > 0 && out[-1] != separator) |
|
717
|
0 |
0 |
for (i = 0; i < nbuf; ++i) { |
|
721
|
0 |
0 |
segment = va_arg(ap, const char *); |
|
722
|
0 |
0 |
if (!segment) |
|
726
|
0 |
0 |
if (segment >= original && segment < original + original_size) { |
|
|
0 |
0 |
if (segment >= original && segment < original + original_size) { |
|
735
|
0 |
0 |
if (out > buf->ptr && out[-1] == separator) |
|
|
0 |
0 |
if (out > buf->ptr && out[-1] == separator) |
|
736
|
0 |
0 |
while (segment_len > 0 && *segment == separator) { |
|
|
0 |
0 |
while (segment_len > 0 && *segment == separator) { |
|
742
|
0 |
0 |
if (segment_len > 0) { |
|
748
|
0 |
0 |
if (i < nbuf - 1 && out > buf->ptr && out[-1] != separator) |
|
|
0 |
0 |
if (i < nbuf - 1 && out > buf->ptr && out[-1] != separator) |
|
|
0 |
0 |
if (i < nbuf - 1 && out > buf->ptr && out[-1] != separator) |
|
766
|
16351 |
1 |
size_t strlen_a = str_a ? strlen(str_a) : 0; |
|
773
|
5636 |
10716 |
if (buf->size) |
|
774
|
4861 |
775 |
GIT_ASSERT_ARG(str_b < buf->ptr || str_b >= buf->ptr + buf->size); |
|
|
0 |
4861 |
GIT_ASSERT_ARG(str_b < buf->ptr || str_b >= buf->ptr + buf->size); |
|
777
|
16352 |
0 |
if (separator && strlen_a) { |
|
|
15228 |
1124 |
if (separator && strlen_a) { |
|
778
|
5 |
15228 |
while (*str_b == separator) { str_b++; strlen_b--; } |
|
779
|
3087 |
12141 |
if (str_a[strlen_a - 1] != separator) |
|
784
|
5636 |
10716 |
if (buf->size && str_a >= buf->ptr && str_a < buf->ptr + buf->size) |
|
|
4190 |
1446 |
if (buf->size && str_a >= buf->ptr && str_a < buf->ptr + buf->size) |
|
|
3580 |
610 |
if (buf->size && str_a >= buf->ptr && str_a < buf->ptr + buf->size) |
|
787
|
0 |
16352 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, strlen_a, strlen_b); |
|
|
0 |
16352 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, strlen_a, strlen_b); |
|
788
|
0 |
16352 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, need_sep); |
|
|
0 |
16352 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, need_sep); |
|
789
|
0 |
16352 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1); |
|
|
0 |
16352 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1); |
|
790
|
16352 |
0 |
ENSURE_SIZE(buf, alloc_len); |
|
|
11743 |
4609 |
ENSURE_SIZE(buf, alloc_len); |
|
|
0 |
11743 |
ENSURE_SIZE(buf, alloc_len); |
|
793
|
3580 |
12772 |
if (offset_a >= 0) |
|
797
|
12772 |
3580 |
if (offset_a != 0 && str_a) |
|
|
12771 |
1 |
if (offset_a != 0 && str_a) |
|
799
|
3087 |
13265 |
if (need_sep) |
|
824
|
0 |
14 |
GIT_ASSERT(str_a < buf->ptr || str_a >= buf->ptr + buf->size); |
|
|
0 |
0 |
GIT_ASSERT(str_a < buf->ptr || str_a >= buf->ptr + buf->size); |
|
825
|
0 |
14 |
GIT_ASSERT(str_b < buf->ptr || str_b >= buf->ptr + buf->size); |
|
|
0 |
0 |
GIT_ASSERT(str_b < buf->ptr || str_b >= buf->ptr + buf->size); |
|
826
|
0 |
14 |
GIT_ASSERT(str_c < buf->ptr || str_c >= buf->ptr + buf->size); |
|
|
0 |
0 |
GIT_ASSERT(str_c < buf->ptr || str_c >= buf->ptr + buf->size); |
|
828
|
14 |
0 |
if (separator) { |
|
829
|
14 |
0 |
if (len_a > 0) { |
|
830
|
0 |
14 |
while (*str_b == separator) { str_b++; len_b--; } |
|
833
|
0 |
14 |
if (len_a > 0 || len_b > 0) |
|
|
0 |
0 |
if (len_a > 0 || len_b > 0) |
|
834
|
0 |
14 |
while (*str_c == separator) { str_c++; len_c--; } |
|
835
|
10 |
4 |
if (len_b > 0) |
|
839
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_a, sep_a); |
|
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_a, sep_a); |
|
840
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, len_b); |
|
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, len_b); |
|
841
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, sep_b); |
|
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, sep_b); |
|
842
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, len_c); |
|
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, len_c); |
|
843
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, 1); |
|
|
0 |
14 |
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, 1); |
|
844
|
14 |
0 |
ENSURE_SIZE(buf, len_total); |
|
|
14 |
0 |
ENSURE_SIZE(buf, len_total); |
|
|
0 |
14 |
ENSURE_SIZE(buf, len_total); |
|
848
|
14 |
0 |
if (len_a) { |
|
852
|
0 |
14 |
if (sep_a) |
|
854
|
10 |
4 |
if (len_b) { |
|
858
|
7 |
7 |
if (sep_b) |
|
860
|
14 |
0 |
if (len_c) |
|
871
|
1410 |
0 |
while (buf->size > 0) { |
|
872
|
766 |
644 |
if (!git__isspace(buf->ptr[buf->size - 1])) |
|
878
|
766 |
0 |
if (buf->asize > buf->size) |
|
885
|
0 |
0 |
return (result != 0) ? result : |
|
886
|
0 |
0 |
(a->size < b->size) ? -1 : (a->size > b->size) ? 1 : 0; |
|
899
|
0 |
0 |
GIT_ASSERT(buf); |
|
900
|
0 |
0 |
GIT_ASSERT(where <= buf->size); |
|
901
|
0 |
0 |
GIT_ASSERT(nb_to_remove <= buf->size - where); |
|
908
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, (buf->size - nb_to_remove), nb_to_insert); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, (buf->size - nb_to_remove), nb_to_insert); |
|
909
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_size, new_size, 1); |
|
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_size, new_size, 1); |
|
910
|
0 |
0 |
ENSURE_SIZE(buf, alloc_size); |
|
|
0 |
0 |
ENSURE_SIZE(buf, alloc_size); |
|
|
0 |
0 |
ENSURE_SIZE(buf, alloc_size); |
|
933
|
50 |
0 |
if (buf->size && buf->ptr[0] == '!') |
|
|
0 |
50 |
if (buf->size && buf->ptr[0] == '!') |
|
936
|
526 |
0 |
for (i = 0; !quote && i < buf->size; i++) { |
|
|
476 |
50 |
for (i = 0; !quote && i < buf->size; i++) { |
|
937
|
476 |
0 |
if (buf->ptr[i] == '"' || buf->ptr[i] == '\\' || |
|
|
476 |
0 |
if (buf->ptr[i] == '"' || buf->ptr[i] == '\\' || |
|
|
476 |
0 |
if (buf->ptr[i] == '"' || buf->ptr[i] == '\\' || |
|
938
|
0 |
476 |
buf->ptr[i] < ' ' || buf->ptr[i] > '~') { |
|
944
|
50 |
0 |
if (!quote) |
|
950
|
0 |
0 |
for (; i < buf->size; i++) { |
|
952
|
0 |
0 |
if (buf->ptr[i] >= '\a' && buf->ptr[i] <= '\r') { |
|
|
0 |
0 |
if (buf->ptr[i] >= '\a' && buf->ptr[i] <= '\r') { |
|
958
|
0 |
0 |
else if (buf->ptr[i] == '"' || buf->ptr[i] == '\\') { |
|
|
0 |
0 |
else if (buf->ptr[i] == '"' || buf->ptr[i] == '\\') { |
|
964
|
0 |
0 |
else if (buf->ptr[i] != ' ' && |
|
|
0 |
0 |
else if (buf->ptr[i] != ' ' && |
|
965
|
0 |
0 |
(buf->ptr[i] < '!' || buf->ptr[i] > '~')) { |
|
977
|
0 |
0 |
if (git_str_oom("ed)) { |
|
997
|
0 |
0 |
if (buf->size < 2 || buf->ptr[0] != '"' || buf->ptr[buf->size-1] != '"') |
|
|
0 |
0 |
if (buf->size < 2 || buf->ptr[0] != '"' || buf->ptr[buf->size-1] != '"') |
|
|
0 |
0 |
if (buf->size < 2 || buf->ptr[0] != '"' || buf->ptr[buf->size-1] != '"') |
|
1000
|
0 |
0 |
for (i = 0, j = 1; j < buf->size-1; i++, j++) { |
|
1003
|
0 |
0 |
if (ch == '\\') { |
|
1004
|
0 |
0 |
if (j == buf->size-2) |
|
1025
|
0 |
0 |
if (j == buf->size-3) { |
|
1031
|
0 |
0 |
if (buf->ptr[j+1] < '0' || buf->ptr[j+1] > '7' || |
|
|
0 |
0 |
if (buf->ptr[j+1] < '0' || buf->ptr[j+1] > '7' || |
|
|
0 |
0 |
if (buf->ptr[j+1] < '0' || buf->ptr[j+1] > '7' || |
|
1032
|
0 |
0 |
buf->ptr[j+2] < '0' || buf->ptr[j+2] > '7') { |
|
1073
|
0 |
3 |
if (!string) |
|
1076
|
6 |
3 |
for (scan = string; *scan; ) { |
|
1087
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, total, 1); |
|
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, total, 1); |
|
1088
|
0 |
3 |
if (git_str_grow_by(buf, alloclen) < 0) |
|
1091
|
6 |
3 |
for (scan = string; *scan; ) { |
|
1098
|
3 |
6 |
for (count = strspn(scan, esc_chars); count > 0; --count) { |
|
1127
|
0 |
3 |
GIT_ASSERT(tgt != src); |
|
1129
|
0 |
3 |
if (!next) |
|
1133
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, src->size, 1); |
|
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, src->size, 1); |
|
1134
|
0 |
3 |
if (git_str_grow(tgt, new_size) < 0) |
|
1141
|
3 |
3 |
for (; next; scan = next + 1, next = memchr(scan, '\r', scan_end - scan)) { |
|
1142
|
3 |
0 |
if (next > scan) { |
|
1149
|
3 |
0 |
if (next + 1 == scan_end || next[1] != '\n') |
|
|
0 |
3 |
if (next + 1 == scan_end || next[1] != '\n') |
|
1154
|
3 |
0 |
if (scan < scan_end) { |
|
1174
|
0 |
3 |
GIT_ASSERT(tgt != src); |
|
1176
|
0 |
3 |
if (!next) |
|
1180
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4); |
|
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4); |
|
1181
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1); |
|
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1); |
|
1182
|
0 |
3 |
if (git_str_grow(tgt, alloclen) < 0) |
|
1186
|
3 |
3 |
for (; next; scan = next + 1, next = memchr(scan, '\n', end - scan)) { |
|
1190
|
3 |
0 |
if (copylen && next[-1] == '\r') |
|
|
0 |
3 |
if (copylen && next[-1] == '\r') |
|
1193
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, copylen, 3); |
|
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, copylen, 3); |
|
1194
|
0 |
3 |
if (git_str_grow_by(tgt, alloclen) < 0) |
|
1197
|
3 |
0 |
if (copylen) { |
|
1217
|
36 |
0 |
if (!strings || !count) |
|
|
0 |
36 |
if (!strings || !count) |
|
1221
|
0 |
36 |
if (git_str_sets(buf, strings[0]) < 0) |
|
1225
|
3 |
33 |
for (i = 1; i < count; ++i) { |
|
1227
|
3 |
0 |
for (str = strings[i], pfx = buf->ptr; |
|
1228
|
0 |
3 |
*str && *str == *pfx; |
|
1234
|
3 |
0 |
if (!buf->size) |
|
1249
|
0 |
10 |
if (bom > GIT_STR_BOM_UTF8) |
|
1252
|
279 |
10 |
while (scan < end) { |
|
1258
|
276 |
3 |
if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014') |
|
|
0 |
276 |
if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014') |
|
|
3 |
0 |
if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014') |
|
|
3 |
0 |
if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014') |
|
|
0 |
3 |
if ((c > 0x1F && c != 127) || c == '\b' || c == '\033' || c == '\014') |
|
1260
|
0 |
3 |
else if (c == '\0') |
|
1262
|
0 |
3 |
else if (!git__isspace(c)) |
|
1281
|
2419 |
331 |
if (buf->size < 2) |
|
1289
|
0 |
0 |
if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') { |
|
|
0 |
0 |
if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') { |
|
|
0 |
0 |
if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') { |
|
|
0 |
0 |
if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') { |
|
1295
|
0 |
0 |
if (len >= 3 && ptr[0] == '\xBB' && ptr[1] == '\xBF') { |
|
|
0 |
0 |
if (len >= 3 && ptr[0] == '\xBB' && ptr[1] == '\xBF') { |
|
|
0 |
0 |
if (len >= 3 && ptr[0] == '\xBB' && ptr[1] == '\xBF') { |
|
1301
|
0 |
0 |
if (*ptr == '\xFF') { |
|
1307
|
0 |
0 |
if (*ptr != '\xFE') |
|
1309
|
0 |
0 |
if (len >= 4 && ptr[1] == 0 && ptr[2] == 0) { |
|
|
0 |
0 |
if (len >= 4 && ptr[1] == 0 && ptr[2] == 0) { |
|
|
0 |
0 |
if (len >= 4 && ptr[1] == 0 && ptr[2] == 0) { |
|
1334
|
0 |
63 |
if (skip_bom) |
|
1338
|
63 |
0 |
if (buf->size > 0 && end[-1] == '\032') |
|
|
0 |
63 |
if (buf->size > 0 && end[-1] == '\032') |
|
1342
|
1940 |
63 |
while (scan < end) { |
|
1345
|
1889 |
51 |
if (c > 0x1F && c != 0x7F) |
|
|
1889 |
0 |
if (c > 0x1F && c != 0x7F) |
|
1357
|
3 |
0 |
if (scan < end && *scan == '\n') |
|
|
3 |
0 |
if (scan < end && *scan == '\n') |
|
1370
|
63 |
0 |
return (stats->cr != stats->crlf || stats->nul > 0 || |
|
|
63 |
0 |
return (stats->cr != stats->crlf || stats->nul > 0 || |
|
|
0 |
63 |
return (stats->cr != stats->crlf || stats->nul > 0 || |