Commit e9015531 authored by Kristian Høgsberg's avatar Kristian Høgsberg
Browse files

2005-07-28 Kristian Høgsberg <krh@redhat.com>

        * poppler/poppler-config.h.in: Add GCC_PRINTF_FORMAT macro to
        annotate printf-like functions (#3638).

        * poppler/Error.h: Add GCC_PRINTF_FORMAT to error().

        * poppler/PSOutputDev.h: Add GCC_PRINTF_FORMAT to
        PSOutputDev::writePSFmt().

        * poppler/PSOutputDev.cc, poppler/GlobalParams.cc: Quiet new
        printf warnings.
parent 9df89c49
2005-07-28 Kristian Høgsberg <krh@redhat.com>
* poppler/poppler-config.h.in: Add GCC_PRINTF_FORMAT macro to
annotate printf-like functions (#3638).
* poppler/Error.h: Add GCC_PRINTF_FORMAT to error().
* poppler/PSOutputDev.h: Add GCC_PRINTF_FORMAT to
PSOutputDev::writePSFmt().
* poppler/PSOutputDev.cc, poppler/GlobalParams.cc: Quiet new
printf warnings.
* poppler/TextOutputDev.cc (TextBlock::visitSelection): Assign
start and stop coordinates in one place so we don't assign the
same point to both in some corner cases.
......
......@@ -16,7 +16,7 @@
#include <stdarg.h>
#include "poppler-config.h"
extern void CDECL error(int pos, char *msg, ...);
extern void CDECL error(int pos, char *msg, ...) GCC_PRINTF_FORMAT (2, 3);
void setErrorFunction(void (* f)(int , char *, va_list args));
......
......@@ -530,7 +530,8 @@ void GlobalParams::parseNameToUnicode(GooList *tokens, GooString *fileName,
sscanf(tok1, "%x", &u);
nameToUnicode->add(tok2, u);
} else {
error(-1, "Bad line in 'nameToUnicode' file (%s:%d)", name, line2);
error(-1, "Bad line in 'nameToUnicode' file (%s:%d)",
name->getCString(), line2);
}
++line2;
}
......
......@@ -2909,8 +2909,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
if (i > 0) {
writePS(" ");
}
writePSFmt("0 1", colorMap->getDecodeLow(i),
colorMap->getDecodeHigh(i));
writePSFmt("0 1");
}
} else {
numComps = colorMap->getNumPixelComps();
......
......@@ -237,7 +237,7 @@ private:
#endif
void writePSChar(char c);
void writePS(char *s);
void writePSFmt(const char *fmt, ...);
void writePSFmt(const char *fmt, ...) GCC_PRINTF_FORMAT(2, 3);
void writePSString(GooString *s);
void writePSName(char *s);
GooString *filterPSName(GooString *name);
......
......@@ -3243,7 +3243,8 @@ void TextSelectionPainter::visitWord (TextWord *word, int begin, int end,
}
void TextWord::visitSelection(TextSelectionVisitor *visitor,
PDFRectangle *selection) {
PDFRectangle *selection)
{
int i, begin, end;
double mid;
......@@ -3303,6 +3304,11 @@ void TextBlock::visitSelection(TextSelectionVisitor *visitor,
begin = NULL;
end = NULL;
start_x = selection->x1;
start_y = selection->y1;
stop_x = selection->x2;
stop_y = selection->y2;
for (p = lines; p != NULL; p = p->next) {
if (selection->x1 < p->xMax && selection->y1 < p->yMax &&
selection->x2 < p->xMax && selection->y2 < p->yMax && begin == NULL) {
......@@ -3369,6 +3375,11 @@ void TextPage::visitSelection(TextSelectionVisitor *visitor,
begin = nBlocks;
end = 0;
start_x = selection->x1;
start_y = selection->y1;
stop_x = selection->x2;
stop_y = selection->y2;
for (i = 0; i < nBlocks; i++) {
b = blocks[i];
......
......@@ -142,4 +142,16 @@
#define CDECL
#endif
//------------------------------------------------------------------------
// Compiler
//------------------------------------------------------------------------
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define GCC_PRINTF_FORMAT(fmt_index, va_index) \
__attribute__((__format__(__printf__, fmt_index, va_index)))
#else
#define GCC_PRINTF_FORMAT (fmt_index, va_index)
#endif
#endif /* POPPLER_CONFIG_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment