portable %lu printing

main
Igor Canadi 11 years ago
parent f5f5c645a8
commit 249e736bc5
  1. 7
      utilities/backupable/backupable_db.cc

@ -247,7 +247,8 @@ void BackupEngine::DeleteBackupsNewerThan(uint64_t sequence_number) {
for (auto backup : backups_) { for (auto backup : backups_) {
if (backup.second.GetSequenceNumber() > sequence_number) { if (backup.second.GetSequenceNumber() > sequence_number) {
Log(options_.info_log, Log(options_.info_log,
"Deleting backup %u because sequence number (%lu) is newer than %lu", "Deleting backup %u because sequence number (%" PRIu64
") is newer than %" PRIu64 "",
backup.first, backup.second.GetSequenceNumber(), sequence_number); backup.first, backup.second.GetSequenceNumber(), sequence_number);
backup.second.Delete(); backup.second.Delete();
obsolete_backups_.push_back(backup.first); obsolete_backups_.push_back(backup.first);
@ -742,9 +743,9 @@ Status BackupEngine::BackupMeta::LoadFromFile(const std::string& backup_dir) {
uint32_t num_files = 0; uint32_t num_files = 0;
int bytes_read = 0; int bytes_read = 0;
sscanf(data.data(), "%ld%n", &timestamp_, &bytes_read); sscanf(data.data(), "%" PRId64 "%n", &timestamp_, &bytes_read);
data.remove_prefix(bytes_read + 1); // +1 for '\n' data.remove_prefix(bytes_read + 1); // +1 for '\n'
sscanf(data.data(), "%lu%n", &sequence_number_, &bytes_read); sscanf(data.data(), "%" PRIu64 "%n", &sequence_number_, &bytes_read);
data.remove_prefix(bytes_read + 1); // +1 for '\n' data.remove_prefix(bytes_read + 1); // +1 for '\n'
sscanf(data.data(), "%u%n", &num_files, &bytes_read); sscanf(data.data(), "%u%n", &num_files, &bytes_read);
data.remove_prefix(bytes_read + 1); // +1 for '\n' data.remove_prefix(bytes_read + 1); // +1 for '\n'

Loading…
Cancel
Save