Home | History | Annotate | Download | only in libFLAC

Lines Matching refs:tempfile

127 static FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append);
128 static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, off_t fixup_is_last_flag_offset, FLAC__bool backup);
130 static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status);
132 static FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status);
135 static FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status);
136 static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status);
137 static void cleanup_tempfile_(FILE **tempfile, char **tempfilename);
487 * original with the tempfile fast but requires extra space in the same
488 * partition for the tempfile. If space is a problem, you can pass a
1399 FILE *f, *tempfile;
1413 if(!open_tempfile_(chain->filename, tempfile_path_prefix, &tempfile, &tempfilename, &status)) {
1415 cleanup_tempfile_(&tempfile, &tempfilename);
1418 if(!copy_n_bytes_from_file_(f, tempfile, chain->first_offset, &status)) {
1420 cleanup_tempfile_(&tempfile, &tempfilename);
1426 if(!write_metadata_block_header_(tempfile, &status, node->data)) {
1430 if(!write_metadata_block_data_(tempfile, &status, node->data)) {
1439 cleanup_tempfile_(&tempfile, &tempfilename);
1443 if(!copy_remaining_bytes_from_file_(f, tempfile, &status)) {
1444 cleanup_tempfile_(&tempfile, &tempfilename);
1449 /* move the tempfile on top of the original */
1451 if(!transport_tempfile_(chain->filename, &tempfile, &tempfilename, &status))
2904 FILE *tempfile;
2929 if(!simple_iterator_copy_file_prefix_(iterator, &tempfile, &tempfilename, append))
2933 if(!write_metadata_block_header_(tempfile, &iterator->status, block)) {
2934 cleanup_tempfile_(&tempfile, &tempfilename);
2938 if(!write_metadata_block_data_(tempfile, &iterator->status, block)) {
2939 cleanup_tempfile_(&tempfile, &tempfilename);
2944 if(!simple_iterator_copy_file_postfix_(iterator, &tempfile, &tempfilename, fixup_is_last_code, fixup_is_last_flag_offset, block==0))
3033 FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append)
3041 if(!open_tempfile_(iterator->filename, iterator->tempfile_path_prefix, tempfile, tempfilename, &iterator->status)) {
3042 cleanup_tempfile_(tempfile, tempfilename);
3045 if(!copy_n_bytes_from_file_(iterator->file, *tempfile, offset_end, &iterator->status)) {
3046 cleanup_tempfile_(tempfile, tempfilename);
3053 FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, off_t fixup_is_last_flag_offset, FLAC__bool backup)
3056 FLAC__ASSERT(0 != *tempfile);
3059 cleanup_tempfile_(tempfile, tempfilename);
3063 if(!copy_remaining_bytes_from_file_(iterator->file, *tempfile, &iterator->status)) {
3064 cleanup_tempfile_(tempfile, tempfilename);
3077 if(0 != fseeko(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) {
3078 cleanup_tempfile_(tempfile, tempfilename);
3082 if(fread(&x, 1, 1, *tempfile) != 1) {
3083 cleanup_tempfile_(tempfile, tempfilename);
3095 if(0 != fseeko(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) {
3096 cleanup_tempfile_(tempfile, tempfilename);
3100 if(local__fwrite(&x, 1, 1, *tempfile) != 1) {
3101 cleanup_tempfile_(tempfile, tempfilename);
3109 if(!transport_tempfile_(iterator->filename, tempfile, tempfilename, &iterator->status))
3132 FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status)
3144 if(local__fwrite(buffer, 1, n, tempfile) != n) {
3176 FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status)
3187 if(n > 0 && local__fwrite(buffer, 1, n, tempfile) != n) {
3216 FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status)
3244 if(0 == (*tempfile = fopen(*tempfilename, "w+b"))) {
3252 FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status)
3255 FLAC__ASSERT(0 != tempfile);
3256 FLAC__ASSERT(0 != *tempfile);
3261 (void)fclose(*tempfile);
3262 *tempfile = 0;
3267 cleanup_tempfile_(tempfile, tempfilename);
3275 cleanup_tempfile_(tempfile, tempfilename);
3280 cleanup_tempfile_(tempfile, tempfilename);
3285 void cleanup_tempfile_(FILE **tempfile, char **tempfilename)
3287 if(0 != *tempfile) {
3288 (void)fclose(*tempfile);
3289 *tempfile = 0;