libprint: fix invalid use of long.

This commit is contained in:
Jérôme Duval
2017-07-16 11:35:42 +02:00
parent ce058fa0a9
commit c57b500a15
6 changed files with 19 additions and 17 deletions
+3 -1
View File
@@ -11,10 +11,12 @@
#include <Message.h> #include <Message.h>
#include <Node.h> #include <Node.h>
#include <stdio.h>
// #define DBG // #define DBG
#ifdef DBG #ifdef DBG
void write_debug_stream(const char *, ...); void write_debug_stream(const char *, ...) __PRINTFLIKE(1,2);
void DUMP_BFILE(BFile *file, const char *name); void DUMP_BFILE(BFile *file, const char *name);
void DUMP_BMESSAGE(BMessage *msg); void DUMP_BMESSAGE(BMessage *msg);
void DUMP_BDIRECTORY(BDirectory *dir); void DUMP_BDIRECTORY(BDirectory *dir);
+3 -3
View File
@@ -39,8 +39,8 @@ public:
private: private:
BFile *fFile; BFile *fFile;
bool fReverse; bool fReverse;
int fPictureCount; int32 fPictureCount;
int fRest; int32 fRest;
off_t fOffset; off_t fOffset;
bool fHollow; bool fHollow;
}; };
@@ -49,7 +49,7 @@ typedef list<PageData *> PageDataList;
class SpoolData { class SpoolData {
public: public:
SpoolData(BFile *file, int page_count, int nup, bool reverse); SpoolData(BFile *file, int32 page_count, int32 nup, bool reverse);
~SpoolData(); ~SpoolData();
bool startEnum(); bool startEnum();
bool enumObject(PageData **); bool enumObject(PageData **);
+2 -2
View File
@@ -26,9 +26,9 @@ protected:
UIDriver& operator=(const UIDriver &); UIDriver& operator=(const UIDriver &);
virtual long PageSetup(JobData* jobData, PrinterData* printerData, virtual status_t PageSetup(JobData* jobData, PrinterData* printerData,
const PrinterCap* printerCap); const PrinterCap* printerCap);
virtual long JobSetup(JobData* jobData, PrinterData* printerData, virtual status_t JobSetup(JobData* jobData, PrinterData* printerData,
const PrinterCap* printerCap); const PrinterCap* printerCap);
private: private:
+1 -1
View File
@@ -53,7 +53,7 @@ void DUMP_BMESSAGE(BMessage *msg)
int32 count = 0; int32 count = 0;
DBGMSG(("\t************ START - DUMP BMessage ***********\n")); DBGMSG(("\t************ START - DUMP BMessage ***********\n"));
DBGMSG(("\taddress: 0x%x\n", (int)msg)); DBGMSG(("\taddress: %p\n", msg));
if (!msg) if (!msg)
return; return;
+8 -8
View File
@@ -54,8 +54,8 @@ PageData::PageData(BFile *file, bool reverse)
fHollow = false; fHollow = false;
if (reverse) { if (reverse) {
file->Read(&fPictureCount, sizeof(long)); file->Read(&fPictureCount, sizeof(int32));
DBGMSG(("picture_count = %d\n", (int)fPictureCount)); DBGMSG(("picture_count = %" B_PRId32 "\n", fPictureCount));
fOffset = fFile->Position(); fOffset = fFile->Position();
off_t o = fOffset; off_t o = fOffset;
// seek to start of next page // seek to start of next page
@@ -75,8 +75,8 @@ PageData::startEnum()
return false; return false;
if (fOffset == 0) { if (fOffset == 0) {
fFile->Read(&fPictureCount, sizeof(long)); fFile->Read(&fPictureCount, sizeof(int32));
DBGMSG(("picture_count = %d\n", (int)fPictureCount)); DBGMSG(("picture_count = %" B_PRId32 "\n", fPictureCount));
fOffset = fFile->Position(); fOffset = fFile->Position();
} else { } else {
fFile->Seek(fOffset, SEEK_SET); fFile->Seek(fOffset, SEEK_SET);
@@ -104,15 +104,15 @@ PageData::enumObject(PictureData **picture_data)
} }
SpoolData::SpoolData(BFile *file, int page_count, int nup, bool reverse) SpoolData::SpoolData(BFile *file, int32 page_count, int32 nup, bool reverse)
{ {
DBGMSG(("nup = %d\n", nup)); DBGMSG(("nup = %" B_PRId32 "\n", nup));
DBGMSG(("page_count = %d\n", page_count)); DBGMSG(("page_count = %" B_PRId32 "\n", page_count));
DBGMSG(("reverse = %s\n", reverse ? "true" : "false")); DBGMSG(("reverse = %s\n", reverse ? "true" : "false"));
if (reverse) { if (reverse) {
if (nup > 1) { if (nup > 1) {
for (int page_index = 0; page_index < page_count; page_index++) { for (int32 page_index = 0; page_index < page_count; page_index++) {
if (page_index % nup == 0) { if (page_index % nup == 0) {
fPages.push_front(new PageData(file, reverse)); fPages.push_front(new PageData(file, reverse));
fIt = fPages.begin(); fIt = fPages.begin();
+2 -2
View File
@@ -66,7 +66,7 @@ UIDriver::ConfigJob()
} }
long status_t
UIDriver::PageSetup(JobData* jobData, PrinterData* printerData, UIDriver::PageSetup(JobData* jobData, PrinterData* printerData,
const PrinterCap* printerCap) const PrinterCap* printerCap)
{ {
@@ -75,7 +75,7 @@ UIDriver::PageSetup(JobData* jobData, PrinterData* printerData,
} }
long status_t
UIDriver::JobSetup(JobData *jobData, PrinterData *printerData, UIDriver::JobSetup(JobData *jobData, PrinterData *printerData,
const PrinterCap *printerCap) const PrinterCap *printerCap)
{ {