Commit Graph

1797 Commits

Author SHA1 Message Date
Georg Baum
0b30253f2b Fix compilation without trivstring 2014-12-07 20:39:31 +01:00
Georg Baum
83bee109db Make trivstring class ready for use
The interface is now 100% unit tested, and the typedefs depend on the new
STD_STRING_USES_COW configuration variable. The only missing bit is to detect
clang and disable STD_STRING_USES_COW for clang.
2014-12-07 13:14:17 +01:00
Georg Baum
46f7b578b2 First version of trivstring class (bug #9336)
As discused on the list. This is not used yet, but it is intended to provide
thread-safe read-access without the need for synchronization if the used STL
implementation does not provide it for std::basic_string. This is the case for
all implementations using copy-on-write.
2014-12-07 13:14:17 +01:00
Georg Baum
49af9db623 Remove unneeded typedef
docstring is already defined in strfwd.h (which is included from docstring.h).
There are only two possible cases:
Either the typedef in docstring.h defines an identical type (then it is not
needed), or it defines a different type (then it generates a compilation error)
=> it is not needed.
2014-12-03 21:08:13 +01:00
Enrico Forestieri
11b7b7234e Fix bug #9342: LaTeX build get stuck for unconventional path name
The reason being that the TEXINPUTS path list was not quoted on Windows.
This was no problem with spaces but some special characters are
interpreted by the shell and can cause problems. In this particular
case, the '&' character was being interpreted as a command separator.
2014-11-27 21:59:09 +01:00
Georg Baum
a180414975 Fix viewer file paths on windows (bug #8892)
Some applications do not accept forward slashes, so call external viewers
and editors with backward slashes which is the usual convention under windows.
2014-11-19 22:47:36 +01:00
Georg Baum
e7a8f63e1b Fix typo 2014-11-16 12:40:23 +01:00
Kornel Benko
07683c1f0d Cmake build: 'callstack printing' detection.
Instead of depending on compiler we try to check for working
API as is done now for automake build too.
2014-11-09 12:59:14 +01:00
Richard Heck
07079e7da3 Improve debugging output. 2014-10-27 18:28:33 -04:00
Stephan Witt
e7163a0999 #9130 Text in main work area isn't rendered with high resolution
Add search mode check_hidpi to ease the lookup for images with double size to use for displays with high resolution.
2014-10-18 15:19:47 +02:00
Kornel Benko
6c7b5b12c7 Add cmake files to autoconf's dist 2014-08-31 15:21:20 +02:00
Peter Kümmel
ada262a78b print callstack on assert 2014-08-27 19:48:42 +02:00
Stephan Witt
0d6f17afe2 More careful NSAutoreleasePool management 2014-08-26 08:22:12 +02:00
Stephan Witt
fad67d64ac FSPathMakeRef is deprecated: use LSOpenFromURLSpec instead of LSOpenFromRefSpec 2014-08-24 12:49:34 +02:00
Enrico Forestieri
4bdeae2733 Update autotools for building with Qt5.
The option --enable-qt5 allows configuring for Qt5. The default is Qt4.
Nothing special is done with respect to Qt4, apart from pulling in the
correct libraries. Indeed, other than the core and gui libraries, now
also the concurrent and widgets libraries are needed.
2014-07-19 03:34:28 +02:00
Enrico Forestieri
4342411297 Fix build on FreeBSD.
Notified by Raphael Kubo da Costa.
2014-07-16 22:28:46 +02:00
Enrico Forestieri
5bd14af887 Fix bug #9193: Spacing modification not exact
The conversion from floating point to string performed by
boost:lexical_cast does not allow specifying a precision and,
for example, values such as 0.9 are resturned as 0.899999976.
The standard C++ way for performing the conversion is using
std::ostringstream which is exempt from this problem, even if
less efficient. For the sake of accuracy, boost::lexical_cast
is ditched in favor of the ostrinsgstream implementation.
In C++11 another option would be using std::to_string, but I
think it is not as efficient as the boost way and not worth
implementing through #ifdef's.
Incidentally, this patch would have also fixed #9190 and all
similar cases involving the use of convert<string>(float|double).
2014-07-12 19:12:08 +02:00
Enrico Forestieri
b3735501c7 Fix compatibility issue with 64-bit cygwin. 2014-07-11 16:49:10 +02:00
Enrico Forestieri
b60b505fd8 Fix import of latex documents with scaled fonts. 2014-07-11 11:21:45 +02:00
Enrico Forestieri
60a1b3b83c Fix make check. 2014-07-11 11:14:02 +02:00
Jean-Marc
8715bab65c Fix typo spotted by cppcheck 2014-07-05 18:01:19 +02:00
Georg Baum
0de4bc224a Make DocFileName::mangledFileName() threadsafe 2014-07-05 12:22:08 +02:00
Georg Baum
c9c20dc23b Make IconvProcessor::Impl noncopyable
The compiler-generated copy-constructor and assigment operators would be wrong
for IconvProcessor::Impl, since cd would be copied, and iconv_close() could
thus be called twice on the same descriptor. The old code did work, but now
IconvProcessor::Impl cannot be copied by accident in the future.
2014-07-01 22:23:06 +02:00
Georg Baum
0e8fea0705 Fix memory leak and assignment operator signature
The IconvProcessor assignment operator did not delete pimpl_ and used a
non-standard signature. If you want to know why the standard signature is
important, read "Effective C++" by Scott Meyers.
2014-07-01 22:17:07 +02:00
Peter Kümmel
2f17858115 On Linux show in crash message box the backtrace 2014-06-14 11:25:25 +02:00
Kornel Benko
3b14de740d Cmake build: Symplify use of linking optional libraries found via find_package 2014-06-12 19:02:29 +02:00
Kornel Benko
2b0511510a Cmake build: Added magic library to some link commands.
Needed due to the use of magic_(open|load|error|file|close) after recent changes.
2014-06-12 07:49:17 +02:00
Enrico Forestieri
f439609304 Make binary file detection more robust.
The magic library can detect the charset used by a file. While this
detection is not full proof, actually the library seems to be infallible
as regards the binary nature of a file. So, use libmagic for the detection
and fallback to the previous method if the library is not installed or
its database cannot be loaded.
2014-06-11 23:04:39 +02:00
Enrico Forestieri
82faa66192 Set the default locale at startup.
On startup, the default locale is "C", meaning that all system
functions assume an ascii codeset. The environment's locale
settings should be selected by calling setlocale(LC_ALL,"").
This is done by Qt during the QCoreApplication initialization
but this inizialization is never performed for batch processing
and, as a result, LyX is not able to process files whose names
contain non-ascii characters. This is not an issue on Windows,
where the file names are always stored as UTF-16, so the call is
only performed for unix-like platforms (this also includes cygwin,
due to its own filenames management that allows using characters
which are forbidden to native programs).
2014-06-11 18:23:44 +02:00
Georg Baum
f76d6997b7 Fix thinko in loop detection 2014-06-09 22:06:58 +02:00
Georg Baum
f09a9fe2e6 Remove unsafe method FileName::tempName()
FileName::tempName() created a new temp file name by using qt to create a
temporary file with a unique name, and then deleting that file and returning
the name. This was unsafe, since other processes or even other threads of the
running LyX could create files with the same name between deletion and then
using the temp name.
This is fixed by using the TempFile class instead. As a side effect, a few
cases where the temp files were not deleted after usage were fixed as well.
The only place that is still unsafe is createTmpDir().
2014-06-09 13:05:50 +02:00
Georg Baum
ae15b59734 Don't double delete by making TempFile noncopyable
The compiler generated copy constructor and assignment operator are wrong.
This could easily be fixed by implementing them manually, but a) they are
not needed, and b) the semantics would be unclear (should the copy point
to a new temp file or not?), so it is better to forbid them.
2014-06-09 13:03:32 +02:00
Georg Baum
bf782ee02a Improve file saving strategy
- The TempFile class guarantees to generate a file name, we are not limited to
  100 tries of a predictable scheme anymore, which could break if LyX
  frequently crashes.
- The temp file name generation has no race condition against another LyX
  instance in the same directory anymore.
- Symlinks survive saving again (regression of 10364082c8).
2014-06-09 11:08:24 +02:00
Georg Baum
47721216f0 Fix typo 2014-06-09 10:26:39 +02:00
Enrico Forestieri
7d31194085 Fix bug #9146.
If LyX does not know about a given file format, it may easily
happen that the format is recognized as "latex" and this causes
bug #9146. This patch limits the check for a latex format to
non-binary files. The strategy for deciding that a file has
binary content is the same as that adopted by the "less" program.
2014-06-05 17:33:25 +02:00
Scott Kostyshak
fc19148f6d Fix a GCC warning: comparing signed vs. unsigned
This also changes the type of an int to an ssize_t.

nRead is initialized as an ssize_t because it could
be negative. It is cast to a size_t for comparison
to the size of a vector, but only after we check
that nRead is not negative.
2014-05-20 08:01:49 -04:00
Enrico Forestieri
480f8d3115 Fix compilation after afc34c7a 2014-05-20 00:43:46 +02:00
Georg Baum
afc34c7a60 Fix bug 9030 except for windows
The format entries should be sorted according to the culture selected for the
UI. This was not the case previously, resulting in unexpected sorting of small
and capital letters. This is now fixed by using the standard C function
strcoll(). Qt does only offer similar functionality in Qt5, and this is not
mature enough yet to depend on it.
Unfortunately we have a report that strcoll() does not work on MSVC, however
this partial fix is better than nothing. The MSVC issue might also be a
configuration problem, since MS claims that strcoll() is supported. This
still needs to be checked.
2014-05-19 22:37:14 +02:00
Enrico Forestieri
ee9ff6cb0c Extend the otexstream class to also report about paragraph breaks.
The new method afterParbreak() returns true if a blank line was just
output and we are at the beginning of the next line, false otherwise.
2014-05-18 22:46:33 +02:00
Scott Kostyshak
1821c6d8a3 Centralize substitution of python commands
The code for detecting python commands and substituting in the
correct prefix is now merged with what used to be libScriptSearch()
and is now renamed to commandPrep(). This commit does not change
any functionality and just improves organization to reduce the
chance of bugs in the future.
2014-05-14 15:45:20 -04:00
Scott Kostyshak
8b66f9cedf Centralize replacement of "$$s"
Now the replacement is done in startScript(). In addition to making
the code cleaner and more consistent, this commit fixes a bug where
"$$s" was not replaced when "latex=" was specified in the extra flags
of a converter.

Note that the temporary fix at 731b8610 is reverted with this commit.
2014-05-14 15:45:20 -04:00
Jean-Marc Lasgouttes
ac9a2fa9f8 Turn an error message into a Debug::LOCALE warning 2014-05-06 14:29:42 +02:00
Stephan Witt
36e5864a82 improve language flag for Objective-C compiler call 2014-04-30 23:14:41 +02:00
Georg Baum
351363c599 Fix C++11 test
Thanks Vincent for noticing. The old test was slightly off, the C++98 standard
guarantees that __cplusplus is defined as 199711L, not 19971L.
2014-04-29 21:00:02 +02:00
Vincent van Ravesteijn
b6ccf21192 cmake: Objective-C compilation support with clang and C++11
This fixes an issue when compiling with C++11 flags on: the
objective-C clang compiler produces an error. This patch set
the -std option to ansi for the Objective-C sources.
2014-04-22 09:41:25 +02:00
Benjamin Piwowarski
d863088986 Revert "Objective-C compililation support with cmake and C++11"
This reverts commit c2e67a41ce.
2014-04-22 09:36:17 +02:00
Richard Heck
065db68067 Fix a bunch of minor issues discovered by the cppcheck script. 2014-04-21 11:52:00 -04:00
Richard Heck
cd32001de6 Typo. 2014-04-21 11:51:59 -04:00
Benjamin Piwowarski
73405549cb Avoids const_cast in configure_command by using mutable 2014-04-21 11:51:57 -04:00
Richard Heck
fdbe775b9f This is the result of an audit of all static variables, looking
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
	// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.

I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
2014-04-21 11:51:57 -04:00