View Issue Details

IDProjectCategoryView StatusLast Update
0002395ScribusInternalpublic2005-09-07 21:00
ReporterringercAssigned Tofschmid  
Status closedResolutionfixed 
Platformx86 LinuxOSFedora CoreOS Version3
Fixed in Version1.3.1cvs 
Summary0002395: Portability: Casting between pointer and int
DescriptionWe cast between pointer and int types in Scribus, it seems. This is unsafe, especially on 64 bit architectures, and it's rather ugly anyway. It also renders Scribus unbuildable with --enable-debug with gcc4 on AMD64.

ScribusDoc::FrameItems is the main culprit I've found so far.

The first case I ran into was in fileloader.cpp:220:

    ScText *hl = it->;
    if ((hl->ch == QChar(25)) && ((int)hl->cembedded != -1))
       hl->cembedded = app->doc->>cembedded);

but I suspect this is all over the place.

I really don't know how to fix this. I don't even understand the design behind it, or exactly what it's for.
TagsNo tags attached.


related to 0002098 acknowledged Metabug: New File Format 
related to 0001099 closedfschmid Inline graphics 



2005-08-08 02:28

reporter   ~0005923

Sending this your way franz... I suspect you're the only person likely to know what this does and why.


2005-08-08 03:14

reporter   ~0005924

Correction: Building fails even without --enable-debug or even the default KDE warnings:

[craig@wallace scribus]$ g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/libart-2.0 -I/usr/include/freetype2 -I/usr/lib64/qt-3.3/include -I/usr/X11R6/include -DDOCDIR=\"/home/craig/scribus/amd64/scribus13cvs_amd64/share/scribus/doc/\" -DICONDIR=\"/home/craig/scribus/amd64/scribus13cvs_amd64/share/scribus/icons/\" -DSAMPLESDIR=\"/home/craig/scribus/amd64/scribus13cvs_amd64/share/scribus/samples/\" -DSCRIPTSDIR=\"/home/craig/scribus/amd64/scribus13cvs_amd64/share/scribus/scripts/\" -DTEMPLATEDIR=\"/home/craig/scribus/amd64/scribus13cvs_amd64/share/scribus/templates/\" -DLIBDIR=\"/home/craig/scribus/amd64/scribus13cvs_amd64/lib/scribus/\" -DPLUGINDIR=\"/home/craig/scribus/amd64/scribus13cvs_amd64/lib/scribus/plugins/\" -DSHAREDIR=\"/home/craig/scribus/amd64/scribus13cvs_amd64/share/scribus/\" -DQT_THREAD_SUPPORT -D_REENTRANT -fno-exceptions -fno-check-new -fno-common -MT fileloader.o -MD -MP -MF ".deps/fileloader.Tpo" -c -o fileloader.o fileloader.cpp
fileloader.cpp: In member function ‘bool FileLoader::LoadFile(ScribusApp*)’:
fileloader.cpp:220: error: cast from ‘PageItem*’ to ‘int’ loses precision
fileloader.cpp:221: error: cast from ‘PageItem*’ to ‘int’ loses precision
fileloader.cpp:235: error: cast from ‘PageItem*’ to ‘int’ loses precision
fileloader.cpp:236: error: cast from ‘PageItem*’ to ‘int’ loses precision


2005-08-08 05:51

administrator   ~0005925

I know that this is not very portable, but this casting is somewhat needed to get the inline Objects working. Will see if i can find another solution.


2005-08-08 05:53

reporter   ~0005926

OK, inline objects. Am I correct in guessing then that this is to build a "containment graph" - ie what objects are contained within other objects?


2005-08-08 23:05

administrator   ~0005952

Last edited: 2005-08-08 23:06

Have fixed that now, but this fix makes it impossible that inline Objects can also have inline Objects in them (No big matter given the fact that even Quark can't do that). A bigger drawback is that all older docs using inline Objects aren't working anymore. You have to move all <FRAMEOBJECT> marked items after the last </PAGE> tag by hand with a texteditor to keep them.


2005-08-09 17:11

reporter   ~0005993

That's great. I made a few build fixes and it's now running happily on AMD64 with gcc4 .

If we're going to use inline frames for bullets, drop caps, etc as Andreas is talking about, then we'll probably need to be able to support nesting in future. This does the job for now though, and a cleaner data structure can be built to keep track of things when needed.

Thanks Franz.

Issue History

Date Modified Username Field Change
2005-08-08 02:26 ringerc New Issue
2005-08-08 02:27 ringerc Status new => assigned
2005-08-08 02:27 ringerc Assigned To => fschmid
2005-08-08 02:28 ringerc Note Added: 0005923
2005-08-08 03:14 ringerc Note Added: 0005924
2005-08-08 05:51 fschmid Note Added: 0005925
2005-08-08 05:53 ringerc Note Added: 0005926
2005-08-08 23:05 fschmid Note Added: 0005952
2005-08-08 23:06 fschmid Note Edited: 0005952
2005-08-08 23:07 fschmid Status assigned => resolved
2005-08-08 23:07 fschmid Fixed in Version => 1.3.1cvs
2005-08-08 23:07 fschmid Resolution open => fixed
2005-08-09 17:11 ringerc Note Added: 0005993
2005-08-09 17:13 ringerc Relationship added related to 0002098
2005-08-09 17:13 ringerc Relationship added related to 0001099
2005-09-07 21:00 cbradney Status resolved => closed