Lines Matching refs:buf
223 char* buf = (char*)malloc(bufsize); in write_update_file() local
235 free(buf); in write_update_file()
245 free(buf); in write_update_file()
251 while ((amt = read(fd, buf, bufsize)) != 0 && bytesLeft > 0) { in write_update_file()
256 err = dataStream->WriteEntityData(buf, amt); in write_update_file()
258 free(buf); in write_update_file()
266 memset(buf, 0, bufsize); in write_update_file()
270 err = dataStream->WriteEntityData(buf, amt); in write_update_file()
272 free(buf); in write_update_file()
281 free(buf); in write_update_file()
316 char* buf = (char*)malloc(bufsize); in compute_crc32() local
321 while ((amt = read(fd, buf, bufsize)) != 0) { in compute_crc32()
322 crc = crc32(crc, (Bytef*)buf, amt); in compute_crc32()
326 free(buf); in compute_crc32()
444 static void calc_tar_checksum(char* buf, size_t buf_size) { in calc_tar_checksum() argument
446 memset(buf + 148, ' ', 8); in calc_tar_checksum()
449 for (uint8_t* p = (uint8_t*) buf; p < ((uint8_t*)buf) + 512; p++) { in calc_tar_checksum()
455 snprintf(buf + 148, buf_size - 148, "%06o", sum); // the trailing space is in calc_tar_checksum()
460 static int write_pax_header_entry(char* buf, size_t buf_size, in write_pax_header_entry() argument
470 return snprintf(buf, buf_size, "%d %s=%s\n", len, key, value); in write_pax_header_entry()
553 char* buf = (char *)calloc(1,BUFSIZE); in write_tarfile() local
557 char* const paxHeader = buf + PAXHEADER_OFFSET; // use a different chunk of in write_tarfile()
561 if (buf == NULL) { in write_tarfile()
568 strcat(buf + 257, "ustar"); in write_tarfile()
569 strcat(buf + 263, "00"); in write_tarfile()
575 snprintf(buf + 100, 8, "%06o ", s.st_mode & ~S_IFMT); in write_tarfile()
579 snprintf(buf + 108, 8, "0%lo", (unsigned long)s.st_uid); in write_tarfile()
580 snprintf(buf + 116, 8, "0%lo", (unsigned long)s.st_gid); in write_tarfile()
583 snprintf(buf + 124, 12, "%011llo", (isdir) ? 0LL : s.st_size); in write_tarfile()
586 snprintf(buf + 136, 12, "%0lo", (unsigned long)s.st_mtime); in write_tarfile()
598 buf[156] = type; in write_tarfile()
623 strncpy(buf, relpath.string(), 100); in write_tarfile()
624 strncpy(buf + 345, prefix.string(), 155); in write_tarfile()
626 strncpy(buf, fullname.string(), 100); in write_tarfile()
655 memcpy(paxHeader, buf, 512); in write_tarfile()
679 calc_tar_checksum(buf, BUFSIZE); in write_tarfile()
680 send_tarfile_chunk(writer, buf, 512); in write_tarfile()
691 ssize_t nRead = read(fd, buf, toRead); in write_tarfile()
710 memset(buf + nRead, 0, remainder); in write_tarfile()
713 send_tarfile_chunk(writer, buf, nRead); in write_tarfile()
719 free(buf); in write_tarfile()
748 void* buf = m_buf; in WriteFile() local
788 while ((amt = in->ReadEntityData(buf, RESTORE_BUF_SIZE)) > 0) { in WriteFile()
789 err = write(fd, buf, amt); in WriteFile()
795 crc = crc32(crc, (Bytef*)buf, amt); in WriteFile()
1204 char* buf = (char*)malloc(bufSize); in test_read_header_and_entity() local
1244 nRead = reader.ReadEntityData(buf, bufSize); in test_read_header_and_entity()
1251 if (0 != memcmp(buf, str, bufSize)) { in test_read_header_and_entity()
1253 "%02x %02x %02x %02x '%c%c%c%c'\n", str, buf[0], buf[1], buf[2], buf[3], in test_read_header_and_entity()
1254 buf[0], buf[1], buf[2], buf[3]); in test_read_header_and_entity()
1265 free(buf); in test_read_header_and_entity()