MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / check

Function check

tools/ffhash.c:76–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76static int check(char *file)
77{
78 uint8_t buffer[SIZE];
79 int fd, flags = O_RDONLY;
80 int ret = 0;
81
82#ifdef O_BINARY
83 flags |= O_BINARY;
84#endif
85 if (file) fd = open(file, flags);
86 else fd = 0;
87 if (fd == -1) {
88 printf("%s=OPEN-FAILED: %s:", av_hash_get_name(hash), strerror(errno));
89 ret = 1;
90 goto end;
91 }
92
93 av_hash_init(hash);
94 for (;;) {
95 int size = read(fd, buffer, SIZE);
96 if (size < 0) {
97 int err = errno;
98 close(fd);
99 finish();
100 printf("+READ-FAILED: %s", strerror(err));
101 ret = 2;
102 goto end;
103 } else if(!size)
104 break;
105 av_hash_update(hash, buffer, size);
106 }
107 close(fd);
108
109 finish();
110end:
111 if (file)
112 printf(" *%s", file);
113 printf("\n");
114
115 return ret;
116}
117
118int main(int argc, char **argv)
119{

Callers 1

mainFunction · 0.70

Calls 5

av_hash_get_nameFunction · 0.85
av_hash_initFunction · 0.85
closeFunction · 0.85
av_hash_updateFunction · 0.85
finishFunction · 0.70

Tested by

no test coverage detected