1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072
|
Description: poppler 0.71 removed several functions we rely on; update accordingly
Author: Iain Lane <iain.lane@canonical.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915618
Index: b/xpdf/PDFCore.cc
===================================================================
--- a/xpdf/PDFCore.cc
+++ b/xpdf/PDFCore.cc
@@ -144,7 +144,7 @@
delete out;
}
-int PDFCore::loadFile(GString *fileName, GString *ownerPassword,
+int PDFCore::loadFile(const GString *fileName, GString *ownerPassword,
GString *userPassword) {
int err;
@@ -208,9 +208,7 @@
// nothing displayed yet
topPage = -99;
midPage = -99;
- while (pages->getLength() > 0) {
- delete (PDFCorePage *)pages->del(0);
- }
+ pages->clear();
// compute the max unscaled page size
maxUnscaledPageW = maxUnscaledPageH = 0;
@@ -244,9 +242,7 @@
// no page displayed
topPage = -99;
midPage = -99;
- while (pages->getLength() > 0) {
- delete (PDFCorePage *)pages->del(0);
- }
+ pages->clear();
// redraw
scrollX = scrollY = 0;
@@ -269,9 +265,7 @@
// no page displayed
topPage = -99;
midPage = -99;
- while (pages->getLength() > 0) {
- delete (PDFCorePage *)pages->del(0);
- }
+ pages->clear();
// redraw
scrollX = scrollY = 0;
@@ -491,9 +485,7 @@
rotateA != rotate) {
needUpdate = gTrue;
setSelection(0, 0, 0, 0, 0);
- while (pages->getLength() > 0) {
- delete (PDFCorePage *)pages->del(0);
- }
+ pages->clear();
zoom = zoomA;
rotate = rotateA;
dpi = dpiA;
@@ -613,14 +605,21 @@
// delete pages that are no longer needed and insert new pages
// objects that are needed
- while (pages->getLength() > 0 &&
- ((PDFCorePage *)pages->get(0))->page < pg0) {
- delete (PDFCorePage *)pages->del(0);
- }
- i = pages->getLength() - 1;
- while (i > 0 && ((PDFCorePage *)pages->get(i))->page > pg1) {
- delete (PDFCorePage *)pages->del(i--);
+ for (auto it = pages->begin(); it != pages->end();) {
+ auto page = static_cast<PDFCorePage *> (*it);
+ if (page->page >= pg0)
+ break;
+ it = pages->erase(it);
}
+
+ for (auto it = pages->rbegin(); it != pages->rend();) {
+ auto page = static_cast<PDFCorePage *> (*it);
+ if (page->page <= pg1)
+ break;
+
+ it = decltype(it){ pages->erase(std::next(it).base()) };
+ }
+
j = pages->getLength() > 0 ? ((PDFCorePage *)pages->get(0))->page - 1
: pg1;
for (i = pg0; i <= j; ++i) {
@@ -648,11 +647,11 @@
}
// delete tiles that are no longer needed
- for (i = 0; i < pages->getLength(); ++i) {
- page = (PDFCorePage *)pages->get(i);
+ for (auto it = pages->begin(); it != pages->end(); it++) {
+ page = static_cast<PDFCorePage *> (*it);
j = 0;
- while (j < page->tiles->getLength()) {
- tile = (PDFCoreTile *)page->tiles->get(j);
+ for (auto itt = page->tiles->begin(); itt != page->tiles->end();) {
+ tile = static_cast<PDFCoreTile *> (*itt);
if (continuousMode) {
y0 = pageY[page->page - 1] + tile->yMin;
y1 = pageY[page->page - 1] + tile->yMax;
@@ -664,9 +663,9 @@
tile->xMin > scrollX + drawAreaWidth + drawAreaWidth / 2 ||
y1 < scrollY - drawAreaHeight / 2 ||
y0 > scrollY + drawAreaHeight + drawAreaHeight / 2) {
- delete (PDFCoreTile *)page->tiles->del(j);
+ itt = page->tiles->erase(itt);
} else {
- ++j;
+ itt++;
}
}
}
@@ -831,10 +830,16 @@
tileH = h ? h : 1;
}
page = new PDFCorePage(pg, w, h, tileW, tileH);
- for (i = 0;
- i < pages->getLength() && pg > ((PDFCorePage *)pages->get(i))->page;
- ++i) ;
- pages->insert(i, page);
+
+ for (auto it = pages->begin(); it != pages->end(); it++) {
+ auto curpage = static_cast<PDFCorePage *> (*it);
+ if (pg <= curpage->page) {
+ pages->insert(it, page);
+ return;
+ }
+ }
+
+ pages->insert(pages->begin(), page);
}
void PDFCore::needTile(PDFCorePage *page, int x, int y) {
@@ -932,7 +937,7 @@
delete textOut;
}
}
- page->tiles->append(tile);
+ page->tiles->push_back(tile);
curTile = NULL;
curPage = NULL;
Index: b/xpdf/XPDFCore.h
===================================================================
--- a/xpdf/XPDFCore.h
+++ b/xpdf/XPDFCore.h
@@ -36,11 +36,11 @@
// callbacks
//------------------------------------------------------------------------
-typedef void (*XPDFUpdateCbk)(void *data, GString *fileName,
+typedef void (*XPDFUpdateCbk)(void *data, const GString *fileName,
int pageNum, int numPages,
const char *linkLabel);
-typedef void (*XPDFActionCbk)(void *data, char *action);
+typedef void (*XPDFActionCbk)(void *data, const char *action);
typedef void (*XPDFKeyPressCbk)(void *data, KeySym key, Guint modifiers,
XEvent *event);
@@ -65,7 +65,7 @@
//----- loadFile / displayPage / displayDest
// Load a new file. Returns pdfOk or error code.
- virtual int loadFile(GString *fileName, GString *ownerPassword = NULL,
+ virtual int loadFile(const GString *fileName, GString *ownerPassword = NULL,
GString *userPassword = NULL);
// Load a new file, via a Stream instead of a file name. Returns
Index: b/xpdf/XPDFCore.cc
===================================================================
--- a/xpdf/XPDFCore.cc
+++ b/xpdf/XPDFCore.cc
@@ -35,6 +35,7 @@
#include "SplashPattern.h"
#include "XPDFApp.h"
#include "XPDFCore.h"
+#include "xfile.h"
// these macro defns conflict with xpdf's Object class
#ifdef LESSTIF_VERSION
@@ -184,7 +185,7 @@
// loadFile / displayPage / displayDest
//------------------------------------------------------------------------
-int XPDFCore::loadFile(GString *fileName, GString *ownerPassword,
+int XPDFCore::loadFile(const GString *fileName, GString *ownerPassword,
GString *userPassword) {
int err;
@@ -475,14 +476,14 @@
&& (*target == XA_STRING
|| *target == textAtom
|| *target == compoundtextAtom)) {
- char *str = currentSelection->getCString();
+ const char *str = currentSelection->getCString();
XICCEncodingStyle style
= (*target == XA_STRING ? XStringStyle
: *target == textAtom ? XStdICCTextStyle
: XCompoundTextStyle);
XTextProperty t;
int ret = Xutf8TextListToTextProperty(XtDisplay(widget),
- &str,1, style, &t);
+ (char **) &str,1, style, &t);
if (ret < 0) {
error(errInternal, -1 , "cannot form text property, error {0:d}", ret);
return False;
@@ -528,7 +529,7 @@
LinkActionKind kind;
LinkDest *dest;
GString *namedDest;
- char *s;
+ const char *s;
GString *fileName, *fileName2;
GString *cmd;
GString *actionName;
@@ -558,7 +559,7 @@
} else if ((namedDest = (GString*) ((LinkGoToR *)action)->getNamedDest())) {
namedDest = namedDest->copy();
}
- s = (char*) ((LinkGoToR *)action)->getFileName()->getCString();
+ s = (const char*) ((LinkGoToR *)action)->getFileName()->getCString();
//~ translate path name for VMS (deal with '/')
if (isAbsolutePath(s) || !doc->getFileName()) {
fileName = new GString(s);
@@ -755,7 +756,7 @@
// <arg> string to insert in place of the '%s'.
void XPDFCore::runCommand(GString *cmdFmt, GString *arg) {
GString *cmd;
- char *s;
+ const char *s;
int errcode;
if ((s = strstr(cmdFmt->getCString(), "%s"))) {
@@ -1540,9 +1541,8 @@
XtSetArg(args[n], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ++n;
s1 = XmStringCreateLocalized((char *)title);
XtSetArg(args[n], XmNdialogTitle, s1); ++n;
- s2 = NULL; // make gcc happy
if (msg->getLength() <= 80) {
- s2 = XmStringCreateLocalized(msg->getCString());
+ s2 = XmStringCreateLocalized((char *) msg->getCString());
XtSetArg(args[n], XmNmessageString, s2); ++n;
}
dialog = XmCreateMessageDialog(drawArea, "questionDialog", args, n);
Index: b/xpdf/PDFCore.h
===================================================================
--- a/xpdf/PDFCore.h
+++ b/xpdf/PDFCore.h
@@ -127,7 +127,7 @@
//----- loadFile / displayPage / displayDest
// Load a new file. Returns pdfOk or error code.
- virtual int loadFile(GString *fileName, GString *ownerPassword = NULL,
+ virtual int loadFile(const GString *fileName, GString *ownerPassword = NULL,
GString *userPassword = NULL);
#ifdef _WIN32
Index: b/xpdf/XPDFApp.cc
===================================================================
--- a/xpdf/XPDFApp.cc
+++ b/xpdf/XPDFApp.cc
@@ -220,7 +220,7 @@
}
}
-XPDFViewer *XPDFApp::open(GString *fileName, int page,
+XPDFViewer *XPDFApp::open(const GString *fileName, int page,
GString *ownerPassword, GString *userPassword) {
XPDFViewer *viewer;
@@ -237,7 +237,7 @@
&remoteMsgCbk, this);
XSetSelectionOwner(display, remoteAtom, XtWindow(remoteWin), CurrentTime);
}
- viewers->append(viewer);
+ viewers->push_back(viewer);
return viewer;
}
@@ -259,7 +259,7 @@
&remoteMsgCbk, this);
XSetSelectionOwner(display, remoteAtom, XtWindow(remoteWin), CurrentTime);
}
- viewers->append(viewer);
+ viewers->push_back(viewer);
return viewer;
}
@@ -267,12 +267,8 @@
GBool fullScreenA) {
int i;
- for (i = 0; i < viewers->getLength(); ++i) {
- if (((XPDFViewer *)viewers->get(i)) == viewer) {
- viewers->del(i);
- delete viewer;
- }
- }
+ viewers->erase(std::remove(viewers->begin(), viewers->end(), viewer), viewers->end());
+
viewer = new XPDFViewer(this, doc, page, NULL, fullScreenA);
if (!viewer->isOk()) {
delete viewer;
@@ -285,7 +281,7 @@
&remoteMsgCbk, this);
XSetSelectionOwner(display, remoteAtom, XtWindow(remoteWin), CurrentTime);
}
- viewers->append(viewer);
+ viewers->push_back(viewer);
return viewer;
}
@@ -304,7 +300,7 @@
} else {
for (i = 0; i < viewers->getLength(); ++i) {
if (((XPDFViewer *)viewers->get(i)) == viewer) {
- viewers->del(i);
+ viewers->erase(viewers->begin() + i);
if (remoteAtom != None && remoteViewer == viewer) {
remoteViewer = (XPDFViewer *)viewers->get(viewers->getLength() - 1);
remoteWin = remoteViewer->getWindow();
@@ -322,9 +318,7 @@
if (remoteAtom != None) {
XSetSelectionOwner(display, remoteAtom, None, CurrentTime);
}
- while (viewers->getLength() > 0) {
- delete (XPDFViewer *)viewers->del(0);
- }
+ viewers->clear();
#if HAVE_XTAPPSETEXITFLAG
XtAppSetExitFlag(appContext);
#else
Index: b/goo/gfile.h
===================================================================
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -68,24 +68,24 @@
// string, denoting the current directory). Returns <path>.
extern GString *appendToPath(GString *path, const char *fileName);
+*/
+
// Grab the path from the front of the file name. If there is no
// directory component in <fileName>, returns an empty string.
-extern GString *grabPath(char *fileName);
+extern GString *grabPath(const char *fileName);
// Is this an absolute path or file name?
-extern GBool isAbsolutePath(char *path);
-
-*/
+extern GBool isAbsolutePath(const char *path);
// Make this path absolute by prepending current directory (if path is
// relative) or prepending user's directory (if path starts with '~').
extern GString *makePathAbsolute(GString *path);
-/*
-
// Get the modification time for <fileName>. Returns 0 if there is an
// error.
-extern time_t getModTime(char *fileName);
+time_t getModTime(const char *fileName);
+
+/*
// Create a temporary file and open it for writing. If <ext> is not
// NULL, it will be used as the file name extension. Returns both the
Index: b/goo/gfile.cc
===================================================================
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -275,7 +275,9 @@
#endif
}
-GString *grabPath(char *fileName) {
+*/
+
+GString *grabPath(const char *fileName) {
#ifdef VMS
//---------- VMS ----------
char *p;
@@ -316,7 +318,7 @@
#else
//---------- Unix ----------
- char *p;
+ const char *p;
if ((p = strrchr(fileName, '/')))
return new GString(fileName, p - fileName);
@@ -324,7 +326,7 @@
#endif
}
-GBool isAbsolutePath(char *path) {
+GBool isAbsolutePath(const char *path) {
#ifdef VMS
//---------- VMS ----------
return strchr(path, ':') ||
@@ -348,8 +350,6 @@
#endif
}
-*/
-
GString *makePathAbsolute(GString *path) {
#ifdef VMS
//---------- VMS ----------
@@ -391,7 +391,7 @@
struct passwd *pw;
char buf[PATH_MAX+1];
GString *s;
- char *p1, *p2;
+ const char *p1, *p2;
int n;
if (path->getChar(0) == '~') {
@@ -432,9 +432,7 @@
#endif
}
-/*
-
-time_t getModTime(char *fileName) {
+time_t getModTime(const char *fileName) {
#ifdef _WIN32
//~ should implement this, but it's (currently) only used in xpdf
return 0;
@@ -448,6 +446,8 @@
#endif
}
+/*
+
GBool openTempFile(GString **name, FILE **f,
const char *mode, const char *ext) {
#if defined(_WIN32)
Index: b/xpdf/GlobalParams.cc
===================================================================
--- a/xpdf/GlobalParams.cc
+++ b/xpdf/GlobalParams.cc
@@ -406,7 +406,7 @@
} else {
p1 = p0 + strlen(p0);
}
- fonts->append(makeWindowsFont(p0, fontNum,
+ fonts->push_back(makeWindowsFont(p0, fontNum,
fontPath->getCString()));
p0 = p1;
++fontNum;
@@ -486,7 +486,7 @@
mods = modsA;
context = contextA;
cmds = new GList();
- cmds->append(new GString(cmd0));
+ cmds->push_back(new GString(cmd0));
}
KeyBinding::KeyBinding(int codeA, int modsA, int contextA,
@@ -495,8 +495,8 @@
mods = modsA;
context = contextA;
cmds = new GList();
- cmds->append(new GString(cmd0));
- cmds->append(new GString(cmd1));
+ cmds->push_back(new GString(cmd0));
+ cmds->push_back(new GString(cmd1));
}
KeyBinding::KeyBinding(int codeA, int modsA, int contextA, GList *cmdsA) {
@@ -875,132 +875,132 @@
keyBindings = new GList();
//----- mouse buttons
- keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress1, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMousePress1, xpdfKeyModNone,
xpdfKeyContextAny, "startSelection"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeMouseRelease1, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMouseRelease1, xpdfKeyModNone,
xpdfKeyContextAny, "endSelection",
"followLinkNoSel"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress2, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMousePress2, xpdfKeyModNone,
xpdfKeyContextAny, "startPan"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeMouseRelease2, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMouseRelease2, xpdfKeyModNone,
xpdfKeyContextAny, "endPan"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress3, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMousePress3, xpdfKeyModNone,
xpdfKeyContextAny, "postPopupMenu"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress4, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMousePress4, xpdfKeyModNone,
xpdfKeyContextAny,
"scrollUpPrevPage(16)"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress5, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMousePress5, xpdfKeyModNone,
xpdfKeyContextAny,
"scrollDownNextPage(16)"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress6, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMousePress6, xpdfKeyModNone,
xpdfKeyContextAny, "scrollLeft(16)"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress7, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeMousePress7, xpdfKeyModNone,
xpdfKeyContextAny, "scrollRight(16)"));
//----- keys
- keyBindings->append(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModCtrl,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModCtrl,
xpdfKeyContextAny, "gotoPage(1)"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModNone,
xpdfKeyContextAny, "scrollToTopLeft"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModCtrl,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModCtrl,
xpdfKeyContextAny, "gotoLastPage"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModNone,
xpdfKeyContextAny,
"scrollToBottomRight"));
- keyBindings->append(new KeyBinding(xpdfKeyCodePgUp, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodePgUp, xpdfKeyModNone,
xpdfKeyContextAny, "pageUp"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeBackspace, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeBackspace, xpdfKeyModNone,
xpdfKeyContextAny, "pageUp"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeDelete, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeDelete, xpdfKeyModNone,
xpdfKeyContextAny, "pageUp"));
- keyBindings->append(new KeyBinding(xpdfKeyCodePgDn, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodePgDn, xpdfKeyModNone,
xpdfKeyContextAny, "pageDown"));
- keyBindings->append(new KeyBinding(' ', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(' ', xpdfKeyModNone,
xpdfKeyContextAny, "pageDown"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeLeft, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeLeft, xpdfKeyModNone,
xpdfKeyContextAny, "scrollLeft(16)"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeRight, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeRight, xpdfKeyModNone,
xpdfKeyContextAny, "scrollRight(16)"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeUp, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeUp, xpdfKeyModNone,
xpdfKeyContextAny, "scrollUp(16)"));
- keyBindings->append(new KeyBinding(xpdfKeyCodeDown, xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(xpdfKeyCodeDown, xpdfKeyModNone,
xpdfKeyContextAny, "scrollDown(16)"));
- keyBindings->append(new KeyBinding('o', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('o', xpdfKeyModNone,
xpdfKeyContextAny, "open"));
- keyBindings->append(new KeyBinding('O', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('O', xpdfKeyModNone,
xpdfKeyContextAny, "open"));
- keyBindings->append(new KeyBinding('r', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('r', xpdfKeyModNone,
xpdfKeyContextAny, "reload"));
- keyBindings->append(new KeyBinding('R', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('R', xpdfKeyModNone,
xpdfKeyContextAny, "reload"));
- keyBindings->append(new KeyBinding('s', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('s', xpdfKeyModNone,
xpdfKeyContextAny, "saveAs"));
- keyBindings->append(new KeyBinding('S', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('S', xpdfKeyModNone,
xpdfKeyContextAny, "saveAs"));
- keyBindings->append(new KeyBinding('f', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('f', xpdfKeyModNone,
xpdfKeyContextAny, "find"));
- keyBindings->append(new KeyBinding('F', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('F', xpdfKeyModNone,
xpdfKeyContextAny, "find"));
- keyBindings->append(new KeyBinding('f', xpdfKeyModCtrl,
+ keyBindings->push_back(new KeyBinding('f', xpdfKeyModCtrl,
xpdfKeyContextAny, "find"));
- keyBindings->append(new KeyBinding('g', xpdfKeyModCtrl,
+ keyBindings->push_back(new KeyBinding('g', xpdfKeyModCtrl,
xpdfKeyContextAny, "findNext"));
- keyBindings->append(new KeyBinding('p', xpdfKeyModCtrl,
+ keyBindings->push_back(new KeyBinding('p', xpdfKeyModCtrl,
xpdfKeyContextAny, "print"));
- keyBindings->append(new KeyBinding('n', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('n', xpdfKeyModNone,
xpdfKeyContextScrLockOff, "nextPage"));
- keyBindings->append(new KeyBinding('N', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('N', xpdfKeyModNone,
xpdfKeyContextScrLockOff, "nextPage"));
- keyBindings->append(new KeyBinding('n', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('n', xpdfKeyModNone,
xpdfKeyContextScrLockOn,
"nextPageNoScroll"));
- keyBindings->append(new KeyBinding('N', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('N', xpdfKeyModNone,
xpdfKeyContextScrLockOn,
"nextPageNoScroll"));
- keyBindings->append(new KeyBinding('p', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('p', xpdfKeyModNone,
xpdfKeyContextScrLockOff, "prevPage"));
- keyBindings->append(new KeyBinding('P', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('P', xpdfKeyModNone,
xpdfKeyContextScrLockOff, "prevPage"));
- keyBindings->append(new KeyBinding('p', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('p', xpdfKeyModNone,
xpdfKeyContextScrLockOn,
"prevPageNoScroll"));
- keyBindings->append(new KeyBinding('P', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('P', xpdfKeyModNone,
xpdfKeyContextScrLockOn,
"prevPageNoScroll"));
- keyBindings->append(new KeyBinding('[', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('[', xpdfKeyModNone,
xpdfKeyContextAny, "rotateCCW"));
- keyBindings->append(new KeyBinding(']', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding(']', xpdfKeyModNone,
xpdfKeyContextAny, "rotateCW"));
- keyBindings->append(new KeyBinding('v', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('v', xpdfKeyModNone,
xpdfKeyContextAny, "goForward"));
- keyBindings->append(new KeyBinding('b', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('b', xpdfKeyModNone,
xpdfKeyContextAny, "goBackward"));
- keyBindings->append(new KeyBinding('g', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('g', xpdfKeyModNone,
xpdfKeyContextAny, "focusToPageNum"));
- keyBindings->append(new KeyBinding('0', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('0', xpdfKeyModNone,
xpdfKeyContextAny, "zoomPercent(125)"));
- keyBindings->append(new KeyBinding('+', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('+', xpdfKeyModNone,
xpdfKeyContextAny, "zoomIn"));
- keyBindings->append(new KeyBinding('-', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('-', xpdfKeyModNone,
xpdfKeyContextAny, "zoomOut"));
- keyBindings->append(new KeyBinding('z', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('z', xpdfKeyModNone,
xpdfKeyContextAny, "zoomFitPage"));
- keyBindings->append(new KeyBinding('h', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('h', xpdfKeyModNone,
xpdfKeyContextAny, "zoomFitHeight"));
- keyBindings->append(new KeyBinding('w', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('w', xpdfKeyModNone,
xpdfKeyContextAny, "zoomFitWidth"));
- keyBindings->append(new KeyBinding('f', xpdfKeyModAlt,
+ keyBindings->push_back(new KeyBinding('f', xpdfKeyModAlt,
xpdfKeyContextAny,
"toggleFullScreenMode"));
- keyBindings->append(new KeyBinding('l', xpdfKeyModCtrl,
+ keyBindings->push_back(new KeyBinding('l', xpdfKeyModCtrl,
xpdfKeyContextAny, "redraw"));
- keyBindings->append(new KeyBinding('w', xpdfKeyModCtrl,
+ keyBindings->push_back(new KeyBinding('w', xpdfKeyModCtrl,
xpdfKeyContextAny, "closeWindowOrQuit"));
- keyBindings->append(new KeyBinding('?', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('?', xpdfKeyModNone,
xpdfKeyContextAny, "about"));
- keyBindings->append(new KeyBinding('q', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('q', xpdfKeyModNone,
xpdfKeyContextAny, "quit"));
- keyBindings->append(new KeyBinding('Q', xpdfKeyModNone,
+ keyBindings->push_back(new KeyBinding('Q', xpdfKeyModNone,
xpdfKeyContextAny, "quit"));
}
@@ -1035,7 +1035,7 @@
} else {
for (p2 = p1 + 1; *p2 && !isspace(*p2); ++p2) ;
}
- tokens->append(new GString(p1, (int)(p2 - p1)));
+ tokens->push_back(new GString(p1, (int)(p2 - p1)));
p1 = *p2 ? p2 + 1 : p2;
}
@@ -1383,7 +1383,7 @@
list = new GList();
cMapDirs->add(collection->copy(), list);
}
- list->append(dir->copy());
+ list->push_back(dir->copy());
}
void GlobalParams::parseToUnicodeDir(GList *tokens, GString *fileName,
@@ -1394,7 +1394,7 @@
fileName, line);
return;
}
- toUnicodeDirs->append(((GString *)tokens->get(1))->copy());
+ toUnicodeDirs->push_back(((GString *)tokens->get(1))->copy());
}
*/
@@ -1417,7 +1417,7 @@
fileName, line);
return;
}
- fontDirs->append(((GString *)tokens->get(1))->copy());
+ fontDirs->push_back(((GString *)tokens->get(1))->copy());
}
void GlobalParams::parseFontFileCC(GList *tokens, GString *fileName,
@@ -1451,7 +1451,7 @@
if (tokens->getLength() == 2) {
tok = (GString *)tokens->get(1);
- if (!setPSPaperSize(tok->getCString())) {
+ if (!setPSPaperSize((char *) tok->getCString())) {
error(errConfig, -1,
"Bad 'psPaperSize' config file command ({0:s}:{1:d})",
fileName, line);
@@ -1549,7 +1549,7 @@
wMode,
((GString *)tokens->get(3))->copy(),
((GString *)tokens->get(4))->copy());
- psResidentFonts16->append(param);
+ psResidentFonts16->push_back(param);
}
void GlobalParams::parsePSResidentFontCC(GList *tokens, GString *fileName,
@@ -1577,7 +1577,7 @@
wMode,
((GString *)tokens->get(3))->copy(),
((GString *)tokens->get(4))->copy());
- psResidentFontsCC->append(param);
+ psResidentFontsCC->push_back(param);
}
void GlobalParams::parseTextEncoding(GList *tokens, GString *fileName,
@@ -1666,20 +1666,20 @@
"bind", tokens, fileName, line)) {
return;
}
- for (i = 0; i < keyBindings->getLength(); ++i) {
- binding = (KeyBinding *)keyBindings->get(i);
+ for (auto it = keyBindings->begin(); it != keyBindings->end(); it++) {
+ binding = static_cast<KeyBinding *> (*it);
if (binding->code == code &&
binding->mods == mods &&
binding->context == context) {
- delete (KeyBinding *)keyBindings->del(i);
+ keyBindings->erase(it);
break;
}
}
cmds = new GList();
for (i = 3; i < tokens->getLength(); ++i) {
- cmds->append(((GString *)tokens->get(i))->copy());
+ cmds->push_back(((GString *)tokens->get(i))->copy());
}
- keyBindings->append(new KeyBinding(code, mods, context, cmds));
+ keyBindings->push_back(new KeyBinding(code, mods, context, cmds));
}
void GlobalParams::parseUnbind(GList *tokens, GString *fileName, int line) {
@@ -1696,12 +1696,12 @@
"unbind", tokens, fileName, line)) {
return;
}
- for (i = 0; i < keyBindings->getLength(); ++i) {
- binding = (KeyBinding *)keyBindings->get(i);
+ for (auto it = keyBindings->begin(); it != keyBindings->end(); it++) {
+ binding = static_cast<KeyBinding *> (*it);
if (binding->code == code &&
binding->mods == mods &&
binding->context == context) {
- delete (KeyBinding *)keyBindings->del(i);
+ keyBindings->erase(it);
break;
}
}
@@ -1711,7 +1711,7 @@
int *code, int *mods, int *context,
const char *cmdName,
GList *tokens, GString *fileName, int line) {
- char *p0;
+ const char *p0;
int btn;
*mods = xpdfKeyModNone;
@@ -1867,8 +1867,8 @@
cmdName, fileName, line);
return;
}
- tok = (GString *)tokens->get(1);
- if (!parseYesNo2(tok->getCString(), flag)) {
+ tok = (GString *) tokens->get(1);
+ if (!parseYesNo2((char *) tok->getCString(), flag)) {
error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})",
cmdName, fileName, line);
}
@@ -2538,7 +2538,7 @@
lockGlobalParams;
psResidentFonts->startIter(&iter);
while (psResidentFonts->getNext(&iter, &name, (void **)&psName)) {
- names->append(psName->copy());
+ names->push_back(psName->copy());
}
unlockGlobalParams;
return names;
@@ -2959,7 +2959,7 @@
(~binding->context | context) == ~0) {
cmds = new GList();
for (j = 0; j < binding->cmds->getLength(); ++j) {
- cmds->append(((GString *)binding->cmds->get(j))->copy());
+ cmds->push_back(((GString *)binding->cmds->get(j))->copy());
}
break;
}
@@ -3383,7 +3383,7 @@
void GlobalParams::addSecurityHandler(XpdfSecurityHandler *handler) {
#ifdef ENABLE_PLUGINS
lockGlobalParams;
- securityHandlers->append(handler);
+ securityHandlers->push_back(handler);
unlockGlobalParams;
#endif
}
@@ -3433,7 +3433,7 @@
return gFalse;
}
lockGlobalParams;
- plugins->append(plugin);
+ plugins->push_back(plugin);
unlockGlobalParams;
return gTrue;
}
Index: b/xpdf/XPDFViewer.cc
===================================================================
--- a/xpdf/XPDFViewer.cc
+++ b/xpdf/XPDFViewer.cc
@@ -262,7 +262,7 @@
//------------------------------------------------------------------------
-XPDFViewer::XPDFViewer(XPDFApp *appA, GString *fileName,
+XPDFViewer::XPDFViewer(XPDFApp *appA, const GString *fileName,
int pageA, GString *destName, GBool fullScreen,
GString *ownerPassword, GString *userPassword) {
LinkDest *dest;
@@ -422,14 +422,14 @@
}
void XPDFViewer::clear() {
- char *title;
+ const char *title;
XmString s;
core->clear();
// set up title
title = app->getTitle() ? app->getTitle()->getCString()
- : (char *)xpdfAppName;
+ : (const char *)xpdfAppName;
XtVaSetValues(win, XmNtitle, title, XmNiconName, title, NULL);
if (toolBar != None) {
@@ -459,7 +459,7 @@
// load / display
//------------------------------------------------------------------------
-GBool XPDFViewer::loadFile(GString *fileName, GString *ownerPassword,
+GBool XPDFViewer::loadFile(const GString *fileName, GString *ownerPassword,
GString *userPassword) {
return core->loadFile(fileName, ownerPassword, userPassword) == errNone;
}
@@ -543,7 +543,7 @@
}
}
-void XPDFViewer::actionCbk(void *data, char *action) {
+void XPDFViewer::actionCbk(void *data, const char *action) {
XPDFViewer *viewer = (XPDFViewer *)data;
if (!strcmp(action, "Quit")) {
@@ -690,7 +690,8 @@
void XPDFViewer::execCmd(GString *cmd, XEvent *event) {
GString *name;
GString *args[cmdMaxArgs];
- char *p0, *p1;
+ const char *p0;
+ const char *p1;
int nArgs, i;
int a, b, m, cmp;
@@ -1138,13 +1139,14 @@
void XPDFViewer::cmdRun(GString *args[], int nArgs,
XEvent *event) {
- GString *fmt, *cmd, *s;
+ GString *fmt, *cmd;
+ const GString *s;
LinkAction *action;
double selLRX, selLRY, selURX, selURY, mouseX, mouseY;
int selPage, mousePage;
GBool gotSel, gotMouse;
char buf[64];
- char *p;
+ const char *p;
char c0, c1;
int i;
int errcode;
@@ -1549,7 +1551,7 @@
// top-level window
n = 0;
- title = app->getTitle() ? app->getTitle()->getCString()
+ title = app->getTitle() ? (char *)app->getTitle()->getCString()
: (char *)xpdfAppName;
XtSetArg(args[n], XmNtitle, title); ++n;
XtSetArg(args[n], XmNiconName, title); ++n;
@@ -2690,7 +2692,7 @@
XmTextFieldSetString(viewer->pageNumText, buf);
}
-void XPDFViewer::updateCbk(void *data, GString *fileName,
+void XPDFViewer::updateCbk(void *data, const GString *fileName,
int pageNum, int numPages, const char *linkString) {
XPDFViewer *viewer = (XPDFViewer *)data;
GString *title;
@@ -2816,7 +2818,7 @@
XtSetArg(args[n], XPDFNentryParent, parent); ++n;
}
XtSetArg(args[n], XPDFNentryExpanded, item->isOpen()); ++n;
- s = XmStringCreateLocalized(title->getCString());
+ s = XmStringCreateLocalized((char *) title->getCString());
delete title;
XtSetArg(args[n], XmNlabelString, s); ++n;
XtSetArg(args[n], XmNuserData, item); ++n;
@@ -3003,7 +3005,7 @@
if (core->getDoc() && core->getDoc()->getFileName()) {
dir = makePathAbsolute(grabPath(
core->getDoc()->getFileName()->getCString()));
- s1 = XmStringCreateLocalized(dir->getCString());
+ s1 = XmStringCreateLocalized((char *) dir->getCString());
XtVaSetValues(openDialog, XmNdirectory, s1, NULL);
XmStringFree(s1);
delete dir;
@@ -3259,7 +3261,7 @@
if (core->getDoc() && core->getDoc()->getFileName()) {
dir = makePathAbsolute(grabPath(
core->getDoc()->getFileName()->getCString()));
- s1 = XmStringCreateLocalized(dir->getCString());
+ s1 = XmStringCreateLocalized((char *) dir->getCString());
XtVaSetValues(saveAsDialog, XmNdirectory, s1, NULL);
XmStringFree(s1);
delete dir;
@@ -3554,9 +3556,9 @@
if ((psFileName = xpdfParams->getPSFile())) {
if (psFileName->getChar(0) == '|') {
XmTextFieldSetString(printCmdText,
- psFileName->getCString() + 1);
+ (char *) psFileName->getCString() + 1);
} else {
- XmTextFieldSetString(printFileText, psFileName->getCString());
+ XmTextFieldSetString(printFileText, (char *) psFileName->getCString());
}
delete psFileName;
}
@@ -3619,8 +3621,9 @@
void XPDFViewer::setupPrintDialog() {
PDFDoc *doc;
char buf[20];
- GString *pdfFileName, *psFileName, *psFileName2;
- char *p;
+ const GString *pdfFileName;
+ GString *psFileName, *psFileName2;
+ const char *p;
doc = core->getDoc();
psFileName = xpdfParams->getPSFile();
@@ -3634,7 +3637,7 @@
psFileName2 = pdfFileName->copy();
}
psFileName2->append(".ps");
- XmTextFieldSetString(printFileText, psFileName2->getCString());
+ XmTextFieldSetString(printFileText, (char *) psFileName2->getCString());
delete psFileName2;
}
}
@@ -3863,7 +3866,7 @@
}
void XPDFViewer::cmdSearch(GString *args[], int nArgs, XEvent *event) {
- char *searchText = args[0]->getCString();
+ char *searchText = (char *) args[0]->getCString();
core->find(searchText,
gFalse,
gFalse,
Index: b/xpdf/PDFDoc.h
===================================================================
--- a/xpdf/PDFDoc.h
+++ b/xpdf/PDFDoc.h
@@ -54,7 +54,7 @@
int getErrorCode() { return errCode; }
// Get file name.
- GString *getFileName() { return fileName; }
+ const GString *getFileName() { return fileName; }
#ifdef _WIN32
wchar_t *getFileNameU() { return fileNameU; }
#endif
Index: b/xpdf/XPDFViewer.h
===================================================================
--- a/xpdf/XPDFViewer.h
+++ b/xpdf/XPDFViewer.h
@@ -57,7 +57,7 @@
class XPDFViewer {
public:
- XPDFViewer(XPDFApp *appA, GString *fileName,
+ XPDFViewer(XPDFApp *appA, const GString *fileName,
int pageA, GString *destName, GBool fullScreen,
GString *ownerPassword, GString *userPassword);
XPDFViewer(XPDFApp *appA, PDFDoc *doc, int pageA,
@@ -76,7 +76,7 @@
private:
//----- load / display
- GBool loadFile(GString *fileName, GString *ownerPassword = NULL,
+ GBool loadFile(const GString *fileName, GString *ownerPassword = NULL,
GString *userPassword = NULL);
void displayPage(int pageA, double zoomA, int rotateA,
GBool scrollToTop, GBool addToHist);
@@ -87,7 +87,7 @@
//----- hyperlinks / actions
void doLink(int wx, int wy, GBool onlyIfNoSelection, GBool newWin);
- static void actionCbk(void *data, char *action);
+ static void actionCbk(void *data, const char *action);
//----- keyboard/mouse input
static void keyPressCbk(void *data, KeySym key, Guint modifiers,
@@ -241,7 +241,7 @@
XtPointer callData);
static void pageNumCbk(Widget widget, XtPointer ptr,
XtPointer callData);
- static void updateCbk(void *data, GString *fileName,
+ static void updateCbk(void *data, const GString *fileName,
int pageNum, int numPages, const char *linkString);
//----- GUI code: outline
Index: b/xpdf/XPDFApp.h
===================================================================
--- a/xpdf/XPDFApp.h
+++ b/xpdf/XPDFApp.h
@@ -40,7 +40,7 @@
XPDFApp(int *argc, char *argv[]);
~XPDFApp();
- XPDFViewer *open(GString *fileName, int page = 1,
+ XPDFViewer *open(const GString *fileName, int page = 1,
GString *ownerPassword = NULL,
GString *userPassword = NULL);
XPDFViewer *openAtDest(GString *fileName, GString *dest,
Index: b/xpdf/xpdf.cc
===================================================================
--- a/xpdf/xpdf.cc
+++ b/xpdf/xpdf.cc
@@ -212,7 +212,7 @@
// the initialZoom parameter can be set in either the config file or
// as an X resource (or command line arg)
if (app->getInitialZoom()) {
- xpdfParams->setInitialZoom(app->getInitialZoom()->getCString());
+ xpdfParams->setInitialZoom((char *) app->getInitialZoom()->getCString());
}
// check command line
|