Commit 746ccb42 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

сборка под линукс. странные правки (добавление this->) - не править. Это...

сборка под линукс. странные правки (добавление this->) - не править. Это особенность компилятора gcc
The problem is that templates are processed in two passes (according to the standard, VS does otherwise). In the first pass, before the type substitution, everything that does not depend on the template arguments is looked up and checked. Dependent names are then left to resolve in the second pass, once the type has been substituted. 

Now, in the first pass there is nothing that indicates that next is dependent on template arguments, and thus it needs to resolve before type substitution. Now, because the base type is templated on the template argument of your current template, the compiler cannot look into it (it might be specialized for some types, and without knowing what type T we are instantiating the template with, we cannot know which specialization to use, i.e. the base depends on T and we are checking before knowing T).

The trick of adding this-> turns next into a dependent name, and that in turn means that lookup is delayed until the second pass, where T is known, and because T is known, List<T> is also known and can be looked up into.


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63683 954022d7-b5bf-4e40-9824-e11837661b57
parent 7e4d0d72
......@@ -68,6 +68,42 @@ shared {
}
################################################
CONFIG += c++11
DEFINES += \
_QT \
FT2_BUILD_LIBRARY \
EXCLUDE_JPG_SUPPORT \
MNG_SUPPORT_DISPLAY \
MNG_SUPPORT_READ \
MNG_SUPPORT_WRITE \
MNG_ACCESS_CHUNKS \
MNG_STORE_CHUNKS\
MNG_ERROR_TELLTALE
linux-g++ | linux-g++-64 | linux-g++-32 {
DEFINES += \
HAVE_UNISTD_H \
LINUX \
_LINUX \
_LINUX_QT \
HAVE_MBSTATE_T \
GCONTAINER_NO_MEMBER_TEMPLATES="1" \
HAS_WCHAR \
HAVE_WCHAR_H \
UNIX \
HAVE_STDINCLUDES
}
win32 {
DEFINES += \
JAS_WIN_MSVC_BUILD \
WIN32 \
NOMINMAX
DEFINES -= UNICODE
}
INCLUDEPATH += \
../DesktopEditor/agg-2.4/include \
../DesktopEditor/freetype-2.5.2/include
......
......@@ -49,7 +49,7 @@ namespace NSDjvu
try
{
return static_cast<int>(_wtoi64(wsString.c_str()));
return static_cast<int>(std::stol(wsString));
}
catch (...)
{
......
......@@ -78,6 +78,11 @@
#include "debug.h"
#ifdef __linux__
typedef unsigned int UINT;
#endif
#include <algorithm>
#ifdef HAVE_NAMESPACES
namespace DJVU {
......@@ -1919,11 +1924,11 @@ void DjVuDocument::ReadPageInfo(int nPage, int& width, int& height, int& nDpi)
pInfo->decode(*chunk_stream);
// Check data for consistency
width = max(pInfo->width, 0);
height = max(pInfo->height, 0);
width = std::max(pInfo->width, 0);
height = std::max(pInfo->height, 0);
int nInitialRotate = pInfo->orientation;
nDpi = max(pInfo->dpi, 0);
nDpi = std::max(pInfo->dpi, 0);
if ((nInitialRotate & 1) != 0)
{
......
......@@ -72,7 +72,11 @@ inline void * operator new(size_t, void * ptr) { return ptr; }
#elif defined(AUTOCONF) && defined(HAVE_STDINCLUDES)
# include <new>
#else
# include <new.h>
# include <new>
#endif
#ifdef WIN32
#include <new.h>
#endif
//#ifdef WIN32
......
......@@ -301,7 +301,10 @@ DjVuTXT::Zone::decode(const GP<ByteStream> &gbs, int maxtext,
z->decode(gbs, maxtext, this, prev_child);
//< Changed for WinDjView project
if (z->rect.isempty())
children.del(children.lastpos());
{
GPosition _lastpos = children.lastpos();
children.del(_lastpos);
}
else
//>
prev_child=z;
......
......@@ -970,21 +970,21 @@ public:
/** Inserts an element after the last element of the list.
The new element is initialized with a copy of argument #elt#. */
void append(const TYPE &elt)
{ GListImpl<TI>::append(newnode((const TI&)elt)); }
{ GListImpl<TI>::append(this->newnode((const TI&)elt)); }
/** Inserts an element before the first element of the list.
The new element is initialized with a copy of argument #elt#. */
void prepend(const TYPE &elt)
{ GListImpl<TI>::prepend(newnode((const TI&)elt)); }
{ GListImpl<TI>::prepend(this->newnode((const TI&)elt)); }
/** Inserts a new element after the list element at position #pos#. When
position #pos# is null the element is inserted at the beginning of the
list. The new element is initialized with a copy of #elt#. */
void insert_after(GPosition pos, const TYPE &elt)
{ GListImpl<TI>::insert_after(pos, newnode((const TI&)elt)); }
{ GListImpl<TI>::insert_after(pos, this->newnode((const TI&)elt)); }
/** Inserts a new element before the list element at position #pos#. When
position #pos# is null the element is inserted at the end of the
list. The new element is initialized with a copy of #elt#. */
void insert_before(GPosition pos, const TYPE &elt)
{ GListImpl<TI>::insert_before(pos, newnode((const TI&)elt)); }
{ GListImpl<TI>::insert_before(pos, this->newnode((const TI&)elt)); }
/** Inserts an element of another list into this list. This function
removes the element at position #frompos# in list #frompos#, inserts it
in the current list before the element at position #pos#, and advances
......@@ -1205,7 +1205,7 @@ GMapImpl<K,TI>::GMapImpl(const GCONT Traits &traits)
template<class K, class TI> GCONT HNode *
GMapImpl<K,TI>::get_or_create(const K &key)
{
GCONT HNode *m = get(key);
GCONT HNode *m = this->get(key);
if (m) return m;
MNode *n = (MNode*) operator new (sizeof(MNode));
#if GCONTAINER_ZERO_FILL
......@@ -1214,7 +1214,7 @@ GMapImpl<K,TI>::get_or_create(const K &key)
new ((void*)&(n->key)) K (key);
new ((void*)&(n->val)) TI ();
n->hashcode = hash((const K&)(n->key));
installnode(n);
this->installnode(n);
return n;
}
......@@ -1280,13 +1280,13 @@ public:
contains key #key#. This variant of #operator[]# is necessary when
dealing with a #const GMAP<KTYPE,VTYPE>#. */
const VTYPE& operator[](const KTYPE &key) const
{ return (const VTYPE&)(((const typename GMapImpl<KTYPE,TI>::MNode*)(get_or_throw(key)))->val); }
{ return (const VTYPE&)(((const typename GMapImpl<KTYPE,TI>::MNode*)(this->get_or_throw(key)))->val); }
/** Returns a reference to the value of the map entry for key #key#. This
reference can be used for both reading (as "#a[n]#") and modifying (as
"#a[n]=v#"). If there is no entry for key #key#, a new entry is created
for that key with the null constructor #VTYPE::VTYPE()#. */
VTYPE& operator[](const KTYPE &key)
{ return (VTYPE&)(((typename GMapImpl<KTYPE,TI>::MNode*)(get_or_create(key)))->val); }
{ return (VTYPE&)(((typename GMapImpl<KTYPE,TI>::MNode*)(this->get_or_create(key)))->val); }
/** Destroys the map entry for position #pos#.
Nothing is done if position #pos# is not a valid position. */
void del(GPosition &pos)
......
......@@ -65,6 +65,8 @@
# pragma interface
#endif
#include <stddef.h>
/** @name GSmartPointer.h
Files #"GSmartPointer.h"# and #"GSmartPointer.cpp"# define a smart-pointer
......
......@@ -204,7 +204,7 @@ GThread::create(void (*entry)(void*), void *arg)
void
GThread::terminate()
{
OutputDebugString(L"Terminating thread.\n");
OutputDebugString("Terminating thread.\n");
if (hthr)
TerminateThread(hthr,0);
}
......
......@@ -163,7 +163,7 @@ JB2Dict::get_shape(const int shapeno)
}else
{
G_THROW( ERR_MSG("JB2Image.bad_number") );
retval = &(JB2Shape());
retval = new JB2Shape();
}
return *retval;
}
......@@ -181,7 +181,7 @@ JB2Dict::get_shape(const int shapeno) const
}else
{
G_THROW( ERR_MSG("JB2Image.bad_number") );
retval = &(JB2Shape());
retval = new JB2Shape();
}
return *retval;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment