Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file corruption in TTeXDump #69

Closed
wants to merge 1 commit into from
Closed

Fix file corruption in TTeXDump #69

wants to merge 1 commit into from

Conversation

veprbl
Copy link
Contributor

@veprbl veprbl commented Jul 5, 2015

This fixes a bug that would lead to producing corrupted files when saving plots as TeX.

The current implementation of TTeXDump uses TVirtualPS::PrintFast based
methods to output TeX markup with automatic linewraps. Yet these methods
are optimized for PostScript format where there are a lot of space
characters that are used for newline placement. Current
TTeXDump::DrawPolyMarker would often produce a long contiguous lines
that trigger a forceful linewrap that can happen in the middle of real
number constant (ignored by latex) or even in the middle of latex
command (producing incorrect file).

One solution would be to rewrite TTeXDump using only PrintRaw (that you
can't mix with PrintStr/PrintFast/WriteReal). The other would be to fix
PrintFast to not introduce forced newline. The third option is less
intrusive and just adds additional spaces to provide clues for the
proper line wrapping (this is the one implemented in this change).
@couet
Copy link
Member

couet commented Jul 6, 2015

Thanks. It is now applied on master.

@couet couet closed this Jul 6, 2015
amadio added a commit to amadio/root that referenced this pull request Jul 12, 2017
Warning:
root/core/rootcling_stage1/src/rootcling_stage1.cxx(38):
	warning root-project#69: integer conversion resulted in truncation

   auto dummyVal = (int)(long)&usedToIdentifyRootClingByDlSym;
                    ^^^

The method above uses a cast to long, followed by a cast to int,
which results in a truncation. That is harmless, since the value
is never used, but generates a compiler warning with ICC 17. This
commit avoids the warning by storing the address of the same symbol
in a static variable instead.
amadio added a commit to amadio/root that referenced this pull request Jul 12, 2017
Warning:
root/core/rootcling_stage1/src/rootcling_stage1.cxx(38):
	warning root-project#69: integer conversion resulted in truncation

   auto dummyVal = (int)(long)&usedToIdentifyRootClingByDlSym;
                    ^^^

The method above uses a cast to long, followed by a cast to int,
which results in a truncation. That is harmless, since the value
is never used, but generates a compiler warning with ICC 17. This
commit avoids the warning by storing the address of the same symbol
in a static variable instead.
amadio added a commit to amadio/root that referenced this pull request Jul 12, 2017
Warning:
root/core/rootcling_stage1/src/rootcling_stage1.cxx(38):
	warning root-project#69: integer conversion resulted in truncation

   auto dummyVal = (int)(long)&usedToIdentifyRootClingByDlSym;
                    ^^^

The method above uses a cast to long, followed by a cast to int,
which results in a truncation. That is harmless, since the value
is never used, but generates a compiler warning with ICC 17. This
commit avoids the warning by storing the address of the same symbol
in a static variable instead.
amadio added a commit that referenced this pull request Jul 13, 2017
Warning:
root/core/rootcling_stage1/src/rootcling_stage1.cxx(38):
	warning #69: integer conversion resulted in truncation

   auto dummyVal = (int)(long)&usedToIdentifyRootClingByDlSym;
                    ^^^

The method above uses a cast to long, followed by a cast to int,
which results in a truncation. That is harmless, since the value
is never used, but generates a compiler warning with ICC 17. This
commit avoids the warning by storing the address of the same symbol
in a static variable instead.
adriansev pushed a commit to adriansev/root that referenced this pull request Sep 12, 2017
Warning:
root/core/rootcling_stage1/src/rootcling_stage1.cxx(38):
	warning root-project#69: integer conversion resulted in truncation

   auto dummyVal = (int)(long)&usedToIdentifyRootClingByDlSym;
                    ^^^

The method above uses a cast to long, followed by a cast to int,
which results in a truncation. That is harmless, since the value
is never used, but generates a compiler warning with ICC 17. This
commit avoids the warning by storing the address of the same symbol
in a static variable instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants