MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / write_header

Function write_header

src/burp/split/spit.cpp:1171–1225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1169
1170
1171static int write_header(const b_fil* fl_ptr,
1172 header_rec hdr_rec,
1173 FILE_DESC output_fl_desc,
1174 TEXT header_str[])
1175{
1176/********************************************************************
1177**
1178** w r i t e _ h e a d e r
1179**
1180*********************************************************************
1181**
1182** Functional description:
1183**
1184** writes out gsplit header record
1185**
1186** assigns backup file name to header record file name array
1187** calls conv_ntoc routine to convert numeric data to char data
1188** and assigns to header record file number field
1189** writes gsplit header record out to backup file
1190**
1191*********************************************************************
1192*/
1193 TEXT num_arr[5];
1194
1195 SLONG ret_cd = conv_ntoc(fl_ptr->b_fil_number, num_arr);
1196 if (ret_cd == FB_FAILURE)
1197 {
1198 printf("gsplit could not convert numeric data to character data\n");
1199 return FB_FAILURE;
1200 }
1201 num_arr[sizeof(num_arr) - 1] = TERMINAL;
1202 SLONG pos = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) + sizeof(hdr_rec.text1);
1203 ret_cd = set_hdr_str(header_str, num_arr, pos, sizeof(hdr_rec.num));
1204
1205 const TEXT* file_name = fl_ptr->b_fil_name;
1206 pos = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) +
1207 sizeof(hdr_rec.text1) + sizeof(hdr_rec.num) +
1208 sizeof(hdr_rec.text2) + sizeof(hdr_rec.total) + sizeof(hdr_rec.text3);
1209 ret_cd = set_hdr_str(header_str, file_name, pos, static_cast<SLONG>(strlen(file_name)));
1210
1211 SLONG end, indx;
1212 SLONG write_cnt = write_platf(output_fl_desc, header_str, header_rec_len);
1213 switch (write_cnt)
1214 {
1215 case -1: // write failed
1216 close_platf(output_fl_desc);
1217 return FB_FAILURE;
1218
1219 default:
1220 end = pos + fb_strlen(file_name);
1221 for (indx = pos; indx < end; indx++)
1222 header_str[indx] = BLANK;
1223 return FB_SUCCESS;
1224 }
1225}
1226
1227
1228static int flush_io_buff(const UCHAR* remaining_io,

Callers 1

gen_multy_bakup_filesFunction · 0.70

Calls 5

conv_ntocFunction · 0.85
set_hdr_strFunction · 0.85
write_platfFunction · 0.85
fb_strlenFunction · 0.85
close_platfFunction · 0.70

Tested by

no test coverage detected