| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * log functions | ||
| 3 | * Copyright (c) 2003 Michel Bardiaux | ||
| 4 | * | ||
| 5 | * This file is part of FFmpeg. | ||
| 6 | * | ||
| 7 | * FFmpeg is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU Lesser General Public | ||
| 9 | * License as published by the Free Software Foundation; either | ||
| 10 | * version 2.1 of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * Lesser General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU Lesser General Public | ||
| 18 | * License along with FFmpeg; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "libavutil/log.c" | ||
| 23 | |||
| 24 | #include <string.h> | ||
| 25 | |||
| 26 | 3 | static int call_log_format_line2(const char *fmt, char *buffer, int buffer_size, ...) | |
| 27 | { | ||
| 28 | va_list args; | ||
| 29 | int ret; | ||
| 30 | 3 | int print_prefix=1; | |
| 31 | 3 | va_start(args, buffer_size); | |
| 32 | 3 | ret = av_log_format_line2(NULL, AV_LOG_INFO, fmt, args, buffer, buffer_size, &print_prefix); | |
| 33 | 3 | va_end(args); | |
| 34 | 3 | return ret; | |
| 35 | } | ||
| 36 | |||
| 37 | 1 | int main(int argc, char **argv) | |
| 38 | { | ||
| 39 | int i; | ||
| 40 | 1 | av_log_set_level(AV_LOG_DEBUG); | |
| 41 | 1 | check_color_terminal(); | |
| 42 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
|
4 | for (use_color=0; use_color<=256; use_color = 255*use_color+1) { |
| 43 | 3 | av_log(NULL, AV_LOG_FATAL, "use_color: %d\n", use_color); | |
| 44 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 3 times.
|
27 | for (i = AV_LOG_DEBUG; i>=AV_LOG_QUIET; i-=8) { |
| 45 | 24 | av_log(NULL, i, " %d", i); | |
| 46 | 24 | av_log(NULL, AV_LOG_INFO, "e "); | |
| 47 | 24 | av_log(NULL, i + 256*123, "C%d", i); | |
| 48 | 24 | av_log(NULL, AV_LOG_INFO, "e"); | |
| 49 | } | ||
| 50 | 3 | av_log(NULL, AV_LOG_PANIC, "\n"); | |
| 51 | } | ||
| 52 | { | ||
| 53 | int result; | ||
| 54 | char buffer[4]; | ||
| 55 | 1 | result = call_log_format_line2("foo", NULL, 0); | |
| 56 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(result != 3) { |
| 57 | ✗ | printf("Test NULL buffer failed.\n"); | |
| 58 | ✗ | return 1; | |
| 59 | } | ||
| 60 | 1 | result = call_log_format_line2("foo", buffer, 2); | |
| 61 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(result != 3 || strncmp(buffer, "f", 2)) { |
| 62 | ✗ | printf("Test buffer too small failed.\n"); | |
| 63 | ✗ | return 1; | |
| 64 | } | ||
| 65 | 1 | result = call_log_format_line2("foo", buffer, 4); | |
| 66 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(result != 3 || strncmp(buffer, "foo", 4)) { |
| 67 | ✗ | printf("Test buffer sufficiently big failed.\n"); | |
| 68 | ✗ | return 1; | |
| 69 | } | ||
| 70 | } | ||
| 71 | 1 | return 0; | |
| 72 | } | ||
| 73 |