Merge lp:~noskcaj/ubuntu/trusty/klatexformula/3.2.8 into lp:ubuntu/trusty/klatexformula
- Trusty (14.04)
- 3.2.8
- Merge into trusty
Proposed by
Jackson Doak
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | Sebastien Bacher | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~noskcaj/ubuntu/trusty/klatexformula/3.2.8 | ||||
Merge into: | lp:ubuntu/trusty/klatexformula | ||||
Diff against target: |
761 lines (+465/-95) 8 files modified
VERSION (+1/-1) debian/changelog (+7/-0) debian/control (+2/-1) src/CMakeLists.txt (+7/-4) src/klfbackend/klfbackend.cpp (+434/-77) src/klfbackend/klfblockprocess.cpp (+9/-9) src/klfbackend/klfdebug.h (+2/-2) src/klfbackend/klfqt34common.h (+3/-1) |
||||
To merge this branch: | bzr merge lp:~noskcaj/ubuntu/trusty/klatexformula/3.2.8 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastien Bacher | Approve | ||
Review via email: mp+212506@code.launchpad.net |
Commit message
Description of the change
New upstream bugfix release, only one change. Fixes bug caused by a ghostscript change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'VERSION' | |||
2 | --- VERSION 2013-07-22 17:50:27 +0000 | |||
3 | +++ VERSION 2014-03-24 20:24:05 +0000 | |||
4 | @@ -1,1 +1,1 @@ | |||
6 | 1 | 3.2.7 | 1 | 3.2.8 |
7 | 2 | 2 | ||
8 | === modified file 'debian/changelog' | |||
9 | --- debian/changelog 2013-07-22 17:50:27 +0000 | |||
10 | +++ debian/changelog 2014-03-24 20:24:05 +0000 | |||
11 | @@ -1,3 +1,10 @@ | |||
12 | 1 | klatexformula (3.2.8-0ubuntu1) trusty; urgency=medium | ||
13 | 2 | |||
14 | 3 | * New upstream release. LP: #1296902 | ||
15 | 4 | - fixes a bug caused by recent versions of ghostscript | ||
16 | 5 | |||
17 | 6 | -- Jackson Doak <noskcaj@ubuntu.com> Tue, 25 Mar 2014 07:03:05 +1100 | ||
18 | 7 | |||
19 | 1 | klatexformula (3.2.7-1) unstable; urgency=low | 8 | klatexformula (3.2.7-1) unstable; urgency=low |
20 | 2 | 9 | ||
21 | 3 | * New upstream release | 10 | * New upstream release |
22 | 4 | 11 | ||
23 | === modified file 'debian/control' | |||
24 | --- debian/control 2013-07-22 17:50:27 +0000 | |||
25 | +++ debian/control 2014-03-24 20:24:05 +0000 | |||
26 | @@ -1,7 +1,8 @@ | |||
27 | 1 | Source: klatexformula | 1 | Source: klatexformula |
28 | 2 | Section: tex | 2 | Section: tex |
29 | 3 | Priority: extra | 3 | Priority: extra |
31 | 4 | Maintainer: Tobias Winchen <winchen@physik.rwth-aachen.de> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
32 | 5 | XSBC-Original-Maintainer: Tobias Winchen <winchen@physik.rwth-aachen.de> | ||
33 | 5 | Build-Depends: cdbs, debhelper (>= 7), docbook-to-man, cmake, libqt4-dev, pkg-kde-tools, kdelibs5-dev, libx11-dev | 6 | Build-Depends: cdbs, debhelper (>= 7), docbook-to-man, cmake, libqt4-dev, pkg-kde-tools, kdelibs5-dev, libx11-dev |
34 | 6 | Standards-Version: 3.9.4 | 7 | Standards-Version: 3.9.4 |
35 | 7 | Vcs-git: git://github.com/winchen/klatexformula_debian.git | 8 | Vcs-git: git://github.com/winchen/klatexformula_debian.git |
36 | 8 | 9 | ||
37 | === modified file 'src/CMakeLists.txt' | |||
38 | --- src/CMakeLists.txt 2012-01-02 20:23:27 +0000 | |||
39 | +++ src/CMakeLists.txt 2014-03-24 20:24:05 +0000 | |||
40 | @@ -1,7 +1,7 @@ | |||
41 | 1 | # ######################################## # | 1 | # ######################################## # |
42 | 2 | # CMake project file for klatexformula/src # | 2 | # CMake project file for klatexformula/src # |
43 | 3 | # ######################################## # | 3 | # ######################################## # |
45 | 4 | # $Id: CMakeLists.txt 742 2011-10-09 11:02:08Z phfaist $ | 4 | # $Id: CMakeLists.txt 864 2013-11-23 13:52:28Z phfaist $ |
46 | 5 | # ######################################## # | 5 | # ######################################## # |
47 | 6 | 6 | ||
48 | 7 | if(KLF_MACOSX_BUNDLES) | 7 | if(KLF_MACOSX_BUNDLES) |
49 | @@ -503,9 +503,12 @@ | |||
50 | 503 | if(WIN32 AND KLF_INSTALL_QTLIBS) | 503 | if(WIN32 AND KLF_INSTALL_QTLIBS) |
51 | 504 | # Install Qt libs | 504 | # Install Qt libs |
52 | 505 | # QT_BINARY_DIR and QT_PLUGINS_DIR are set by FindQt4 CMake module | 505 | # QT_BINARY_DIR and QT_PLUGINS_DIR are set by FindQt4 CMake module |
56 | 506 | install(DIRECTORY "${QT_BINARY_DIR}/" DESTINATION "${KLF_INSTALL_LIB_DIR}" | 506 | #message(STATUS "QT_BINARY_DIR is ${QT_BINARY_DIR}") |
57 | 507 | FILES_MATCHING REGEX "/Qt(Core|Gui|Sql|Xml)4?\\.dll$" REGEX "/libgcc.*\\.dll" REGEX "/mingw.*\\.dll" | 507 | install(DIRECTORY "${QT_BINARY_DIR}/" DESTINATION "${KLF_INSTALL_LIB_DIR}" FILES_MATCHING |
58 | 508 | ) | 508 | PATTERN "libgcc*.dll" |
59 | 509 | PATTERN "mingw*.dll" | ||
60 | 510 | REGEX "/Qt(Core|Gui|Sql|Xml)4?\\.dll$" | ||
61 | 511 | ) | ||
62 | 509 | set(qtplugin_list ${KLF_INSTALL_QTPLUGINS_LIST}) | 512 | set(qtplugin_list ${KLF_INSTALL_QTPLUGINS_LIST}) |
63 | 510 | set(qtplugin_list "dummyitem" ${qtplugin_list}) | 513 | set(qtplugin_list "dummyitem" ${qtplugin_list}) |
64 | 511 | string(REGEX REPLACE ";" ";${QT_PLUGINS_DIR}/" qtplugin_list_temp "${qtplugin_list}") | 514 | string(REGEX REPLACE ";" ";${QT_PLUGINS_DIR}/" qtplugin_list_temp "${qtplugin_list}") |
65 | 512 | 515 | ||
66 | === modified file 'src/klfbackend/klfbackend.cpp' | |||
67 | --- src/klfbackend/klfbackend.cpp 2012-01-02 20:23:27 +0000 | |||
68 | +++ src/klfbackend/klfbackend.cpp 2014-03-24 20:24:05 +0000 | |||
69 | @@ -19,7 +19,7 @@ | |||
70 | 19 | * Free Software Foundation, Inc., * | 19 | * Free Software Foundation, Inc., * |
71 | 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
72 | 21 | ***************************************************************************/ | 21 | ***************************************************************************/ |
74 | 22 | /* $Id: klfbackend.cpp 748 2012-01-01 15:06:40Z phfaist $ */ | 22 | /* $Id: klfbackend.cpp 863 2013-11-23 13:14:34Z phfaist $ */ |
75 | 23 | 23 | ||
76 | 24 | #include <stdio.h> | 24 | #include <stdio.h> |
77 | 25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
78 | @@ -33,7 +33,6 @@ | |||
79 | 33 | #include <qbuffer.h> | 33 | #include <qbuffer.h> |
80 | 34 | #include <qdir.h> | 34 | #include <qdir.h> |
81 | 35 | 35 | ||
82 | 36 | |||
83 | 37 | #include "klfblockprocess.h" | 36 | #include "klfblockprocess.h" |
84 | 38 | #include "klfbackend.h" | 37 | #include "klfbackend.h" |
85 | 39 | 38 | ||
86 | @@ -205,6 +204,22 @@ | |||
87 | 205 | 204 | ||
88 | 206 | 205 | ||
89 | 207 | 206 | ||
90 | 207 | // utilities for dealing with bounding boxes in EPS file | ||
91 | 208 | // (backported from 3.3) | ||
92 | 209 | |||
93 | 210 | // A Bounding Box | ||
94 | 211 | struct klfbbox { | ||
95 | 212 | double x1, x2, y1, y2; | ||
96 | 213 | }; | ||
97 | 214 | static bool read_eps_bbox(const QByteArray& epsdata, klfbbox *bbox, KLFBackend::klfOutput * resError); | ||
98 | 215 | static void correct_eps_bbox(const QByteArray& epsdata, const klfbbox& bbox_corrected, const klfbbox& bbox_orig, | ||
99 | 216 | double vectorscale, QByteArray * epsdatacorrected); | ||
100 | 217 | |||
101 | 218 | |||
102 | 219 | |||
103 | 220 | |||
104 | 221 | |||
105 | 222 | |||
106 | 208 | KLFBackend::klfOutput KLFBackend::getLatexFormula(const klfInput& in, const klfSettings& settings) | 223 | KLFBackend::klfOutput KLFBackend::getLatexFormula(const klfInput& in, const klfSettings& settings) |
107 | 209 | { | 224 | { |
108 | 210 | // ALLOW ONLY ONE RUNNING getLatexFormula() AT A TIME | 225 | // ALLOW ONLY ONE RUNNING getLatexFormula() AT A TIME |
109 | @@ -254,7 +269,13 @@ | |||
110 | 254 | // - if epstopdfexec is not empty, run epstopdf and get PDF file. | 269 | // - if epstopdfexec is not empty, run epstopdf and get PDF file. |
111 | 255 | 270 | ||
112 | 256 | QString tempfname = settings.tempdir + "/klatexformulatmp" KLF_VERSION_STRING "-" | 271 | QString tempfname = settings.tempdir + "/klatexformulatmp" KLF_VERSION_STRING "-" |
114 | 257 | + QDateTime::currentDateTime().toString("hh-mm-ss"); | 272 | + QDateTime::currentDateTime().toString("hh-mm-ss") |
115 | 273 | #ifdef KLFBACKEND_QT4 | ||
116 | 274 | + "-p"+ QString("%1").arg(QApplication::applicationPid(), 0, 26) | ||
117 | 275 | #else | ||
118 | 276 | + "-p" + QString("%1").arg(rand()%100000, 0, 26) | ||
119 | 277 | #endif | ||
120 | 278 | ; | ||
121 | 258 | 279 | ||
122 | 259 | QString fnTex = tempfname + ".tex"; | 280 | QString fnTex = tempfname + ".tex"; |
123 | 260 | QString fnDvi = tempfname + ".dvi"; | 281 | QString fnDvi = tempfname + ".dvi"; |
124 | @@ -391,71 +412,122 @@ | |||
125 | 391 | return res; | 412 | return res; |
126 | 392 | } | 413 | } |
127 | 393 | 414 | ||
193 | 394 | // add some space on bounding-box to avoid some too tight bounding box bugs | 415 | // { // DEAL WITH BOUNDING BOX |
194 | 395 | // read eps file | 416 | |
195 | 396 | QFile epsfile(fnRawEps); | 417 | // // add some space on bounding-box to avoid some too tight bounding box bugs |
196 | 397 | r = epsfile.open(dev_READONLY); | 418 | // // read eps file |
197 | 398 | if ( ! r ) { | 419 | // QFile epsfile(fnRawEps); |
198 | 399 | res.status = KLFERR_EPSREADFAIL; | 420 | // r = epsfile.open(dev_READONLY); |
199 | 400 | res.errorstr = QObject::tr("Can't read file '%1'!\n", "KLFBackend").arg(fnRawEps); | 421 | // if ( ! r ) { |
200 | 401 | return res; | 422 | // res.status = KLFERR_EPSREADFAIL; |
201 | 402 | } | 423 | // res.errorstr = QObject::tr("Can't read file '%1'!\n", "KLFBackend").arg(fnRawEps); |
202 | 403 | /** \todo Hi-Res bounding box adjustment. Shouldn't be too hard to do, but needs tests to see | 424 | // return res; |
203 | 404 | * how this works... [ Currently: only integer-valued BoundingBox: is adjusted. ] */ | 425 | // } |
204 | 405 | QByteArray epscontent = epsfile.readAll(); | 426 | // /** \todo Hi-Res bounding box adjustment. Shouldn't be too hard to do, but needs tests to see |
205 | 406 | #ifdef KLFBACKEND_QT4 | 427 | // * how this works... [ Currently: only integer-valued BoundingBox: is adjusted. ] */ |
206 | 407 | QByteArray epscontent_s = epscontent; | 428 | // QByteArray epscontent = epsfile.readAll(); |
207 | 408 | int i = epscontent_s.indexOf("%%BoundingBox: "); | 429 | // #ifdef KLFBACKEND_QT4 |
208 | 409 | #else | 430 | // QByteArray epscontent_s = epscontent; |
209 | 410 | QCString epscontent_s(epscontent.data(), epscontent.size()); | 431 | // int i = epscontent_s.indexOf("%%BoundingBox: "); |
210 | 411 | int i = epscontent_s.find("%%BoundingBox: "); | 432 | // #else |
211 | 412 | #endif | 433 | // QCString epscontent_s(epscontent.data(), epscontent.size()); |
212 | 413 | // process file data and transform it | 434 | // int i = epscontent_s.find("%%BoundingBox: "); |
213 | 414 | if ( i == -1 ) { | 435 | // #endif |
214 | 415 | res.status = KLFERR_NOEPSBBOX; | 436 | // // process file data and transform it |
215 | 416 | res.errorstr = QObject::tr("File '%1' does not contain line \"%%BoundingBox: ... \" !", | 437 | // if ( i == -1 ) { |
216 | 417 | "KLFBackend").arg(fnRawEps); | 438 | // res.status = KLFERR_NOEPSBBOX; |
217 | 418 | return res; | 439 | // res.errorstr = QObject::tr("File '%1' does not contain line \"%%BoundingBox: ... \" !", |
218 | 419 | } | 440 | // "KLFBackend").arg(fnRawEps); |
219 | 420 | int ax, ay, bx, by; | 441 | // return res; |
220 | 421 | char temp[250]; | 442 | // } |
221 | 422 | const int k = i; | 443 | // int ax, ay, bx, by; |
222 | 423 | i += strlen("%%BoundingBox:"); | 444 | // char temp[250]; |
223 | 424 | int n = sscanf(epscontent_s.data()+i, "%d %d %d %d", &ax, &ay, &bx, &by); | 445 | // const int k = i; |
224 | 425 | if ( n != 4 ) { | 446 | // i += strlen("%%BoundingBox:"); |
225 | 426 | res.status = KLFERR_BADEPSBBOX; | 447 | // int n = sscanf(epscontent_s.data()+i, "%d %d %d %d", &ax, &ay, &bx, &by); |
226 | 427 | res.errorstr = QObject::tr("file %1: Line %%BoundingBox: can't read values!\n", "KLFBackend") | 448 | // if ( n != 4 ) { |
227 | 428 | .arg(fnRawEps); | 449 | // res.status = KLFERR_BADEPSBBOX; |
228 | 429 | return res; | 450 | // res.errorstr = QObject::tr("file %1: Line %%BoundingBox: can't read values!\n", "KLFBackend") |
229 | 430 | } | 451 | // .arg(fnRawEps); |
230 | 431 | // grow bbox by settings.Xborderoffset points | 452 | // return res; |
231 | 432 | // Don't forget: '%' in printf has special meaning (!) -> double percent signs '%'->'%%' | 453 | // } |
232 | 433 | sprintf(temp, "%%%%BoundingBox: %d %d %d %d", | 454 | // // grow bbox by settings.Xborderoffset points |
233 | 434 | (int)(ax-settings.lborderoffset+0.5), | 455 | // // Don't forget: '%' in printf has special meaning (!) -> double percent signs '%'->'%%' |
234 | 435 | (int)(ay-settings.bborderoffset+0.5), | 456 | // sprintf(temp, "%%%%BoundingBox: %d %d %d %d", |
235 | 436 | (int)(bx+settings.rborderoffset+0.5), | 457 | // (int)(ax-settings.lborderoffset+0.5), |
236 | 437 | (int)(by+settings.tborderoffset+0.5)); | 458 | // (int)(ay-settings.bborderoffset+0.5), |
237 | 438 | QString chunk = QString::fromLocal8Bit(epscontent_s.data()+k); | 459 | // (int)(bx+settings.rborderoffset+0.5), |
238 | 439 | QRegExp rx("^%%BoundingBox: [0-9]+ [0-9]+ [0-9]+ [0-9]+"); | 460 | // (int)(by+settings.tborderoffset+0.5)); |
239 | 440 | rx.rx_indexin(chunk); | 461 | // QString chunk = QString::fromLocal8Bit(epscontent_s.data()+k); |
240 | 441 | int l = rx.matchedLength(); | 462 | // QRegExp rx("^%%BoundingBox: [0-9]+ [0-9]+ [0-9]+ [0-9]+"); |
241 | 442 | epscontent_s.replace(k, l, temp); | 463 | // rx.rx_indexin(chunk); |
242 | 443 | 464 | // int l = rx.matchedLength(); | |
243 | 444 | // write content back to second file | 465 | // epscontent_s.replace(k, l, temp); |
244 | 445 | QFile epsgoodfile(fnBBCorrEps); | 466 | |
245 | 446 | r = epsgoodfile.open(dev_WRITEONLY); | 467 | // // write content back to second file |
246 | 447 | if ( ! r ) { | 468 | // QFile epsgoodfile(fnBBCorrEps); |
247 | 448 | res.status = KLFERR_EPSWRITEFAIL; | 469 | // r = epsgoodfile.open(dev_WRITEONLY); |
248 | 449 | res.errorstr = QObject::tr("Can't write to file '%1'!\n", "KLFBackend") | 470 | // if ( ! r ) { |
249 | 450 | .arg(fnBBCorrEps); | 471 | // res.status = KLFERR_EPSWRITEFAIL; |
250 | 451 | return res; | 472 | // res.errorstr = QObject::tr("Can't write to file '%1'!\n", "KLFBackend") |
251 | 452 | } | 473 | // .arg(fnBBCorrEps); |
252 | 453 | epsgoodfile.dev_write(epscontent_s); | 474 | // return res; |
253 | 454 | 475 | // } | |
254 | 455 | if ( ! settings.outlineFonts ) { | 476 | // epsgoodfile.dev_write(epscontent_s); |
255 | 456 | res.epsdata.ba_assign(epscontent_s); | 477 | |
256 | 457 | } | 478 | // if ( ! settings.outlineFonts ) { |
257 | 458 | // res.epsdata is now set. | 479 | // res.epsdata.ba_assign(epscontent_s); |
258 | 480 | // } | ||
259 | 481 | // // res.epsdata is now set. | ||
260 | 482 | |||
261 | 483 | // } | ||
262 | 484 | |||
263 | 485 | { // DEAL WITH BBOX: BACKPORT FROM 3.3 | ||
264 | 486 | |||
265 | 487 | // read eps file | ||
266 | 488 | QFile epsfile(fnRawEps); | ||
267 | 489 | r = epsfile.open(dev_READONLY); | ||
268 | 490 | if ( ! r ) { | ||
269 | 491 | res.status = KLFERR_EPSREADFAIL; | ||
270 | 492 | res.errorstr = QObject::tr("Can't read file '%1'!\n", "KLFBackend").arg(fnRawEps); | ||
271 | 493 | return res; | ||
272 | 494 | } | ||
273 | 495 | QByteArray rawepsdata = epsfile.readAll(); | ||
274 | 496 | |||
275 | 497 | klfbbox bbox, bbox_corrected; | ||
276 | 498 | bool ok = read_eps_bbox(rawepsdata, &bbox, &res); | ||
277 | 499 | if (!ok) | ||
278 | 500 | return res; // res was set by the function | ||
279 | 501 | |||
280 | 502 | bbox.x1 -= settings.lborderoffset; | ||
281 | 503 | bbox.y1 -= settings.bborderoffset; | ||
282 | 504 | bbox.x2 += settings.rborderoffset; | ||
283 | 505 | bbox.y2 += settings.tborderoffset; | ||
284 | 506 | |||
285 | 507 | int width_pt = bbox.x2 - bbox.x1; | ||
286 | 508 | int height_pt = bbox.y2 - bbox.y1; | ||
287 | 509 | |||
288 | 510 | // now correct the bbox to (0,0,width,height) | ||
289 | 511 | |||
290 | 512 | bbox_corrected.x1 = 0; | ||
291 | 513 | bbox_corrected.y1 = 0; | ||
292 | 514 | bbox_corrected.x2 = width_pt; | ||
293 | 515 | bbox_corrected.y2 = height_pt; | ||
294 | 516 | |||
295 | 517 | // and generate corrected raw EPS | ||
296 | 518 | correct_eps_bbox(rawepsdata, bbox_corrected, bbox, 1.0, | ||
297 | 519 | &res.epsdata); | ||
298 | 520 | |||
299 | 521 | QFile epsgoodfile(fnBBCorrEps); | ||
300 | 522 | r = epsgoodfile.open(dev_WRITEONLY); | ||
301 | 523 | if ( ! r ) { | ||
302 | 524 | res.status = KLFERR_EPSWRITEFAIL; | ||
303 | 525 | res.errorstr = QObject::tr("Can't write to file '%1'!\n", "KLFBackend") | ||
304 | 526 | .arg(fnBBCorrEps); | ||
305 | 527 | return res; | ||
306 | 528 | } | ||
307 | 529 | epsgoodfile.dev_write(res.epsdata); | ||
308 | 530 | } | ||
309 | 459 | 531 | ||
310 | 460 | qDebug("%s: %s: eps bbox set.", KLF_FUNC_NAME, KLF_SHORT_TIME) ; | 532 | qDebug("%s: %s: eps bbox set.", KLF_FUNC_NAME, KLF_SHORT_TIME) ; |
311 | 461 | 533 | ||
312 | @@ -464,15 +536,48 @@ | |||
313 | 464 | if (settings.outlineFonts) { | 536 | if (settings.outlineFonts) { |
314 | 465 | // run 'gs' to outline fonts | 537 | // run 'gs' to outline fonts |
315 | 466 | KLFBlockProcess proc; | 538 | KLFBlockProcess proc; |
325 | 467 | QStringList args; | 539 | |
326 | 468 | args << settings.gsexec << "-dNOCACHE" << "-dNOPAUSE" << "-dSAFER" << "-dEPSCrop" | 540 | // Very bad joke from ghostscript's guys: they deprecate pswrite device, which worked very well, and |
327 | 469 | << "-sDEVICE=pswrite" << "-sOutputFile="+dir_native_separators(fnOutlFontsEps) | 541 | // so I had to adapt the code so that it works with the new ps2write device. The bounding boxes were |
328 | 470 | << "-q" << "-dBATCH" << dir_native_separators(fnBBCorrEps); | 542 | // going like hell. Hopefully a backport of the new system in 3.3 seemed to fix the issue. |
329 | 471 | 543 | ||
330 | 472 | qDebug("%s: %s: about to gs (for outline fonts)...\n%s", KLF_FUNC_NAME, KLF_SHORT_TIME, | 544 | // So now we have to make sure we use ps2write on newer systems but make sure we still use pswrite on |
331 | 473 | qPrintable(args.join(" "))); | 545 | // old systems which don't support ps2write. THANKS A TON GS GUYS :( |
332 | 474 | bool r = proc.startProcess(args, execenv); | 546 | |
333 | 475 | qDebug("%s: %s: gs returned (for outline fonts).", KLF_FUNC_NAME, KLF_SHORT_TIME) ; | 547 | // In 3.2 we don't query gs version so we have no idea. So just let the user define an environment |
334 | 548 | // variable in case. KLFBACKEND_GS_PS_DEVICE="pswrite" or "epswrite" or "ps2write" (note: with epswrite | ||
335 | 549 | // you can't expand the bbox) | ||
336 | 550 | |||
337 | 551 | QStringList try_ps_devices; | ||
338 | 552 | const char *env_gs_device = getenv("KLFBACKEND_GS_PS_DEVICE"); | ||
339 | 553 | if (env_gs_device != NULL) { | ||
340 | 554 | try_ps_devices << QString::fromLatin1(env_gs_device); | ||
341 | 555 | } else { | ||
342 | 556 | try_ps_devices << QLatin1String("pswrite") << QLatin1String("ps2write"); | ||
343 | 557 | } | ||
344 | 558 | |||
345 | 559 | bool r = false; | ||
346 | 560 | int try_ps_dev_i = 0; | ||
347 | 561 | for (try_ps_dev_i = 0; try_ps_dev_i < try_ps_devices.size(); try_ps_dev_i++) { | ||
348 | 562 | QString psdev = try_ps_devices[try_ps_dev_i]; | ||
349 | 563 | qDebug("trying with gs device %s ...", qPrintable(psdev)); | ||
350 | 564 | |||
351 | 565 | QStringList args; | ||
352 | 566 | args << settings.gsexec << "-dNOCACHE" << "-dNOPAUSE" << "-dSAFER" << "-dEPSCrop" | ||
353 | 567 | << QString("-sDEVICE=%1").arg(psdev) | ||
354 | 568 | << "-sOutputFile="+dir_native_separators(fnOutlFontsEps) | ||
355 | 569 | << "-q" << "-dBATCH" << dir_native_separators(fnBBCorrEps); | ||
356 | 570 | |||
357 | 571 | qDebug("%s: %s: about to gs (for outline fonts)...\n%s", KLF_FUNC_NAME, KLF_SHORT_TIME, | ||
358 | 572 | qPrintable(args.join(" "))); | ||
359 | 573 | r = proc.startProcess(args, execenv); | ||
360 | 574 | qDebug("%s: %s: gs returned (for outline fonts).", KLF_FUNC_NAME, KLF_SHORT_TIME) ; | ||
361 | 575 | |||
362 | 576 | if (r && proc.processNormalExit() && proc.processExitStatus() == 0) { | ||
363 | 577 | // successful run | ||
364 | 578 | break; | ||
365 | 579 | } | ||
366 | 580 | } | ||
367 | 476 | 581 | ||
368 | 477 | if ( ! r ) { | 582 | if ( ! r ) { |
369 | 478 | res.status = KLFERR_NOGSPROG; | 583 | res.status = KLFERR_NOGSPROG; |
370 | @@ -653,6 +758,253 @@ | |||
371 | 653 | } | 758 | } |
372 | 654 | 759 | ||
373 | 655 | 760 | ||
374 | 761 | |||
375 | 762 | static bool s_starts_with(const char * x, int len_x, const char *test, int len_test) | ||
376 | 763 | { | ||
377 | 764 | if (len_x < len_test) | ||
378 | 765 | return false; | ||
379 | 766 | return !strncmp(x, test, len_test); | ||
380 | 767 | } | ||
381 | 768 | |||
382 | 769 | #define D_RX "([0-9eE.-]+)" | ||
383 | 770 | |||
384 | 771 | static bool parse_bbox_values(const QString& str, klfbbox *bbox) | ||
385 | 772 | { | ||
386 | 773 | // parse bbox values | ||
387 | 774 | QRegExp rx_bbvalues("" D_RX "\\s+" D_RX "\\s+" D_RX "\\s+" D_RX ""); | ||
388 | 775 | int i = rx_bbvalues.rx_indexin(str); | ||
389 | 776 | if (i < 0) { | ||
390 | 777 | return false; | ||
391 | 778 | } | ||
392 | 779 | bbox->x1 = rx_bbvalues.cap(1).toDouble(); | ||
393 | 780 | bbox->y1 = rx_bbvalues.cap(2).toDouble(); | ||
394 | 781 | bbox->x2 = rx_bbvalues.cap(3).toDouble(); | ||
395 | 782 | bbox->y2 = rx_bbvalues.cap(4).toDouble(); | ||
396 | 783 | return true; | ||
397 | 784 | } | ||
398 | 785 | |||
399 | 786 | static bool read_eps_bbox(const QByteArray& epsdata, klfbbox *bbox, KLFBackend::klfOutput * resError) | ||
400 | 787 | { | ||
401 | 788 | static const char * hibboxtag = "%%HiResBoundingBox:"; | ||
402 | 789 | static const char * bboxtag = "%%BoundingBox:"; | ||
403 | 790 | static const int hibboxtaglen = strlen(hibboxtag); | ||
404 | 791 | static const int bboxtaglen = strlen(bboxtag); | ||
405 | 792 | |||
406 | 793 | // Read dvips' bounding box. | ||
407 | 794 | QBuffer buf; | ||
408 | 795 | buf_setdata(buf, epsdata); | ||
409 | 796 | bool r = buf.open(dev_READONLY); | ||
410 | 797 | if (!r) { | ||
411 | 798 | qWarning("What's going on!!?! can't open buffer for reading? Will Fail!!!") ; | ||
412 | 799 | } | ||
413 | 800 | |||
414 | 801 | QString nobboxerrstr = | ||
415 | 802 | QObject::tr("DVIPS did not provide parsable %%BoundingBox: in its output!", "KLFBackend"); | ||
416 | 803 | |||
417 | 804 | char linebuffer[512]; | ||
418 | 805 | int n; | ||
419 | 806 | bool gotepsbbox = false; | ||
420 | 807 | int still_look_for_hiresbbox_lines = 5; | ||
421 | 808 | while ((n = buf.readLine(linebuffer, sizeof(linebuffer)-1)) > 0) { | ||
422 | 809 | if (gotepsbbox && still_look_for_hiresbbox_lines-- < 0) { | ||
423 | 810 | // if we already got the %BoundingBox, and we've been looking at more than a certian number of lines | ||
424 | 811 | // after that, abort because usually %BoundingBox and %HiResBoundingBox are together... | ||
425 | 812 | klfDbg("stopped looking for hires-bbox.") ; | ||
426 | 813 | break; | ||
427 | 814 | } | ||
428 | 815 | if (s_starts_with(linebuffer, n-1, hibboxtag, hibboxtaglen)) { | ||
429 | 816 | // got hi-res bounding-box | ||
430 | 817 | bool ok = parse_bbox_values(QString::fromLatin1(linebuffer+hibboxtaglen), bbox); | ||
431 | 818 | if (!ok) { | ||
432 | 819 | resError->status = KLFERR_BADEPSBBOX; | ||
433 | 820 | resError->errorstr = nobboxerrstr; | ||
434 | 821 | return false; | ||
435 | 822 | } | ||
436 | 823 | klfDbg("got hires-bbox.") ; | ||
437 | 824 | // all ok, got hi-res bbox | ||
438 | 825 | return true; | ||
439 | 826 | } | ||
440 | 827 | if (s_starts_with(linebuffer, n-1, bboxtag, bboxtaglen)) { | ||
441 | 828 | // got bounding-box. | ||
442 | 829 | bool ok = parse_bbox_values(QString::fromLatin1(linebuffer+bboxtaglen), bbox); | ||
443 | 830 | if (!ok) { | ||
444 | 831 | continue; | ||
445 | 832 | } | ||
446 | 833 | // stand by, continue in case we have a hi-res bbox. | ||
447 | 834 | gotepsbbox = true; | ||
448 | 835 | klfDbg("got normal bbox.") ; | ||
449 | 836 | continue; | ||
450 | 837 | } | ||
451 | 838 | } | ||
452 | 839 | |||
453 | 840 | // didn't get a hi-res bbox. see if we still got a regular %BoundingBox: and return that. | ||
454 | 841 | if (gotepsbbox) { | ||
455 | 842 | // bbox pointer is already set | ||
456 | 843 | return true; | ||
457 | 844 | } | ||
458 | 845 | |||
459 | 846 | resError->status = KLFERR_BADEPSBBOX; | ||
460 | 847 | resError->errorstr = nobboxerrstr; | ||
461 | 848 | return false; | ||
462 | 849 | } | ||
463 | 850 | |||
464 | 851 | // static int find_ba_in_ba(const QByteArray& haystack, const QByteArray& needle) | ||
465 | 852 | // { | ||
466 | 853 | // #ifdef KLFBACKEND_QT4 | ||
467 | 854 | // return haystack.indexOf(needle); | ||
468 | 855 | // #else | ||
469 | 856 | // int k, j; | ||
470 | 857 | // for (k = 0; k < haystack.length()-needle.length(); ++k) { | ||
471 | 858 | // // locally compare haystack and needle | ||
472 | 859 | // for (j = 0; j < needle.length(); ++j) { | ||
473 | 860 | // if (haystack[k+j] != needle[j]) | ||
474 | 861 | // break; // nope they're not the same | ||
475 | 862 | // } | ||
476 | 863 | // if (j == needle.length()) | ||
477 | 864 | // // found the needle | ||
478 | 865 | // return k; | ||
479 | 866 | // } | ||
480 | 867 | // return -1; | ||
481 | 868 | // #endif | ||
482 | 869 | // } | ||
483 | 870 | |||
484 | 871 | static void correct_eps_bbox(const QByteArray& rawepsdata, const klfbbox& bbox_corrected, | ||
485 | 872 | const klfbbox& bbox_orig, double vectorscale, | ||
486 | 873 | QByteArray * epsdatacorrected) | ||
487 | 874 | { | ||
488 | 875 | static const char * bboxdecl = "%%BoundingBox:"; | ||
489 | 876 | static int bboxdecl_len = strlen(bboxdecl); | ||
490 | 877 | |||
491 | 878 | double offx = bbox_corrected.x1 - bbox_orig.x1; | ||
492 | 879 | double offy = bbox_corrected.y1 - bbox_orig.y1; | ||
493 | 880 | |||
494 | 881 | // in raw EPS data, find '%%BoundingBox:' and length of the full BoundingBox instruction | ||
495 | 882 | int i, len; | ||
496 | 883 | char nl[] = "\0\0\0"; | ||
497 | 884 | #ifdef KLFBACKEND_QT4 | ||
498 | 885 | i = rawepsdata.indexOf(bboxdecl); | ||
499 | 886 | #else | ||
500 | 887 | QCString rawepsdata_s(rawepsdata.data(), rawepsdata.size()); | ||
501 | 888 | i = rawepsdata_s.find(bboxdecl); | ||
502 | 889 | #endif | ||
503 | 890 | if (i < 0) { | ||
504 | 891 | i = 0; | ||
505 | 892 | len = 0; | ||
506 | 893 | } else { | ||
507 | 894 | int j = i+bboxdecl_len; | ||
508 | 895 | while (j < (int)rawepsdata.size() && rawepsdata[j] != '\r' && rawepsdata[j] != '\n') | ||
509 | 896 | ++j; | ||
510 | 897 | len = j-i; | ||
511 | 898 | // also determine what the newline is (\n, \r, \r\n?) | ||
512 | 899 | if (rawepsdata[j] == '\r' && j < (int)rawepsdata.size()-1 && rawepsdata[j+1] == '\n') { | ||
513 | 900 | nl[0] = '\r', nl[1] = '\n'; | ||
514 | 901 | } else { | ||
515 | 902 | nl[0] = rawepsdata[j]; | ||
516 | 903 | } | ||
517 | 904 | } | ||
518 | 905 | |||
519 | 906 | double dwi = bbox_corrected.x2 * vectorscale; | ||
520 | 907 | double dhi = bbox_corrected.y2 * vectorscale; | ||
521 | 908 | int wi = (int)(dwi + 0.99999) ; | ||
522 | 909 | int hi = (int)(dhi + 0.99999) ; | ||
523 | 910 | char buffer[1024]; | ||
524 | 911 | int buffer_len; | ||
525 | 912 | // recall that '%%' in printf is replaced by a single '%'... | ||
526 | 913 | snprintf(buffer, sizeof(buffer)-1, | ||
527 | 914 | "%%%%BoundingBox: 0 0 %d %d%s" | ||
528 | 915 | "%%%%HiResBoundingBox: 0 0 %.6g %.6g%s", | ||
529 | 916 | wi, hi, nl, | ||
530 | 917 | dwi, dhi, nl); | ||
531 | 918 | buffer_len = strlen(buffer); | ||
532 | 919 | |||
533 | 920 | /* | ||
534 | 921 | char backgroundfillps[1024] = ""; | ||
535 | 922 | if (qAlpha(bgcolor) > 0) { | ||
536 | 923 | sprintf(backgroundfillps, | ||
537 | 924 | // draw the background color, if any | ||
538 | 925 | "newpath " | ||
539 | 926 | "-2 -2 moveto " | ||
540 | 927 | "%s -2 lineto " | ||
541 | 928 | "%s %s lineto " | ||
542 | 929 | "-2 %s lineto " | ||
543 | 930 | "closepath " | ||
544 | 931 | "gsave " | ||
545 | 932 | "%s %s %s setrgbcolor " | ||
546 | 933 | "fill " | ||
547 | 934 | "grestore %s", | ||
548 | 935 | klfFmtDoubleCC(dwi+1, 'g', 6), | ||
549 | 936 | klfFmtDoubleCC(dwi+1, 'g', 6), klfFmtDoubleCC(dhi+1, 'g', 6), | ||
550 | 937 | klfFmtDoubleCC(dhi+1, 'g', 6), | ||
551 | 938 | // and the color, in RGB components: | ||
552 | 939 | klfFmtDoubleCC(qRed(bgcolor)/255.0, 'f', 6), | ||
553 | 940 | klfFmtDoubleCC(qGreen(bgcolor)/255.0, 'f', 6), | ||
554 | 941 | klfFmtDoubleCC(qBlue(bgcolor)/255.0, 'f', 6), | ||
555 | 942 | nl | ||
556 | 943 | ); | ||
557 | 944 | } | ||
558 | 945 | */ | ||
559 | 946 | |||
560 | 947 | char buffer2[1024]; | ||
561 | 948 | int buffer2_len; | ||
562 | 949 | snprintf(buffer2, sizeof(buffer2)-1, | ||
563 | 950 | "%s" | ||
564 | 951 | "%%%%Page 1 1%s" | ||
565 | 952 | "%%%%PageBoundingBox 0 0 %d %d%s" | ||
566 | 953 | "<< /PageSize [%d %d] >> setpagedevice%s" | ||
567 | 954 | //"%s" | ||
568 | 955 | "%f %f scale%s" | ||
569 | 956 | "%f %f translate%s" | ||
570 | 957 | , | ||
571 | 958 | nl, | ||
572 | 959 | nl, | ||
573 | 960 | wi, hi, nl, | ||
574 | 961 | wi, hi, nl, | ||
575 | 962 | //backgroundfillps, | ||
576 | 963 | vectorscale, vectorscale, nl, | ||
577 | 964 | offx, offy, nl); | ||
578 | 965 | buffer2_len = strlen(buffer2); | ||
579 | 966 | |||
580 | 967 | // char buffer2[128]; | ||
581 | 968 | // snprintf(buffer2, 127, "%sgrestore%s", nl, nl); | ||
582 | 969 | |||
583 | 970 | //klfDbg("buffer is `"<<buffer<<"', length="<<buffer_len) ; | ||
584 | 971 | //klfDbg("rawepsdata has length="<<rawepsdata.size()) ; | ||
585 | 972 | |||
586 | 973 | // and modify the raw EPS data, to replace "%%BoundingBox:" instruction by our stuff... | ||
587 | 974 | #ifdef KLFBACKEND_QT4 | ||
588 | 975 | QByteArray neweps; | ||
589 | 976 | neweps = rawepsdata; | ||
590 | 977 | #else | ||
591 | 978 | QCString neweps(rawepsdata.data(), rawepsdata.size()); // makes deep copy | ||
592 | 979 | #endif | ||
593 | 980 | neweps.replace(i, len, buffer); | ||
594 | 981 | |||
595 | 982 | const char * endsetupstr = "%%EndSetup"; | ||
596 | 983 | int i2 = neweps.s_indexOf(endsetupstr); | ||
597 | 984 | if (i2 < 0) | ||
598 | 985 | i2 = i + buffer_len; // add our info after modified %%BoundingBox'es instructions if %%EndSetup not found | ||
599 | 986 | else | ||
600 | 987 | i2 += strlen(endsetupstr); | ||
601 | 988 | |||
602 | 989 | neweps.replace(i2, 0, buffer2); | ||
603 | 990 | |||
604 | 991 | qDebug("neweps has now length=%d",neweps.size()); | ||
605 | 992 | qDebug("New eps bbox is [0 0 %.6g %.6g] with translate [%.6g %.6g] and scale %.6g.", | ||
606 | 993 | dwi, dhi, offx, offy, vectorscale); | ||
607 | 994 | |||
608 | 995 | epsdatacorrected->ba_assign(neweps); | ||
609 | 996 | } | ||
610 | 997 | |||
611 | 998 | |||
612 | 999 | |||
613 | 1000 | |||
614 | 1001 | |||
615 | 1002 | |||
616 | 1003 | |||
617 | 1004 | |||
618 | 1005 | |||
619 | 1006 | |||
620 | 1007 | |||
621 | 656 | void KLFBackend::cleanup(QString tempfname) | 1008 | void KLFBackend::cleanup(QString tempfname) |
622 | 657 | { | 1009 | { |
623 | 658 | const char *skipcleanup = getenv("KLFBACKEND_LEAVE_TEMP_FILES"); | 1010 | const char *skipcleanup = getenv("KLFBACKEND_LEAVE_TEMP_FILES"); |
624 | @@ -674,9 +1026,14 @@ | |||
625 | 674 | if (QFile::exists(tempfname+".pdf")) QFile::remove(tempfname+".pdf"); | 1026 | if (QFile::exists(tempfname+".pdf")) QFile::remove(tempfname+".pdf"); |
626 | 675 | } | 1027 | } |
627 | 676 | 1028 | ||
628 | 1029 | |||
629 | 1030 | |||
630 | 1031 | |||
631 | 677 | // static private mutex object | 1032 | // static private mutex object |
632 | 678 | QMutex KLFBackend::__mutex; | 1033 | QMutex KLFBackend::__mutex; |
633 | 679 | 1034 | ||
634 | 1035 | |||
635 | 1036 | |||
636 | 680 | KLF_EXPORT bool operator==(const KLFBackend::klfInput& a, const KLFBackend::klfInput& b) | 1037 | KLF_EXPORT bool operator==(const KLFBackend::klfInput& a, const KLFBackend::klfInput& b) |
637 | 681 | { | 1038 | { |
638 | 682 | return a.latex == b.latex && | 1039 | return a.latex == b.latex && |
639 | 683 | 1040 | ||
640 | === modified file 'src/klfbackend/klfblockprocess.cpp' | |||
641 | --- src/klfbackend/klfblockprocess.cpp 2013-07-22 17:50:27 +0000 | |||
642 | +++ src/klfbackend/klfblockprocess.cpp 2014-03-24 20:24:05 +0000 | |||
643 | @@ -19,7 +19,7 @@ | |||
644 | 19 | * Free Software Foundation, Inc., * | 19 | * Free Software Foundation, Inc., * |
645 | 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
646 | 21 | ***************************************************************************/ | 21 | ***************************************************************************/ |
648 | 22 | /* $Id: klfblockprocess.cpp 856 2013-06-23 10:38:35Z phfaist $ */ | 22 | /* $Id: klfblockprocess.cpp 862 2013-11-23 11:10:54Z phfaist $ */ |
649 | 23 | 23 | ||
650 | 24 | #include <ctype.h> | 24 | #include <ctype.h> |
651 | 25 | 25 | ||
652 | @@ -70,7 +70,7 @@ | |||
653 | 70 | 70 | ||
654 | 71 | bool KLFBlockProcess::startProcess(QStringList cmd, QByteArray stdindata, QStringList env) | 71 | bool KLFBlockProcess::startProcess(QStringList cmd, QByteArray stdindata, QStringList env) |
655 | 72 | { | 72 | { |
657 | 73 | klfDbg("Running: "<<cmd<<", stdindata/size="<<stdindata.size()); | 73 | // klfDbg("Running: "<<cmd<<", stdindata/size="<<stdindata.size()); |
658 | 74 | 74 | ||
659 | 75 | _runstatus = 0; | 75 | _runstatus = 0; |
660 | 76 | 76 | ||
661 | @@ -87,7 +87,7 @@ | |||
662 | 87 | fn = klfSearchPath(cmd[0]); | 87 | fn = klfSearchPath(cmd[0]); |
663 | 88 | QFile fpeek(fn); | 88 | QFile fpeek(fn); |
664 | 89 | if (!fpeek.open(QIODevice::ReadOnly)) { | 89 | if (!fpeek.open(QIODevice::ReadOnly)) { |
666 | 90 | klfDbg("cmd[0]="<<cmd[0]<<", Can't peek into file "<<fn<<"!") ; | 90 | //klfDbg("cmd[0]="<<cmd[0]<<", Can't peek into file "<<fn<<"!") ; |
667 | 91 | } else { | 91 | } else { |
668 | 92 | QByteArray line; | 92 | QByteArray line; |
669 | 93 | int n = 0, j; | 93 | int n = 0, j; |
670 | @@ -114,8 +114,8 @@ | |||
671 | 114 | 114 | ||
672 | 115 | QString program = cmd[0]; | 115 | QString program = cmd[0]; |
673 | 116 | 116 | ||
676 | 117 | klfDbg("Running cmd="<<cmd); | 117 | //klfDbg("Running cmd="<<cmd); |
677 | 118 | klfDbg("env="<<env<<", curenv="<<environment()); | 118 | //klfDbg("env="<<env<<", curenv="<<environment()); |
678 | 119 | 119 | ||
679 | 120 | #ifdef KLFBACKEND_QT4 | 120 | #ifdef KLFBACKEND_QT4 |
680 | 121 | if (env.size() > 0) { | 121 | if (env.size() > 0) { |
681 | @@ -124,17 +124,17 @@ | |||
682 | 124 | 124 | ||
683 | 125 | QStringList args = cmd; | 125 | QStringList args = cmd; |
684 | 126 | args.erase(args.begin()); | 126 | args.erase(args.begin()); |
686 | 127 | klfDbg("Starting "<<program<<", "<<args) ; | 127 | //klfDbg("Starting "<<program<<", "<<args) ; |
687 | 128 | start(program, args); | 128 | start(program, args); |
688 | 129 | if ( ! waitForStarted() ) { | 129 | if ( ! waitForStarted() ) { |
690 | 130 | klfDbg("Can't wait for started! Error="<<error()) ; | 130 | //klfDbg("Can't wait for started! Error="<<error()) ; |
691 | 131 | return false; | 131 | return false; |
692 | 132 | } | 132 | } |
693 | 133 | 133 | ||
694 | 134 | write(stdindata.constData(), stdindata.size()); | 134 | write(stdindata.constData(), stdindata.size()); |
695 | 135 | closeWriteChannel(); | 135 | closeWriteChannel(); |
696 | 136 | 136 | ||
698 | 137 | klfDbg("wrote input data (size="<<stdindata.size()<<")") ; | 137 | //klfDbg("wrote input data (size="<<stdindata.size()<<")") ; |
699 | 138 | 138 | ||
700 | 139 | #else | 139 | #else |
701 | 140 | setArguments(cmd); | 140 | setArguments(cmd); |
702 | @@ -168,7 +168,7 @@ | |||
703 | 168 | #endif | 168 | #endif |
704 | 169 | 169 | ||
705 | 170 | if (_runstatus < 0) { // some error occurred somewhere | 170 | if (_runstatus < 0) { // some error occurred somewhere |
707 | 171 | klfDbg("some error occurred, _runstatus="<<_runstatus) ; | 171 | klfDbg("some error occurred, _runstatus="+QString("%1").arg(_runstatus)) ; |
708 | 172 | return false; | 172 | return false; |
709 | 173 | } | 173 | } |
710 | 174 | 174 | ||
711 | 175 | 175 | ||
712 | === modified file 'src/klfbackend/klfdebug.h' | |||
713 | --- src/klfbackend/klfdebug.h 2012-01-02 20:23:27 +0000 | |||
714 | +++ src/klfbackend/klfdebug.h 2014-03-24 20:24:05 +0000 | |||
715 | @@ -19,7 +19,7 @@ | |||
716 | 19 | * Free Software Foundation, Inc., * | 19 | * Free Software Foundation, Inc., * |
717 | 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
718 | 21 | ***************************************************************************/ | 21 | ***************************************************************************/ |
720 | 22 | /* $Id: klfdebug.h 748 2012-01-01 15:06:40Z phfaist $ */ | 22 | /* $Id: klfdebug.h 862 2013-11-23 11:10:54Z phfaist $ */ |
721 | 23 | 23 | ||
722 | 24 | #ifndef KLFDEBUG_H | 24 | #ifndef KLFDEBUG_H |
723 | 25 | #define KLFDEBUG_H | 25 | #define KLFDEBUG_H |
724 | @@ -235,7 +235,7 @@ | |||
725 | 235 | #else | 235 | #else |
726 | 236 | #define KLF_ASSERT_CONDITION(expr, msg, failaction) \ | 236 | #define KLF_ASSERT_CONDITION(expr, msg, failaction) \ |
727 | 237 | if ( !(expr) ) { \ | 237 | if ( !(expr) ) { \ |
729 | 238 | qWarning("In function %s:\n\t%s", (QString("")+msg).local8Bit().data()); \ | 238 | qWarning("In function %s:\n\t%s", KLF_FUNC_NAME, (QString("")+msg).local8Bit().data()); \ |
730 | 239 | failaction; \ | 239 | failaction; \ |
731 | 240 | } | 240 | } |
732 | 241 | #endif | 241 | #endif |
733 | 242 | 242 | ||
734 | === modified file 'src/klfbackend/klfqt34common.h' | |||
735 | --- src/klfbackend/klfqt34common.h 2011-05-15 17:55:27 +0000 | |||
736 | +++ src/klfbackend/klfqt34common.h 2014-03-24 20:24:05 +0000 | |||
737 | @@ -19,7 +19,7 @@ | |||
738 | 19 | * Free Software Foundation, Inc., * | 19 | * Free Software Foundation, Inc., * |
739 | 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
740 | 21 | ***************************************************************************/ | 21 | ***************************************************************************/ |
742 | 22 | /* $Id: klfqt34common.h 603 2011-02-26 23:14:55Z phfaist $ */ | 22 | /* $Id: klfqt34common.h 862 2013-11-23 11:10:54Z phfaist $ */ |
743 | 23 | 23 | ||
744 | 24 | #ifndef KLFQT34COMMON_H | 24 | #ifndef KLFQT34COMMON_H |
745 | 25 | #define KLFQT34COMMON_H | 25 | #define KLFQT34COMMON_H |
746 | @@ -30,6 +30,7 @@ | |||
747 | 30 | #ifdef KLFBACKEND_QT4 | 30 | #ifdef KLFBACKEND_QT4 |
748 | 31 | #define dir_native_separators(x) QDir::toNativeSeparators(x) | 31 | #define dir_native_separators(x) QDir::toNativeSeparators(x) |
749 | 32 | #define ba_assign(otherba) operator=(otherba) | 32 | #define ba_assign(otherba) operator=(otherba) |
750 | 33 | #define buf_setdata(buf, ba_ref) buf.setData(ba_ref) | ||
751 | 33 | #define dev_WRITEONLY QIODevice::WriteOnly | 34 | #define dev_WRITEONLY QIODevice::WriteOnly |
752 | 34 | #define dev_READONLY QIODevice::ReadOnly | 35 | #define dev_READONLY QIODevice::ReadOnly |
753 | 35 | #define dev_write write | 36 | #define dev_write write |
754 | @@ -54,6 +55,7 @@ | |||
755 | 54 | #define QLatin1String QString::fromLatin1 | 55 | #define QLatin1String QString::fromLatin1 |
756 | 55 | #define dir_native_separators(x) QDir::convertSeparators(x) | 56 | #define dir_native_separators(x) QDir::convertSeparators(x) |
757 | 56 | #define ba_assign(otherba) duplicate((otherba).data(), (otherba).size()) | 57 | #define ba_assign(otherba) duplicate((otherba).data(), (otherba).size()) |
758 | 58 | #define buf_setdata(buf, ba_ref) buf.setBuffer(ba_ref) | ||
759 | 57 | #define dev_WRITEONLY IO_WriteOnly | 59 | #define dev_WRITEONLY IO_WriteOnly |
760 | 58 | #define dev_READONLY IO_ReadOnly | 60 | #define dev_READONLY IO_ReadOnly |
761 | 59 | #define dev_write writeBlock | 61 | #define dev_write writeBlock |
Thanks, sponsored to trusty (it's in the unapproved queue)