fix: replace %ldd/%ld by PRId64 to remove warnings on all archs
This commit is contained in:
112
src/debug.c
112
src/debug.c
@@ -100,7 +100,7 @@ static void random_error1(Image *image, char *arg)
|
||||
|
||||
if(block_sel[i] && block_idx[i]<image->sectorSize)
|
||||
{ if(!LargeSeek(image->file, (gint64)(2048*block_idx[i])))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"),block_idx[i],strerror(errno));
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"),block_idx[i],strerror(errno));
|
||||
|
||||
CreateMissingSector(missing, block_idx[i], image->imageFP, FINGERPRINT_SECTOR, NULL);
|
||||
|
||||
@@ -108,7 +108,7 @@ static void random_error1(Image *image, char *arg)
|
||||
write_size = image->inLast;
|
||||
|
||||
if(LargeWrite(image->file, missing, write_size) != write_size)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"),block_idx[i],strerror(errno));
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"),block_idx[i],strerror(errno));
|
||||
}
|
||||
|
||||
block_idx[i]++;
|
||||
@@ -188,12 +188,12 @@ static void random_error2(Image *image, char *arg)
|
||||
{ unsigned char missing[2048];
|
||||
|
||||
if(!LargeSeek(image->file, (gint64)(2048*s)))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"), s, strerror(errno));
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"), s, strerror(errno));
|
||||
|
||||
CreateMissingSector(missing, s, image->imageFP, image->fpSector, NULL);
|
||||
|
||||
if(LargeWrite(image->file, missing, 2048) != 2048)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"), s, strerror(errno));
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"), s, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,11 +236,11 @@ static void random_error2(Image *image, char *arg)
|
||||
else s = RS02EccSectorIndex(lay, i-eh->dataBytes, si);
|
||||
|
||||
if(!LargeSeek(image->file, (gint64)(2048*s)))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"), s, strerror(errno));
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"), s, strerror(errno));
|
||||
|
||||
CreateMissingSector(missing, s, image->imageFP, image->fpSector, NULL);
|
||||
if(LargeWrite(image->file, missing, 2048) != 2048)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"), s, strerror(errno));
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"), s, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,12 +360,12 @@ static void random_error3(Image *image, char *arg)
|
||||
}
|
||||
|
||||
if(!LargeSeek(file, (gint64)(2048*file_s))) // FIXME: wrong for ecc files
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"), s, strerror(errno));
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"), s, strerror(errno));
|
||||
|
||||
CreateMissingSector(missing, s, image->imageFP, image->fpSector, NULL);
|
||||
|
||||
if(LargeWrite(file, missing, 2048) != 2048)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"), s, strerror(errno));
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"), s, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ void Byteset(char *arg)
|
||||
byte = atoi(cpos+1);
|
||||
|
||||
if(s<0 || s>=image->sectorSize)
|
||||
Stop(_("Sector must be in range [0..%lld]\n"),image->sectorSize-1);
|
||||
Stop(_("Sector must be in range [0..%" PRId64 "]\n"),image->sectorSize-1);
|
||||
|
||||
if(i<0 || i>=2048)
|
||||
Stop(_("Byte position must be in range [0..2047]"));
|
||||
@@ -467,7 +467,7 @@ void Byteset(char *arg)
|
||||
if(byte<0 || byte>=256)
|
||||
Stop(_("Byte value must be in range [0..255]"));
|
||||
|
||||
PrintLog(_("Setting byte %d in sector %lld to value %d.\n"), i, s, byte);
|
||||
PrintLog(_("Setting byte %d in sector %" PRId64 " to value %d.\n"), i, s, byte);
|
||||
|
||||
/*** Set the byte */
|
||||
|
||||
@@ -521,9 +521,9 @@ void Erase(char *arg)
|
||||
else start = end = atoi(arg);
|
||||
|
||||
if(start>end || start < 0 || end >= image->sectorSize)
|
||||
Stop(_("Sectors must be in range [0..%lld].\n"),image->sectorSize-1);
|
||||
Stop(_("Sectors must be in range [0..%" PRId64 "].\n"),image->sectorSize-1);
|
||||
|
||||
PrintLog(_("Erasing sectors [%lld,%lld]\n"),start,end);
|
||||
PrintLog(_("Erasing sectors [%" PRId64 ",%" PRId64 "]\n"),start,end);
|
||||
|
||||
/*** Erase them. */
|
||||
|
||||
@@ -542,7 +542,7 @@ void Erase(char *arg)
|
||||
n = LargeWrite(image->file, missing, m);
|
||||
|
||||
if(n != m)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"),s,strerror(errno));
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"),s,strerror(errno));
|
||||
}
|
||||
|
||||
/*** Clean up */
|
||||
@@ -569,9 +569,9 @@ void TruncateImageFile(char *arg)
|
||||
end = atoi(arg);
|
||||
|
||||
if(end >= image->sectorSize)
|
||||
Stop(_("New length must be in range [0..%lld].\n"),image->sectorSize-1);
|
||||
Stop(_("New length must be in range [0..%" PRId64 "].\n"),image->sectorSize-1);
|
||||
|
||||
PrintLog(_("Truncating image to %lld sectors.\n"),end);
|
||||
PrintLog(_("Truncating image to %" PRId64 " sectors.\n"),end);
|
||||
|
||||
/*** Truncate it. */
|
||||
|
||||
@@ -607,10 +607,10 @@ void RandomImage(char *image_name, char *n_sectors, int mark)
|
||||
|
||||
/*** Print banner */
|
||||
|
||||
PrintLog(_("\nCreating random image with %lld sectors.\n\n"
|
||||
PrintLog(_("\nCreating random image with %" PRId64 " sectors.\n\n"
|
||||
"There is no need for permanently storing this image;\n"
|
||||
"you can always reproduce it by calling\n"
|
||||
"dvdisaster --debug %s %lld --random-seed %d\n\n"),
|
||||
"dvdisaster --debug %s %" PRId64 " --random-seed %d\n\n"),
|
||||
sectors,
|
||||
mark ? "--marked-image" : "--random-image",
|
||||
sectors, Closure->randomSeed);
|
||||
@@ -659,7 +659,7 @@ void RandomImage(char *image_name, char *n_sectors, int mark)
|
||||
s++;
|
||||
|
||||
if(n != 2048)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"),s,strerror(errno));
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"),s,strerror(errno));
|
||||
|
||||
percent = (100*s)/sectors;
|
||||
if(last_percent != percent)
|
||||
@@ -697,20 +697,20 @@ void ZeroUnreadable(void)
|
||||
{ int n = LargeRead(image->file, buf, 2048);
|
||||
|
||||
if(n != 2048)
|
||||
Stop(_("Could not read image sector %lld:\n%s\n"),s,strerror(errno));
|
||||
Stop(_("Could not read image sector %" PRId64 ":\n%s\n"),s,strerror(errno));
|
||||
|
||||
/* Replace the dead sector marker */
|
||||
|
||||
if(CheckForMissingSector(buf, s, image->imageFP, FINGERPRINT_SECTOR) != SECTOR_PRESENT)
|
||||
{
|
||||
if(!LargeSeek(image->file, (gint64)(2048*s)))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"),s,strerror(errno));
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"),s,strerror(errno));
|
||||
|
||||
n = LargeWrite(image->file, zeros, 2048);
|
||||
n=2048;
|
||||
|
||||
if(n != 2048)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"),s,strerror(errno));
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"),s,strerror(errno));
|
||||
|
||||
cnt++;
|
||||
}
|
||||
@@ -722,7 +722,7 @@ void ZeroUnreadable(void)
|
||||
}
|
||||
}
|
||||
|
||||
PrintProgress(_("%lld \"unreadable sector\" markers replaced.\n"), cnt);
|
||||
PrintProgress(_("%" PRId64 " \"unreadable sector\" markers replaced.\n"), cnt);
|
||||
|
||||
CloseImage(image);
|
||||
}
|
||||
@@ -799,16 +799,16 @@ void ShowHeader(char *arg)
|
||||
sector = atoi(arg);
|
||||
|
||||
if(sector < 0 || sector >= image->sectorSize)
|
||||
Stop(_("Sector must be in range [0..%lld]\n"),image->sectorSize-1);
|
||||
Stop(_("Sector must be in range [0..%" PRId64 "]\n"),image->sectorSize-1);
|
||||
|
||||
/*** Load it. */
|
||||
|
||||
if(!LargeSeek(image->file, (gint64)(2048*sector)))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"),sector,strerror(errno));
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"),sector,strerror(errno));
|
||||
|
||||
n = LargeRead(image->file, eh, 2048);
|
||||
if(n != 2048)
|
||||
Stop(_("Failed reading sector %lld in image: %s"),sector,strerror(errno));
|
||||
Stop(_("Failed reading sector %" PRId64 " in image: %s"),sector,strerror(errno));
|
||||
|
||||
/*** Clean up */
|
||||
|
||||
@@ -840,18 +840,18 @@ void ShowSector(char *arg)
|
||||
sector = atoi(arg);
|
||||
|
||||
if(sector < 0 || sector >= image->sectorSize)
|
||||
Stop(_("Sector must be in range [0..%lld]\n"),image->sectorSize-1);
|
||||
Stop(_("Sector must be in range [0..%" PRId64 "]\n"),image->sectorSize-1);
|
||||
|
||||
PrintLog(_("Contents of sector %lld:\n\n"),sector);
|
||||
PrintLog(_("Contents of sector %" PRId64 ":\n\n"),sector);
|
||||
|
||||
/*** Show it. */
|
||||
|
||||
if(!LargeSeek(image->file, (gint64)(2048*sector)))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"),sector,strerror(errno));
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"),sector,strerror(errno));
|
||||
|
||||
n = LargeRead(image->file, buf, 2048);
|
||||
if(n != 2048)
|
||||
Stop(_("Failed reading sector %lld in image: %s"),sector,strerror(errno));
|
||||
Stop(_("Failed reading sector %" PRId64 " in image: %s"),sector,strerror(errno));
|
||||
|
||||
if(Closure->debugCDump)
|
||||
CDump(buf, sector, 2048, 16);
|
||||
@@ -888,10 +888,10 @@ void ReadSector(char *arg)
|
||||
if(sector < 0 || sector >= image->dh->sectors)
|
||||
{ CloseImage(image);
|
||||
FreeAlignedBuffer(ab);
|
||||
Stop(_("Sector must be in range [0..%lld]\n"),image->dh->sectors-1);
|
||||
Stop(_("Sector must be in range [0..%" PRId64 "]\n"),image->dh->sectors-1);
|
||||
}
|
||||
|
||||
PrintLog(_("Contents of sector %lld:\n\n"),sector);
|
||||
PrintLog(_("Contents of sector %" PRId64 ":\n\n"),sector);
|
||||
|
||||
/*** Read it. */
|
||||
|
||||
@@ -902,7 +902,7 @@ void ReadSector(char *arg)
|
||||
if(status)
|
||||
{ CloseImage(image);
|
||||
FreeAlignedBuffer(ab);
|
||||
Stop(_("Failed reading sector %lld: %s"),sector,strerror(errno));
|
||||
Stop(_("Failed reading sector %" PRId64 ": %s"),sector,strerror(errno));
|
||||
}
|
||||
|
||||
if(Closure->debugCDump)
|
||||
@@ -951,10 +951,10 @@ void RawSector(char *arg)
|
||||
if(lba < 0 || lba >= image->dh->sectors)
|
||||
{ CloseImage(image);
|
||||
FreeAlignedBuffer(ab);
|
||||
Stop(_("Sector must be in range [0..%lld]\n"),image->dh->sectors-1);
|
||||
Stop(_("Sector must be in range [0..%" PRId64 "]\n"),image->dh->sectors-1);
|
||||
}
|
||||
|
||||
PrintLog(_("Contents of sector %lld:\n\n"),lba);
|
||||
PrintLog(_("Contents of sector %" PRId64 ":\n\n"),lba);
|
||||
|
||||
/*** Try the raw read */
|
||||
|
||||
@@ -1162,7 +1162,7 @@ void CopySector(char *arg)
|
||||
|
||||
LargeStat(from_path, §ors); sectors /= 2048;
|
||||
if(from_sector<0 || from_sector>sectors-1)
|
||||
Stop(_("Source sector must be in range [0..%lld]\n"), sectors-1);
|
||||
Stop(_("Source sector must be in range [0..%" PRId64 "]\n"), sectors-1);
|
||||
|
||||
|
||||
if(!(to = LargeOpen(to_path, O_WRONLY, IMG_PERMS)))
|
||||
@@ -1170,27 +1170,27 @@ void CopySector(char *arg)
|
||||
|
||||
LargeStat(to_path, §ors); sectors /= 2048;
|
||||
if(to_sector<0 || to_sector>sectors-1)
|
||||
Stop(_("Destination sector must be in range [0..%lld]\n"), sectors-1);
|
||||
Stop(_("Destination sector must be in range [0..%" PRId64 "]\n"), sectors-1);
|
||||
|
||||
/*** Copy the sector */
|
||||
|
||||
PrintLog(_("Copying sector %lld from %s to sector %lld in %s.\n"),
|
||||
PrintLog(_("Copying sector %" PRId64 " from %s to sector %" PRId64 " in %s.\n"),
|
||||
from_sector, from_path, to_sector, to_path);
|
||||
|
||||
if(!LargeSeek(from, (gint64)(2048*from_sector)))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"),
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"),
|
||||
from_sector, strerror(errno));
|
||||
|
||||
if(LargeRead(from, buf, 2048) != 2048)
|
||||
Stop(_("Failed reading sector %lld in image: %s"),
|
||||
Stop(_("Failed reading sector %" PRId64 " in image: %s"),
|
||||
from_sector, strerror(errno));
|
||||
|
||||
if(!LargeSeek(to, (gint64)(2048*to_sector)))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"),
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"),
|
||||
to_sector, strerror(errno));
|
||||
|
||||
if(LargeWrite(to, buf, 2048) != 2048)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"),
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"),
|
||||
to_sector, strerror(errno));
|
||||
|
||||
/*** Clean up */
|
||||
@@ -1233,9 +1233,9 @@ void MergeImages(char *arg, int mode)
|
||||
|
||||
/*** Compare/merge the images */
|
||||
|
||||
if(!mode) PrintLog("Comparing %s (%lld sectors) with %s (%lld sectors).\n",
|
||||
if(!mode) PrintLog("Comparing %s (%" PRId64 " sectors) with %s (%" PRId64 " sectors).\n",
|
||||
left_path, left_sectors, right_path, right_sectors);
|
||||
else PrintLog("Merging %s (%lld sectors) with %s (%lld sectors).\n",
|
||||
else PrintLog("Merging %s (%" PRId64 " sectors) with %s (%" PRId64 " sectors).\n",
|
||||
left_path, left_sectors, right_path, right_sectors);
|
||||
|
||||
/*** Compare them */
|
||||
@@ -1249,33 +1249,33 @@ void MergeImages(char *arg, int mode)
|
||||
{ unsigned char left_buf[2048], right_buf[2048];
|
||||
|
||||
if(LargeRead(left, left_buf, 2048) != 2048)
|
||||
Stop(_("Failed reading sector %lld in image: %s"),
|
||||
Stop(_("Failed reading sector %" PRId64 " in image: %s"),
|
||||
s, strerror(errno));
|
||||
|
||||
if(LargeRead(right, right_buf, 2048) != 2048)
|
||||
Stop(_("Failed reading sector %lld in image: %s"),
|
||||
Stop(_("Failed reading sector %" PRId64 " in image: %s"),
|
||||
s, strerror(errno));
|
||||
|
||||
if(memcmp(left_buf, right_buf, 2048))
|
||||
{
|
||||
if(CheckForMissingSector(left_buf, s, NULL, 0) != SECTOR_PRESENT)
|
||||
{ if(!mode) PrintLog("< Sector %lld missing\n", s);
|
||||
{ if(!mode) PrintLog("< Sector %" PRId64 " missing\n", s);
|
||||
else
|
||||
{ PrintLog("< Sector %lld missing; copied from %s.\n", s, right_path);
|
||||
{ PrintLog("< Sector %" PRId64 " missing; copied from %s.\n", s, right_path);
|
||||
if(!LargeSeek(left, (2048*s)))
|
||||
Stop(_("Failed seeking to sector %lld in image: %s"),
|
||||
Stop(_("Failed seeking to sector %" PRId64 " in image: %s"),
|
||||
s, strerror(errno));
|
||||
|
||||
if(LargeWrite(left, right_buf, 2048) != 2048)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"),
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"),
|
||||
s, strerror(errno));
|
||||
}
|
||||
}
|
||||
else if(CheckForMissingSector(right_buf, s, NULL, 0) != SECTOR_PRESENT)
|
||||
{ PrintLog("> Sector %lld missing\n", s);
|
||||
{ PrintLog("> Sector %" PRId64 " missing\n", s);
|
||||
}
|
||||
else
|
||||
{ PrintLog("! Sector %lld differs in images\n", s);
|
||||
{ PrintLog("! Sector %" PRId64 " differs in images\n", s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1287,27 +1287,27 @@ void MergeImages(char *arg, int mode)
|
||||
}
|
||||
|
||||
if(left_sectors > right_sectors)
|
||||
{ PrintLog("%lld sectors missing at the end of %s\n",
|
||||
{ PrintLog("%" PRId64 " sectors missing at the end of %s\n",
|
||||
left_sectors-right_sectors, right_path);
|
||||
}
|
||||
|
||||
if(left_sectors < right_sectors)
|
||||
{ if(!mode)
|
||||
PrintLog("%lld sectors missing at the end of %s\n",
|
||||
PrintLog("%" PRId64 " sectors missing at the end of %s\n",
|
||||
right_sectors-left_sectors, left_path);
|
||||
else
|
||||
{ unsigned char buf[2048];
|
||||
|
||||
PrintLog("Transferring %lld sectors from the end of %s to %s.\n",
|
||||
PrintLog("Transferring %" PRId64 " sectors from the end of %s to %s.\n",
|
||||
right_sectors-left_sectors, right_path, left_path);
|
||||
|
||||
for(s=left_sectors; s<right_sectors; s++)
|
||||
{ if(LargeRead(right, buf, 2048) != 2048)
|
||||
Stop(_("Failed reading sector %lld in image: %s"),
|
||||
Stop(_("Failed reading sector %" PRId64 " in image: %s"),
|
||||
s, strerror(errno));
|
||||
|
||||
if(LargeWrite(left, buf, 2048) != 2048)
|
||||
Stop(_("Failed writing to sector %lld in image: %s"),
|
||||
Stop(_("Failed writing to sector %" PRId64 " in image: %s"),
|
||||
s, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user