Skip to content

Commit

Permalink
fixed -Wnarrowing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
andimachovec authored and waddlesplash committed Dec 11, 2024
1 parent 58c849a commit 0fffb77
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 48 deletions.
58 changes: 29 additions & 29 deletions application/BaseEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class BaseEngine
public:
BaseEngine(void);
virtual ~BaseEngine();

void Start(void);
void Stop(void);

void StopTextSearch(void);

// the name of the file this engine handles
Expand All @@ -52,80 +52,80 @@ class BaseEngine

// the angle in degrees the given page is rotated natively (usually 0 deg)
virtual int const& PageRotation(int pageNumber);
virtual std::unique_ptr<BBitmap> RenderBitmap(int const& pageNumber,int const& width,
int const& height, int const& rotation = 0) = 0;

virtual std::unique_ptr<BBitmap> RenderBitmap(int const& pageNumber,uint32 const& width,
uint32 const& height, int const& rotation = 0) = 0;

virtual BBitmap* Page(int pageNumber);

// access to various document properties (such as Author, Title, etc.)
virtual BString GetProperty(BString name) { return BString(""); }

virtual BString GetPageLabel(int pageNumber);

// reverts GetPageLabel by returning the first page number
// having the given label
virtual int GetPageByLabel(BString label);

// returns a string to remember when the user wants to save
// a document's password (don't implement for document types
// that don't support password protection)
virtual BString GetDecryptionKey(void) const;

virtual void SetCacheSize(int forwardCache, int backwardCache = 0);
virtual void MultiplyZoom(float factor);

virtual void WriteOutline(BOutlineListView* list);

virtual void FindString(BString const& name, BLooper* looper, BHandler* handler,
int32 flag = 0);

bool HighlightUnderText(void);

bool fStopThread;

protected:
virtual std::pair<BBitmap*, bool> _RenderBitmap(int const& pageNumber) = 0;
virtual std::tuple< std::vector<BString>, std::vector<BRect> >
_FindString(BString const& name, int const& page);


static void* _DrawingThread(void* arg);

pthread_t fDrawingThread;

static pthread_mutex_t gEngineStopMutex;


float fZoomFactor;
int fPages;
int fRotation;
int fForwardCache;
int fBackwardCache;
int fCurrentPageNo;

int32 fSearchFlag;

std::vector<std::pair< BBitmap*, bool> > fBitmap;
std::vector<pthread_mutex_t> fMutex;

BRect fDefaultRect;
bool fHighlightUnderText;

Debug out;

private:
static void* _TextSearchThread(void* arg);

pthread_t fTextSearchThread;

bool fStopTextSearchThread;

static pthread_mutex_t gTextSearchStopMutex;

BLooper* fTargetLooper;
BHandler* fSearchHandler;

BString fSearchString;
};

Expand Down
2 changes: 1 addition & 1 deletion application/DJVUEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ DJVUEngine::FileName(void) const

unique_ptr<BBitmap>
DJVUEngine::RenderBitmap(int const& pageNumber,
int const& width, int const& height, int const& rotation)
uint32 const& width, uint32 const& height, int const& rotation)
{
if (pageNumber < 0 || pageNumber >= fPages) {
return unique_ptr<BBitmap>(nullptr);
Expand Down
16 changes: 8 additions & 8 deletions application/DJVUEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@ class DJVUEngine : public BaseEngine
int PageCount(void) const;

virtual BString GetProperty(BString name);

virtual void WriteOutline(BOutlineListView* list);

virtual std::unique_ptr<BBitmap> RenderBitmap(int const& pageNumber,int const& width,
int const& height, int const& rotation = 0);
virtual std::unique_ptr<BBitmap> RenderBitmap(int const& pageNumber,uint32 const& width,
uint32 const& height, int const& rotation = 0);

private:
virtual std::pair<BBitmap*, bool> _RenderBitmap(int const& pageNumber);

virtual std::tuple< std::vector<BString>, std::vector<BRect> >
_FindString(BString const& name, int const& page);

void _HandleDjvuMessages(ddjvu_context_t *context,
int wait = false);

BString fFileName;
BString fPassword;

ddjvu_context_t* fContext;
ddjvu_document_t* fDocument;

static pthread_mutex_t gRendermutex;

Debug out;
Expand Down
6 changes: 3 additions & 3 deletions application/PDFEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ PDFEngine::FileName(void) const

unique_ptr<BBitmap>
PDFEngine::RenderBitmap(int const& pageNumber,
int const& width, int const& height, int const& rotation)
uint32 const& width, uint32 const& height, int const& rotation)
{
if (pageNumber < 0 || pageNumber >= fPages) {
return unique_ptr<BBitmap>(nullptr);
Expand Down Expand Up @@ -342,7 +342,7 @@ PDFEngine::RenderBitmap(int const& pageNumber,
fz_run_display_list(fRenderContext, list, dev, ctm, bounds, nullptr);
else
fz_run_page(fRenderContext, page, dev, ctm, nullptr);

fz_close_device(fRenderContext, dev);
fz_drop_device(fRenderContext, dev);
dev = nullptr;
Expand All @@ -368,7 +368,7 @@ PDFEngine::RenderBitmap(int const& pageNumber,
BBitmap* bitmap = new BBitmap(BRect(0, 0, imageWidth - 1, imageHeight - 1), B_RGBA32);
bitmap->SetBits(fz_pixmap_samples(fRenderContext, image),
imageWidth * imageHeight * fz_pixmap_components(fRenderContext, image), 0, B_RGBA32);

fz_close_device(fRenderContext, dev);
fz_drop_device(fRenderContext, dev);
fz_drop_pixmap(fRenderContext, image);
Expand Down
14 changes: 7 additions & 7 deletions application/PDFEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class PDFEngine : public BaseEngine
int PageCount(void) const;

virtual BString GetProperty(BString name);

virtual void WriteOutline(BOutlineListView* list);
virtual std::unique_ptr<BBitmap> RenderBitmap(int const& pageNumber,int const& width,
int const& height, int const& rotation = 0);

virtual std::unique_ptr<BBitmap> RenderBitmap(int const& pageNumber,uint32 const& width,
uint32 const& height, int const& rotation = 0);

private:
virtual std::pair<BBitmap*, bool> _RenderBitmap(int const& pageNumber);
Expand All @@ -47,16 +47,16 @@ class PDFEngine : public BaseEngine
fz_document* fDocument;
fz_context* fContext;
fz_context* fRenderContext;

fz_page* fPage;
fz_display_list* fList;
fz_device* fDev;

fz_colorspace* fColorSpace;

BString fFileName;
BString fPassword;

pthread_mutex_t fRendermutex = PTHREAD_MUTEX_INITIALIZER;

Debug out;
Expand Down

0 comments on commit 0fffb77

Please sign in to comment.