blob: d81e260cd6decfc9c4d6607c5476bfca0ab5847b [file] [log] [blame]
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/fs/fs_afs.cpp
--- a/src/client/fs/fs_afs.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/fs/fs_afs.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -285,10 +285,10 @@ void CAfsPart::printfInformations()
getStdInfos(szText, sizeof(szText), false);
SNPRINTF(szFullText, i18n("%s" // standard infos
- "Allocation groups count:......%lu\n"
- "Byte order:...................%lu\n"
- "Blocks per group:.............%lu\n"
- "Boot loader size:.............%lu blocks\n"),
+ "Allocation groups count:......%u\n"
+ "Byte order:...................%u\n"
+ "Blocks per group:.............%u\n"
+ "Boot loader size:.............%u blocks\n"),
szText, m_info.dwAllocGroupCount, m_info.dwByteOrder,
m_info.dwBlockPerGroup, m_info.dwBootLoaderSize);
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/fs/fs_base.cpp
--- a/src/client/fs/fs_base.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/fs/fs_base.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -14,6 +14,9 @@
* (at your option) any later version. *
* *
***************************************************************************/
+
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
#include "fs_base.h"
#include "partimage.h"
@@ -727,10 +730,10 @@ int CFSBase::getStdInfos(char *szDest, i
if (bShowBlocksInfo)
{
- SNPRINTF(szBlocksInfo, i18n("Block size....................%llu bytes\n"
- "Total blocks count............%llu\n"
- "Used blocks count.............%llu\n"
- "Free blocks count.............%llu\n"),
+ SNPRINTF(szBlocksInfo, i18n("Block size....................%"PRIu64" bytes\n"
+ "Total blocks count............%"PRIu64"\n"
+ "Used blocks count.............%"PRIu64"\n"
+ "Free blocks count.............%"PRIu64"\n"),
m_header.qwBlockSize,
m_header.qwBlocksCount,
m_header.qwUsedBlocks,
@@ -742,7 +745,7 @@ int CFSBase::getStdInfos(char *szDest, i
}
snprintf(szDest, nMaxLen, i18n("%s" // Blocks infos
- "Space usage:..................%llu %%\n"
+ "Space usage:..................%"PRIu64" %%\n"
"Used space....................%s\n"
"Free space....................%s\n"
"Bitmap size...................%s\n"
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/fs/fs_ext2.cpp
--- a/src/client/fs/fs_ext2.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/fs/fs_ext2.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -103,12 +103,12 @@ void CExt2Part::printfInformations()
getStdInfos(szText, sizeof(szText), false);
SNPRINTF(szFullText, i18n("%s" // standard infos
- "Number of groups..............%lu\n"
- "First block...................%lu\n"
+ "Number of groups..............%u\n"
+ "First block...................%u\n"
"Ext3fs journalization.........%s\n"
"Sparse super block............%s\n"
"Large files support...........%s\n"
- "File system revision..........%lu\n"),
+ "File system revision..........%u\n"),
szText, m_info.dwGroupsCount, m_info.dwFirstBlock,
(m_info.dwFeatureCompat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) ? i18n("yes") : i18n("no"),
(m_info.dwFeatureRoCompat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) ? i18n("yes") : i18n("no"),
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/fs/fs_fat.cpp
--- a/src/client/fs/fs_fat.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/fs/fs_fat.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -124,14 +124,14 @@ void CFatPart::printfInformations()
"Sector Size...................%u\n"
"Sectors per cluster...........%u\n"
"Reserved Sectors count........%u\n"
- "Root directory sectors........%lu\n"
+ "Root directory sectors........%u\n"
"FAT tables count..............%u\n"
- "Total Sectors Count...........%lu\n"
- "Sectors per FAT...............%lu\n"
- "Clusters count:...............%lu\n"
- "Used clusters.................%lu\n"
- "Free clusters.................%lu\n"
- "Damaged clusters..............%lu\n"),
+ "Total Sectors Count...........%u\n"
+ "Sectors per FAT...............%u\n"
+ "Clusters count:...............%u\n"
+ "Used clusters.................%u\n"
+ "Free clusters.................%u\n"
+ "Damaged clusters..............%u\n"),
szText, m_info.wBytesPerSector, m_info.cSectorsPerCluster,
m_info.wReservedSectorsCount, m_info.dwRootDirSectors,
m_info.cNumberOfFATs,m_info.dwTotalSectorsCount,
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/fs/fs_hfs.cpp
--- a/src/client/fs/fs_hfs.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/fs/fs_hfs.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -22,6 +22,8 @@
#include "gui_text.h"
#include <stdio.h>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
// =======================================================
CHfsPart::CHfsPart(char *szDevice, FILE *fDeviceFile, QWORD qwPartSize): CFSBase(szDevice, fDeviceFile, qwPartSize)
@@ -140,10 +142,10 @@ void CHfsPart::printfInformations()
getStdInfos(szText, sizeof(szText), true);
SNPRINTF(szFullText, i18n("%s" // standard infos
- "Allocation Group count:.......%llu\n"
- "Blocks per Allocation Group...%lu\n"
+ "Allocation Group count:.......%"PRIu64"\n"
+ "Blocks per Allocation Group...%u\n"
"Allocation Group size:........%s\n"
- "First allocation block:.......%llu\n"),
+ "First allocation block:.......%"PRIu64"\n"),
szText, m_info.qwAllocCount, m_info.dwBlocksPerAlloc,
formatSize(m_info.dwAllocSize,szTemp1), m_info.qwFirstAllocBlock);
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/fs/fs_ntfs.cpp
--- a/src/client/fs/fs_ntfs.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/fs/fs_ntfs.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -18,6 +18,9 @@
#include "partimage.h"
#include "imagefile.h"
#include "fs_ntfs.h"
+
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
// =======================================================
CNtfsPart::CNtfsPart(char *szDevice, FILE *fDeviceFile, QWORD qwPartSize): CFSBase(szDevice, fDeviceFile, qwPartSize)
@@ -308,8 +311,8 @@ void CNtfsPart::printfInformations()
SNPRINTF(szFullText, i18n("%s" // standard infos
"Bytes per sector..............%u\n"
"Sectors per cluster...........%u\n"
- "File record size..............%lu\n"
- "LCN of MFT Data attrib........%llu\n"),
+ "File record size..............%u\n"
+ "LCN of MFT Data attrib........%"PRIu64"\n"),
szText, m_info.nBytesPerSector, m_info.cSectorsPerCluster,
m_info.dwFileRecordSize, m_info.qwLCNOfMftDataAttrib);
@@ -726,7 +729,7 @@ void CNtfsRunList::show()
QWORD i;
for (i=0L; i < m_qwClustersCount; i++)
- fprintf(stderr, "cluster[%llu] = %llu\n", i, m_qwOffset[i]);
+ fprintf(stderr, "cluster[%llu] = %"PRIu64"\n", i, m_qwOffset[i]);
}
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/fs/fs_ufs.cpp
--- a/src/client/fs/fs_ufs.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/fs/fs_ufs.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -25,6 +25,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
#include "fs_ufs.h"
#include "partimage.h"
@@ -210,11 +213,11 @@ void CUfsPart::printfInformations()
getStdInfos(szText, sizeof(szText), true);
SNPRINTF(szFullText, i18n("%s" // standard infos
- "Cylinder groups count:........%lu\n"
+ "Cylinder groups count:........%u\n"
"Cylinder group size:..........%s\n"
- "Basic blocks per CG:..........%lu\n"
- "Basic block size:.............%lu\n"
- "Data frags count:.............%llu\n"),
+ "Basic blocks per CG:..........%u\n"
+ "Basic block size:.............%u\n"
+ "Data frags count:.............%"PRIu64"\n"),
szText, m_info.dwCylinderGroupsCount,
formatSize(m_info.dwCylinderGroupSize*m_info.dwBasicBlockSize,szTemp1),
m_info.dwCylinderGroupSize, m_info.dwBasicBlockSize, m_info.qwDataFrags);
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/fs/fs_xfs.cpp
--- a/src/client/fs/fs_xfs.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/fs/fs_xfs.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -208,8 +208,8 @@ void CXfsPart::printfInformations()
getStdInfos(szText, sizeof(szText), true);
SNPRINTF(szFullText, i18n("%s" // standard infos
- "Allocation Group count:.......%lu\n"
- "Blocks per Allocation Group...%lu\n"
+ "Allocation Group count:.......%u\n"
+ "Blocks per Allocation Group...%u\n"
"Allocation Group size:........%s\n"),
szText, m_info.dwAgCount, m_info.dwAgBlocksCount,
formatSize(m_info.dwAgBlocksCount*m_header.qwBlockSize,szTemp1));
@@ -300,7 +300,7 @@ char* blocknum(char *szBuffer, DWORD dwB
char* blocknum(char *szBuffer, DWORD dwBn)
{
if (dwBn != NULLAGBLOCK)
- sprintf(szBuffer, "%lu", dwBn);
+ sprintf(szBuffer, "%u", dwBn);
else
sprintf(szBuffer, "NULLAGBLOCK");
return szBuffer;
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/gui_text.cpp
--- a/src/client/gui_text.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/gui_text.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -29,6 +29,8 @@
#include <stdlib.h>
#include <errno.h>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
// =======================================================
void CRestoreMbrWindow::addHardDisk(char *szText, DWORD dwNumber)
{
@@ -81,12 +83,12 @@ int CRestoreMbrWindow::create()
}
// =======================================================
-void CRestoreMbrWindow::getValues(DWORD *dwCurrentMbrNb, DWORD *dwOriginalMbrNb, int *nRestoreMode)
-{
- BEGIN;
-
- *dwCurrentMbrNb = (DWORD) newtListboxGetCurrent(m_list1);
- *dwOriginalMbrNb = (DWORD) newtListboxGetCurrent(m_list2);
+void CRestoreMbrWindow::getValues(uintptr_t *dwCurrentMbrNb, uintptr_t *dwOriginalMbrNb, int *nRestoreMode)
+{
+ BEGIN;
+
+ *dwCurrentMbrNb = (uintptr_t) newtListboxGetCurrent(m_list1);
+ *dwOriginalMbrNb = (uintptr_t) newtListboxGetCurrent(m_list2);
if (newtRadioGetCurrent(m_radioFull) == m_radioFull)
*nRestoreMode = MBR_RESTORE_WHOLE;
@@ -339,7 +341,7 @@ int CSaveOptWindow::create(char *szImage
m_labelSplit = newtLabel(1, 12, i18n("Image split mode"));
m_radioSplitAuto = newtRadiobutton(1, 13, i18n("Automatic split (when no space left)"), !options.qwSplitSize, NULL);
m_radioSplitSize = newtRadiobutton(1, 14, i18n("Into files whose size is:............"), !!options.qwSplitSize, m_radioSplitAuto);
- SNPRINTF(szTemp, "%llu", (!!options.qwSplitSize) ? (options.qwSplitSize/1024/1024) : 2048);
+ SNPRINTF(szTemp, "%"PRIu64"", (!!options.qwSplitSize) ? (options.qwSplitSize/1024/1024) : 2048);
m_editSplitSize = newtEntry(43, 14, szTemp, 8, NULL, 0);
m_labelSplitSizeKB = newtLabel(52, 14, i18n("MiB"));
m_checkSplitWait = newtCheckbox(1, 15, i18n("Wait after each volume change"), (!!options.bSplitWait ? 'X' : ' '), " X", NULL);
@@ -460,7 +462,7 @@ int CSavingWindow::create(const char *sz
SNPRINTF(szTemp, i18n("Partition to save:...........%s"), szDevice);
m_labelPartition = newtLabel(1, 0, szTemp);
- SNPRINTF(szTemp, i18n("Size of the Partition:.......%s = %llu bytes"), formatSize(qwPartSize, szTemp2), qwPartSize);
+ SNPRINTF(szTemp, i18n("Size of the Partition:.......%s = %"PRIu64" bytes"), formatSize(qwPartSize, szTemp2), qwPartSize);
m_labelPartitionSize = newtLabel(1, 1, szTemp);
SNPRINTF(szTemp, i18n("Image file to create.........%s"), szImageFile);
@@ -608,7 +610,7 @@ void CSavingWindow::showImageFileInfo(ch
newtLabelSetText(m_labelImageFileSize, szTemp);
}
- SNPRINTF (szTemp, i18n("Available space for image:...%s = %llu bytes"), formatSize(qwFreeSpace, szTemp2), qwFreeSpace);
+ SNPRINTF (szTemp, i18n("Available space for image:...%s = %"PRIu64" bytes"), formatSize(qwFreeSpace, szTemp2), qwFreeSpace);
newtLabelSetText(m_labelFreeSpace, szTemp);
//option -B gui=no
@@ -696,8 +698,27 @@ int CRestoreOptWindow::getValues(COption
RETURN_int(0);
}
-// =======================================================
-int CRestoringWindow::create(char *szDevice, char *szImageFile, QWORD qwCurPartSize, DWORD dwCompressionMode, char *szOriginalDevice, char *szFileSystem, tm dateCreate, QWORD qwOrigPartSize, COptions * options)
+static char *asctime_portable (const struct portable_tm *__tp)
+{
+struct tm tms;
+
+ tms.tm_sec=__tp->tm_sec;
+ tms.tm_min=__tp->tm_min;
+ tms.tm_hour=__tp->tm_hour;
+ tms.tm_mday=__tp->tm_mday;
+ tms.tm_mon=__tp->tm_mon;
+ tms.tm_year=__tp->tm_year;
+ tms.tm_wday=__tp->tm_wday;
+ tms.tm_yday=__tp->tm_yday;
+ tms.tm_isdst=__tp->tm_isdst;
+ tms.tm_gmtoff=__tp->tm_gmtoff;
+ tms.tm_zone="UTC";
+
+ return asctime (&tms);
+}
+
+// =======================================================
+int CRestoringWindow::create(char *szDevice, char *szImageFile, QWORD qwCurPartSize, DWORD dwCompressionMode, char *szOriginalDevice, char *szFileSystem, struct portable_tm dateCreate, QWORD qwOrigPartSize, COptions * options)
{
BEGIN;
@@ -713,7 +734,7 @@ int CRestoringWindow::create(char *szDev
SNPRINTF(szTemp, i18n("Partition to restore:.............%s"), szDevice);
m_labelPartition = newtLabel(1, 0, szTemp);
- SNPRINTF(szTemp, i18n("Size of partition to restore:.....%s = %llu bytes"), formatSize(qwCurPartSize, szTemp2), qwCurPartSize);
+ SNPRINTF(szTemp, i18n("Size of partition to restore:.....%s = %"PRIu64" bytes"), formatSize(qwCurPartSize, szTemp2), qwCurPartSize);
m_labelPartitionSize = newtLabel(1, 1, szTemp);
SNPRINTF(szTemp, i18n("Image file to use.................%s"), szImageFile);
@@ -727,10 +748,10 @@ int CRestoringWindow::create(char *szDev
SNPRINTF(szTemp, i18n("Partition was on device:..........%s\n"), szOriginalDevice);
m_labelOldDevice = newtLabel(1, 5, szTemp);
- SNPRINTF(szTemp, i18n("Image created on:.................%s\n"), asctime(&dateCreate));
+ SNPRINTF(szTemp, i18n("Image created on:.................%s\n"), asctime_portable(&dateCreate));
m_labelDate = newtLabel(1, 6, szTemp);
- SNPRINTF(szTemp, i18n("Size of the original partition:...%s = %llu bytes"), formatSize(qwOrigPartSize, szTemp2), qwOrigPartSize);
+ SNPRINTF(szTemp, i18n("Size of the original partition:...%s = %"PRIu64" bytes"), formatSize(qwOrigPartSize, szTemp2), qwOrigPartSize);
m_labelOriginalPartitionSize = newtLabel(1, 7, szTemp);
// stats
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/gui_text.h
--- a/src/client/gui_text.h Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/gui_text.h Tue Sep 04 21:43:30 2007 +0200
@@ -56,7 +56,7 @@ class CRestoreMbrWindow: public COptions
void addMbr(char *szText, DWORD dwNumber);
//int runForm();
//void destroyForm();
- void getValues(DWORD *dwCurrentMbrNb, DWORD *dwOriginalMbrNb, int *nRestoreMode);
+ void getValues(uintptr_t *dwCurrentMbrNb, uintptr_t *dwOriginalMbrNb, int *nRestoreMode);
private:
//newtComponent m_formMain;
@@ -124,7 +124,7 @@ class CRestoringWindow
class CRestoringWindow
{
public:
- int create(char *szDevice, char *szImageFile, QWORD qwCurPartSize, DWORD dwCompressionMode, char *szOriginalDevice, char *szFileSystem, tm dateCreate, QWORD qwOrigPartSize, COptions * options);
+ int create(char *szDevice, char *szImageFile, QWORD qwCurPartSize, DWORD dwCompressionMode, char *szOriginalDevice, char *szFileSystem, struct portable_tm dateCreate, QWORD qwOrigPartSize, COptions * options);
int runForm();
void destroyForm();
void showImageFileInfo(char *szImageFile, int nCompressionMode, char *szFullyBatchMode);
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/imagefile.cpp
--- a/src/client/imagefile.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/imagefile.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -488,7 +488,7 @@ void CImage::splitChangeImageFileWrite()
}
set_dwVolumeNumber(get_dwVolumeNumber()+1); // increase the volume number
- SNPRINTF(aux, "%s/%s.%.3ld", get_szPath(), get_szOriginalFilename(), get_dwVolumeNumber());
+ SNPRINTF(aux, "%s/%s.%.3d", get_szPath(), get_szOriginalFilename(), get_dwVolumeNumber());
//*(aux+MAXPATHLEN-1) = '\0';
set_szImageFilename(aux);
@@ -514,7 +514,7 @@ void CImage::splitChangeImageFileRead()
// increase volume number
set_dwVolumeNumber(get_dwVolumeNumber()+1);
- SNPRINTF(aux, "%s/%s.%.3ld", get_szPath(), get_szOriginalFilename(), get_dwVolumeNumber());
+ SNPRINTF(aux, "%s/%s.%.3d", get_szPath(), get_szOriginalFilename(), get_dwVolumeNumber());
//*(aux+MAXPATHLEN-1) = '\0';
set_szImageFilename(aux);
@@ -700,7 +700,7 @@ int CImage::openWritingFdDisk()
set_szPath(aux2);
extractFilenameFromFullPath(szAux, aux2); // filename without path
set_szOriginalFilename(aux2);
- SNPRINTF(szAux, "%s/%s.%.3ld", get_szPath(), get_szOriginalFilename(), get_dwVolumeNumber());
+ SNPRINTF(szAux, "%s/%s.%.3d", get_szPath(), get_szOriginalFilename(), get_dwVolumeNumber());
set_szImageFilename(szAux);
nRes = openWritingFdDisk();
RETURN_int(nRes);
@@ -728,7 +728,7 @@ int CImage::openWritingFdDisk()
case ERR_RETRY:
strcpy(szAux, excep->getNewString()); // endding '/' were removed
set_szPath(szAux);
- SNPRINTF(aux2, "%s/%s.%.3ld", szAux, get_szOriginalFilename(),
+ SNPRINTF(aux2, "%s/%s.%.3d", szAux, get_szOriginalFilename(),
get_dwVolumeNumber());
set_szImageFilename(aux2);
@@ -1068,7 +1068,7 @@ void CImage::openReading(CVolumeHeader *
set_szPath(aux2);
extractFilenameFromFullPath(szAux, aux2);
set_szOriginalFilename(aux2);
- SNPRINTF(szAux, "%s/%s.%.3ld", get_szPath(),
+ SNPRINTF(szAux, "%s/%s.%.3d", get_szPath(),
get_szOriginalFilename(), get_dwVolumeNumber());
set_szImageFilename(szAux);
umountImageLocation();
@@ -1132,7 +1132,7 @@ void CImage::openReading(CVolumeHeader *
if (strcmp(headVolume.szMagicString, MAGIC_BEGIN_VOLUME) != 0)
{
- SNPRINTF(szAux, "%s/%s.%.3ld", get_szPath(), get_szOriginalFilename(), get_dwVolumeNumber());
+ SNPRINTF(szAux, "%s/%s.%.3d", get_szPath(), get_szOriginalFilename(), get_dwVolumeNumber());
THROW(ERR_NOTAPARTIMAGEFILE, szAux);
}
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/imginfo.cpp
--- a/src/client/imginfo.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/imginfo.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -26,6 +26,29 @@
#include "imagefile.h"
#include "interface_newt.h"
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
+static char *asctime_portable (const struct portable_tm *__tp)
+{
+struct tm tms;
+
+ tms.tm_sec=__tp->tm_sec;
+ tms.tm_min=__tp->tm_min;
+ tms.tm_hour=__tp->tm_hour;
+ tms.tm_mday=__tp->tm_mday;
+ tms.tm_mon=__tp->tm_mon;
+ tms.tm_year=__tp->tm_year;
+ tms.tm_wday=__tp->tm_wday;
+ tms.tm_yday=__tp->tm_yday;
+ tms.tm_isdst=__tp->tm_isdst;
+ tms.tm_gmtoff=__tp->tm_gmtoff;
+ tms.tm_zone="UTC";
+
+ return asctime (&tms);
+}
+
+
// =======================================================
void imageInfoShowRegular(char *szText, int nMaxTextLen, CMainHeader *head, char *szImagefile, DWORD dwCompression)
{
@@ -65,20 +88,20 @@ void imageInfoShowRegular(char *szText,
"Description:...........%s\n"
"Original device:.......%s\n"
"Original filepath:.... %s\n"
- "Flags:.................%ld: %s\n"
+ "Flags:.................%d: %s\n"
"Creation date:.........%s"
"Partition size:........%s\n"
"Hostname:..............%s\n"
"Compatible Version:....%s\n"
- "Encryption algorithm:..%ld -> %s\n"
- "MBR saved count:.......%lu\n\n"
+ "Encryption algorithm:..%d -> %s\n"
+ "MBR saved count:.......%u\n\n"
"System of the backup:\n"
"- machine:.............%s\n"
"- operating system:....%s\n"
"- release:.............%s\n"
"\n\n"),
head->szFileSystem, szDescription, head->szOriginalDevice, head->szFirstImageFilepath,
- head->dwMainFlags, szFlags, asctime(&head->dateCreate), formatSize(head->qwPartSize, cTemp), head->szHostname,
+ head->dwMainFlags, szFlags, asctime_portable(&head->dateCreate), formatSize(head->qwPartSize, cTemp), head->szHostname,
head->szVersion, head->dwEncryptAlgo, szEncryption, head->dwMbrCount, head->szUnameMachine,
head->szUnameSysname, head->szUnameRelease);
}
@@ -88,7 +111,7 @@ void imageInfoShowMBR(char *szText, int
{
snprintf(szText, nMaxTextLen, i18n("-------------------- MBR %.3d -------------------\n"
"Device:................%s\n"
- "Device blocks count:...%llu\n"
+ "Device blocks count:...%"PRIu64"\n"
"Device model:..........%s\n\n"),
i, mbr->szDevice, mbr->qwBlocksCount, mbr->szDescModel);
}
@@ -127,10 +150,10 @@ void imageInfoShowVolume(char *szText, i
break;
}
- snprintf(szText, nMaxTextLen, i18n("Volume number:.........%lu\n"
+ snprintf(szText, nMaxTextLen, i18n("Volume number:.........%u\n"
"Volume size:...........%s\n"
- "Compression level: ....%ld -> %s\n"
- "Identificator:.........%llu=%llX\n\n"),
+ "Compression level: ....%d -> %s\n"
+ "Identificator:.........%"PRIu64"=%"PRIX64"\n\n"),
head->dwVolumeNumber, formatSize(qwImageSize, cTemp), dwCompression,
szCompression, head->qwIdentificator, head->qwIdentificator);
}
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/interface_newt.cpp
--- a/src/client/interface_newt.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/interface_newt.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -239,7 +239,7 @@ int CInterfaceNewt::guiInitMainWindow(ch
labelNetwork = newtLabel(5, 18, i18n("IP/name of the server:"));
editNetwork = newtEntry(28, 18, szNetworkIP, 25, NULL, 0);
labelPort = newtLabel(54, 18, i18n("Port:"));
- SNPRINTF(szTemp, "%lu", *dwServerPort);
+ SNPRINTF(szTemp, "%u", *dwServerPort);
editPort = newtEntry(60, 18, szTemp, 6, NULL, 0);
btnContinue = newtCompactButton(50, 12, i18n("Next (F5)"));
@@ -473,7 +473,7 @@ WORD CInterfaceNewt::askNewPath(char * s
char szMess[2048];
SNPRINTF(szMess, i18n("Disk full! Can't write next volume file "
- "(%s.%.3ld)\nto %s\nPlease, enter another directory path "
+ "(%s.%.3d)\nto %s\nPlease, enter another directory path "
"(without filename):"), szOrigFilename, dwVolume, szPath);
//*(szMess+2047) = '\0';
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/main.cpp
--- a/src/client/main.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/main.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -29,6 +29,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
#include <sched.h>
#include <sys/types.h>
#include <sys/param.h>
@@ -278,7 +282,7 @@ int main(int argc, char *argv[])
case 'V': // split image into multiple files
options.qwSplitSize = (QWORD)atol(optarg) * 1024 * 1024;
- fprintf (stderr, i18n("Volume size: %llu bytes (%ld MiB)\n"),
+ fprintf (stderr, i18n("Volume size: %"PRIu64" bytes (%ld MiB)\n"),
options.qwSplitSize, atol(optarg));
break;
@@ -971,15 +975,15 @@ int checkStructSizes()
{
// ---- check types sizes
- if (sizeof(unsigned long int) != 4)
+ if (sizeof(DWORD) != 4)
{
- fprintf (stderr, "Error: sizeof(DWORD) != 4 (%d)\n", sizeof(unsigned long int));
- goto errcheck;
- }
-
- if (sizeof(unsigned long long int) != 8)
+ fprintf (stderr, "Error: sizeof(DWORD) != 4 (%zd)\n", sizeof(DWORD));
+ goto errcheck;
+ }
+
+ if (sizeof(QWORD) != 8)
{
- fprintf (stderr, "Error: sizeof(QWORD) != 8 (%d)\n", sizeof(unsigned long long int));
+ fprintf (stderr, "Error: sizeof(QWORD) != 8 (%zd)\n", sizeof(QWORD));
goto errcheck;
}
@@ -988,7 +992,7 @@ int checkStructSizes()
// check main header size is 16384
if (sizeof(CMainHeader) != 16384)
{
- fprintf (stderr, "Error: main header size != 16384 (%d)\n",
+ fprintf (stderr, "Error: main header size != 16384 (%zd)\n",
sizeof(CMainHeader));
goto errcheck;
}
@@ -996,7 +1000,7 @@ int checkStructSizes()
// check ext2 header size is 16384
if (sizeof(CInfoExt2Header) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: ext2 header size != %d (%d)\n", INFOS_STRUCT_SIZE,
+ fprintf (stderr, "Error: ext2 header size != %d (%zd)\n", INFOS_STRUCT_SIZE,
sizeof(CInfoExt2Header));
goto errcheck;
}
@@ -1004,7 +1008,7 @@ int checkStructSizes()
// check reiserfs header size is 16384
if (sizeof(CInfoReiserHeader) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: reiserfs header size != %d (%d)\n", INFOS_STRUCT_SIZE,
+ fprintf (stderr, "Error: reiserfs header size != %d (%zd)\n", INFOS_STRUCT_SIZE,
sizeof(CInfoReiserHeader));
goto errcheck;
}
@@ -1012,7 +1016,7 @@ int checkStructSizes()
// check fat header size is 16384
if (sizeof(CInfoFatHeader) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: fat header size != %d (%d)\n", INFOS_STRUCT_SIZE,
+ fprintf (stderr, "Error: fat header size != %d (%zd)\n", INFOS_STRUCT_SIZE,
sizeof(CInfoFatHeader));
goto errcheck;
}
@@ -1020,7 +1024,7 @@ int checkStructSizes()
// check ntfs header size is 16384
if (sizeof(CInfoNtfsHeader) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: ntfs header size != %d (%d)\n", INFOS_STRUCT_SIZE,
+ fprintf (stderr, "Error: ntfs header size != %d (%zd)\n", INFOS_STRUCT_SIZE,
sizeof(CInfoNtfsHeader));
goto errcheck;
}
@@ -1028,7 +1032,7 @@ int checkStructSizes()
// check hpfs header size is 16384
if (sizeof(CInfoHpfsHeader) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: hpfs header size != %d (%d)\n", INFOS_STRUCT_SIZE,
+ fprintf (stderr, "Error: hpfs header size != %d (%zd)\n", INFOS_STRUCT_SIZE,
sizeof(CInfoHpfsHeader));
goto errcheck;
}
@@ -1036,7 +1040,7 @@ int checkStructSizes()
// check jfs header size is 16384
if (sizeof(CInfoJfsHeader) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: jfs header size != %d (%d)\n", INFOS_STRUCT_SIZE,
+ fprintf (stderr, "Error: jfs header size != %d (%zd)\n", INFOS_STRUCT_SIZE,
sizeof(CInfoJfsHeader));
goto errcheck;
}
@@ -1044,7 +1048,7 @@ int checkStructSizes()
// check xfs header size is 16384
if (sizeof(CInfoXfsHeader) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: xfs header size != %d (%d)\n", INFOS_STRUCT_SIZE,
+ fprintf (stderr, "Error: xfs header size != %d (%zd)\n", INFOS_STRUCT_SIZE,
sizeof(CInfoXfsHeader));
goto errcheck;
}
@@ -1052,7 +1056,7 @@ int checkStructSizes()
// check hfs header size is 16384
if (sizeof(CInfoHfsHeader) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: hfs header size != %d (%d)\n", INFOS_STRUCT_SIZE,
+ fprintf (stderr, "Error: hfs header size != %d (%zd)\n", INFOS_STRUCT_SIZE,
sizeof(CInfoHfsHeader));
goto errcheck;
}
@@ -1060,36 +1064,39 @@ int checkStructSizes()
// check ufs header size is 16384
if (sizeof(CInfoUfsHeader) != INFOS_STRUCT_SIZE)
{
- fprintf (stderr, "Error: jfs header size != %d (%d)\n", INFOS_STRUCT_SIZE,
- sizeof(CInfoUfsHeader));
+ fprintf (stderr, "Error: jfs header size != %d (%zd)\n",
+ INFOS_STRUCT_SIZE, sizeof(CInfoUfsHeader));
goto errcheck;
}
// check tail size is 16384
if (sizeof(CMainTail) != 16384)
{
- fprintf (stderr, "Error: main footer size != 16384 (%d)\n", sizeof(CMainTail));
+ fprintf (stderr, "Error: main footer size != 16384 (%zd)\n",
+ sizeof(CMainTail));
goto errcheck;
}
// check volume header size is 512
if (sizeof(CVolumeHeader) != 512)
{
- fprintf (stderr, "Error: volume hedaer size != 512 (%d)\n", sizeof(CVolumeHeader));
+ fprintf (stderr, "Error: volume hedaer size != 512 (%zd)\n",
+ sizeof(CVolumeHeader));
goto errcheck;
}
// check MBR size is 2048
if (sizeof(CMbr) != 2048)
{
- fprintf (stderr, "Error: MBR size != 2048 (%d)\n", sizeof(CMbr));
+ fprintf (stderr, "Error: MBR size != 2048 (%zd)\n", sizeof(CMbr));
goto errcheck;
}
// check volume header size is 512
if (sizeof(CLocalHeader) != 16384)
{
- fprintf (stderr, "Error: local header size != 16384 (%d)\n", sizeof(CLocalHeader));
+ fprintf (stderr, "Error: local header size != 16384 (%zd)\n",
+ sizeof(CLocalHeader));
goto errcheck;
}
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/mbr_backup.cpp
--- a/src/client/mbr_backup.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/mbr_backup.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -164,7 +164,7 @@ int mbrParseProcPart(char *szHdList, int
//if (isDriveReady(szTemp))
{
nCount++; // number of hard disks
- SNPRINTF(szTemp, "/dev/%s#%lu#",szDevice, (DWORD)nBlocks);
+ SNPRINTF(szTemp, "/dev/%s#%u#",szDevice, (DWORD)nBlocks);
if (szHdList)
strncat(szHdList, szTemp, nMaxLen);
}
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/misc.cpp
--- a/src/client/misc.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/misc.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -22,6 +22,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
@@ -88,8 +90,8 @@ void restoreMbr(char *szImageFile, COpti
CRestoreMbrWindow optGui;
DWORD dwDiskCount;
- DWORD dwOriginalMbrNb;
- DWORD dwCurrentMbrNb;
+ uintptr_t dwOriginalMbrNb;
+ uintptr_t dwCurrentMbrNb;
char szHdList[2048];
char szTemp[512];
char szTemp2[512];
@@ -209,7 +211,7 @@ void restoreMbr(char *szImageFile, COpti
image.closeReading(true);
throw excep;
}
- SNPRINTF(szTemp, "%.3lu: %s [%llu blocks]", i, mbrOriginal[i].szDevice, mbrOriginal[i].qwBlocksCount);
+ SNPRINTF(szTemp, "%.3u: %s [%"PRIu64" blocks]", i, mbrOriginal[i].szDevice, mbrOriginal[i].qwBlocksCount);
if (options->bBatchMode == false)
optGui.addMbr(szTemp, i);
@@ -319,6 +321,28 @@ void restoreMbr(char *szImageFile, COpti
THROW(ERR_ERRNO, errno);
RETURN;
+}
+
+struct portable_tm *localtime_portable (const time_t *__timer)
+{
+static struct portable_tm ret;
+struct tm *host_tm;
+
+ host_tm=localtime (__timer);
+ ret.tm_sec=host_tm->tm_sec;
+ ret.tm_min=host_tm->tm_min;
+ ret.tm_hour=host_tm->tm_hour;
+ ret.tm_mday=host_tm->tm_mday;
+ ret.tm_mon=host_tm->tm_mon;
+ ret.tm_year=host_tm->tm_year;
+ ret.tm_wday=host_tm->tm_wday;
+ ret.tm_yday=host_tm->tm_yday;
+ ret.tm_isdst=host_tm->tm_isdst;
+
+ ret.tm_gmtoff=host_tm->tm_gmtoff;
+ ret.tm_zone=0;
+
+ return &ret;
}
// =======================================================
@@ -467,7 +491,7 @@ void savePartition(char *szDevice, char
time(&dt);
// current time/date (date of image creation)
- headMain.dateCreate = *localtime(&dt);
+ headMain.dateCreate = *localtime_portable(&dt);
// file format version
strcpy(headMain.szVersion, CURRENT_IMAGE_FORMAT);
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/client/partimage.h
--- a/src/client/partimage.h Tue Sep 04 21:36:14 2007 +0200
+++ b/src/client/partimage.h Tue Sep 04 21:43:30 2007 +0200
@@ -21,6 +21,7 @@
#include <errno.h>
#include <libintl.h> // intl translation
#include <stdio.h>
+#include <stdint.h>
#include <time.h>
#ifdef HAVE_CONFIG_H
@@ -53,10 +54,10 @@ extern time_t g_timeEnd; // End of the
extern time_t g_timeEnd; // End of the operation
typedef bool BOOL; // variant size
-typedef unsigned char BYTE; // 8 bits
-typedef unsigned short int WORD; // 16 bits
-typedef unsigned long int DWORD; // 32 bits
-typedef unsigned long long int QWORD; // 64 bits
+typedef uint8_t BYTE; // 8 bits
+typedef uint16_t WORD; // 16 bits
+typedef uint32_t DWORD; // 32 bits
+typedef uint64_t QWORD; // 64 bits
#include "endianess.h"
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/shared/common.cpp
--- a/src/shared/common.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/shared/common.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -23,6 +23,9 @@
#include <stdlib.h>
#include <ctype.h>
#include <fcntl.h>
+
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -268,7 +271,7 @@ char *formatSize2(QWORD qwSize, char *sz
if (qwSize < llKiloB) // In Bytes
{
- snprintf(szText, nMaxLen, i18n("%lld bytes"), qwSize);
+ snprintf(szText, nMaxLen, i18n("%"PRId64" bytes"), qwSize);
}
else if (qwSize < llMegaB) // In KiloBytes
{
@@ -307,7 +310,7 @@ char *formatSizeNoGui(QWORD qwSize, char
if (qwSize < llKiloB) // In Bytes
{
- snprintf(szText, nMaxLen, i18n("%lldb"), qwSize);
+ snprintf(szText, nMaxLen, i18n("%"PRId64"b"), qwSize);
}
else if (qwSize < llMegaB) // In KiloBytes
{
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/shared/common.h
--- a/src/shared/common.h Tue Sep 04 21:36:14 2007 +0200
+++ b/src/shared/common.h Tue Sep 04 21:43:30 2007 +0200
@@ -146,6 +146,23 @@ struct COptions
#define MAX_UNAMEINFOLEN 65 //SYS_NMLN
+struct portable_tm
+{
+ uint32_t tm_sec;
+ uint32_t tm_min;
+ uint32_t tm_hour;
+ uint32_t tm_mday;
+ uint32_t tm_mon;
+ uint32_t tm_year;
+ uint32_t tm_wday;
+ uint32_t tm_yday;
+ uint32_t tm_isdst;
+
+ uint32_t tm_gmtoff;
+ uint32_t tm_zone;
+};
+
+
// ================================================
struct CMainHeader // size must be 16384 (adjust the reserved data)
{
@@ -163,7 +180,7 @@ struct CMainHeader // size must be 16384
DWORD dwCompression; // COMPRESS_XXXXXX
DWORD dwMainFlags;
- struct tm dateCreate; // date of image creation
+ struct portable_tm dateCreate; // date of image creation
QWORD qwPartSize; // size of the partition in bytes
char szHostname[MAX_HOSTNAMESIZE];
char szVersion[64]; // version of the image file
diff -r 0ffb61b8c31d -r 88ac9824fc14 src/shared/image_disk.cpp
--- a/src/shared/image_disk.cpp Tue Sep 04 21:36:14 2007 +0200
+++ b/src/shared/image_disk.cpp Tue Sep 04 21:43:30 2007 +0200
@@ -524,7 +524,7 @@ void CImageDisk::openWriting() // [Main-
if (m_bIsOpened == true)
THROW(ERR_OPENED);
- SNPRINTF(szShortName, "pi%.8lx", (DWORD)generateIdentificator());
+ SNPRINTF(szShortName, "pi%.8x", (DWORD)generateIdentificator());
extractFilepathFromFullPath(m_szImageFilename, szPathDir); // filepath without filename
if (access(szPathDir, R_OK) == -1) mkdir(szPathDir, 0755);
snprintf(m_szSpaceFilename, MAXPATHLEN, "%s/%8s.tmp", szPathDir, szShortName);