Lines Matching refs:file

4  * you may not use this file except in compliance with the License.

121 FILE *file = fopen(path.c_str(), "rb");
122 if (file == nullptr) {
125 if (fseek(file, 0L, SEEK_END) != 0) {
126 (void)fclose(file);
129 size_t fileSize = ftell(file);
130 (void)fclose(file);
136 FILE *file = fopen(path.c_str(), "rb");
137 if (file == nullptr) {
140 if (fseek(file, 0L, SEEK_END) != 0) {
141 (void)fclose(file);
145 size_t fileSize = ftell(file);
147 (void)fclose(file);
150 rewind(file);
152 (void)fclose(file);
155 size_t ret = fread(data.GetBuffer(), 1, fileSize, file);
156 (void)fclose(file);
158 LOG_ERROR("Read size (%{public}zu) < file size", ret);
239 FILE *file = fopen(filePath.c_str(), "ab");
240 if (file == nullptr) {
243 if (fseek(file, 0L, SEEK_END) != 0) {
244 (void)fclose(file);
248 size_t fileSize = ftell(file);
249 if (fseek(file, fileSize - FAKE_STRING.size(), SEEK_SET)) {
250 (void)fclose(file);
253 int32_t ret = fwrite(FAKE_STRING.c_str(), 1, FAKE_STRING.size(), file);
255 (void)fclose(file);
261 FILE *file = fopen(filePath.c_str(), "ab");
262 if (file == nullptr) {
265 if (fseek(file, 0L, SEEK_SET) != 0) {
266 (void)fclose(file);
270 int32_t ret = fwrite(FAKE_STRING.c_str(), 1, FAKE_STRING.size(), file);
272 (void)fclose(file);
344 // tamper file
349 // expand tampered file
372 * @tc.desc: enable all data in file successfully
380 LOG_INFO("Test on file path = %{public}s", filePath.c_str());
394 * @tc.desc: enable orignial file with wrong file size
410 // size is set to less than file size
415 // size is set to greater than file size
425 * @tc.desc: enable expanded file successfully
446 * @tc.desc: enable expanded file with inside tree successfully
454 LOG_INFO("Test on file path = %{public}s", filePath.c_str());
470 * @tc.desc: enable expanded file with wrong tree offset
498 * @tc.desc: enable expanded file with wrong root hash
525 * @tc.desc: enable expanded file with wrong file