MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / FCopyFile

Function FCopyFile

BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c:109–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109UINT64
110FCopyFile (
111 FILE *in,
112 FILE *out
113 )
114/*++
115Routine Description:
116 Write all the content of input file to output file.
117
118Arguments:
119 in - input file pointer
120 out - output file pointer
121
122Return:
123 UINT64 : file size of input file
124--*/
125{
126 UINT32 filesize, offset, length;
127 CHAR8 Buffer[8*1024];
128
129 fseek (in, 0, SEEK_END);
130 filesize = ftell(in);
131
132 fseek (in, 0, SEEK_SET);
133
134 offset = 0;
135 while (offset < filesize) {
136 length = sizeof(Buffer);
137 if (filesize-offset < length) {
138 length = filesize-offset;
139 }
140
141 fread (Buffer, length, 1, in);
142 fwrite (Buffer, length, 1, out);
143 offset += length;
144 }
145
146 return filesize;
147}
148
149
150int

Callers 1

mainFunction · 0.85

Calls 2

freadFunction · 0.85
fwriteFunction · 0.85

Tested by

no test coverage detected