diff options
99 files changed, 1569 insertions, 1988 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cd0fcaa..764aebe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,6 +157,7 @@ if (win_static) endforeach() endif() +include(cmake/CompilerWarnings.cmake) add_subdirectory(libmd5) add_subdirectory(liblodepng) diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake new file mode 100644 index 0000000..4c422b6 --- /dev/null +++ b/cmake/CompilerWarnings.cmake @@ -0,0 +1,110 @@ +# adapted from +# https://github.com/lefticus/cppbestpractices/blob/master/02-Use_the_Tools_Available.md + +function(set_project_warnings project_name) + + set(MSVC_WARNINGS + #/W4 # Baseline reasonable warnings + /w14242 # 'identfier': conversion from 'type1' to 'type1', possible loss + # of data + /w14254 # 'operator': conversion from 'type1:field_bits' to + # 'type2:field_bits', possible loss of data + /w14263 # 'function': member function does not override any base class + # virtual member function + /w14265 # 'classname': class has virtual functions, but destructor is not + # virtual instances of this class may not be destructed correctly + /w14287 # 'operator': unsigned/negative constant mismatch + /we4289 # nonstandard extension used: 'variable': loop control variable + # declared in the for-loop is used outside the for-loop scope + /w14296 # 'operator': expression is always 'boolean_value' + /w14311 # 'variable': pointer truncation from 'type1' to 'type2' + /w14545 # expression before comma evaluates to a function which is missing + # an argument list + /w14546 # function call before comma missing argument list + /w14547 # 'operator': operator before comma has no effect; expected + # operator with side-effect + /w14549 # 'operator': operator before comma has no effect; did you intend + # 'operator'? + /w14555 # expression has no effect; expected expression with side- effect + /w14619 # pragma warning: there is no warning number 'number' + /w14640 # Enable warning on thread un-safe static member initialization + /w14826 # Conversion from 'type1' to 'type_2' is sign-extended. This may + # cause unexpected runtime behavior. + /w14905 # wide string literal cast to 'LPSTR' + /w14906 # string literal cast to 'LPWSTR' + /w14928 # illegal copy-initialization; more than one user-defined + # conversion has been implicitly applied + ) + + set(CLANG_WARNINGS + -Wall + -Wextra # reasonable and standard + -Wshadow # warn the user if a variable declaration shadows one from a + # parent context + -Wnon-virtual-dtor # warn the user if a class with virtual functions has a + # non-virtual destructor. This helps catch hard to + # track down memory errors +# -Wold-style-cast # warn for c-style casts + -Wcast-align # warn for potential performance problem casts + -Wunused # warn on anything being unused + -Woverloaded-virtual # warn if you overload (not override) a virtual + # function + -Wpedantic # warn if non-standard C++ is used + -Wconversion # warn on type conversions that may lose data + -Wnull-dereference # warn if a null dereference is detected + -Wdouble-promotion # warn if float is implicit promoted to double + -Wformat=2 # warn on security issues around functions that format output + # (ie printf) + + # turn off warning caused by generated code (flex) + -Wno-unused-parameter + -Wno-implicit-int-conversion + -Wno-sign-conversion + -Wno-format-nonliteral + -Wno-shorten-64-to-32 + + # enable to turn warnings into errors + #-Werror + ) + + set(GCC_WARNINGS + -Wall + -Wextra # reasonable and standard + #-Wshadow # warn the user if a variable declaration shadows one from a + # # parent context + -Wnon-virtual-dtor # warn the user if a class with virtual functions has a + # non-virtual destructor. This helps catch hard to + # track down memory errors +# -Wold-style-cast # warn for c-style casts + -Wcast-align # warn for potential performance problem casts + -Wunused # warn on anything being unused + -Woverloaded-virtual # warn if you overload (not override) a virtual + # function + -Wpedantic # warn if non-standard C++ is used + #-Wconversion # warn on type conversions that may lose data + #-Wnull-dereference # warn if a null dereference is detected + -Wdouble-promotion # warn if float is implicit promoted to double + -Wformat=2 # warn on security issues around functions that format output + # (ie printf) + + # turn off warning caused by generated code (flex) + -Wno-unused-parameter + -Wno-sign-conversion + -Wno-format-nonliteral + -Wno-implicit-fallthrough + + # enable to turn warnings into errors + #-Werror + ) + + if(MSVC) + set(PROJECT_WARNINGS ${MSVC_WARNINGS}) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(PROJECT_WARNINGS ${CLANG_WARNINGS}) + else() + set(PROJECT_WARNINGS ${GCC_WARNINGS}) + endif() + + target_compile_options(${project_name} PRIVATE ${PROJECT_WARNINGS}) + +endfunction() diff --git a/qtools/qasciidict.h b/qtools/qasciidict.h index 29fcf2f..6a93a02 100644 --- a/qtools/qasciidict.h +++ b/qtools/qasciidict.h @@ -46,7 +46,7 @@ template<class type> class Q_EXPORT QAsciiDict : public QGDict { public: - QAsciiDict(int size=17, bool caseSensitive=TRUE, bool copyKeys=TRUE ) + QAsciiDict(uint size=17, bool caseSensitive=TRUE, bool copyKeys=TRUE ) : QGDict(size,AsciiKey,caseSensitive,copyKeys) {} QAsciiDict( const QAsciiDict<type> &d ) : QGDict(d) {} ~QAsciiDict() { clear(); } diff --git a/qtools/qcache.h b/qtools/qcache.h index 39d4f7a..87f9866 100644 --- a/qtools/qcache.h +++ b/qtools/qcache.h @@ -46,7 +46,7 @@ template<class type> class Q_EXPORT QCache : public QGCache { public: QCache( const QCache<type> &c ) : QGCache(c) {} - QCache( int maxCost=100, int size=17, bool caseSensitive=TRUE ) + QCache( int maxCost=100, uint size=17, bool caseSensitive=TRUE ) : QGCache( maxCost, size, AsciiKey, caseSensitive, TRUE ) {} ~QCache() { clear(); } QCache<type> &operator=( const QCache<type> &c ) diff --git a/qtools/qcstring.h b/qtools/qcstring.h index f54cf2f..a527fec 100644 --- a/qtools/qcstring.h +++ b/qtools/qcstring.h @@ -149,7 +149,7 @@ public: /** creates a string with room for size characters * @param[in] size the number of character to allocate (including the 0-terminator) */ - explicit QCString( int size ) : m_rep(size) + explicit QCString( uint size ) : m_rep(size) { } @@ -269,7 +269,7 @@ public: bool stripPrefix(const char *prefix); QCString left( uint len ) const; QCString right( uint len ) const; - QCString mid( uint index, uint len=0xffffffff) const; + QCString mid( uint index, uint len=(uint)-1) const; QCString lower() const; QCString upper() const; QCString stripWhiteSpace() const; @@ -307,8 +307,8 @@ public: QCString &operator+=( const char *str ) { if (!str) return *this; - int len1 = length(); - int len2 = (int)strlen(str); + uint len1 = length(); + uint len2 = (uint)strlen(str); resize(len1+len2+1); memcpy(rawData()+len1,str,len2); return *this; @@ -317,7 +317,7 @@ public: /** Appends character \a c to this string and returns a reference to the result. */ QCString &operator+=( char c ) { - int len = length(); + uint len = length(); resize(len+2); rawData()[len]=c; return *this; @@ -361,7 +361,7 @@ public: // ref counting string header struct LSHeader { - int len; // length of string without 0 terminator + uint len; // length of string without 0 terminator int refCount; // -1=leaked, 0=one ref & non-cost, n>0, n+1 refs, const }; // ref counting string data and methods @@ -374,7 +374,7 @@ public: // creates a LSData item with room for size bytes (which includes the 0 terminator!) // if size is zero, an empty string will be created. - static LSData *create(int size) + static LSData *create(uint size) { LSData *data; data = (LSData*)malloc(sizeof(LSHeader)+size); @@ -454,14 +454,14 @@ public: u = s.u; // avoid uninitialized warning from gcc } } - StringRep(int size) + StringRep(uint size) { u.s.isShort = size<=SHORT_STR_CAPACITY; if (size<=SHORT_STR_CAPACITY) // init short string { if (size>0) { - u.s.len = size-1; + u.s.len = (uchar)(size-1); u.s.str[size-1]='\0'; } else @@ -478,11 +478,11 @@ public: { if (str) { - int len = (int)strlen(str); + uint len = (uint)strlen(str); u.s.isShort = len<SHORT_STR_CAPACITY; if (len<SHORT_STR_CAPACITY) { - u.s.len = len; + u.s.len = (uchar)len; qstrncpy(u.s.str,str,SHORT_STR_CAPACITY); } else @@ -505,7 +505,7 @@ public: u.s.isShort = len<=SHORT_STR_MAX_LEN; if (u.s.isShort) { - u.s.len = len; + u.s.len = (uchar)len; memcpy(u.s.str,str,len); u.s.str[len]='\0'; } @@ -554,11 +554,11 @@ public: } if (str) { - int len = (int)strlen(str); + uint len = (uint)strlen(str); u.s.isShort = len<SHORT_STR_CAPACITY; if (len<SHORT_STR_CAPACITY) { - u.s.len = len; + u.s.len = (uchar)len; qstrncpy(u.s.str,str,SHORT_STR_CAPACITY); } else @@ -605,7 +605,7 @@ public: return u.l.d->len==0 ? 0 : u.l.d->toStr(); } } - char &at(int i) const + char &at(uint i) const { if (u.s.isShort) { @@ -622,7 +622,7 @@ public: { if (newlen>0) { - u.s.len = newlen-1; + u.s.len = (uchar)(newlen-1); u.s.str[newlen-1]='\0'; } else // string becomes empty @@ -668,21 +668,21 @@ public: } bool fill( char c, int len ) { - if (len<0) len=length(); + uint ulen = len<0 ? length() : (uint)len; if (!u.s.isShort) // detach from shared string { - resize(len+1); + resize(ulen+1); } - else if (len!=(int)length()) + else if (ulen!=length()) { - if (len>0) + if (ulen>0) { - resize(len+1); + resize(ulen+1); } } - if (len>0) + if (ulen>0) { - memset(rawData(),c,len); + memset(rawData(),c,ulen); } return TRUE; } diff --git a/qtools/qgstring.h b/qtools/qgstring.h index 6934c93..0af1045 100644 --- a/qtools/qgstring.h +++ b/qtools/qgstring.h @@ -43,7 +43,7 @@ class QGString bool truncate( uint pos ) { return resize(pos+1); } operator const char *() const { return (const char *)data(); } char &at( uint index ) const { return m_data[index]; } - char &operator[]( int i ) const { return at(i); } + char &operator[]( uint i ) const { return at(i); } private: char * m_data; diff --git a/qtools/qintdict.h b/qtools/qintdict.h index ddc5fdf..0606ec8 100644 --- a/qtools/qintdict.h +++ b/qtools/qintdict.h @@ -46,7 +46,7 @@ template<class type> class Q_EXPORT QIntDict : public QGDict { public: - QIntDict(int size=17) : QGDict(size,IntKey,0,0) {} + QIntDict(uint size=17) : QGDict(size,IntKey,0,0) {} QIntDict( const QIntDict<type> &d ) : QGDict(d) {} ~QIntDict() { clear(); } QIntDict<type> &operator=(const QIntDict<type> &d) diff --git a/qtools/qptrdict.h b/qtools/qptrdict.h index c075e30..df8bcb4 100644 --- a/qtools/qptrdict.h +++ b/qtools/qptrdict.h @@ -46,7 +46,7 @@ template<class type> class Q_EXPORT QPtrDict : public QGDict { public: - QPtrDict(int size=17) : QGDict(size,PtrKey,0,0) {} + QPtrDict(uint size=17) : QGDict(size,PtrKey,0,0) {} QPtrDict( const QPtrDict<type> &d ) : QGDict(d) {} ~QPtrDict() { clear(); } QPtrDict<type> &operator=(const QPtrDict<type> &d) diff --git a/qtools/qstring.h b/qtools/qstring.h index d459132..293768f 100644 --- a/qtools/qstring.h +++ b/qtools/qstring.h @@ -147,8 +147,8 @@ public: QString decomposition() const; Decomposition decompositionTag() const; - char latin1() const { return rw ? 0 : cl; } - ushort unicode() const { return (rw << 8) | cl; } + char latin1() const { return rw ? 0 : (char)cl; } + ushort unicode() const { return (ushort)((rw << 8) | cl); } #ifndef QT_NO_CAST_ASCII // like all ifdef'd code this is undocumented operator char() const { return latin1(); } @@ -333,7 +333,7 @@ struct Q_EXPORT QStringData : public QShared { QStringData() : unicode(0), ascii(0), len(0), maxl(0), dirtyascii(0) { ref(); } QStringData(QChar *u, uint l, uint m) : - unicode(u), ascii(0), len(l), maxl(m), dirtyascii(0) { } + unicode(u), ascii(0), len(l), maxl(m&0x3FFFFFFF), dirtyascii(0) { } ~QStringData() { if ( unicode ) delete[] ((char*)unicode); if ( ascii ) delete[] ascii; } diff --git a/qtools/qvaluelist.h b/qtools/qvaluelist.h index a1014ed..eb827fe 100644 --- a/qtools/qvaluelist.h +++ b/qtools/qvaluelist.h @@ -43,10 +43,6 @@ #include "qdatastream.h" #endif // QT_H -#if defined(_CC_MSVC_) -#pragma warning(disable:4284) // "return type for operator -> is not a UDT" -#endif - template <class T> class Q_EXPORT QValueListNode { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23460d0..bed61a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -148,13 +148,6 @@ add_library(doxycfg STATIC ) add_library(_doxygen STATIC - # custom generated files - ${GENERATED_SRC}/lang_cfg.h - ${GENERATED_SRC}/settings.h - ${GENERATED_SRC}/layout_default.xml.h - ${GENERATED_SRC}/ce_parse.h - ${GENERATED_SRC}/configvalues.h - ${GENERATED_SRC}/resources.cpp # generated for/by flex/bison #${LEX_FILES_H} #unfortunately doesn't work in older versions of CMake (like 3.6.2) #${LEX_FILES_CPP} #unfortunately doesn't work in older versions of CMake (like 3.6.2) @@ -196,6 +189,13 @@ add_library(_doxygen STATIC ${GENERATED_SRC}/xmlcode.cpp # ${GENERATED_SRC}/ce_parse.cpp + # custom generated files + ${GENERATED_SRC}/lang_cfg.h + ${GENERATED_SRC}/settings.h + ${GENERATED_SRC}/layout_default.xml.h + ${GENERATED_SRC}/ce_parse.h + ${GENERATED_SRC}/configvalues.h + ${GENERATED_SRC}/resources.cpp # arguments.cpp cite.cpp @@ -330,5 +330,8 @@ target_link_libraries(doxygen ${EXTRA_LIBS} ${CLANG_LIBS} ) +set_project_warnings(doxycfg) +set_project_warnings(_doxygen) +set_project_warnings(doxygen) install(TARGETS doxygen DESTINATION bin) diff --git a/src/bufstr.h b/src/bufstr.h index 331def2..e64a049 100644 --- a/src/bufstr.h +++ b/src/bufstr.h @@ -30,7 +30,7 @@ class BufStr { public: - BufStr(int size) + BufStr(uint size) : m_size(size), m_writeOffset(0), m_spareRoom(10240), m_buf(0) { m_buf = (char *)calloc(size,1); @@ -44,7 +44,7 @@ class BufStr makeRoomFor(1); m_buf[m_writeOffset++]=c; } - void addArray(const char *a,int len) + void addArray(const char *a,uint len) { makeRoomFor(len); memcpy(m_buf+m_writeOffset,a,len); @@ -74,7 +74,7 @@ class BufStr memset(m_buf+oldsize,0,m_size-oldsize); } } - int size() const + uint size() const { return m_size; } @@ -115,7 +115,7 @@ class BufStr } uint m_size; uint m_writeOffset; - const int m_spareRoom; // 10Kb extra room to avoid frequent resizing + const uint m_spareRoom; // 10Kb extra room to avoid frequent resizing char *m_buf; }; diff --git a/src/cite.cpp b/src/cite.cpp index 612ddc1..dac2bcd 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -94,7 +94,7 @@ void CitationManager::clear() bool CitationManager::isEmpty() const { - int numFiles = Config_getList(CITE_BIB_FILES).count(); + uint numFiles = Config_getList(CITE_BIB_FILES).count(); return (numFiles==0 || p->entries.empty()); } @@ -135,15 +135,15 @@ void CitationManager::generatePage() err("could not open file %s for reading\n",bibFile.data()); } QCString doc; - QFileInfo fi(bibFile); QCString input(fi.size()+1); f.readBlock(input.rawData(),fi.size()); f.close(); input.at(fi.size())='\0'; - int pos=0,s; + int pos=0; + int s; while ((s=input.find('\n',pos))!=-1) { - QCString line = input.mid(pos,s-pos); + QCString line = input.mid((uint)pos,(uint)(s-pos)); pos=s+1; int i; @@ -153,7 +153,7 @@ void CitationManager::generatePage() int k=line.find("}",i); if (j!=-1 && k!=-1) { - QCString label = line.mid(j+1,k-j-1); + QCString label = line.mid((uint)(j+1),(uint)(k-j-1)); if (p->entries.find(label.data())==p->entries.end()) // not found yet { insert(label); @@ -246,25 +246,25 @@ void CitationManager::generatePage() { err("could not open file %s for reading\n",citeListFile.data()); } - bool insideBib=FALSE; - + QCString doc; QFileInfo fi(citeListFile); QCString input(fi.size()+1); f.readBlock(input.rawData(),fi.size()); f.close(); input.at(fi.size())='\0'; + + bool insideBib=FALSE; int pos=0,s; //printf("input=[%s]\n",input.data()); while ((s=input.find('\n',pos))!=-1) { - QCString line = input.mid(pos,s-pos); + QCString line = input.mid((uint)pos,(uint)(s-pos)); //printf("pos=%d s=%d line=[%s]\n",pos,s,line.data()); pos=s+1; if (line.find("<!-- BEGIN BIBLIOGRAPHY")!=-1) insideBib=TRUE; else if (line.find("<!-- END BIBLIOGRAPH")!=-1) insideBib=FALSE; - int i; // determine text to use at the location of the @cite command if (insideBib && (i=line.find("name=\"CITEREF_"))!=-1) { @@ -272,10 +272,13 @@ void CitationManager::generatePage() int k=line.find("]</a>"); if (j!=-1 && k!=-1) { - QCString label = line.mid(i+14,j-i-14); - QCString number = line.mid(j+2,k-j-1); + uint ui=(uint)i; + uint uj=(uint)j; + uint uk=(uint)k; + QCString label = line.mid(ui+14,uj-ui-14); + QCString number = line.mid(uj+2,uk-uj-1); label = substitute(substitute(label,"–","--"),"—","---"); - line = line.left(i+14) + label + line.right(line.length()-j); + line = line.left(ui+14) + label + line.right(line.length()-uj); auto it = p->entries.find(label.data()); //printf("label='%s' number='%s' => %p\n",label.data(),number.data(),it->second.get()); if (it!=p->entries.end()) @@ -296,15 +299,14 @@ void CitationManager::generatePage() if (Config_getBool(GENERATE_LATEX)) { // copy bib files to the latex output dir - const QStrList &citeDataList = Config_getList(CITE_BIB_FILES); QCString latexOutputDir = Config_getString(LATEX_OUTPUT)+"/"; - int i = 0; + i = 0; for (li.toFirst() ; (bibdata = li.current()) ; ++li) { QCString bibFile = bibdata; // Note: file can now have multiple dots if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; - QFileInfo fi(bibFile); + fi.setFile(bibFile); if (fi.exists()) { if (!bibFile.isEmpty()) diff --git a/src/classdef.cpp b/src/classdef.cpp index 2124817..95f01c1 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -106,7 +106,7 @@ class ClassDefImpl : public DefinitionImpl, public ClassDef virtual Definition *findInnerCompound(const char *name) const; virtual std::vector<ArgumentList> getTemplateParameterLists() const; virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *actualParams=0,int *actualParamIndex=0) const; + const std::vector<ArgumentList> *actualParams=0,uint *actualParamIndex=0) const; virtual bool isAbstract() const; virtual bool isObjectiveC() const; virtual bool isFortran() const; @@ -368,7 +368,7 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef virtual std::vector<ArgumentList> getTemplateParameterLists() const { return getCdAlias()->getTemplateParameterLists(); } virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *actualParams=0,int *actualParamIndex=0) const + const std::vector<ArgumentList> *actualParams=0,uint *actualParamIndex=0) const { return getCdAlias()->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex); } virtual bool isAbstract() const { return getCdAlias()->isAbstract(); } @@ -448,37 +448,37 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef const QCString &templSpec,bool &freshInstance) const { return getCdAlias()->insertTemplateInstance(fileName,startLine,startColumn,templSpec,freshInstance); } - virtual void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0) { } - virtual void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0) { } - virtual void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force) {} + virtual void insertBaseClass(ClassDef *,const char *,Protection,Specifier,const char *) { } + virtual void insertSubClass(ClassDef *,Protection,Specifier,const char *) { } + virtual void setIncludeFile(FileDef *,const char *,bool,bool) {} virtual void insertMember(MemberDef *) {} virtual void insertUsedFile(FileDef *) {} - virtual bool addExample(const char *anchor,const char *name, const char *file) { return FALSE; } - virtual void mergeCategory(ClassDef *category) {} - virtual void setNamespace(NamespaceDef *nd) {} - virtual void setFileDef(FileDef *fd) {} - virtual void setSubGrouping(bool enabled) {} - virtual void setProtection(Protection p) {} - virtual void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs) {} - virtual void addInnerCompound(const Definition *d) {} - virtual void addUsedClass(ClassDef *cd,const char *accessName,Protection prot) {} - virtual void addUsedByClass(ClassDef *cd,const char *accessName,Protection prot) {} - virtual void setIsStatic(bool b) {} - virtual void setCompoundType(CompoundType t) {} - virtual void setClassName(const char *name) {} - virtual void setClassSpecifier(uint64 spec) {} - virtual void setTemplateArguments(const ArgumentList &al) {} - virtual void setTemplateBaseClassNames(QDict<int> *templateNames) {} - virtual void setTemplateMaster(const ClassDef *tm) {} - virtual void setTypeConstraints(const ArgumentList &al) {} - virtual void addMembersToTemplateInstance(const ClassDef *cd,const char *templSpec) {} - virtual void makeTemplateArgument(bool b=TRUE) {} - virtual void setCategoryOf(ClassDef *cd) {} - virtual void setUsedOnly(bool b) {} - virtual void addTaggedInnerClass(ClassDef *cd) {} - virtual void setTagLessReference(ClassDef *cd) {} - virtual void setName(const char *name) {} - virtual void setMetaData(const char *md) {} + virtual bool addExample(const char *,const char *, const char *) { return FALSE; } + virtual void mergeCategory(ClassDef *) {} + virtual void setNamespace(NamespaceDef *) {} + virtual void setFileDef(FileDef *) {} + virtual void setSubGrouping(bool) {} + virtual void setProtection(Protection) {} + virtual void setGroupDefForAllMembers(GroupDef *,Grouping::GroupPri_t,const QCString &,int,bool) {} + virtual void addInnerCompound(const Definition *) {} + virtual void addUsedClass(ClassDef *,const char *,Protection) {} + virtual void addUsedByClass(ClassDef *,const char *,Protection) {} + virtual void setIsStatic(bool) {} + virtual void setCompoundType(CompoundType) {} + virtual void setClassName(const char *) {} + virtual void setClassSpecifier(uint64) {} + virtual void setTemplateArguments(const ArgumentList &) {} + virtual void setTemplateBaseClassNames(QDict<int> *) {} + virtual void setTemplateMaster(const ClassDef *) {} + virtual void setTypeConstraints(const ArgumentList &) {} + virtual void addMembersToTemplateInstance(const ClassDef *,const char *) {} + virtual void makeTemplateArgument(bool=TRUE) {} + virtual void setCategoryOf(ClassDef *) {} + virtual void setUsedOnly(bool) {} + virtual void addTaggedInnerClass(ClassDef *) {} + virtual void setTagLessReference(ClassDef *) {} + virtual void setName(const char *) {} + virtual void setMetaData(const char *) {} virtual void findSectionsInDocumentation() {} virtual void addMembersToMemberGroup() {} virtual void addListReferences() {} @@ -487,24 +487,24 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef virtual void mergeMembers() {} virtual void sortMemberLists() {} virtual void distributeMemberGroupDocumentation() {} - virtual void writeDocumentation(OutputList &ol) const {} - virtual void writeDocumentationForInnerClasses(OutputList &ol) const {} - virtual void writeMemberPages(OutputList &ol) const {} - virtual void writeMemberList(OutputList &ol) const {} - virtual void writeDeclaration(OutputList &ol,const MemberDef *md,bool inGroup, - const ClassDef *inheritedFrom,const char *inheritId) const {} - virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const {} - virtual void writeSummaryLinks(OutputList &ol) const {} - virtual void reclassifyMember(MemberDef *md,MemberType t) {} - virtual void writeInlineDocumentation(OutputList &ol) const {} + virtual void writeDocumentation(OutputList &) const {} + virtual void writeDocumentationForInnerClasses(OutputList &) const {} + virtual void writeMemberPages(OutputList &) const {} + virtual void writeMemberList(OutputList &) const {} + virtual void writeDeclaration(OutputList &,const MemberDef *,bool, + const ClassDef *,const char *) const {} + virtual void writeQuickMemberLinks(OutputList &,const MemberDef *) const {} + virtual void writeSummaryLinks(OutputList &) const {} + virtual void reclassifyMember(MemberDef *,MemberType) {} + virtual void writeInlineDocumentation(OutputList &) const {} virtual void writeDeclarationLink(OutputList &ol,bool &found, const char *header,bool localNames) const { getCdAlias()->writeDeclarationLink(ol,found,header,localNames); } - virtual void removeMemberFromLists(MemberDef *md) {} + virtual void removeMemberFromLists(MemberDef *) {} virtual void setAnonymousEnumType() {} virtual void countMembers() {} - virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, - const ClassDef *inheritedFrom,const QCString &inheritId) const {} + virtual void addGroupedInheritedMembers(OutputList &,MemberListType, + const ClassDef *,const QCString &) const {} virtual void writeTagFile(FTextStream &) {} virtual void setVisited(bool visited) const { m_visited = visited; } @@ -516,10 +516,8 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef virtual int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom, int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const { return getCdAlias()->countMemberDeclarations(lt,inheritedFrom,lt2,invert,showAlways,visitedClasses); } - virtual void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title, - const char *subTitle=0,bool showInline=FALSE,const ClassDef *inheritedFrom=0, - int lt2=-1,bool invert=FALSE,bool showAlways=FALSE, - QPtrDict<void> *visitedClasses=0) const {} + virtual void writeMemberDeclarations(OutputList &,MemberListType,const QCString &, + const char *,bool,const ClassDef *, int,bool,bool, QPtrDict<void> *) const {} private: mutable bool m_visited = false; @@ -1743,7 +1741,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const ol.startParagraph(); //parseText(ol,theTranslator->trInherits()+" "); - QCString inheritLine = theTranslator->trInheritsList(m_impl->inherits->count()); + QCString inheritLine = theTranslator->trInheritsList((int)m_impl->inherits->count()); QRegExp marker("@[0-9]+"); int index=0,newIndex,matchLen; // now replace all markers in inheritLine with links to the classes @@ -1780,7 +1778,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const } index=newIndex+matchLen; } - ol.parseText(inheritLine.right(inheritLine.length()-index)); + ol.parseText(inheritLine.right(inheritLine.length()-(uint)index)); ol.endParagraph(); } @@ -1788,7 +1786,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const if (m_impl->inheritedBy && m_impl->inheritedBy->count()>0) { ol.startParagraph(); - QCString inheritLine = theTranslator->trInheritedByList(m_impl->inheritedBy->count()); + QCString inheritLine = theTranslator->trInheritedByList((int)m_impl->inheritedBy->count()); QRegExp marker("@[0-9]+"); int index=0,newIndex,matchLen; // now replace all markers in inheritLine with links to the classes @@ -1813,7 +1811,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const } index=newIndex+matchLen; } - ol.parseText(inheritLine.right(inheritLine.length()-index)); + ol.parseText(inheritLine.right(inheritLine.length()-(uint)index)); ol.endParagraph(); } @@ -3301,7 +3299,9 @@ bool ClassDefImpl::hasExamples() const { bool result=FALSE; if (m_impl->exampleSDict) - result = m_impl->exampleSDict->count()>0; + { + result = m_impl->exampleSDict->count()>0; + } return result; } @@ -3354,7 +3354,7 @@ void ClassDefImpl::addTypeConstraints() addTypeConstraint(typeConstraint,a.type); p=i+1; } - typeConstraint = a.typeConstraint.right(a.typeConstraint.length()-p).stripWhiteSpace(); + typeConstraint = a.typeConstraint.right(a.typeConstraint.length()-(uint)p).stripWhiteSpace(); addTypeConstraint(typeConstraint,a.type); } } @@ -3606,7 +3606,7 @@ void ClassDefImpl::mergeMembers() //static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); SrcLangExt lang = getLanguage(); QCString sep=getLanguageSpecificSeparator(lang,TRUE); - int sepLen = sep.length(); + uint sepLen = sep.length(); m_impl->membersMerged=TRUE; //printf(" mergeMembers for %s\n",name().data()); @@ -3683,7 +3683,7 @@ void ClassDefImpl::mergeMembers() // dstMd->name().data(), // dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data()); - QCString scope=dstMi->scopePath.left(dstMi->scopePath.find(sep)+sepLen); + QCString scope=dstMi->scopePath.left((uint)dstMi->scopePath.find(sep)+sepLen); if (scope!=dstMi->ambiguityResolutionScope.left(scope.length())) dstMi->ambiguityResolutionScope.prepend(scope); ambiguous=TRUE; @@ -3710,7 +3710,7 @@ void ClassDefImpl::mergeMembers() // dstMd->name().data(), // dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data()); - QCString scope=dstMi->scopePath.left(dstMi->scopePath.find(sep)+sepLen); + QCString scope=dstMi->scopePath.left((uint)dstMi->scopePath.find(sep)+sepLen); if (scope!=dstMi->ambiguityResolutionScope.left(scope.length())) { dstMi->ambiguityResolutionScope.prepend(scope); @@ -4344,7 +4344,7 @@ std::vector<ArgumentList> ClassDefImpl::getTemplateParameterLists() const } QCString ClassDefImpl::qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *actualParams,int *actualParamIndex) const + const std::vector<ArgumentList> *actualParams,uint *actualParamIndex) const { //static bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); static bool hideScopeNames = Config_getBool(HIDE_SCOPE_NAMES); @@ -4380,7 +4380,7 @@ QCString ClassDefImpl::qualifiedNameWithTemplateParameters( scName+=clName; if (!templateArguments().empty()) { - if (actualParams && *actualParamIndex<(int)actualParams->size()) + if (actualParams && *actualParamIndex<actualParams->size()) { const ArgumentList &al = actualParams->at(*actualParamIndex); if (!isSpecialization) @@ -4411,7 +4411,7 @@ QCString ClassDefImpl::className() const { return m_impl->className; } -}; +} void ClassDefImpl::setClassName(const char *name) { diff --git a/src/classdef.h b/src/classdef.h index 3158c50..72ee92d 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -232,7 +232,7 @@ class ClassDef : virtual public Definition virtual std::vector<ArgumentList> getTemplateParameterLists() const = 0; virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *actualParams=0,int *actualParamIndex=0) const = 0; + const std::vector<ArgumentList> *actualParams=0,uint *actualParamIndex=0) const = 0; /** Returns TRUE if there is at least one pure virtual member in this * class. @@ -465,7 +465,7 @@ struct UsesClassDef class UsesClassDict : public QDict<UsesClassDef> { public: - UsesClassDict(int size) : QDict<UsesClassDef>(size) {} + UsesClassDict(uint size) : QDict<UsesClassDef>(size) {} ~UsesClassDict() {} }; @@ -575,7 +575,7 @@ struct ConstraintClassDef class ConstraintClassDict : public QDict<ConstraintClassDef> { public: - ConstraintClassDict(int size) : QDict<ConstraintClassDef>(size) {} + ConstraintClassDict(uint size) : QDict<ConstraintClassDef>(size) {} ~ConstraintClassDict() {} }; diff --git a/src/classlist.h b/src/classlist.h index 11c8305..6e4281f 100644 --- a/src/classlist.h +++ b/src/classlist.h @@ -48,7 +48,7 @@ class ClassListIterator : public QListIterator<ClassDef> class ClassDict : public QDict<ClassDef> { public: - ClassDict(int size) : QDict<ClassDef>(size) {} + ClassDict(uint size) : QDict<ClassDef>(size) {} ~ClassDict() {} }; @@ -56,7 +56,7 @@ class ClassDict : public QDict<ClassDef> class ClassSDict : public SDict<ClassDef> { public: - ClassSDict(int size=17) : SDict<ClassDef>(size) {} + ClassSDict(uint size=17) : SDict<ClassDef>(size) {} ~ClassSDict() {} void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter=0, const char *header=0,bool localNames=FALSE) const; @@ -60,6 +60,8 @@ #define SCOPEBLOCK (int *)8 #define INNERBLOCK (int *)12 +#define USE_STATE2STRING 0 + /* ----------------------------------------------------------------- * statics */ @@ -137,7 +139,7 @@ class VariableContext void addVariable(yyscan_t yyscanner,const QCString &type,const QCString &name); ClassDef *findVariable(const QCString &name); - int count() const { return m_scopes.count(); } + uint count() const { return m_scopes.count(); } private: Scope m_globalScope; @@ -224,7 +226,7 @@ struct codeYY_state QCString parmName; const char * inputString = 0; //!< the code fragment as text - int inputPosition = 0; //!< read offset during parsing + yy_size_t inputPosition = 0; //!< read offset during parsing int inputLines = 0; //!< number of line in the code fragment int yyLineNr = 0; //!< current line number int yyColNr = 0; //!< current column number @@ -306,10 +308,12 @@ struct codeYY_state static bool isCastKeyword(const QCString &s); //------------------------------------------------------------------- +#if USE_STATE2STRING +static const char *stateToString(yyscan_t yyscanner,int state); +#endif static void saveObjCContext(yyscan_t yyscanner); static void restoreObjCContext(yyscan_t yyscanner); -static const char *stateToString(yyscan_t yyscanner,int state); static void addUsingDirective(yyscan_t yyscanner,const char *name); static void pushScope(yyscan_t yyscanner,const char *s); static void popScope(yyscan_t yyscanner); @@ -359,7 +363,7 @@ static QCString escapeObject(yyscan_t yyscanner,const char *s); static QCString escapeWord(yyscan_t yyscanner,const char *s); static QCString escapeComment(yyscan_t yyscanner,const char *s); static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const QCString &kw); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); /* ----------------------------------------------------------------- @@ -601,7 +605,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" { yyextra->code->codify(yytext); } - char c=yyinput(yyscanner); + char c=(char)yyinput(yyscanner); QCString text; text+=c; yyextra->code->codify(text); @@ -1197,8 +1201,8 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } <Body>"("{B}*("*"{B}*)+{SCOPENAME}*{B}*")"/{B}* { // (*p)->func() but not "if (p) ..." yyextra->code->codify(yytext); - int s=0;while (s<(int)yyleng && !isId(yytext[s])) s++; - int e=(int)yyleng-1;while (e>=0 && !isId(yytext[e])) e--; + uint s=0;while (s<(uint)yyleng && !isId(yytext[s])) s++; + uint e=(uint)yyleng-1;while (!isId(yytext[e])) e--; QCString varname = ((QCString)yytext).mid(s,e-s+1); addType(yyscanner); yyextra->name=varname; @@ -1218,7 +1222,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } <FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} { QCString text=yytext; - int i=text.find('R'); + uint i=(uint)text.find('R'); yyextra->code->codify(text.left(i+1)); startFontClass(yyscanner,"stringliteral"); yyextra->code->codify(yytext+i+1); @@ -1767,7 +1771,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" DBG_CTX((stderr,"yyextra->name=%s\n",yyextra->name.data())); if (index!=-1) { - QCString scope = yyextra->name.left(index); + QCString scope = yyextra->name.left((uint)index); if (!yyextra->classScope.isEmpty()) scope.prepend(yyextra->classScope+"::"); const ClassDef *cd=getResolvedClass(Doxygen::globalScope,yyextra->sourceFileDef,scope); if (cd) @@ -1894,8 +1898,8 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } <FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}*{B}*")"{B}*)/("."|"->") { yyextra->code->codify(yytext); - int s=0;while (!isId(yytext[s])) s++; - int e=(int)yyleng-1;while (!isId(yytext[e])) e--; + uint s=0;while (!isId(yytext[s])) s++; + uint e=(uint)yyleng-1;while (!isId(yytext[e])) e--; yyextra->name=((QCString)yytext).mid(s,e-s+1); BEGIN( MemberCall2 ); } @@ -2107,8 +2111,8 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } <*>"/*[tag:"[^\]\n]*"]*/"{B}* { // special pattern /*[tag:filename]*/ to force linking to a tag file yyextra->forceTagReference=yytext; - int s=yyextra->forceTagReference.find(':'); - int e=yyextra->forceTagReference.findRev(']'); + uint s=(uint)yyextra->forceTagReference.find(':'); + uint e=(uint)yyextra->forceTagReference.findRev(']'); yyextra->forceTagReference = yyextra->forceTagReference.mid(s+1,e-s-1); } <*>\n{B}*"/*"[!*]/[^/*] { @@ -3726,7 +3730,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx) } else // illegal marker { - ASSERT(!"invalid escape sequence"); + ASSERT("invalid escape sequence"==0); } } } @@ -3800,12 +3804,12 @@ static bool isCastKeyword(const QCString &s) return kw=="const_cast" || kw=="static_cast" || kw=="dynamic_cast" || kw=="reinterpret_cast"; } -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int inputPosition = yyextra->inputPosition; - const char *s = yyextra->inputString + yyextra->inputPosition; - int c=0; + yy_size_t inputPosition = yyextra->inputPosition; + const char *s = yyextra->inputString + inputPosition; + yy_size_t c=0; while( c < max_size && *s ) { *buf++ = *s++; @@ -4007,4 +4011,6 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const return; } +#if USE_STATE2STRING #include "code.l.h" +#endif diff --git a/src/commentcnv.l b/src/commentcnv.l index 279f428..9b91319 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -48,6 +48,8 @@ #define ADDCHAR(c) yyextra->outBuf->addChar(c) #define ADDARRAY(a,s) yyextra->outBuf->addArray(a,s) + +#define USE_STATE2STRING 0 struct CondCtx { @@ -102,7 +104,9 @@ struct commentcnvYY_state bool isFixedForm = FALSE; // For Fortran }; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static inline int computeIndent(const char *s); static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len); @@ -111,7 +115,7 @@ static void startCondSection(yyscan_t yyscanner,const char *sectId); static void endCondSection(yyscan_t yyscanner); static void handleCondSectionId(yyscan_t yyscanner,const char *expression); static void replaceAliases(yyscan_t yyscanner,const char *s); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void replaceComment(yyscan_t yyscanner,int offset); @@ -1036,11 +1040,11 @@ static void replaceAliases(yyscan_t yyscanner,const char *s) } -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos; - int bytesToCopy = QMIN(max_size,bytesInBuf); + yy_size_t bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos; + yy_size_t bytesToCopy = QMIN(max_size,bytesInBuf); memcpy(buf,yyextra->inBuf->data()+yyextra->inBufPos,bytesToCopy); yyextra->inBufPos+=bytesToCopy; return bytesToCopy; @@ -1064,7 +1068,7 @@ static void replaceComment(yyscan_t yyscanner,int offset) else { copyToOutput(yyscanner," */",3); - int i;for (i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); + for (i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); yyextra->inSpecialComment=FALSE; BEGIN(Scan); } @@ -1200,4 +1204,6 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) //---------------------------------------------------------------------------- +#if USE_STATE2STRING #include "commentcnv.l.h" +#endif diff --git a/src/commentscan.l b/src/commentscan.l index 13ea0c1..309a334 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -56,6 +56,8 @@ #include "util.h" #include "reflist.h" +#define USE_STATE2STRING 0 + // forward declarations static bool handleBrief(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handleFn(yyscan_t yyscanner,const QCString &, const QCStringList &); @@ -136,7 +138,9 @@ static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStrin static bool handleParam(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handleRetval(yyscan_t yyscanner,const QCString &, const QCStringList &); +#if USE_STATE2STRING static const char *stateToString(int state); +#endif typedef bool (*DocCmdFunc)(yyscan_t yyscanner,const QCString &name, const QCStringList &optList); @@ -296,6 +300,7 @@ static const std::map< std::string, DocCmdMap > docCmdMap = #define YY_NO_UNISTD_H 1 #define YY_NEVER_INTERACTIVE 1 + enum XRefKind { XRef_Item, @@ -405,7 +410,6 @@ static void stripTrailingWhiteSpace(QCString &s); static void initParser(yyscan_t yyscanner); static bool makeStructuralIndicator(yyscan_t yyscanner,Entry::Sections s); static void lineCount(yyscan_t yyscanner); -static QCString stripQuotes(yyscan_t yyscanner,const char *s); static void addXRefItem(yyscan_t yyscanner, const char *listName,const char *itemTitle, const char *listTitle,bool append); @@ -418,7 +422,7 @@ static inline void addOutput(yyscan_t yyscanner,const char *s); static inline void addOutput(yyscan_t yyscanner,char c); static void endBrief(yyscan_t yyscanner,bool addToOutput=TRUE); static void handleGuard(yyscan_t yyscanner,const QCString &expr); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void addCite(yyscan_t yyscanner); //----------------------------------------------------------------------------- @@ -818,8 +822,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" { // see bug 613024, we need to put the newlines after ending the XRef section. if (!yyextra->insideParBlock) setOutput(yyscanner,OutputDoc); - int i; - for (i=0;i<yyleng;) + yy_size_t i; + for (i=0;i<(yy_size_t)yyleng;) { if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++; else if (strcmp(yytext+i,"\\_linebr")==0) addOutput(yyscanner,'\n'),i+=8; @@ -828,8 +832,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" } else if (yyextra->inContext!=OutputBrief) { - int i; - for (i=0;i<yyleng;) + yy_size_t i; + for (i=0;i<(yy_size_t)yyleng;) { if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++; else if (strcmp(yytext+i,"\\_linebr")==0) addOutput(yyscanner,'\n'),i+=8; @@ -2503,7 +2507,6 @@ static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringLi static bool handleLineBr(yyscan_t yyscanner,const QCString &, const QCStringList &) { - struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; addOutput(yyscanner,'\n'); return FALSE; } @@ -2910,7 +2913,7 @@ static void addCite(yyscan_t yyscanner) if (yytext[0] =='"') { name=yytext+1; - name=name.left(yyleng-2); + name=name.left((int)yyleng-2); } CitationManager::instance().insert(name.data()); } @@ -3104,18 +3107,18 @@ static void endBrief(yyscan_t yyscanner,bool addToOutput) } } -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - yyextra->prevPosition=yyextra->inputPosition; - int c=0; - while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) - { - *buf = yyextra->inputString[yyextra->inputPosition++] ; - //printf("%d (%c)\n",*buf,*buf); - c++; buf++; - } - return c; + yyextra->prevPosition=yyextra->inputPosition; + yy_size_t c=0; + while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) + { + *buf = yyextra->inputString[yyextra->inputPosition++] ; + //printf("%d (%c)\n",*buf,*buf); + c++; buf++; + } + return c; } //---------------------------------------------------------------------------- @@ -3348,4 +3351,6 @@ void CommentScanner::close(Entry *e,const char *fileName,int lineNr,bool foundIn yyextra->docGroup.close(e,fileName,lineNr,foundInline,implicit); } +#if USE_STATE2STRING #include "commentscan.l.h" +#endif diff --git a/src/condparser.cpp b/src/condparser.cpp index 9d7ac45..e76b164 100644 --- a/src/condparser.cpp +++ b/src/condparser.cpp @@ -102,8 +102,7 @@ static bool isAlpha(const char c) static bool isAlphaNumSpec(const char c) { - return isAlpha(c) || (c>='0' && c<='9') || c=='-' || c=='.' || - (((unsigned char)c)>=0x80 && ((unsigned char)c)<=0xFF); + return isAlpha(c) || (c>='0' && c<='9') || c=='-' || c=='.' || (((unsigned char)c)>=0x80); } /** diff --git a/src/configimpl.l b/src/configimpl.l index 4ea877b..1490912 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -47,7 +47,11 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static const char *warning_str = "warning: "; static const char *error_str = "error: "; @@ -96,20 +100,27 @@ static QCString convertToComment(const QCString &s, const QCString &u) QCString tmp=s.stripWhiteSpace(); const char *p=tmp.data(); char c; - result+="#"; - if (*p && *p!='\n') - result+=" "; - while ((c=*p++)) + if (p) { - if (c=='\n') + result+="#"; + if (*p && *p!='\n') + { + result+=" "; + } + while ((c=*p++)) { - result+="\n#"; - if (*p && *p!='\n') - result+=" "; + if (c=='\n') + { + result+="\n#"; + if (*p && *p!='\n') + { + result+=" "; + } + } + else result+=c; } - else result+=c; + result+='\n'; } - result+='\n'; } if (!u.isEmpty()) { @@ -134,7 +145,7 @@ void ConfigOption::writeStringValue(FTextStream &t,QCString &s) { char c; bool needsEscaping=FALSE; - // convert the string back to it original encoding + // convert the string back to it original g_encoding QCString se = configStringRecode(s,"UTF-8",m_encoding); const char *p=se.data(); if (p) @@ -530,47 +541,47 @@ struct ConfigFileState QCString fileName; }; -static const char *inputString; -static int inputPosition; -static int yyLineNr; -static QCString yyFileName; -static QCString tmpString; -static QCString *s=0; -static bool *b=0; -static QStrList *l=0; -static int lastState; -static QCString elemStr; -static QStrList includePathList; -static QStack<ConfigFileState> includeStack; -static int includeDepth; -static bool config_upd = FALSE; -static QCString encoding; -static ConfigImpl *config; +static const char *g_inputString; +static int g_inputPosition; +static int g_yyLineNr; +static QCString g_yyFileName; +static QCString g_tmpString; +static QCString *g_string=0; +static bool *g_bool=0; +static QStrList *g_list=0; +static int g_lastState; +static QCString g_elemStr; +static QStrList g_includePathList; +static QStack<ConfigFileState> g_includeStack; +static int g_includeDepth; +static bool g_configUpdate = FALSE; +static QCString g_encoding; +static ConfigImpl *g_config; /* ----------------------------------------------------------------- */ #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - // no file included - if (includeStack.isEmpty()) - { - int c=0; - if (inputString==0) return c; - while( c < max_size && inputString[inputPosition] ) - { - *buf = inputString[inputPosition++] ; - c++; buf++; - } - return c; - } - else + // no file included + if (g_includeStack.isEmpty()) + { + yy_size_t c=0; + if (g_inputString==0) return c; + while( c < max_size && g_inputString[g_inputPosition] ) { - //assert(includeStack.current()->newState==YY_CURRENT_BUFFER); - return (int)fread(buf,1,max_size,includeStack.current()->filePtr); + *buf = g_inputString[g_inputPosition++] ; + c++; buf++; } + return c; + } + else + { + //assert(g_includeStack.current()->newState==YY_CURRENT_BUFFER); + return (yy_size_t)fread(buf,1,max_size,g_includeStack.current()->filePtr); + } } @@ -613,8 +624,8 @@ static QCString configStringRecode( static void checkEncoding() { - ConfigString *option = (ConfigString*)config->get("DOXYFILE_ENCODING"); - encoding = *option->valueRef(); + ConfigString *option = (ConfigString*)g_config->get("DOXYFILE_ENCODING"); + g_encoding = *option->valueRef(); } static FILE *tryPath(const char *path,const char *fileName) @@ -643,21 +654,21 @@ static FILE *findFile(const char *fileName) { return tryPath(NULL, fileName); } - substEnvVarsInStrList(includePathList); - char *s=includePathList.first(); + substEnvVarsInStrList(g_includePathList); + char *s=g_includePathList.first(); while (s) // try each of the include paths { FILE *f = tryPath(s,fileName); if (f) return f; - s=includePathList.next(); + s=g_includePathList.next(); } - // try cwd if includePathList fails + // try cwd if g_includePathList fails return tryPath(".",fileName); } static void readIncludeFile(const char *incName) { - if (includeDepth==MAX_INCLUDE_DEPTH) { + if (g_includeDepth==MAX_INCLUDE_DEPTH) { config_term("maximum include depth (%d) reached, %s is not included. Aborting...\n", MAX_INCLUDE_DEPTH,incName); } @@ -677,23 +688,23 @@ static void readIncludeFile(const char *incName) { // For debugging #if SHOW_INCLUDES - for (i=0;i<includeStack.count();i++) msg(" "); + for (i=0;i<g_includeStack.count();i++) msg(" "); msg("@INCLUDE = %s: parsing...\n",inc.data()); #endif // store the state of the old file ConfigFileState *fs=new ConfigFileState; fs->oldState=YY_CURRENT_BUFFER; - fs->lineNr=yyLineNr; - fs->fileName=yyFileName; + fs->lineNr=g_yyLineNr; + fs->fileName=g_yyFileName; fs->filePtr=f; // push the state on the stack - includeStack.push(fs); + g_includeStack.push(fs); // set the scanner to the include file yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); fs->newState=YY_CURRENT_BUFFER; - yyFileName=inc; - includeDepth++; + g_yyFileName=inc; + g_includeDepth++; } else { @@ -721,26 +732,26 @@ static void readIncludeFile(const char *incName) %% <*>\0x0d -<PreStart>"##".*"\n" { config->appendStartComment(yytext);yyLineNr++;} +<PreStart>"##".*"\n" { g_config->appendStartComment(yytext);g_yyLineNr++;} <PreStart>. { BEGIN(Start); unput(*yytext); } -<Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"##".*"\n" { config->appendUserComment(yytext);yyLineNr++;} +<Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"##".*"\n" { g_config->appendUserComment(yytext);g_yyLineNr++;} <Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"#" { BEGIN(SkipComment); } <Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { QCString cmd=yytext; cmd=cmd.left(cmd.length()-1).stripWhiteSpace(); - ConfigOption *option = config->get(cmd); + ConfigOption *option = g_config->get(cmd); if (option==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - cmd.data(),yyLineNr,yyFileName.data()); + cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); } else // known tag { - option->setUserComment(config->takeUserComment()); - option->setEncoding(encoding); + option->setUserComment(g_config->takeUserComment()); + option->setEncoding(g_encoding); switch(option->kind()) { case ConfigOption::O_Info: @@ -748,9 +759,9 @@ static void readIncludeFile(const char *incName) BEGIN(SkipInvalid); break; case ConfigOption::O_List: - l = ((ConfigList *)option)->valueRef(); - l->clear(); - elemStr=""; + g_list = ((ConfigList *)option)->valueRef(); + g_list->clear(); + g_elemStr=""; if (cmd == "PREDEFINED") { BEGIN(GetStrList1); @@ -761,50 +772,50 @@ static void readIncludeFile(const char *incName) } break; case ConfigOption::O_Enum: - s = ((ConfigEnum *)option)->valueRef(); - s->resize(0); + g_string = ((ConfigEnum *)option)->valueRef(); + g_string->resize(0); BEGIN(GetString); break; case ConfigOption::O_String: - s = ((ConfigString *)option)->valueRef(); - s->resize(0); + g_string = ((ConfigString *)option)->valueRef(); + g_string->resize(0); BEGIN(GetString); break; case ConfigOption::O_Int: - s = ((ConfigInt *)option)->valueStringRef(); - s->resize(0); + g_string = ((ConfigInt *)option)->valueStringRef(); + g_string->resize(0); BEGIN(GetString); break; case ConfigOption::O_Bool: - s = ((ConfigBool *)option)->valueStringRef(); - s->resize(0); + g_string = ((ConfigBool *)option)->valueStringRef(); + g_string->resize(0); BEGIN(GetString); break; case ConfigOption::O_Obsolete: - if (config_upd) + if (g_configUpdate) { config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n" - " This tag has been removed.\n", cmd.data(),yyLineNr,yyFileName.data()); + " This tag has been removed.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } else { config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n" " To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data()); + "file or upgrade it using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } BEGIN(SkipInvalid); break; case ConfigOption::O_Disabled: - if (config_upd) + if (g_configUpdate) { config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n" - " This tag has been removed.\n", cmd.data(),yyLineNr,yyFileName.data()); + " This tag has been removed.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } else { config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n" " To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),yyLineNr,yyFileName.data()); + "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } BEGIN(SkipInvalid); break; @@ -813,16 +824,16 @@ static void readIncludeFile(const char *incName) } <Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { QCString cmd=yytext; cmd=cmd.left(cmd.length()-2).stripWhiteSpace(); - ConfigOption *option = config->get(cmd); + ConfigOption *option = g_config->get(cmd); if (option==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - cmd.data(),yyLineNr,yyFileName.data()); + cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); } else // known tag { - option->setUserComment(config->takeUserComment()); + option->setUserComment(g_config->takeUserComment()); switch(option->kind()) { case ConfigOption::O_Info: @@ -830,8 +841,8 @@ static void readIncludeFile(const char *incName) BEGIN(SkipInvalid); break; case ConfigOption::O_List: - l = ((ConfigList *)option)->valueRef(); - elemStr=""; + g_list = ((ConfigList *)option)->valueRef(); + g_elemStr=""; if (cmd == "PREDEFINED") { BEGIN(GetStrList1); @@ -846,137 +857,137 @@ static void readIncludeFile(const char *incName) case ConfigOption::O_Int: case ConfigOption::O_Bool: config_warn("operator += not supported for '%s'. Ignoring line at line %d, file %s\n", - yytext,yyLineNr,yyFileName.data()); + yytext,g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; case ConfigOption::O_Obsolete: config_warn("Tag '%s' at line %d of file %s has become obsolete.\n" "To avoid this warning please update your configuration " - "file using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data()); + "file using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; case ConfigOption::O_Disabled: config_warn("Tag '%s' at line %d of file %s belongs to an option that was not enabled at compile time.\n" "To avoid this warning please remove this line from your configuration " - "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),yyLineNr,yyFileName.data()); + "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; } } } -<Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; } - /* include a config file */ +<Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); g_list=&g_includePathList; g_list->clear(); g_elemStr=""; } + /* include a g_config file */ <Start>"@INCLUDE"[ \t]*"=" { BEGIN(Include);} <Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { - readIncludeFile(configStringRecode(yytext,encoding,"UTF-8")); + readIncludeFile(configStringRecode(yytext,g_encoding,"UTF-8")); BEGIN(Start); } <<EOF>> { //printf("End of include file\n"); //printf("Include stack depth=%d\n",g_includeStack.count()); - if (includeStack.isEmpty()) + if (g_includeStack.isEmpty()) { //printf("Terminating scanner!\n"); yyterminate(); } else { - ConfigFileState *fs=includeStack.pop(); + ConfigFileState *fs=g_includeStack.pop(); fclose(fs->filePtr); YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER; yy_switch_to_buffer( fs->oldState ); yy_delete_buffer( oldBuf ); - yyLineNr=fs->lineNr; - yyFileName=fs->fileName; + g_yyLineNr=fs->lineNr; + g_yyFileName=fs->fileName; delete fs; fs=0; - includeDepth--; + g_includeDepth--; } } -<Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); } -<GetString,GetBool,SkipInvalid>\n { yyLineNr++; BEGIN(Start); } +<Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,g_yyLineNr,g_yyFileName.data()); } +<GetString,GetBool,SkipInvalid>\n { g_yyLineNr++; BEGIN(Start); } <GetStrList,GetStrList1>\n { - yyLineNr++; - if (!elemStr.isEmpty()) + g_yyLineNr++; + if (!g_elemStr.isEmpty()) { - //printf("elemStr1='%s'\n",elemStr.data()); - l->append(elemStr); + //printf("elemStr1='%s'\n",g_elemStr.data()); + g_list->append(g_elemStr); } BEGIN(Start); } <GetStrList1>[ \t]+ { - if (!elemStr.isEmpty()) + if (!g_elemStr.isEmpty()) { - //printf("elemStr2='%s'\n",elemStr.data()); - l->append(elemStr); + //printf("elemStr2='%s'\n",g_elemStr.data()); + g_list->append(g_elemStr); } - elemStr.resize(0); + g_elemStr.resize(0); } <GetStrList>[ \t,]+ { - if (!elemStr.isEmpty()) + if (!g_elemStr.isEmpty()) { - //printf("elemStr2='%s'\n",elemStr.data()); - l->append(elemStr); + //printf("elemStr2='%s'\n",g_elemStr.data()); + g_list->append(g_elemStr); } - elemStr.resize(0); + g_elemStr.resize(0); } -<GetString>[^ \"\t\r\n]+ { (*s)+=configStringRecode(yytext,encoding,"UTF-8"); +<GetString>[^ \"\t\r\n]+ { (*g_string)+=configStringRecode(yytext,g_encoding,"UTF-8"); checkEncoding(); } -<GetString,GetStrList,GetStrList1,SkipInvalid>"\"" { lastState=YY_START; +<GetString,GetStrList,GetStrList1,SkipInvalid>"\"" { g_lastState=YY_START; BEGIN(GetQuotedString); - tmpString.resize(0); + g_tmpString.resize(0); } <GetQuotedString>"\""|"\n" { // we add a bogus space to signal that the string was quoted. This space will be stripped later on. - tmpString+=" "; - //printf("Quoted String = '%s'\n",tmpString.data()); - if (lastState==GetString) + g_tmpString+=" "; + //printf("Quoted String = '%s'\n",g_tmpString.data()); + if (g_lastState==GetString) { - (*s)+=configStringRecode(tmpString,encoding,"UTF-8"); + (*g_string)+=configStringRecode(g_tmpString,g_encoding,"UTF-8"); checkEncoding(); } else { - elemStr+=configStringRecode(tmpString,encoding,"UTF-8"); + g_elemStr+=configStringRecode(g_tmpString,g_encoding,"UTF-8"); } if (*yytext=='\n') { - config_warn("Missing end quote (\") on line %d, file %s\n",yyLineNr,yyFileName.data()); - yyLineNr++; + config_warn("Missing end quote (\") on line %d, file %s\n",g_yyLineNr,g_yyFileName.data()); + g_yyLineNr++; } - BEGIN(lastState); + BEGIN(g_lastState); } <GetQuotedString>"\\\"" { - tmpString+='"'; + g_tmpString+='"'; } -<GetQuotedString>. { tmpString+=*yytext; } +<GetQuotedString>. { g_tmpString+=*yytext; } <GetBool>[a-zA-Z]+ { QCString bs=yytext; bs=bs.upper(); if (bs=="YES" || bs=="1") - *b=TRUE; + *g_bool=TRUE; else if (bs=="NO" || bs=="0") - *b=FALSE; + *g_bool=FALSE; else { - *b=FALSE; + *g_bool=FALSE; config_warn("Invalid value '%s' for " "boolean tag in line %d, file %s; use YES or NO\n", - bs.data(),yyLineNr,yyFileName.data()); + bs.data(),g_yyLineNr,g_yyFileName.data()); } } <GetStrList1>[^ \#\"\t\r\n]+ { - elemStr+=configStringRecode(yytext,encoding,"UTF-8"); + g_elemStr+=configStringRecode(yytext,g_encoding,"UTF-8"); } <GetStrList>[^ \#\"\t\r\n,]+ { - elemStr+=configStringRecode(yytext,encoding,"UTF-8"); + g_elemStr+=configStringRecode(yytext,g_encoding,"UTF-8"); } -<SkipComment>\n { yyLineNr++; BEGIN(Start); } -<SkipComment>\\[ \r\t]*\n { yyLineNr++; BEGIN(Start); } -<*>\\[ \r\t]*\n { yyLineNr++; } +<SkipComment>\n { g_yyLineNr++; BEGIN(Start); } +<SkipComment>\\[ \r\t]*\n { g_yyLineNr++; BEGIN(Start); } +<*>\\[ \r\t]*\n { g_yyLineNr++; } <*>. -<*>\n { yyLineNr++ ; } +<*>\n { g_yyLineNr++ ; } %% @@ -1279,27 +1290,27 @@ static QCString configFileToString(const char *name) bool ConfigImpl::parseString(const char *fn,const char *str,bool update) { - config = ConfigImpl::instance(); - inputString = str; - inputPosition = 0; - yyFileName = fn; - yyLineNr = 1; - includeStack.setAutoDelete(TRUE); - includeStack.clear(); - includeDepth = 0; + g_config = ConfigImpl::instance(); + g_inputString = str; + g_inputPosition = 0; + g_yyFileName = fn; + g_yyLineNr = 1; + g_includeStack.setAutoDelete(TRUE); + g_includeStack.clear(); + g_includeDepth = 0; configimplYYrestart( configimplYYin ); BEGIN( PreStart ); - config_upd = update; + g_configUpdate = update; configimplYYlex(); - config_upd = FALSE; - inputString = 0; + g_configUpdate = FALSE; + g_inputString = 0; return TRUE; } bool ConfigImpl::parse(const char *fn,bool update) { int retval; - encoding = "UTF-8"; + g_encoding = "UTF-8"; printlex(yy_flex_debug, TRUE, __FILE__, fn); retval = parseString(fn,configFileToString(fn), update); printlex(yy_flex_debug, FALSE, __FILE__, fn); @@ -1332,13 +1343,13 @@ static void cleanUpPaths(QStrList &str) if (fi.exists() && fi.isDir()) { int i = str.at(); - QCString p = fi.absFilePath().utf8(); - if (p[p.length()-1]!='/') p+='/'; + QCString path_str = fi.absFilePath().utf8(); + if (path_str[path_str.length()-1]!='/') path_str+='/'; str.remove(); if (str.at()==i) // did not remove last item - str.insert(i,p); + str.insert(i,path_str); else - str.append(p); + str.append(path_str); } } sfp = str.next(); @@ -2003,7 +2014,7 @@ void Config::postProcess(bool clearHeaderAndFooter, bool compare) if (!compare)ConfigImpl::instance()->emptyValueToDefault(); ConfigImpl::instance()->convertStrToVal(); - // avoid bootstrapping issues when the config file already + // avoid bootstrapping issues when the g_config file already // refers to the files that we are supposed to parse. if (clearHeaderAndFooter) { @@ -2019,4 +2030,6 @@ void Config::deinit() ConfigImpl::instance()->deleteInstance(); } +#if USE_STATE2STRING #include "configimpl.l.h" +#endif diff --git a/src/constexp.l b/src/constexp.l index 1c1678e..a14f8d3 100644 --- a/src/constexp.l +++ b/src/constexp.l @@ -35,8 +35,13 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + +#if USE_STATE2STRING static const char *stateToString(int state); -static int yyread(char *buf,int max_size,yyscan_t yyscanner); +#endif + +static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner); #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner); @@ -96,10 +101,10 @@ CONSTSUFFIX ([uU][lL]?[lL]?)|([lL][lL]?[uU]?) %% -static int yyread(char *buf,int max_size,yyscan_t yyscanner) +static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -156,4 +161,7 @@ bool ConstExpressionParser::parse(const char *fileName,int lineNr,const QCString extern "C" { int constexpYYwrap(yyscan_t yyscanner) { return 1; } } + +#if USE_STATE2STRING #include "constexp.l.h" +#endif diff --git a/src/context.cpp b/src/context.cpp index 5ee89cd..d4e2799 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -180,14 +180,14 @@ class GenericNodeListContext : public TemplateListIntf } // TemplateListIntf methods - int count() const + uint count() const { - return (int)m_children.count(); + return m_children.count(); } - TemplateVariant at(int index) const + TemplateVariant at(uint index) const { TemplateVariant result; - if (index>=0 && index<count()) + if (index<count()) { result = *m_children.at(index); } @@ -1397,6 +1397,7 @@ class DefinitionContext { assert(d!=0); } + virtual ~DefinitionContext() {} void addBaseProperties(PropertyMapper<T> &inst) { //%% string name: the name of the symbol @@ -1794,12 +1795,12 @@ IncludeInfoListContext::~IncludeInfoListContext() } // TemplateListIntf -int IncludeInfoListContext::count() const +uint IncludeInfoListContext::count() const { return p->count(); } -TemplateVariant IncludeInfoListContext::at(int index) const +TemplateVariant IncludeInfoListContext::at(uint index) const { return p->at(index); } @@ -2007,7 +2008,6 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { case ContextOutputFormat_Html: { - QGString result; FTextStream tt(&result); QCString name = convertToHtml(m_classDef->displayName()); @@ -2136,7 +2136,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> return cache.inheritedByList.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -2834,7 +2834,7 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -3293,7 +3293,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -5564,7 +5564,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -5852,12 +5852,12 @@ ClassListContext::~ClassListContext() } // TemplateListIntf -int ClassListContext::count() const +uint ClassListContext::count() const { return p->count(); } -TemplateVariant ClassListContext::at(int index) const +TemplateVariant ClassListContext::at(uint index) const { return p->at(index); } @@ -6760,12 +6760,12 @@ NestingContext::~NestingContext() } // TemplateListIntf -int NestingContext::count() const +uint NestingContext::count() const { return p->count(); } -TemplateVariant NestingContext::at(int index) const +TemplateVariant NestingContext::at(uint index) const { return p->at(index); } @@ -6987,12 +6987,12 @@ NamespaceListContext::~NamespaceListContext() } // TemplateListIntf -int NamespaceListContext::count() const +uint NamespaceListContext::count() const { return p->count(); } -TemplateVariant NamespaceListContext::at(int index) const +TemplateVariant NamespaceListContext::at(uint index) const { return p->at(index); } @@ -7166,12 +7166,12 @@ FileListContext::~FileListContext() } // TemplateListIntf -int FileListContext::count() const +uint FileListContext::count() const { return p->count(); } -TemplateVariant FileListContext::at(int index) const +TemplateVariant FileListContext::at(uint index) const { return p->at(index); } @@ -7209,12 +7209,12 @@ DirListContext::~DirListContext() } // TemplateListIntf -int DirListContext::count() const +uint DirListContext::count() const { return p->count(); } -TemplateVariant DirListContext::at(int index) const +TemplateVariant DirListContext::at(uint index) const { return p->at(index); } @@ -7257,12 +7257,12 @@ UsedFilesContext::~UsedFilesContext() } // TemplateListIntf -int UsedFilesContext::count() const +uint UsedFilesContext::count() const { return p->count(); } -TemplateVariant UsedFilesContext::at(int index) const +TemplateVariant UsedFilesContext::at(uint index) const { return p->at(index); } @@ -7532,12 +7532,12 @@ PageListContext::~PageListContext() } // TemplateListIntf -int PageListContext::count() const +uint PageListContext::count() const { return p->count(); } -TemplateVariant PageListContext::at(int index) const +TemplateVariant PageListContext::at(uint index) const { return p->at(index); } @@ -7581,12 +7581,12 @@ ExampleListContext::~ExampleListContext() } // TemplateListIntf -int ExampleListContext::count() const +uint ExampleListContext::count() const { return p->count(); } -TemplateVariant ExampleListContext::at(int index) const +TemplateVariant ExampleListContext::at(uint index) const { return p->at(index); } @@ -7628,12 +7628,12 @@ ModuleListContext::~ModuleListContext() } // TemplateListIntf -int ModuleListContext::count() const +uint ModuleListContext::count() const { return p->count(); } -TemplateVariant ModuleListContext::at(int index) const +TemplateVariant ModuleListContext::at(uint index) const { return p->at(index); } @@ -8594,12 +8594,12 @@ InheritanceListContext::~InheritanceListContext() } // TemplateListIntf -int InheritanceListContext::count() const +uint InheritanceListContext::count() const { return p->count(); } -TemplateVariant InheritanceListContext::at(int index) const +TemplateVariant InheritanceListContext::at(uint index) const { return p->at(index); } @@ -8670,12 +8670,12 @@ MemberListContext::~MemberListContext() } // TemplateListIntf -int MemberListContext::count() const +uint MemberListContext::count() const { return p->count(); } -TemplateVariant MemberListContext::at(int index) const +TemplateVariant MemberListContext::at(uint index) const { return p->at(index); } @@ -8831,12 +8831,12 @@ AllMembersListContext::~AllMembersListContext() } // TemplateListIntf -int AllMembersListContext::count() const +uint AllMembersListContext::count() const { return p->count(); } -TemplateVariant AllMembersListContext::at(int index) const +TemplateVariant AllMembersListContext::at(uint index) const { return p->at(index); } @@ -9013,12 +9013,12 @@ MemberGroupListContext::~MemberGroupListContext() } // TemplateListIntf -int MemberGroupListContext::count() const +uint MemberGroupListContext::count() const { return p->count(); } -TemplateVariant MemberGroupListContext::at(int index) const +TemplateVariant MemberGroupListContext::at(uint index) const { return p->at(index); } @@ -9376,12 +9376,12 @@ InheritedMemberInfoListContext::~InheritedMemberInfoListContext() } // TemplateListIntf -int InheritedMemberInfoListContext::count() const +uint InheritedMemberInfoListContext::count() const { return p->count(); } -TemplateVariant InheritedMemberInfoListContext::at(int index) const +TemplateVariant InheritedMemberInfoListContext::at(uint index) const { return p->at(index); } @@ -9458,7 +9458,7 @@ class ArgumentContext::Private TemplateVariant namePart() const { QCString result = m_argument.attrib; - int l = result.length(); + uint l = result.length(); if (l>2 && result.at(0)=='[' && result.at(l-1)==']') { result = result.mid(1,l-2); @@ -9529,12 +9529,12 @@ ArgumentListContext::~ArgumentListContext() } // TemplateListIntf -int ArgumentListContext::count() const +uint ArgumentListContext::count() const { return p->count(); } -TemplateVariant ArgumentListContext::at(int index) const +TemplateVariant ArgumentListContext::at(uint index) const { return p->at(index); } @@ -9723,12 +9723,12 @@ SymbolListContext::~SymbolListContext() } // TemplateListIntf -int SymbolListContext::count() const +uint SymbolListContext::count() const { return p->count(); } -TemplateVariant SymbolListContext::at(int index) const +TemplateVariant SymbolListContext::at(uint index) const { return p->at(index); } @@ -9834,12 +9834,12 @@ SymbolGroupListContext::~SymbolGroupListContext() } // TemplateListIntf -int SymbolGroupListContext::count() const +uint SymbolGroupListContext::count() const { return p->count(); } -TemplateVariant SymbolGroupListContext::at(int index) const +TemplateVariant SymbolGroupListContext::at(uint index) const { return p->at(index); } @@ -9946,12 +9946,12 @@ SymbolIndicesContext::~SymbolIndicesContext() } // TemplateListIntf -int SymbolIndicesContext::count() const +uint SymbolIndicesContext::count() const { return p->count(); } -TemplateVariant SymbolIndicesContext::at(int index) const +TemplateVariant SymbolIndicesContext::at(uint index) const { return p->at(index); } @@ -10055,12 +10055,12 @@ SearchIndicesContext::~SearchIndicesContext() } // TemplateListIntf -int SearchIndicesContext::count() const +uint SearchIndicesContext::count() const { return p->count(); } -TemplateVariant SearchIndicesContext::at(int index) const +TemplateVariant SearchIndicesContext::at(uint index) const { return p->at(index); } diff --git a/src/context.h b/src/context.h index fc1278b..278cf05 100644 --- a/src/context.h +++ b/src/context.h @@ -189,8 +189,8 @@ class UsedFilesContext : public RefCountedContext, public TemplateListIntf static UsedFilesContext *alloc(const ClassDef *cd) { return new UsedFilesContext(cd); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -234,8 +234,8 @@ class IncludeInfoListContext : public RefCountedContext, public TemplateListIntf { return new IncludeInfoListContext(list,lang); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -390,8 +390,8 @@ class ClassListContext : public RefCountedContext, public TemplateListIntf static ClassListContext *alloc() { return new ClassListContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -472,8 +472,8 @@ class ClassInheritanceContext : public RefCountedContext, public TemplateListInt static ClassInheritanceContext *alloc() { return new ClassInheritanceContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -537,8 +537,8 @@ class NestingContext : public RefCountedContext, public TemplateListIntf { return new NestingContext(parent,level); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -589,8 +589,8 @@ class NamespaceListContext : public RefCountedContext, public TemplateListIntf static NamespaceListContext *alloc() { return new NamespaceListContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -629,8 +629,8 @@ class DirListContext : public RefCountedContext, public TemplateListIntf static DirListContext *alloc() { return new DirListContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -650,8 +650,8 @@ class FileListContext : public RefCountedContext, public TemplateListIntf static FileListContext *alloc() { return new FileListContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -690,8 +690,8 @@ class PageListContext : public RefCountedContext, public TemplateListIntf static PageListContext *alloc(const PageSDict *pages) { return new PageListContext(pages); } // TemplateListIntf methods - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -751,8 +751,8 @@ class ModuleListContext : public RefCountedContext, public TemplateListIntf static ModuleListContext *alloc() { return new ModuleListContext(); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -794,8 +794,8 @@ class ExampleListContext : public RefCountedContext, public TemplateListIntf static ExampleListContext *alloc() { return new ExampleListContext; } // TemplateListIntf methods - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -933,8 +933,8 @@ class InheritanceListContext : public RefCountedContext, public TemplateListIntf { return new InheritanceListContext(list,baseClasses); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -959,8 +959,8 @@ class MemberListContext : public RefCountedContext, public TemplateListIntf { return new MemberListContext(ml,doSort); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1007,8 +1007,8 @@ class MemberGroupListContext : public RefCountedContext, public TemplateListIntf { return new MemberGroupListContext(def,relPath,dict,subGrouping); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1095,8 +1095,8 @@ class InheritedMemberInfoListContext : public RefCountedContext, public Template void addMemberList(const ClassDef *cd,MemberListType lt,const QCString &title,bool additionalList=TRUE); // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1119,8 +1119,8 @@ class AllMembersListContext : public RefCountedContext, public TemplateListIntf { return new AllMembersListContext(ml); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1163,8 +1163,8 @@ class ArgumentListContext : public RefCountedContext, public TemplateListIntf { return new ArgumentListContext(al,def,relPath); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1206,8 +1206,8 @@ class SymbolListContext : public RefCountedContext, public TemplateListIntf { return new SymbolListContext(sdl); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1248,8 +1248,8 @@ class SymbolGroupListContext : public RefCountedContext, public TemplateListIntf { return new SymbolGroupListContext(sil); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1290,8 +1290,8 @@ class SymbolIndicesContext : public RefCountedContext, public TemplateListIntf { return new SymbolIndicesContext(info); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1331,8 +1331,8 @@ class SearchIndicesContext : public RefCountedContext, public TemplateListIntf static SearchIndicesContext *alloc() { return new SearchIndicesContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } diff --git a/src/declinfo.l b/src/declinfo.l index 1660033..2f497f9 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -42,7 +42,9 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 #define YY_NEVER_INTERACTIVE 1 - + +#define USE_STATE2STRING 0 + /* ----------------------------------------------------------------- * * statics @@ -66,10 +68,13 @@ struct declinfoYY_state bool insidePHP; }; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif + static void addType(yyscan_t yyscanner); static void addTypeName(yyscan_t yyscanner); -static int yyread(char *buf,int max_size, yyscan_t yyscanner); +static yy_size_t yyread(char *buf,yy_size_t max_size, yyscan_t yyscanner); /* ----------------------------------------------------------------- */ @@ -237,16 +242,16 @@ static void addTypeName(yyscan_t yyscanner) yyextra->name.resize(0); } -static int yyread(char *buf,int max_size, yyscan_t yyscanner) +static yy_size_t yyread(char *buf,yy_size_t max_size, yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; - while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) - { - *buf = yyextra->inputString[yyextra->inputPosition++] ; - c++; buf++; - } - return c; + yy_size_t c=0; + while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) + { + *buf = yyextra->inputString[yyextra->inputPosition++] ; + c++; buf++; + } + return c; } /*@ public interface------------------------------------------------------------ @@ -383,5 +388,6 @@ int main() } #endif - +#if USE_STATE2STRING #include "declinfo.l.h" +#endif diff --git a/src/defargs.l b/src/defargs.l index e6f74c1..2541a43 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -67,6 +67,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 + +#define USE_STATE2STRING 0 /* ----------------------------------------------------------------- * state variables @@ -98,8 +100,11 @@ struct defargsYY_state QCString delimiter; }; +#if USE_STATE2STRING static const char *stateToString(int state); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +#endif + +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static bool nameIsActuallyPartOfType(QCString &name); /* ----------------------------------------------------------------- @@ -420,7 +425,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (alen>2 && a.array.at(0)=='(' && a.array.at(alen-1)==')') // fix-up for int *(a[10]) { - int i=a.array.find('[')-1; + i=a.array.find('[')-1; a.array = a.array.mid(1,alen-2); if (i>0 && a.name.isEmpty()) { @@ -572,10 +577,10 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" /* ---------------------------------------------------------------------------- */ -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -637,13 +642,13 @@ void class KeywordHash { private: - static inline unsigned int hash (const char *str, size_t len); + static inline unsigned int hash (const char *str, unsigned int len); public: - static const char *find (const char *str, size_t len); + static const char *find (const char *str, unsigned int len); }; inline unsigned int -KeywordHash::hash (const char *str, size_t len) +KeywordHash::hash (const char *str, unsigned int len) { static const unsigned char asso_values[] = { @@ -691,7 +696,7 @@ KeywordHash::hash (const char *str, size_t len) } const char * -KeywordHash::find (const char *str, size_t len) +KeywordHash::find (const char *str, unsigned int len) { static const char * const wordlist[] = { @@ -789,4 +794,6 @@ void stringToArgumentList(SrcLangExt lang, const char *argsString,ArgumentList& defargsYYlex_destroy(yyscanner); } +#if USE_STATE2STRING #include "defargs.l.h" +#endif diff --git a/src/definition.cpp b/src/definition.cpp index 28b552b..9d64b02 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -122,8 +122,8 @@ void DefinitionImpl::IMPL::setDefFileName(const QCString &df) void DefinitionImpl::IMPL::init(const char *df, const char *n) { setDefFileName(df); - QCString name = n; - if (name!="<globalScope>") + QCString lname = n; + if (lname!="<globalScope>") { //extractNamespaceName(m_name,m_localName,ns); localName=stripScope(n); @@ -175,15 +175,16 @@ static bool matchExcludedSymbols(const char *name) if (pattern.find('*')!=-1) // wildcard mode { QRegExp re(substitute(pattern,"*",".*"),TRUE); - int i,pl; - i = re.match(symName,0,&pl); + int pl; + int i = re.match(symName,0,&pl); //printf(" %d = re.match(%s) pattern=%s\n",i,symName.data(),pattern.data()); if (i!=-1) // wildcard match { - int sl=symName.length(); + uint ui=(uint)i; + uint sl=symName.length(); // check if it is a whole word match - if ((i==0 || pattern.at(0)=='*' || (!isId(symName.at(i-1)) && !forceStart)) && - (i+pl==sl || pattern.at(i+pl)=='*' || (!isId(symName.at(i+pl)) && !forceEnd)) + if ((ui==0 || pattern.at(0)=='*' || (!isId(symName.at(ui-1)) && !forceStart)) && + (ui+pl==sl || pattern.at(ui+pl)=='*' || (!isId(symName.at(ui+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); @@ -196,11 +197,12 @@ static bool matchExcludedSymbols(const char *name) int i = symName.find(pattern); if (i!=-1) // we have a match! { - int pl=pattern.length(); - int sl=symName.length(); + uint ui=(uint)i; + uint pl=pattern.length(); + uint sl=symName.length(); // check if it is a whole word match - if ((i==0 || (!isId(symName.at(i-1)) && !forceStart)) && - (i+pl==sl || (!isId(symName.at(i+pl)) && !forceEnd)) + if ((ui==0 || (!isId(symName.at(ui-1)) && !forceStart)) && + (ui+pl==sl || (!isId(symName.at(ui+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); @@ -597,10 +599,10 @@ void DefinitionImpl::setDocumentation(const char *d,const char *docFile,int docL // if that is a multibyte one. static bool lastCharIsMultibyte(const QCString &s) { - int l = s.length(); + uint l = s.length(); int p = 0; int pp = -1; - while ((p=nextUtf8CharPosition(s,l,p))<l) pp=p; + while ((p=nextUtf8CharPosition(s,l,(uint)p))<(int)l) pp=p; if (pp==-1 || ((uchar)s[pp])<0x80) return FALSE; return TRUE; } @@ -614,7 +616,7 @@ void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,in QCString brief = b; brief = brief.stripWhiteSpace(); if (brief.isEmpty()) return; - int bl = brief.length(); + uint bl = brief.length(); if (bl>0 && needsDot) // add punctuation if needed { int c = brief.at(bl-1); @@ -756,7 +758,7 @@ class FilterCache Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",qPrint(cmd)); f = Portable::popen(cmd,"r"); FILE *bf = Portable::fopen(Doxygen::filterDBFileName,"a+b"); - FilterCacheItem *item = new FilterCacheItem; + item = new FilterCacheItem; item->filePos = m_endPos; if (bf==0) { @@ -785,7 +787,7 @@ class FilterCache return FALSE; } size+=bytesWritten; - str.addArray(buf,static_cast<int>(bytesWritten)); + str.addArray(buf,static_cast<uint>(bytesWritten)); } str.addChar('\0'); item->fileSize = size; @@ -806,7 +808,7 @@ class FilterCache while (!feof(f)) { size_t bytesRead = fread(buf,1,blockSize,f); - str.addArray(buf,static_cast<int>(bytesRead)); + str.addArray(buf,static_cast<uint>(bytesRead)); } str.addChar('\0'); fclose(f); @@ -855,7 +857,7 @@ bool readCodeFragment(const char *fileName, char *p=str.data(); if (p) { - int c=0; + char c=0; int col=0; int lineNr=1; // skip until the startLine has reached @@ -958,7 +960,7 @@ bool readCodeFragment(const char *fileName, int braceIndex = result.findRev('}'); if (braceIndex > newLineIndex) { - result.truncate(braceIndex+1); + result.truncate((uint)braceIndex+1); } endLine=lineNr-1; } @@ -1102,10 +1104,9 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const // write normal text (Man, Latex optionally, RTF optionally) ol.docify(m_impl->body->fileDef->name()); ol.popGeneratorState(); - + // write text right from file marker - ol.parseText(refText.right( - refText.length()-fileMarkerPos-2)); + ol.parseText(refText.right(refText.length()-(uint)fileMarkerPos-2)); } else // file marker before line marker { @@ -1185,8 +1186,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.popGeneratorState(); // write text right from linePos marker - ol.parseText(refText.right( - refText.length()-lineMarkerPos-2)); + ol.parseText(refText.right(refText.length()-(uint)lineMarkerPos-2)); } ol.endParagraph(); } @@ -1282,15 +1282,17 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, ol.parseText(text); ol.docify(" "); - QCString ldefLine=theTranslator->trWriteList(members->count()); + QCString ldefLine=theTranslator->trWriteList((int)members->count()); QRegExp marker("@[0-9]+"); - int index=0,newIndex,matchLen; + uint index=0; + int matchLen; + int newIndex; // now replace all markers in inheritLine with links to the classes while ((newIndex=marker.match(ldefLine,index,&matchLen))!=-1) { bool ok; - ol.parseText(ldefLine.mid(index,newIndex-index)); + ol.parseText(ldefLine.mid(index,(uint)newIndex-index)); uint entryIndex = ldefLine.mid(newIndex+1,matchLen-1).toUInt(&ok); MemberDef *md=members->at(entryIndex); if (ok && md) @@ -1408,7 +1410,7 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, ol.docify(name); } } - index=newIndex+matchLen; + index=(uint)newIndex+matchLen; } ol.parseText(ldefLine.right(ldefLine.length()-index)); ol.writeString("."); @@ -1747,7 +1749,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const int level=1,l; char cs[2]; cs[1]='\0'; - bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; + std::vector<bool> inLi(maxLevel+1,false); for (const SectionInfo *si : m_impl->sectionRefs) { SectionType type = si->type(); @@ -1767,11 +1769,11 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const for (l=level;l>nextLevel;l--) { if (l <= maxLevel && inLi[l]) ol.writeString("</li>\n"); - inLi[l]=FALSE; + inLi[l]=false; if (l <= maxLevel) ol.writeString("</ul>\n"); } } - cs[0]='0'+nextLevel; + cs[0]=(char)('0'+nextLevel); if (nextLevel <= maxLevel && inLi[nextLevel]) { ol.writeString("</li>\n"); @@ -1783,7 +1785,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const "<a href=\"#"+si->label()+"\">"+ (si->title().isEmpty()?si->label():titleDoc)+"</a>"); } - inLi[nextLevel]=TRUE; + inLi[nextLevel]=true; level = nextLevel; } } @@ -1799,7 +1801,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const level--; } if (level <= maxLevel && inLi[level]) ol.writeString("</li>\n"); - inLi[level]=FALSE; + inLi[level]=false; ol.writeString("</ul>\n"); ol.writeString("</div>\n"); ol.popGeneratorState(); @@ -1812,8 +1814,8 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const ol.writeString(" <toc>\n"); ol.writeString(" <title>" + theTranslator->trRTFTableOfContents() + "</title>\n"); int level=1,l; - bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; int maxLevel = localToc.docbookLevel(); + std::vector<bool> inLi(maxLevel+1,false); for (const SectionInfo *si : m_impl->sectionRefs) { SectionType type = si->type(); @@ -1932,17 +1934,17 @@ QCString abbreviate(const char *s,const char *name) const char *p = briefDescAbbrev.first(); while (p) { - QCString s = p; - s.replace(QRegExp("\\$name"), scopelessName); // replace $name with entity name - s += " "; - stripWord(result,s); + QCString str = p; + str.replace(QRegExp("\\$name"), scopelessName); // replace $name with entity name + str += " "; + stripWord(result,str); p = briefDescAbbrev.next(); } // capitalize first word if (!result.isEmpty()) { - int c=result[0]; + char c=result[0]; if (c>='a' && c<='z') c+='A'-'a'; result[0]=c; } @@ -2161,7 +2163,7 @@ QCString DefinitionImpl::externalReference(const QCString &relPath) const if (dest) { QCString result = *dest; - int l = result.length(); + uint l = result.length(); if (!relPath.isEmpty() && l>0 && result.at(0)=='.') { // relative path -> prepend relPath. result.prepend(relPath); diff --git a/src/definitionimpl.h b/src/definitionimpl.h index d66ac93..d9c222d 100644 --- a/src/definitionimpl.h +++ b/src/definitionimpl.h @@ -237,37 +237,37 @@ class DefinitionAliasImpl : virtual public Definition { return m_def->navigationPathAsString(); } virtual QCString pathFragment() const { return m_def->pathFragment(); } - virtual void setName(const char *name) { } - virtual void setId(const char *name) { } - virtual void setDefFile(const QCString& df,int defLine,int defColumn) {} - virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE) {} - virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine) {} - virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine) {} - virtual void setReference(const char *r) {} - virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList) {} - virtual void setBodySegment(int bls,int ble) {} - virtual void setBodyDef(FileDef *fd) {} - virtual void addSourceReferencedBy(const MemberDef *d) {} - virtual void addSourceReferences(const MemberDef *d) {} - virtual void setRefItems(const std::vector<RefItem*> &sli) {} - virtual void mergeRefItems(Definition *d) {} - virtual void addInnerCompound(const Definition *d) {} - virtual void setOuterScope(Definition *d) {} - virtual void setHidden(bool b) {} - virtual void setArtificial(bool b) {} - virtual void setLanguage(SrcLangExt lang) {} - virtual void writeSourceDef(OutputList &ol,const char *scopeName) const {} - virtual void writeInlineCode(OutputList &ol,const char *scopeName) const {} - virtual void writeSourceRefs(OutputList &ol,const char *scopeName) const {} - virtual void writeSourceReffedBy(OutputList &ol,const char *scopeName) const {} - virtual void makePartOfGroup(GroupDef *gd) {} - virtual void writeNavigationPath(OutputList &ol) const {} + virtual void setName(const char *) { } + virtual void setId(const char *) { } + virtual void setDefFile(const QCString&,int,int) {} + virtual void setDocumentation(const char *,const char *,int,bool=TRUE) {} + virtual void setBriefDescription(const char *,const char *,int) {} + virtual void setInbodyDocumentation(const char *,const char *,int) {} + virtual void setReference(const char *) {} + virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &) {} + virtual void setBodySegment(int,int) {} + virtual void setBodyDef(FileDef *) {} + virtual void addSourceReferencedBy(const MemberDef *) {} + virtual void addSourceReferences(const MemberDef *) {} + virtual void setRefItems(const std::vector<RefItem*> &) {} + virtual void mergeRefItems(Definition *) {} + virtual void addInnerCompound(const Definition *) {} + virtual void setOuterScope(Definition *) {} + virtual void setHidden(bool) {} + virtual void setArtificial(bool) {} + virtual void setLanguage(SrcLangExt) {} + virtual void writeSourceDef(OutputList &,const char *) const {} + virtual void writeInlineCode(OutputList &,const char *) const {} + virtual void writeSourceRefs(OutputList &,const char *) const {} + virtual void writeSourceReffedBy(OutputList &,const char *) const {} + virtual void makePartOfGroup(GroupDef *) {} + virtual void writeNavigationPath(OutputList &) const {} virtual void writeQuickMemberLinks(OutputList &,const MemberDef *) const {} virtual void writeSummaryLinks(OutputList &) const {} virtual void writeDocAnchorsToTagFile(FTextStream &) const {} - virtual void setLocalName(const QCString name) {} + virtual void setLocalName(const QCString) {} virtual void addSectionsToIndex() {} - virtual void writeToc(OutputList &ol, const LocalToc <) const {} + virtual void writeToc(OutputList &, const LocalToc &) const {} virtual void setCookie(Cookie *cookie) const { delete m_cookie; m_cookie = cookie; } virtual Cookie *cookie() const { return m_cookie; } protected: diff --git a/src/diagram.cpp b/src/diagram.cpp index 25b2c06..d0b7a08 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -42,20 +42,20 @@ class DiagramItemList; class DiagramItem { public: - DiagramItem(DiagramItem *p,int number,const ClassDef *cd, + DiagramItem(DiagramItem *p,uint number,const ClassDef *cd, Protection prot,Specifier virt,const char *ts); ~DiagramItem(); QCString label() const; QCString fileName() const; DiagramItem *parentItem() { return parent; } DiagramItemList *getChildren() { return children; } - void move(int dx,int dy) { x+=dx; y+=dy; } - int xPos() const { return x; } - int yPos() const { return y; } - int avgChildPos() const; - int numChildren() const; + void move(int dx,int dy) { x+=(uint)dx; y+=(uint)dy; } + uint xPos() const { return x; } + uint yPos() const { return y; } + uint avgChildPos() const; + uint numChildren() const; void addChild(DiagramItem *di); - int number() const { return num; } + uint number() const { return num; } Protection protection() const { return prot; } Specifier virtualness() const { return virt; } void putInList() { inList=TRUE; } @@ -64,8 +64,8 @@ class DiagramItem private: DiagramItemList *children; DiagramItem *parent; - int x,y; - int num; + uint x,y; + uint num; Protection prot; Specifier virt; QCString templSpec; @@ -85,8 +85,8 @@ class DiagramItemList : public QList<DiagramItem> class DiagramRow : public QList<DiagramItem> { public: - DiagramRow(TreeDiagram *d,int l) : QList<DiagramItem>() - { + DiagramRow(TreeDiagram *d,uint l) : QList<DiagramItem>() + { diagram=d; level=l; setAutoDelete(TRUE); @@ -129,7 +129,7 @@ class TreeDiagram : public QList<DiagramRow> uint baseRows,uint superRows, uint cellWidth,uint cellheight); private: - bool layoutTree(DiagramItem *root,int row); + bool layoutTree(DiagramItem *root,uint row); TreeDiagram &operator=(const TreeDiagram &); TreeDiagram(const TreeDiagram &); }; @@ -139,8 +139,8 @@ class TreeDiagram : public QList<DiagramRow> //----------------------------------------------------------------------------- const uint maxTreeWidth = 8; -const int gridWidth = 100; -const int gridHeight = 100; +const uint gridWidth = 100; +const uint gridHeight = 100; const uint labelHorSpacing = 10; // horizontal distance between labels const uint labelVertSpacing = 32; // vertical distance between labels @@ -171,7 +171,7 @@ static uint protToMask(Protection p) return 0; } -static uint protToColor(Protection p) +static uchar protToColor(Protection p) { switch(p) { @@ -225,21 +225,23 @@ static Protection getMinProtectionLevel(DiagramItemList *dil) } static void writeBitmapBox(DiagramItem *di,Image *image, - int x,int y,int w,int h,bool firstRow, + uint x,uint y,uint w,uint h,bool firstRow, bool hasDocs,bool children=FALSE) { - int colFill = hasDocs ? (firstRow ? 0 : 2) : 7; - int colBorder = (firstRow || !hasDocs) ? 1 : 3; - int l = Image::stringLength(di->label()); + uchar colFill = hasDocs ? (firstRow ? 0 : 2) : 7; + uchar colBorder = (firstRow || !hasDocs) ? 1 : 3; + uint l = Image::stringLength(di->label()); uint mask=virtToMask(di->virtualness()); image->fillRect(x+1,y+1,w-2,h-2,colFill,mask); image->drawRect(x,y,w,h,colBorder,mask); image->writeString(x+(w-l)/2, y+(h-fontHeight)/2, di->label(),1); if (children) { - int i; + uint i; for (i=0;i<5;i++) + { image->drawHorzLine(y+h+i-6,x+w-2-i,x+w-2,firstRow?1:3,0xffffffff); + } } } @@ -253,7 +255,7 @@ static void writeVectorBox(FTextStream &t,DiagramItem *di, } static void writeMapArea(FTextStream &t,const ClassDef *cd,QCString relPath, - int x,int y,int w,int h) + uint x,uint y,uint w,uint h) { if (cd->isLinkable()) { @@ -283,12 +285,11 @@ static void writeMapArea(FTextStream &t,const ClassDef *cd,QCString relPath, } //----------------------------------------------------------------------------- -DiagramItem::DiagramItem(DiagramItem *p,int number,const ClassDef *cd, +DiagramItem::DiagramItem(DiagramItem *p,uint number,const ClassDef *cd, Protection pr,Specifier vi,const char *ts) -{ - parent=p; - x=y=0; - //name=n; +{ + parent=p; + x=y=0; num=number; children = new DiagramItemList; prot=pr; @@ -297,9 +298,9 @@ DiagramItem::DiagramItem(DiagramItem *p,int number,const ClassDef *cd, classDef=cd; templSpec=ts; } - + DiagramItem::~DiagramItem() -{ +{ delete children; } @@ -330,10 +331,10 @@ QCString DiagramItem::fileName() const return classDef->getOutputFileBase(); } -int DiagramItem::avgChildPos() const +uint DiagramItem::avgChildPos() const { DiagramItem *di; - int c=children->count(); + uint c=children->count(); if (c==0) // no children -> don't move return xPos(); if ((di=children->getFirst())->isInList()) // children should be in a list @@ -344,7 +345,7 @@ int DiagramItem::avgChildPos() const return (children->at(c/2-1)->xPos()+children->at(c/2)->xPos())/2; } -int DiagramItem::numChildren() const +uint DiagramItem::numChildren() const { return children->count(); } @@ -363,7 +364,7 @@ void DiagramRow::insertClass(DiagramItem *parent,const ClassDef *cd,bool doBases cd,prot,virt,ts); //cd->visited=TRUE; if (parent) parent->addChild(di); - di->move(count()*gridWidth,level*gridHeight); + di->move((int)(count()*gridWidth),(int)(level*gridHeight)); append(di); BaseClassList *bcl=doBases ? cd->baseClasses() : cd->subClasses(); int count=0; @@ -431,7 +432,7 @@ void TreeDiagram::moveChildren(DiagramItem *root,int dx) } } -bool TreeDiagram::layoutTree(DiagramItem *root,int r) +bool TreeDiagram::layoutTree(DiagramItem *root,uint r) { bool moved=FALSE; //printf("layoutTree(%s,%d)\n",root->label().data(),r); @@ -440,15 +441,15 @@ bool TreeDiagram::layoutTree(DiagramItem *root,int r) if (dil->count()>0) { uint k; - int pPos=root->xPos(); - int cPos=root->avgChildPos(); + uint pPos=root->xPos(); + uint cPos=root->avgChildPos(); if (pPos>cPos) // move children { DiagramRow *row=at(r+1); //printf("Moving children %d-%d in row %d\n", // dil->getFirst()->number(),row->count()-1,r+1); for (k=dil->getFirst()->number();k<row->count();k++) - row->at(k)->move(pPos-cPos,0); + row->at(k)->move((int)(pPos-cPos),0); moved=TRUE; } else if (pPos<cPos) // move parent @@ -457,7 +458,7 @@ bool TreeDiagram::layoutTree(DiagramItem *root,int r) //printf("Moving parents %d-%d in row %d\n", // root->number(),row->count()-1,r); for (k=root->number();k<row->count();k++) - row->at(k)->move(cPos-pPos,0); + row->at(k)->move((int)(cPos-pPos),0); moved=TRUE; } @@ -525,7 +526,7 @@ void TreeDiagram::computeLayout() uint TreeDiagram::computeRows() { //printf("TreeDiagram::computeRows()=%d\n",count()); - int count=0; + uint count=0; QListIterator<DiagramRow> it(*this); DiagramRow *row; for (;(row=it.current()) && !row->getFirst()->isInList();++it) @@ -535,8 +536,8 @@ uint TreeDiagram::computeRows() //printf("count=%d row=%p\n",count,row); if (row) { - int maxListLen=0; - int curListLen=0; + uint maxListLen=0; + uint curListLen=0; DiagramItem *opi=0; QListIterator<DiagramItem> rit(*row); DiagramItem *di; @@ -587,7 +588,7 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, bool firstRow = doBase; for (;(dr=it.current()) && !done;++it) { - int x=0,y=0; + uint x=0,y=0; float xf=0.0f,yf=0.0f; QListIterator<DiagramItem> rit(*dr); DiagramItem *di = rit.current(); @@ -617,7 +618,7 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth; if (doBase) { - y = image->getHeight()- + y = image->height()- superRows*cellHeight- (superRows-1)*labelVertSpacing- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; @@ -669,7 +670,7 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth; if (doBase) { - y = image->getHeight()- + y = image->height()- superRows*cellHeight- (superRows-1)*labelVertSpacing- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; @@ -717,7 +718,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, DiagramItem *di = rit.current(); if (di->isInList()) // row consists of list connectors { - int x=0,y=0,ys=0; + uint x=0,y=0,ys=0; float xf=0.0f,yf=0.0f,ysf=0.0f; for (;(di=rit.current());++rit) { @@ -731,7 +732,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { - y = image->getHeight()- + y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; image->drawVertArrow(x,y,y+labelVertSpacing/2, @@ -759,7 +760,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, else { t << "0 " << (di->xPos()/(float)gridWidth) << " " - << ((float)superRows-0.25-di->yPos()/(float)gridHeight) + << ((float)superRows-0.25f-di->yPos()/(float)gridHeight) << " in\n"; } } @@ -772,7 +773,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, (cellWidth+labelHorSpacing)/gridWidth+cellWidth/2; if (doBase) // base classes { - ys = image->getHeight()- + ys = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; y = ys - cellHeight/2; @@ -873,7 +874,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, } else { - t << xf << " " << (ysf + 0.25) << " " << yf << " vedge\n"; + t << xf << " " << (ysf + 0.25f) << " " << yf << " vedge\n"; } } } @@ -884,7 +885,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, { for (;(di=rit.current());++rit) { - int x=0,y=0; + uint x=0,y=0; DiagramItemList *dil = di->getChildren(); DiagramItem *parent = di->parentItem(); if (parent) // item has a parent -> connect to it @@ -894,7 +895,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { - y = image->getHeight()- + y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; /* write input line */ @@ -924,7 +925,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, else { t << "0 " << di->xPos()/(float)gridWidth << " " - << ((float)superRows-0.25-di->yPos()/(float)gridHeight) + << ((float)superRows-0.25f-di->yPos()/(float)gridHeight) << " in\n"; } } @@ -933,13 +934,13 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, { Protection p=getMinProtectionLevel(dil); uint mask=protToMask(p); - uint col=protToColor(p); + uchar col=protToColor(p); if (bitmap) { x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { - y = image->getHeight()- + y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- cellHeight-labelVertSpacing/2- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; @@ -964,7 +965,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, else { t << "1 " << di->xPos()/(float)gridWidth << " " - << ((float)superRows-1.75-di->yPos()/(float)gridHeight) + << ((float)superRows-1.75f-di->yPos()/(float)gridHeight) << " out\n"; } } @@ -975,9 +976,9 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, { if (bitmap) { - int xs = first->xPos()*(cellWidth+labelHorSpacing)/gridWidth + uint xs = first->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; - int xe = last->xPos()*(cellWidth+labelHorSpacing)/gridWidth + uint xe = last->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { @@ -1034,17 +1035,17 @@ ClassDiagram::ClassDiagram(const ClassDef *root) super->computeLayout(); DiagramItem *baseItem = base->getFirst()->getFirst(); DiagramItem *superItem = super->getFirst()->getFirst(); - int xbase = baseItem->xPos(); - int xsuper = superItem->xPos(); + uint xbase = baseItem->xPos(); + uint xsuper = superItem->xPos(); if (xbase>xsuper) { - superItem->move(xbase-xsuper,0); - super->moveChildren(superItem,xbase-xsuper); + superItem->move((int)(xbase-xsuper),0); + super->moveChildren(superItem,(int)(xbase-xsuper)); } else if (xbase<xsuper) { - baseItem->move(xsuper-xbase,0); - base->moveChildren(baseItem,xsuper-xbase); + baseItem->move((int)(xsuper-xbase),0); + base->moveChildren(baseItem,(int)(xsuper-xbase)); } } @@ -1116,7 +1117,7 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, t << "%%For: \n"; t << "%Magnification: 1.00\n"; t << "%%Orientation: Portrait\n"; - t << "%%BoundingBox: 0 0 500 " << estHeight*500.0/(float)estWidth << "\n"; + t << "%%BoundingBox: 0 0 500 " << estHeight*500.0f/(float)estWidth << "\n"; t << "%%Pages: 0\n"; t << "%%BeginSetup\n"; t << "%%EndSetup\n"; diff --git a/src/dirdef.cpp b/src/dirdef.cpp index ba792e1..81245e3 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -373,9 +373,7 @@ void DirDefImpl::writeFileList(OutputList &ol) ol.parseText(theTranslator->trFile(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); - QListIterator<FileDef> it(*m_fileList); - FileDef *fd; - for (;(fd=it.current());++it) + for (it.toFirst();(fd=it.current());++it) { if (fd->hasDocumentation()) { @@ -935,7 +933,7 @@ static void computeCommonDirPrefix() sdi.toFirst(); dir=sdi.current(); path=dir->name(); - int i=path.findRev('/',path.length()-2); + int i=path.findRev('/',(int)path.length()-2); path=path.left(i+1); bool done=FALSE; if (i==-1) @@ -946,8 +944,8 @@ static void computeCommonDirPrefix() { while (!done) { - int l = path.length(); - int count=0; + uint l = path.length(); + uint count=0; for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString dirName = dir->name(); @@ -955,7 +953,7 @@ static void computeCommonDirPrefix() { if (qstrncmp(dirName,path,l)!=0) // dirName does not start with path { - int i=path.findRev('/',l-2); + i=path.findRev('/',(int)l-2); if (i==-1) // no unique prefix -> stop { path=""; @@ -972,7 +970,7 @@ static void computeCommonDirPrefix() { path=dir->name(); l=path.length(); - int i=path.findRev('/',l-2); + i=path.findRev('/',(int)l-2); if (i==-1) // no unique prefix -> stop { path=""; @@ -1037,7 +1035,7 @@ void buildDirectories() for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString name = dir->name(); - int i=name.findRev('/',name.length()-2); + int i=name.findRev('/',(int)name.length()-2); if (i>0) { DirDef *parent = Doxygen::directories->find(name.left(i+1)); diff --git a/src/dirdef.h b/src/dirdef.h index 2ea54af..692cd90 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -97,7 +97,7 @@ class FilePair class FilePairDict : public SDict<FilePair> { public: - FilePairDict(int size) : SDict<FilePair>(size) {} + FilePairDict(uint size) : SDict<FilePair>(size) {} private: int compareValues(const FilePair *item1,const FilePair *item2) const; }; @@ -147,7 +147,7 @@ inline int DirList::compareValues(const DirDef *item1,const DirDef *item2) const class DirSDict : public SDict<DirDef> { public: - DirSDict(int size) : SDict<DirDef>(size) {} + DirSDict(uint size) : SDict<DirDef>(size) {} int compareValues(const DirDef *item1,const DirDef *item2) const { return qstricmp(item1->shortName(),item2->shortName()); diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 1799ed9..1b32787 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -132,15 +132,13 @@ void writeDocbookLink(FTextStream &t,const char * /*extRef*/,const char *compoun t << "</link>"; } -DocbookCodeGenerator::DocbookCodeGenerator(FTextStream &t) : m_lineNumber(-1), m_col(0), - m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE) +DocbookCodeGenerator::DocbookCodeGenerator(FTextStream &t) { m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); setTextStream(t); } -DocbookCodeGenerator::DocbookCodeGenerator() : m_lineNumber(-1), m_col(0), - m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE), m_streamSet(FALSE) +DocbookCodeGenerator::DocbookCodeGenerator() { m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); } @@ -160,9 +158,9 @@ void DocbookCodeGenerator::writeCodeLink(const char *ref,const char *file, writeDocbookLink(m_t,ref,file,anchor,name,tooltip); m_col+=(int)strlen(name); } -void DocbookCodeGenerator::writeCodeLinkLine(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip) +void DocbookCodeGenerator::writeCodeLinkLine(const char *,const char *file, + const char *,const char *name, + const char *) { Docbook_DB(("(writeCodeLinkLine)\n")); m_t << "<anchor xml:id=\"_" << stripExtensionGeneral(stripPath(file),".xml"); @@ -274,8 +272,8 @@ DB_GEN_C m_descTable = FALSE; m_inLevel = -1; m_firstMember = FALSE; - for (int i = 0 ; i < sizeof(m_inListItem) / sizeof(*m_inListItem) ; i++) m_inListItem[i] = FALSE; - for (int i = 0 ; i < sizeof(m_inSimpleSect) / sizeof(*m_inSimpleSect) ; i++) m_inSimpleSect[i] = FALSE; + for (size_t i = 0 ; i < sizeof(m_inListItem) / sizeof(*m_inListItem) ; i++) m_inListItem[i] = FALSE; + for (size_t i = 0 ; i < sizeof(m_inSimpleSect) / sizeof(*m_inSimpleSect) ; i++) m_inSimpleSect[i] = FALSE; } DocbookGenerator::~DocbookGenerator() @@ -655,7 +653,8 @@ DB_GEN_C } } } -void DocbookGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *) + +void DocbookGenerator::writeDoc(DocNode *n,const Definition *,const MemberDef *) { DB_GEN_C DocbookDocVisitor *visitor = @@ -680,7 +679,7 @@ void DocbookGenerator::writeString(const char *text) DB_GEN_C t << text; } -void DocbookGenerator::startMemberHeader(const char *name,int) +void DocbookGenerator::startMemberHeader(const char *,int) { DB_GEN_C t << "<simplesect>" << endl; @@ -698,7 +697,7 @@ void DocbookGenerator::docify(const char *str) DB_GEN_C t << convertToDocBook(str); } -void DocbookGenerator::writeObjectLink(const char *ref, const char *f, +void DocbookGenerator::writeObjectLink(const char *, const char *f, const char *anchor, const char *text) { DB_GEN_C @@ -813,7 +812,7 @@ DB_GEN_C t << "<programlisting>"; } } -void DocbookGenerator::endTextBlock(bool dense) +void DocbookGenerator::endTextBlock(bool) { DB_GEN_C if (m_denseText) @@ -822,8 +821,8 @@ DB_GEN_C t << "</programlisting>"; } } -void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *anchor, const char *title, - int memCount, int memTotal, bool showInline) +void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *, const char *title, + int memCount, int memTotal, bool) { DB_GEN_C2("m_inLevel " << m_inLevel) t << " <section>" << endl; @@ -849,15 +848,15 @@ void DocbookGenerator::startTitleHead(const char *) DB_GEN_C t << "<title>"; } -void DocbookGenerator::endTitleHead(const char *fileName,const char *name) +void DocbookGenerator::endTitleHead(const char *,const char *name) { DB_GEN_C t << "</title>" << endl; if (name) addIndexTerm(t, name); } -void DocbookGenerator::startDoxyAnchor(const char *fName,const char *manName, - const char *anchor,const char *name, - const char *args) +void DocbookGenerator::startDoxyAnchor(const char *fName,const char *, + const char *anchor,const char *, + const char *) { DB_GEN_C if (!m_inListItem[m_levelListItem] && !m_descTable) @@ -870,7 +869,7 @@ DB_GEN_C t << "<anchor xml:id=\"_" << stripPath(fName) << "_1" << anchor << "\"/>"; } } -void DocbookGenerator::endDoxyAnchor(const char *fileName,const char *anchor) +void DocbookGenerator::endDoxyAnchor(const char *,const char *) { DB_GEN_C } @@ -883,7 +882,7 @@ void DocbookGenerator::endMemberDocName() { DB_GEN_C } -void DocbookGenerator::startMemberGroupHeader(bool hasHeader) +void DocbookGenerator::startMemberGroupHeader(bool) { DB_GEN_C t << "<simplesect><title>"; @@ -1025,13 +1024,13 @@ DB_GEN_C t << "</para>"; t << "<para>"; } -void DocbookGenerator::startSection(const char *lab,const char *,SectionType type) +void DocbookGenerator::startSection(const char *lab,const char *,SectionType) { DB_GEN_C t << " <section xml:id=\"_" << stripPath(lab) << "\">"; t << "<title>"; } -void DocbookGenerator::endSection(const char *lab,SectionType) +void DocbookGenerator::endSection(const char *,SectionType) { DB_GEN_C t << "</title>"; diff --git a/src/docbookgen.h b/src/docbookgen.h index d993312..bed2f5f 100644 --- a/src/docbookgen.h +++ b/src/docbookgen.h @@ -57,16 +57,16 @@ class DocbookCodeGenerator : public CodeOutputInterface private: FTextStream m_t; - bool m_streamSet; + bool m_streamSet = FALSE; QCString m_refId; QCString m_external; - int m_lineNumber; - int m_col; - bool m_insideCodeLine; - bool m_insideSpecialHL; + int m_lineNumber = -1; + int m_col = 0; + bool m_insideCodeLine = FALSE; + bool m_insideSpecialHL = FALSE; QCString m_relPath; QCString m_sourceFileName; - bool m_prettyCode; + bool m_prettyCode = FALSE; }; @@ -145,14 +145,14 @@ class DocbookGenerator : public OutputGenerator void startFile(const char *name,const char *manName, const char *title); void writeSearchInfo(){DB_GEN_EMPTY}; - void writeFooter(const char *navPath){DB_GEN_NEW}; + void writeFooter(const char *){DB_GEN_NEW}; void endFile(); void startIndexSection(IndexSections); void endIndexSection(IndexSections); void writePageLink(const char *,bool); void startProjectNumber(){DB_GEN_NEW}; void endProjectNumber(){DB_GEN_NEW}; - void writeStyleInfo(int part){DB_GEN_EMPTY}; + void writeStyleInfo(int){DB_GEN_EMPTY}; void startTitleHead(const char *); void endTitleHead(const char *fileName,const char *name); void startIndexListItem(){DB_GEN_NEW}; @@ -166,8 +166,8 @@ class DocbookGenerator : public OutputGenerator void startItemList() {DB_GEN_EMPTY}; void endItemList() {DB_GEN_EMPTY}; - void startIndexItem(const char *ref,const char *file){DB_GEN_NEW}; - void endIndexItem(const char *ref,const char *file){DB_GEN_NEW}; + void startIndexItem(const char *,const char *){DB_GEN_NEW}; + void endIndexItem(const char *,const char *){DB_GEN_NEW}; void startItemListItem() {DB_GEN_EMPTY}; void endItemListItem() {DB_GEN_EMPTY}; void docify(const char *text); @@ -258,23 +258,23 @@ class DocbookGenerator : public OutputGenerator void insertMemberAlign(bool){DB_GEN_EMPTY}; void insertMemberAlignLeft(int,bool){DB_GEN_EMPTY}; void startMemberDoc(const char *,const char *, - const char *,const char *,int,int,bool); + const char *,const char *,int,int,bool); void endMemberDoc(bool); void startDoxyAnchor(const char *fName,const char *manName, - const char *anchor,const char *name, - const char *args); + const char *anchor,const char *name, + const char *args); void endDoxyAnchor(const char *fileName,const char *anchor); void writeLatexSpacing(){DB_GEN_EMPTY} - void writeStartAnnoItem(const char *type,const char *file, - const char *path,const char *name){DB_GEN_NEW}; - void writeEndAnnoItem(const char *name){DB_GEN_NEW}; - void startMemberDescription(const char *anchor,const char *inheritId, bool typ){DB_GEN_EMPTY}; + void writeStartAnnoItem(const char *,const char *, + const char *,const char *){DB_GEN_NEW}; + void writeEndAnnoItem(const char *){DB_GEN_NEW}; + void startMemberDescription(const char *,const char *,bool){DB_GEN_EMPTY}; void endMemberDescription(){DB_GEN_EMPTY}; void startMemberDeclaration(){DB_GEN_EMPTY}; - void endMemberDeclaration(const char *anchor,const char *inheritId){DB_GEN_EMPTY}; - void writeInheritedSectionTitle(const char *id,const char *ref, - const char *file,const char *anchor, - const char *title,const char *name){DB_GEN_NEW}; + void endMemberDeclaration(const char *,const char *){DB_GEN_EMPTY}; + void writeInheritedSectionTitle(const char *,const char *, + const char *,const char *, + const char *,const char *){DB_GEN_NEW}; void startIndent(){DB_GEN_EMPTY}; void endIndent(){DB_GEN_EMPTY}; void writeSynopsis(){DB_GEN_EMPTY}; @@ -290,17 +290,17 @@ class DocbookGenerator : public OutputGenerator void endCallGraph(DotCallGraph &g); void startDirDepGraph(); void endDirDepGraph(DotDirDeps &g); - void writeGraphicalHierarchy(DotGfxHierarchyTable &g){DB_GEN_NEW}; + void writeGraphicalHierarchy(DotGfxHierarchyTable &){DB_GEN_NEW}; void startQuickIndices(){DB_GEN_EMPTY}; void endQuickIndices(){DB_GEN_EMPTY}; void writeSplitBar(const char *){DB_GEN_EMPTY}; void writeNavigationPath(const char *){DB_GEN_NEW}; void writeLogo(){DB_GEN_NEW}; - void writeQuickLinks(bool compact,HighlightedItem hli,const char *file){DB_GEN_EMPTY}; - void writeSummaryLink(const char *file,const char *anchor,const char *title,bool first){DB_GEN_EMPTY}; + void writeQuickLinks(bool,HighlightedItem,const char *){DB_GEN_EMPTY}; + void writeSummaryLink(const char *,const char *,const char *,bool){DB_GEN_EMPTY}; void startContents(){DB_GEN_EMPTY}; void endContents(){DB_GEN_EMPTY}; - void startPageDoc(const char *pageTitle){DB_GEN_EMPTY} + void startPageDoc(const char *){DB_GEN_EMPTY} void endPageDoc() {DB_GEN_EMPTY} void startTextBlock(bool); void endTextBlock(bool); @@ -309,7 +309,7 @@ class DocbookGenerator : public OutputGenerator void endMemberDocPrefixItem(); void startMemberDocName(bool); void endMemberDocName(); - void startParameterType(bool,const char *key){DB_GEN_EMPTY}; + void startParameterType(bool,const char *){DB_GEN_EMPTY}; void endParameterType(){DB_GEN_EMPTY}; void startParameterName(bool); void endParameterName(bool,bool,bool); diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 9ae1c8f..b9bd6aa 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -53,7 +53,7 @@ static QCString filterId(const char *s) static GrowBuf growBuf; growBuf.clear(); if (s==0) return ""; - const unsigned char *p=(const unsigned char *)s; + const char *p=s; char c; while ((c=*p++)) { @@ -396,7 +396,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } m_t << "<para>" << endl; writePlantUMLFile(baseName,s); @@ -1128,14 +1128,14 @@ DB_VIS_C m_t << ">"; } -void DocbookDocVisitor::visitPost(DocHtmlCell *c) +void DocbookDocVisitor::visitPost(DocHtmlCell *) { DB_VIS_C if (m_hide) return; m_t << "</entry>"; } -void DocbookDocVisitor::visitPre(DocHtmlCaption *c) +void DocbookDocVisitor::visitPre(DocHtmlCaption *) { DB_VIS_C if (m_hide) return; @@ -1202,7 +1202,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } visitPreStart(m_t, img->children(), img->hasCaption(), img->relPath() + baseName, img->width(), img->height(), img->isInlineImage()); } @@ -1225,7 +1225,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } QCString m_file; bool ambig; @@ -1332,7 +1332,7 @@ DB_VIS_C if (!ref->file().isEmpty()) endLink(); } -void DocbookDocVisitor::visitPre(DocSecRefItem *ref) +void DocbookDocVisitor::visitPre(DocSecRefItem *) { DB_VIS_C if (m_hide) return; @@ -1415,11 +1415,9 @@ DB_VIS_C if (m_hide) return; m_t << " <row>" << endl; - DocParamSect::Type parentType = DocParamSect::Unknown; DocParamSect *sect = 0; if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect) { - parentType = ((DocParamSect*)pl->parent())->type(); sect=(DocParamSect*)pl->parent(); } @@ -1639,7 +1637,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP); @@ -1655,7 +1653,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); PlantumlManager::instance()->generatePlantUMLOutput(baseName,outDir,PlantumlManager::PUML_BITMAP); @@ -1676,7 +1674,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } if ((i=baseName.find('.'))!=-1) { @@ -1704,7 +1702,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP); @@ -1725,7 +1723,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } if ((i=baseName.find('.'))!=-1) { @@ -1753,7 +1751,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); @@ -1774,7 +1772,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } if ((i=baseName.find('.'))!=-1) { diff --git a/src/docparser.cpp b/src/docparser.cpp index e26c2ac..0cc7080 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -112,7 +112,7 @@ static QCString g_includeFileName; static QCString g_includeFileText; static uint g_includeFileOffset; static uint g_includeFileLength; -static uint g_includeFileLine; +static int g_includeFileLine; static bool g_includeFileShowLineNo; @@ -145,7 +145,7 @@ struct DocParserContext QCString includeFileText; uint includeFileOffset; uint includeFileLength; - uint includeFileLine; + int includeFileLine; bool includeFileLineNo; TokenInfo *token; @@ -302,7 +302,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool int i; if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1) { - result = result.right(result.length()-i-1); + result = result.right((int)result.length()-i-1); } //printf("fileName=%s result=%s\n",fileName,result.data()); QCString outputDir; @@ -679,7 +679,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, QCString cmdArg=substitute(commandName,"#","::"); cmdArg = replaceScopeSeparator(cmdArg); - int l=cmdArg.length(); + int l=(int)cmdArg.length(); if (l==0) return FALSE; int funcStart=cmdArg.find('('); @@ -726,7 +726,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, } - int scopeOffset=g_context.length(); + int scopeOffset=(int)g_context.length(); do // for each scope { QCString fullName=cmdArg; @@ -961,7 +961,7 @@ static int handleAHref(DocNode *parent,QList<DocNode> &children,const HtmlAttrib { HtmlAttribListIterator li(tagHtmlAttribs); HtmlAttrib *opt; - int index=0; + uint index=0; int retval = RetVal_OK; for (li.toFirst();(opt=li.current());++li,++index) { @@ -1054,7 +1054,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor const Definition *compound=0; const MemberDef *member=0; - int len = g_token->name.length(); + uint len = g_token->name.length(); ClassDef *cd=0; bool ambig; FileDef *fd = findFileDef(Doxygen::inputNameDict,g_fileName,ambig); @@ -1730,7 +1730,7 @@ static void handleImg(DocNode *parent,QList<DocNode> &children,const HtmlAttribL HtmlAttribListIterator li(tagHtmlAttribs); HtmlAttrib *opt; bool found=FALSE; - int index=0; + uint index=0; for (li.toFirst();(opt=li.current());++li,++index) { //printf("option name=%s value=%s\n",opt->name.data(),opt->value.data()); @@ -1768,7 +1768,7 @@ DocEmoji::DocEmoji(DocNode *parent,const QCString &symName) : { m_parent = parent; QCString locSymName = symName; - int len=locSymName.length(); + uint len=locSymName.length(); if (len>0) { if (locSymName.at(len-1)!=':') locSymName.append(":"); @@ -2035,7 +2035,7 @@ void DocIncOperator::parse() const char *p = g_includeFileText; uint l = g_includeFileLength; uint o = g_includeFileOffset; - uint il = g_includeFileLine; + int il = g_includeFileLine; DBG(("DocIncOperator::parse() text=%s off=%d len=%d\n",qPrint(p),o,l)); uint so = o,bo; bool nonEmpty = FALSE; @@ -2280,7 +2280,7 @@ void DocSecRefItem::parse() const SectionInfo *sec=0; if (!m_target.isEmpty()) { - const SectionInfo *sec = SectionManager::instance().find(m_target); + sec = SectionManager::instance().find(m_target); if (sec) { m_file = sec->fileName(); @@ -2322,7 +2322,7 @@ void DocSecRefList::parse() { case CMD_SECREFITEM: { - int tok=doctokenizerYYlex(); + tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) { warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after \\refitem command"); @@ -2377,7 +2377,7 @@ DocInternalRef::DocInternalRef(DocNode *parent,const QCString &ref) int i=ref.find('#'); if (i!=-1) { - m_anchor = ref.right(ref.length()-i-1); + m_anchor = ref.right((int)ref.length()-i-1); m_file = ref.left(i); } else @@ -2701,7 +2701,7 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink) m_children.append(new DocWord(this,w.left(p))); if ((uint)p<l-1) // something left after the } (for instance a .) { - result=w.right(l-p-1); + result=w.right((int)l-p-1); } goto endlink; } @@ -2897,7 +2897,7 @@ DocImage::DocImage(DocNode *parent,const HtmlAttribList &attribs,const QCString bool DocImage::isSVG() const { QCString locName = m_url.isEmpty() ? m_name : m_url; - int len = locName.length(); + int len = (int)locName.length(); int fnd = locName.find('?'); // ignore part from ? until end if (fnd==-1) fnd=len; return fnd>=4 && locName.mid(fnd-4,4)==".svg"; @@ -3379,32 +3379,32 @@ int DocHtmlCell::parseXml() return retval; } -int DocHtmlCell::rowSpan() const +uint DocHtmlCell::rowSpan() const { - int retval = 0; + uint retval = 0; HtmlAttribList attrs = attribs(); uint i; for (i=0; i<attrs.count(); ++i) { if (attrs.at(i)->name.lower()=="rowspan") { - retval = attrs.at(i)->value.toInt(); + retval = attrs.at(i)->value.toUInt(); break; } } return retval; } -int DocHtmlCell::colSpan() const +uint DocHtmlCell::colSpan() const { - int retval = 1; + uint retval = 1; HtmlAttribList attrs = attribs(); uint i; for (i=0; i<attrs.count(); ++i) { if (attrs.at(i)->name.lower()=="colspan") { - retval = QMAX(1,attrs.at(i)->value.toInt()); + retval = QMAX(1,attrs.at(i)->value.toUInt()); break; } } @@ -3700,9 +3700,9 @@ int DocHtmlTable::parseXml() /** Helper class to compute the grid for an HTML style table */ struct ActiveRowSpan { - ActiveRowSpan(int rows,int col) : rowsLeft(rows), column(col) {} - int rowsLeft; - int column; + ActiveRowSpan(uint rows,uint col) : rowsLeft(rows), column(col) {} + uint rowsLeft; + uint column; }; /** List of ActiveRowSpan classes. */ @@ -3717,14 +3717,14 @@ void DocHtmlTable::computeTableGrid() //printf("computeTableGrid()\n"); RowSpanList rowSpans; rowSpans.setAutoDelete(TRUE); - int maxCols=0; - int rowIdx=1; + uint maxCols=0; + uint rowIdx=1; QListIterator<DocNode> li(children()); DocNode *rowNode; for (li.toFirst();(rowNode=li.current());++li) { - int colIdx=1; - int cells=0; + uint colIdx=1; + uint cells=0; if (rowNode->kind()==DocNode::Kind_HtmlRow) { uint i; @@ -3736,8 +3736,8 @@ void DocHtmlTable::computeTableGrid() if (cellNode->kind()==DocNode::Kind_HtmlCell) { DocHtmlCell *cell = (DocHtmlCell*)cellNode; - int rs = cell->rowSpan(); - int cs = cell->colSpan(); + uint rs = cell->rowSpan(); + uint cs = cell->colSpan(); for (i=0;i<rowSpans.count();i++) { @@ -3811,7 +3811,7 @@ int DocHtmlDescTitle::parse() { case CMD_REF: { - int tok=doctokenizerYYlex(); + tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) { warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after \\%s command", @@ -3841,7 +3841,7 @@ int DocHtmlDescTitle::parse() // fall through case CMD_LINK: { - int tok=doctokenizerYYlex(); + tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) { warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after \\%s command", diff --git a/src/docparser.h b/src/docparser.h index b414d9b..d05dea9 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -196,20 +196,20 @@ template<class T> class CompAccept : public DocNode } const QList<DocNode> &children() const { return m_children; } QList<DocNode> &children() { return m_children; } - QString::Direction getTextDir(int nodeIndex) const + QString::Direction getTextDir(uint nodeIndex) const { unsigned char resultDir = QString::DirNeutral; for (uint i = nodeIndex; i < m_children.count(); i++) { DocNode* node = m_children.at(i); QString::Direction nodeDir = node->getTextDir(); - resultDir |= nodeDir; + resultDir |= (unsigned char)nodeDir; if (resultDir == QString::DirMixed) return QString::DirMixed; } return static_cast<QString::Direction>(resultDir); } - QString::Direction getTextBasicDir(int nodeIndex) const + QString::Direction getTextBasicDir(uint nodeIndex) const { for (uint i = nodeIndex; i < m_children.count(); i++) { @@ -529,7 +529,7 @@ class DocSeparator : public DocNode m_chars(chars) { m_parent = parent; } Kind kind() const { return Kind_Sep; } QCString chars() const { return m_chars; } - void accept(DocVisitor *v) { } + void accept(DocVisitor *) { } private: QCString m_chars; }; @@ -586,17 +586,17 @@ class DocInclude : public DocNode DocInclude(DocNode *parent,const QCString &file, const QCString context, Type t, bool isExample,const QCString exampleFile, - const QCString blockId, bool isBlock) : + const QCString blockId, bool isBlock) : m_file(file), m_context(context), m_type(t), - m_isExample(isExample), m_exampleFile(exampleFile), - m_blockId(blockId), m_isBlock(isBlock) { m_parent = parent; } + m_isExample(isExample), m_isBlock(isBlock), + m_exampleFile(exampleFile), m_blockId(blockId) { m_parent = parent; } Kind kind() const { return Kind_Include; } QCString file() const { return m_file; } - QCString extension() const { int i=m_file.findRev('.'); - if (i!=-1) - return m_file.right(m_file.length()-i); - else - return ""; + QCString extension() const { int i=m_file.findRev('.'); + if (i!=-1) + return m_file.right(m_file.length()-(uint)i); + else + return ""; } Type type() const { return m_type; } QCString text() const { return m_text; } @@ -612,9 +612,9 @@ class DocInclude : public DocNode QCString m_file; QCString m_context; QCString m_text; - Type m_type = Include; - bool m_isExample = false; - bool m_isBlock = false; + Type m_type; + bool m_isExample; + bool m_isBlock; QCString m_exampleFile; QCString m_blockId; }; @@ -1336,9 +1336,7 @@ class DocHtmlCell : public CompAccept<DocHtmlCell> public: enum Alignment { Left, Right, Center }; DocHtmlCell(DocNode *parent,const HtmlAttribList &attribs,bool isHeading) : - m_isHeading(isHeading), - m_isFirst(FALSE), m_isLast(FALSE), m_attribs(attribs), - m_rowIdx(-1), m_colIdx(-1) { m_parent = parent; } + m_isHeading(isHeading), m_attribs(attribs) { m_parent = parent; } bool isHeading() const { return m_isHeading; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } @@ -1348,21 +1346,21 @@ class DocHtmlCell : public CompAccept<DocHtmlCell> const HtmlAttribList &attribs() const { return m_attribs; } int parse(); int parseXml(); - int rowIndex() const { return m_rowIdx; } - int columnIndex() const { return m_colIdx; } - int rowSpan() const; - int colSpan() const; + uint rowIndex() const { return m_rowIdx; } + uint columnIndex() const { return m_colIdx; } + uint rowSpan() const; + uint colSpan() const; Alignment alignment() const; private: - void setRowIndex(int idx) { m_rowIdx = idx; } - void setColumnIndex(int idx) { m_colIdx = idx; } + void setRowIndex(uint idx) { m_rowIdx = idx; } + void setColumnIndex(uint idx) { m_colIdx = idx; } bool m_isHeading = false; bool m_isFirst = false; bool m_isLast = false; HtmlAttribList m_attribs; - int m_rowIdx = -1; - int m_colIdx = -1; + uint m_rowIdx = (uint)-1; + uint m_colIdx = (uint)-1; }; /** Node representing a HTML table caption */ @@ -1390,7 +1388,7 @@ class DocHtmlRow : public CompAccept<DocHtmlRow> friend class DocHtmlTable; public: DocHtmlRow(DocNode *parent,const HtmlAttribList &attribs) : - m_attribs(attribs), m_visibleCells(-1), m_rowIdx(-1) { m_parent = parent; } + m_attribs(attribs) { m_parent = parent; } Kind kind() const { return Kind_HtmlRow; } uint numCells() const { return m_children.count(); } const HtmlAttribList &attribs() const { return m_attribs; } @@ -1409,15 +1407,15 @@ class DocHtmlRow : public CompAccept<DocHtmlRow> } return m_children.count()>0 && heading; } - void setVisibleCells(int n) { m_visibleCells = n; } - int visibleCells() const { return m_visibleCells; } - int rowIndex() const { return m_rowIdx; } + void setVisibleCells(uint n) { m_visibleCells = n; } + uint visibleCells() const { return m_visibleCells; } + uint rowIndex() const { return m_rowIdx; } private: - void setRowIndex(int idx) { m_rowIdx = idx; } + void setRowIndex(uint idx) { m_rowIdx = idx; } HtmlAttribList m_attribs; - int m_visibleCells = -1; - int m_rowIdx = -1; + uint m_visibleCells = 0; + uint m_rowIdx = (uint)-1; }; /** Node representing a HTML table */ @@ -1446,7 +1444,7 @@ class DocHtmlTable : public CompAccept<DocHtmlTable> void computeTableGrid(); DocHtmlCaption *m_caption = 0; HtmlAttribList m_attribs; - int m_numCols = 0; + uint m_numCols = 0; }; /** Node representing an HTML blockquote */ diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 5b10e5c..cfabd31 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -46,6 +46,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + #define TK_COMMAND_SEL() (yytext[0] == '@' ? TK_COMMAND_AT : TK_COMMAND_BS) //-------------------------------------------------------------------------- @@ -79,7 +81,9 @@ struct DocLexerContext static QStack<DocLexerContext> g_lexerStack; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif //-------------------------------------------------------------------------- void doctokenizerYYpushContext() @@ -323,9 +327,9 @@ static QCString stripEmptyLines(const QCString &s) #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - int c=0; + yy_size_t c=0; const char *src=g_inputString+g_inputPos; while ( c < max_size && *src ) *buf++ = *src++, c++; g_inputPos+=c; @@ -1631,4 +1635,6 @@ void doctokenizerYYendAutoList() // return retval; //} +#if USE_STATE2STRING #include "doctokenizer.l.h" +#endif diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index da272b4..eb6c179 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -13,6 +13,8 @@ * */ +#include <vector> + #include "dotclassgraph.h" #include "dotnode.h" @@ -149,8 +151,8 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode, { QList<DotNode> childQueue; QList<DotNode> parentQueue; - QArray<int> childTreeWidth; - QArray<int> parentTreeWidth; + std::vector<int> childTreeWidth; + std::vector<int> parentTreeWidth; childQueue.append(rootNode); if (includeParents) parentQueue.append(rootNode); bool firstNode=TRUE; // flag to force reprocessing rootNode in the parent loop diff --git a/src/dotdirdeps.cpp b/src/dotdirdeps.cpp index c70128c..59ad75f 100644 --- a/src/dotdirdeps.cpp +++ b/src/dotdirdeps.cpp @@ -135,8 +135,6 @@ void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations) QDictIterator<DirDef> di(dirsInGraph); for (di.toFirst();(dir=di.current());++di) // foreach dir in the graph { - QDictIterator<UsedDir> udi(*dir->usedDirs()); - UsedDir *udir; for (udi.toFirst();(udir=udi.current());++udi) // foreach used dir { const DirDef *usedDir=udir->dir(); diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp index 7a65d89..e386af9 100644 --- a/src/dotfilepatcher.cpp +++ b/src/dotfilepatcher.cpp @@ -506,8 +506,8 @@ bool DotFilePatcher::run() const fo.close(); // keep original SVG file so we can refer to it, we do need to replace // dummy link by real ones - QFile fi(tmpName); - QFile fo(orgName); + fi.setName(tmpName); + fo.setName(orgName); if (!fi.open(IO_ReadOnly)) { err("problem opening file %s for reading!\n",tmpName.data()); @@ -518,7 +518,7 @@ bool DotFilePatcher::run() const err("problem opening file %s for writing!\n",orgName.data()); return FALSE; } - FTextStream t(&fo); + FTextStream to(&fo); while (!fi.atEnd()) // foreach line { QCString line(maxLineLen); @@ -529,7 +529,7 @@ bool DotFilePatcher::run() const } line.resize(numBytes+1); Map *map = m_maps.at(0); // there is only one 'map' for a SVG file - t << replaceRef(line,map->relPath,map->urlOnly,map->context,"_top"); + to << replaceRef(line,map->relPath,map->urlOnly,map->context,"_top"); } fi.close(); fo.close(); diff --git a/src/dotgraph.h b/src/dotgraph.h index edba009..b90d980 100644 --- a/src/dotgraph.h +++ b/src/dotgraph.h @@ -31,7 +31,8 @@ enum GraphType { Dependency, Inheritance, Collaboration, Hierarchy, C class DotGraph { public: - DotGraph() : m_curNodeNumber(0), m_doNotAddImageToIndex(FALSE), m_noDivTag(FALSE), m_zoomable(TRUE), m_urlOnly(FALSE) {} + DotGraph() : m_doNotAddImageToIndex(FALSE), m_noDivTag(FALSE), + m_zoomable(TRUE), m_urlOnly(FALSE) {} virtual ~DotGraph() {} protected: @@ -98,7 +99,7 @@ class DotGraph bool prepareDotFile(); void generateCode(FTextStream &t); - int m_curNodeNumber; + int m_curNodeNumber = 0; }; #endif diff --git a/src/dotnode.cpp b/src/dotnode.cpp index 9eccdde..86ae43a 100644 --- a/src/dotnode.cpp +++ b/src/dotnode.cpp @@ -258,23 +258,12 @@ static QCString stripProtectionPrefix(const QCString &s) DotNode::DotNode(int n,const char *lab,const char *tip, const char *url, bool isRoot,const ClassDef *cd) - : m_subgraphId(-1) - , m_number(n) + : m_number(n) , m_label(lab) , m_tooltip(tip) , m_url(url) - , m_parents(0) - , m_children(0) - , m_edgeInfo(0) - , m_deleted(FALSE) - , m_written(FALSE) - , m_hasDoc(FALSE) , m_isRoot(isRoot) , m_classDef(cd) - , m_visible(FALSE) - , m_truncated(Unknown) - , m_distance(1000) - , m_renumbered(false) { } @@ -408,14 +397,14 @@ void DotNode::writeBox(FTextStream &t, { if (!ei->label().isEmpty()) // labels joined by \n { - int li=ei->label().find('\n'); + int i=ei->label().find('\n'); int p=0; QCString lab; - while ((li=ei->label().find('\n',p))!=-1) + while ((i=ei->label().find('\n',p))!=-1) { - lab = stripProtectionPrefix(ei->label().mid(p,li-p)); + lab = stripProtectionPrefix(ei->label().mid(p,i-p)); arrowNames.insert(lab,(void*)0x8); - p=li+1; + p=i+1; } lab = stripProtectionPrefix(ei->label().right(ei->label().length()-p)); arrowNames.insert(lab,(void*)0x8); diff --git a/src/dotnode.h b/src/dotnode.h index 334fdef..92f268e 100644 --- a/src/dotnode.h +++ b/src/dotnode.h @@ -107,22 +107,22 @@ class DotNode private: int m_number; - QCString m_label; //!< label text - QCString m_tooltip; //!< node's tooltip - QCString m_url; //!< url of the node (format: remote$local) - QList<DotNode> *m_parents; //!< list of parent nodes (incoming arrows) - QList<DotNode> *m_children; //!< list of child nodes (outgoing arrows) - QList<EdgeInfo> *m_edgeInfo; //!< edge info for each child - bool m_deleted; //!< used to mark a node as deleted - mutable bool m_written; //!< used to mark a node as written - bool m_hasDoc; //!< used to mark a node as documented - bool m_isRoot; //!< indicates if this is a root node - const ClassDef * m_classDef; //!< class representing this node (can be 0) - bool m_visible; //!< is the node visible in the output - TruncState m_truncated; //!< does the node have non-visible children/parents - int m_distance; //!< shortest path to the root node - bool m_renumbered;//!< indicates if the node has been renumbered (to prevent endless loops) - int m_subgraphId; + QCString m_label; //!< label text + QCString m_tooltip; //!< node's tooltip + QCString m_url; //!< url of the node (format: remote$local) + QList<DotNode> *m_parents = 0; //!< list of parent nodes (incoming arrows) + QList<DotNode> *m_children = 0; //!< list of child nodes (outgoing arrows) + QList<EdgeInfo> *m_edgeInfo = 0; //!< edge info for each child + bool m_deleted = false; //!< used to mark a node as deleted + mutable bool m_written = false; //!< used to mark a node as written + bool m_hasDoc = false; //!< used to mark a node as documented + bool m_isRoot; //!< indicates if this is a root node + const ClassDef * m_classDef; //!< class representing this node (can be 0) + bool m_visible = false; //!< is the node visible in the output + TruncState m_truncated = Unknown; //!< does the node have non-visible children/parents + int m_distance = 1000; //!< shortest path to the root node + bool m_renumbered = false; //!< indicates if the node has been renumbered (to prevent endless loops) + int m_subgraphId = -1; }; /** Class representing a list of DotNode objects. */ diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index 22a113a..fc9f85c 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -146,8 +146,10 @@ bool DotRunner::readBoundingBox(const char *fileName,int *width,int *height,bool //--------------------------------------------------------------------------------- DotRunner::DotRunner(const QCString& absDotName, const QCString& md5Hash) - : m_file(absDotName), m_md5Hash(md5Hash), m_cleanUp(Config_getBool(DOT_CLEANUP)), - m_dotExe(Config_getString(DOT_PATH)+"dot") + : m_file(absDotName) + , m_md5Hash(md5Hash) + , m_dotExe(Config_getString(DOT_PATH)+"dot") + , m_cleanUp(Config_getBool(DOT_CLEANUP)) { m_jobs.setAutoDelete(TRUE); } diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 6a0f228..af056f1 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1511,7 +1511,7 @@ static void buildNamespaceList(const Entry *root) tagFileName = tagInfo->fileName; } //printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data()); - NamespaceDef *nd=createNamespaceDef(tagInfo?tagName:root->fileName,root->startLine, + nd=createNamespaceDef(tagInfo?tagName:root->fileName,root->startLine, root->startColumn,fullName,tagName,tagFileName, root->type,root->spec&Entry::Published); nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition @@ -1547,7 +1547,7 @@ static void buildNamespaceList(const Entry *root) if (d==0) // we didn't find anything, create the scope artificially // anyway, so we can at least relate scopes properly. { - Definition *d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage(),tagInfo); + d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage(),tagInfo); d->addInnerCompound(nd); nd->setOuterScope(d); // TODO: Due to the order in which the tag file is written @@ -1703,7 +1703,7 @@ static void findUsingDirectives(const Entry *root) else // unknown namespace, but add it anyway. { //printf("++ new unknown namespace %s lang=%s\n",name.data(),langToString(root->lang).data()); - NamespaceDef *nd=createNamespaceDef(root->fileName,root->startLine,root->startColumn,name); + nd=createNamespaceDef(root->fileName,root->startLine,root->startColumn,name); nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); nd->addSectionsToDefinition(root->anchors); @@ -3547,7 +3547,6 @@ static void buildFunctionList(const Entry *root) // add member to the list of file members //printf("Adding member=%s\n",md->name().data()); - MemberName *mn; if ((mn=Doxygen::functionNameSDict->find(name))) { mn->append(md); @@ -4010,7 +4009,6 @@ static void findUsedClassesForClass(const Entry *root, BaseInfo bi(usedName,Public,Normal); findClassRelation(root,context,instanceCd,&bi,templateNames,TemplateInstances,isArtificial); - int count=0; for (const Argument &arg : masterCd->templateArguments()) { if (arg.name==usedName) // type is a template argument @@ -4598,7 +4596,7 @@ static bool findClassRelation( Doxygen::classSDict->append(baseClassName,baseClass); if (isArtificial) baseClass->setArtificial(TRUE); baseClass->setLanguage(root->lang); - int si = baseClassName.findRev("::"); + si = baseClassName.findRev("::"); if (si!=-1) // class is nested { Definition *sd = findScopeFromQualifiedName(Doxygen::globalScope,baseClassName.left(si),0,root->tagInfo()); @@ -5683,7 +5681,7 @@ static void findMember(const Entry *root, { if (funcSpec.isEmpty()) { - int argListIndex=0; + uint argListIndex=0; tempScopeName=cd->qualifiedNameWithTemplateParameters(&root->tArgLists,&argListIndex); } else @@ -5804,7 +5802,7 @@ static void findMember(const Entry *root, bool memFound=FALSE; for (mni.toFirst();!memFound && (md=mni.current());++mni) { - ClassDef *cd=md->getClassDef(); + cd=md->getClassDef(); Debug::print(Debug::FindMembers,0, "3. member definition found, " "scope needed='%s' scope='%s' args='%s' fileName=%s\n", @@ -6056,7 +6054,7 @@ static void findMember(const Entry *root, warnMsg+="Possible candidates:\n"; for (mni.toFirst();(md=mni.current());++mni) { - const ClassDef *cd=md->getClassDef(); + cd=md->getClassDef(); if (cd!=0 && rightScopeMatch(cd->name(),className)) { const ArgumentList &templAl = md->templateArguments(); @@ -6157,15 +6155,15 @@ static void findMember(const Entry *root, MemberNameIterator mni(*mn); MemberDef *md=mni.toFirst(); ASSERT(md); - ClassDef *cd=md->getClassDef(); + cd=md->getClassDef(); ASSERT(cd); - QCString className=cd->name().copy(); + className=cd->name(); ++mni; bool unique=TRUE; for (;(md=mni.current());++mni) { - const ClassDef *cd=md->getClassDef(); - if (className!=cd->name()) unique=FALSE; + const ClassDef *lcd=md->getClassDef(); + if (className!=lcd->name()) unique=FALSE; } if (unique) { @@ -6179,7 +6177,7 @@ static void findMember(const Entry *root, ArgumentList tArgList = getTemplateArgumentsFromName(cd->name()+"::"+funcName,root->tArgLists); //printf("new related member %s args='%s'\n",md->name().data(),funcArgs.data()); - MemberDef *md=createMemberDef( + md=createMemberDef( root->fileName,root->startLine,root->startColumn, funcType,funcName,funcArgs,exceptions, root->protection,root->virt,root->stat,Related, @@ -6232,7 +6230,6 @@ static void findMember(const Entry *root, Debug::print(Debug::FindMembers,0,"2. related function\n" " scopeName=%s className=%s\n",qPrint(scopeName),qPrint(className)); if (className.isEmpty()) className=relates; - ClassDef *cd; //printf("scopeName='%s' className='%s'\n",scopeName.data(),className.data()); if ((cd=getClass(scopeName))) { @@ -6241,7 +6238,7 @@ static void findMember(const Entry *root, MemberDef *mdDefine=0; bool isDefine=FALSE; { - MemberName *mn = Doxygen::functionNameSDict->find(funcName); + mn = Doxygen::functionNameSDict->find(funcName); if (mn) { MemberNameIterator mni(*mn); @@ -6453,7 +6450,6 @@ static void findMember(const Entry *root, else if (root->parent() && root->parent()->section==Entry::OBJCIMPL_SEC) { localObjCMethod: - ClassDef *cd; //printf("scopeName='%s' className='%s'\n",scopeName.data(),className.data()); if (Config_getBool(EXTRACT_LOCAL_METHODS) && (cd=getClass(scopeName))) { @@ -7054,7 +7050,7 @@ static void addEnumValuesToEnums(const Entry *root) fmd->setAnchor(); md->insertEnumField(fmd); fmd->setEnumScope(md,TRUE); - MemberName *mn=mnsd->find(e->name); + mn=mnsd->find(e->name); if (mn) { mn->append(fmd); @@ -7187,7 +7183,7 @@ static void findEnumDocumentation(const Entry *root) MemberDef *md; for (mni.toFirst();(md=mni.current()) && !found;++mni) { - const ClassDef *cd=md->getClassDef(); + cd=md->getClassDef(); if (cd && cd->name()==className && md->isEnumerate()) { // documentation outside a compound overrides the documentation inside it @@ -9016,9 +9012,9 @@ static void copyLatexStyleSheet() else { QCString destFileName = Config_getString(LATEX_OUTPUT)+"/"+fi.fileName().data(); - if (!checkExtension(fi.fileName().data(), latexStyleExtension)) + if (!checkExtension(fi.fileName().data(), LATEX_STYLE_EXTENSION)) { - destFileName += latexStyleExtension; + destFileName += LATEX_STYLE_EXTENSION; } copyFile(fileName, destFileName); } diff --git a/src/example.h b/src/example.h index 321982b..2af06ba 100644 --- a/src/example.h +++ b/src/example.h @@ -36,7 +36,7 @@ struct Example class ExampleSDict : public SDict<Example> { public: - ExampleSDict(int size=17) : SDict<Example>(size) { setAutoDelete(TRUE); } + ExampleSDict(uint size=17) : SDict<Example>(size) { setAutoDelete(TRUE); } ~ExampleSDict() {} private: int compareValues(const Example *item1,const Example *item2) const diff --git a/src/filedef.h b/src/filedef.h index b66d7be..2ca33db 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -217,7 +217,7 @@ class OutputNameList : public QList<FileList> class OutputNameDict : public QDict<FileList> { public: - OutputNameDict(int size) : QDict<FileList>(size) {} + OutputNameDict(uint size) : QDict<FileList>(size) {} ~OutputNameDict() {} }; diff --git a/src/formula.cpp b/src/formula.cpp index 3130122..ac25cfb 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -73,7 +73,7 @@ void FormulaManager::readFormulas(const char *dir,bool doCompare) QFile f(QCString(dir)+"/formula.repository"); if (f.open(IO_ReadOnly)) // open repository { - int formulaCount=0; + uint formulaCount=0; msg("Reading formula repository...\n"); QTextStream t(&f); QCString line; @@ -274,8 +274,8 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c if (zoomFactor<8 || zoomFactor>50) zoomFactor=10; scaleFactor *= zoomFactor/10.0; - int width = (int)((x2-x1)*scaleFactor+0.5f); - int height = (int)((y2-y1)*scaleFactor+0.5f); + int width = (int)((x2-x1)*scaleFactor+0.5); + int height = (int)((y2-y1)*scaleFactor+0.5); p->storeDisplaySize(pageNum,width,height); if (format==Format::Vector) diff --git a/src/fortrancode.l b/src/fortrancode.l index bf6c22e..81bf9f6 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -26,6 +26,7 @@ %option never-interactive %option case-insensitive %option prefix="fortrancodeYY" +%option noyy_top_state %top{ #include <stdint.h> } @@ -68,6 +69,8 @@ const int fixedCommentAfter = 72; #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + /* * For fixed formatted code position 6 is of importance (continuation character). * The following variables and macros keep track of the column number @@ -130,7 +133,7 @@ static UseEntry *useEntry = 0; //!< current use statement info static QList<Scope> scopeStack; static bool g_isExternal = false; // static QCStringList *currentUseNames= new QCStringList; //! contains names of used modules of current program unit -static QCString str=""; //!> contents of fortran string +static QCString g_str=""; //!> contents of fortran string static CodeOutputInterface * g_code; @@ -171,7 +174,9 @@ static int inTypeDecl = 0; static bool g_endComment; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static void endFontClass() { @@ -456,58 +461,58 @@ static bool getFortranDefs(const QCString &memberName, const QCString &moduleNam if (mn) // name is known { - MemberNameIterator mli(*mn); - for (mli.toFirst();(md=mli.current());++mli) // all found functions with given name - { - const FileDef *fd=md->getFileDef(); - const GroupDef *gd=md->getGroupDef(); - const ClassDef *cd=md->getClassDef(); - - //cout << "found link with same name: " << fd->fileName() << " " << memberName; - //if (md->getNamespaceDef() != 0) cout << " in namespace " << md->getNamespaceDef()->name();cout << endl; + MemberNameIterator mli(*mn); + for (mli.toFirst();(md=mli.current());++mli) // all found functions with given name + { + const FileDef *fd=md->getFileDef(); + const GroupDef *gd=md->getGroupDef(); + const ClassDef *cd=md->getClassDef(); - if ((gd && gd->isLinkable()) || (fd && fd->isLinkable())) - { - const NamespaceDef *nspace= md->getNamespaceDef(); + //cout << "found link with same name: " << fd->fileName() << " " << memberName; + //if (md->getNamespaceDef() != 0) cout << " in namespace " << md->getNamespaceDef()->name();cout << endl; - if (nspace == 0) - { // found function in global scope - if(cd == 0) { // Skip if bound to type - return TRUE; + if ((gd && gd->isLinkable()) || (fd && fd->isLinkable())) + { + const NamespaceDef *nspace= md->getNamespaceDef(); + + if (nspace == 0) + { // found function in global scope + if(cd == 0) { // Skip if bound to type + return TRUE; + } + } + else if (moduleName == nspace->name()) + { // found in local scope + return TRUE; + } + else + { // else search in used modules + QCString usedModuleName= nspace->name(); + UseEntry *ue= usedict->find(usedModuleName); + if (ue) + { + // check if only-list exists and if current entry exists is this list + QCStringList &only= ue->onlyNames; + if (only.isEmpty()) + { + //cout << " found in module " << usedModuleName << " entry " << memberName << endl; + return TRUE; // whole module used + } + else + { + for ( QCStringList::Iterator lit = only.begin(); lit != only.end(); ++lit) + { + //cout << " search in only: " << usedModuleName << ":: " << memberName << "==" << (*it)<< endl; + if (memberName == *lit) + { + return TRUE; // found in ONLY-part of use list + } } - } - else if (moduleName == nspace->name()) - { // found in local scope - return TRUE; - } - else - { // else search in used modules - QCString moduleName= nspace->name(); - UseEntry *ue= usedict->find(moduleName); - if (ue) - { - // check if only-list exists and if current entry exists is this list - QCStringList &only= ue->onlyNames; - if (only.isEmpty()) - { - //cout << " found in module " << moduleName << " entry " << memberName << endl; - return TRUE; // whole module used - } - else - { - for ( QCStringList::Iterator it = only.begin(); it != only.end(); ++it) - { - //cout << " search in only: " << moduleName << ":: " << memberName << "==" << (*it)<< endl; - if (memberName == *it) - { - return TRUE; // found in ONLY-part of use list - } - } - } - } - } - } // if linkable - } // for + } + } + } + } // if linkable + } // for } return FALSE; } @@ -669,15 +674,15 @@ static void addLocalVar(const QCString &varName) #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - int c=0; - while( c < max_size && g_inputString[g_inputPosition] ) - { - *buf = g_inputString[g_inputPosition++] ; - c++; buf++; - } - return c; + yy_size_t c=0; + while( c < max_size && g_inputString[g_inputPosition] ) + { + *buf = g_inputString[g_inputPosition++] ; + c++; buf++; + } + return c; } %} @@ -1220,22 +1225,22 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") /*------ strings --------------------------------------------------*/ <String>\n { // string with \n inside g_contLineNr++; - str+=yytext; + g_str+=yytext; startFontClass("stringliteral"); - codifyLines(str); + codifyLines(g_str); endFontClass(); - str = ""; + g_str = ""; YY_FTN_RESET } <String>\"|\' { // string ends with next quote without previous backspace if(yytext[0]!=stringStartSymbol) YY_FTN_REJECT; // single vs double quote - str+=yytext; + g_str+=yytext; startFontClass("stringliteral"); - codifyLines(str); + codifyLines(g_str); endFontClass(); yy_pop_state(); } -<String>. {str+=yytext;} +<String>. {g_str+=yytext;} <*>\"|\' { /* string starts */ /* if(YY_START == StrIgnore) YY_FTN_REJECT; // ignore in simple comments */ @@ -1243,7 +1248,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") yy_push_state(YY_START); stringStartSymbol=yytext[0]; // single or double quote BEGIN(String); - str=yytext; + g_str=yytext; } /*-----------------------------------------------------------------------------*/ @@ -1306,7 +1311,6 @@ const char* prepassFixedForm(const char* contents, int *hasContLine); /* prototy static void checkContLines(const char *s) { int numLines = 0; - int curLine = 0; int i = 0; const char *p = s; @@ -1430,4 +1434,6 @@ void FortranCodeParser::resetCodeParserState() //--------------------------------------------------------- +#if USE_STATE2STRING #include "fortrancode.l.h" +#endif diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 0265fc3..95842f0 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -144,7 +144,7 @@ struct CommentInPrepass { int column; QCString str; - CommentInPrepass(int column, QCString str) : column(column), str(str) {} + CommentInPrepass(int col, QCString s) : column(col), str(s) {} }; /* ----------------------------------------------------------------- @@ -213,7 +213,7 @@ static QCString extractFromParens(const QCString name); static QCString extractBind(const QCString name); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void startCommentBlock(yyscan_t yyscanner,bool); static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief); static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief); @@ -2316,10 +2316,10 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot) return TRUE; } -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while ( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 149f43c..c556b43 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -689,7 +689,7 @@ static void generateJSNavTree(const QList<FTVNode> &nodeList) tsidx << "{" << endl; QListIterator<NavIndexEntry> li(navIndex); NavIndexEntry *e; - bool first=TRUE; + first=TRUE; for (li.toFirst();(e=li.current());) // for each entry { if (elemCount==0) @@ -781,8 +781,7 @@ void FTVHelp::generateTreeViewInline(FTextStream &t) t << "<div class=\"levels\">["; t << theTranslator->trDetailLevel(); t << " "; - int i; - for (i=1;i<=depth;i++) + for (int i=1;i<=depth;i++) { t << "<span onclick=\"javascript:toggleLevel(" << i << ");\">" << i << "</span>"; } @@ -794,9 +793,7 @@ void FTVHelp::generateTreeViewInline(FTextStream &t) for (int i=1;i<=depth;i++) { int num=0; - QListIterator<FTVNode> li(m_indentNodes[0]); - FTVNode *n; - for (;(n=li.current());++li) + for (li.toFirst();(n=li.current());++li) { num+=n->numNodesAtLevel(0,i); } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 960252d..5af1525 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -54,10 +54,10 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef virtual DefType definitionType() const { return TypeGroup; } virtual QCString getOutputFileBase() const; virtual QCString anchor() const { return QCString(); } - virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? title : DefinitionImpl::name(); } - virtual const char *groupTitle() const { return title; } + virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? m_title : DefinitionImpl::name(); } + virtual const char *groupTitle() const { return m_title; } virtual void setGroupTitle( const char *newtitle ); - virtual bool hasGroupTitle( ) const { return titleSet; } + virtual bool hasGroupTitle( ) const { return m_titleSet; } virtual void addFile(const FileDef *def); virtual bool addClass(const ClassDef *def); virtual bool addNamespace(const NamespaceDef *def); @@ -87,22 +87,22 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef virtual void sortMemberLists(); virtual bool subGrouping() const { return m_subGrouping; } - virtual void setGroupScope(Definition *d) { groupScope = d; } - virtual Definition *getGroupScope() const { return groupScope; } + virtual void setGroupScope(Definition *d) { m_groupScope = d; } + virtual Definition *getGroupScope() const { return m_groupScope; } virtual MemberList *getMemberList(MemberListType lt) const; virtual const QList<MemberList> &getMemberLists() const { return m_memberLists; } /* user defined member groups */ - virtual MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } - - virtual FileList * getFiles() const { return fileList; } - virtual ClassSDict * getClasses() const { return classSDict; } - virtual NamespaceSDict * getNamespaces() const { return namespaceSDict; } - virtual GroupList * getSubGroups() const { return groupList; } - virtual PageSDict * getPages() const { return pageDict; } - virtual DirList * getDirs() const { return dirList; } - virtual PageSDict * getExamples() const { return exampleDict; } + virtual MemberGroupSDict *getMemberGroupSDict() const { return m_memberGroupSDict; } + + virtual FileList * getFiles() const { return m_fileList; } + virtual ClassSDict * getClasses() const { return m_classSDict; } + virtual NamespaceSDict * getNamespaces() const { return m_namespaceSDict; } + virtual GroupList * getSubGroups() const { return m_groupList; } + virtual PageSDict * getPages() const { return m_pageDict; } + virtual DirList * getDirs() const { return m_dirList; } + virtual PageSDict * getExamples() const { return m_exampleDict; } virtual bool hasDetailedDescription() const; virtual void sortSubGroups(); @@ -132,25 +132,22 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef void writeSummaryLinks(OutputList &ol) const; void updateLanguage(const Definition *); - QCString title; // title of the group - bool titleSet; // true if title is not the same as the name - QCString fileName; // base name of the generated file - FileList *fileList; // list of files in the group - ClassSDict *classSDict; // list of classes in the group - NamespaceSDict *namespaceSDict; // list of namespaces in the group - GroupList *groupList; // list of sub groups. - PageSDict *pageDict; // list of pages in the group - PageSDict *exampleDict; // list of examples in the group - DirList *dirList; // list of directories in the group - - MemberList *allMemberList; - MemberNameInfoSDict *allMemberNameInfoSDict; - - Definition *groupScope; - - QList<MemberList> m_memberLists; - MemberGroupSDict *memberGroupSDict; - bool m_subGrouping; + QCString m_title; // title of the group + bool m_titleSet; // true if title is not the same as the name + QCString m_fileName; // base name of the generated file + FileList * m_fileList; // list of files in the group + ClassSDict * m_classSDict; // list of classes in the group + NamespaceSDict * m_namespaceSDict; // list of namespaces in the group + GroupList * m_groupList; // list of sub groups. + PageSDict * m_pageDict; // list of pages in the group + PageSDict * m_exampleDict; // list of examples in the group + DirList * m_dirList; // list of directories in the group + MemberList * m_allMemberList; + MemberNameInfoSDict *m_allMemberNameInfoSDict; + Definition * m_groupScope; + QList<MemberList> m_memberLists; + MemberGroupSDict * m_memberGroupSDict; + bool m_subGrouping; }; @@ -166,67 +163,67 @@ GroupDef *createGroupDef(const char *fileName,int line,const char *name, GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t, const char *refFileName) : DefinitionImpl(df,dl,1,na) { - fileList = new FileList; - classSDict = new ClassSDict(17); - groupList = new GroupList; - namespaceSDict = new NamespaceSDict(17); - pageDict = new PageSDict(17); - exampleDict = new PageSDict(17); - dirList = new DirList; - allMemberNameInfoSDict = new MemberNameInfoSDict(17); - allMemberNameInfoSDict->setAutoDelete(TRUE); + m_fileList = new FileList; + m_classSDict = new ClassSDict(17); + m_groupList = new GroupList; + m_namespaceSDict = new NamespaceSDict(17); + m_pageDict = new PageSDict(17); + m_exampleDict = new PageSDict(17); + m_dirList = new DirList; + m_allMemberNameInfoSDict = new MemberNameInfoSDict(17); + m_allMemberNameInfoSDict->setAutoDelete(TRUE); if (refFileName) { - fileName=stripExtension(refFileName); + m_fileName=stripExtension(refFileName); } else { - fileName = convertNameToFile(QCString("group_")+na); + m_fileName = convertNameToFile(QCString("group_")+na); } setGroupTitle( t ); - memberGroupSDict = new MemberGroupSDict; - memberGroupSDict->setAutoDelete(TRUE); + m_memberGroupSDict = new MemberGroupSDict; + m_memberGroupSDict->setAutoDelete(TRUE); - allMemberList = new MemberList(MemberListType_allMembersList); + m_allMemberList = new MemberList(MemberListType_allMembersList); //visited = 0; - groupScope = 0; + m_groupScope = 0; m_subGrouping=Config_getBool(SUBGROUPING); } GroupDefImpl::~GroupDefImpl() { - delete fileList; - delete classSDict; - delete groupList; - delete namespaceSDict; - delete pageDict; - delete exampleDict; - delete allMemberList; - delete allMemberNameInfoSDict; - delete memberGroupSDict; - delete dirList; + delete m_fileList; + delete m_classSDict; + delete m_groupList; + delete m_namespaceSDict; + delete m_pageDict; + delete m_exampleDict; + delete m_allMemberList; + delete m_allMemberNameInfoSDict; + delete m_memberGroupSDict; + delete m_dirList; } void GroupDefImpl::setGroupTitle( const char *t ) { - if ( t && qstrlen(t) ) + if ( t && *t ) { - title = t; - titleSet = TRUE; + m_title = t; + m_titleSet = TRUE; } else { - title = name(); - title.at(0)=toupper(title.at(0)); - titleSet = FALSE; + m_title = name(); + m_title[0]=(char)toupper(m_title[0]); + m_titleSet = FALSE; } } void GroupDefImpl::distributeMemberGroupDocumentation() { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -237,7 +234,7 @@ void GroupDefImpl::distributeMemberGroupDocumentation() void GroupDefImpl::findSectionsInDocumentation() { docFindSections(documentation(),this,docFile()); - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -261,9 +258,9 @@ void GroupDefImpl::addFile(const FileDef *def) if (def->isHidden()) return; updateLanguage(def); if (sortBriefDocs) - fileList->inSort(def); + m_fileList->inSort(def); else - fileList->append(def); + m_fileList->append(def); } bool GroupDefImpl::addClass(const ClassDef *cd) @@ -272,12 +269,12 @@ bool GroupDefImpl::addClass(const ClassDef *cd) if (cd->isHidden()) return FALSE; updateLanguage(cd); QCString qn = cd->name(); - if (classSDict->find(qn)==0) + if (m_classSDict->find(qn)==0) { //printf("--- addClass %s sort=%d\n",qn.data(),sortBriefDocs); if (sortBriefDocs) { - classSDict->inSort(qn,cd); + m_classSDict->inSort(qn,cd); } else { @@ -290,23 +287,23 @@ bool GroupDefImpl::addClass(const ClassDef *cd) // add nested classes (e.g. A::B, A::C) after their parent (A) in // order of insertion QCString scope = qn.left(i); - int j=classSDict->findAt(scope); + int j=m_classSDict->findAt(scope); if (j!=-1) { - while (j<(int)classSDict->count() && - classSDict->at(j)->qualifiedName().left(i)==scope) + while (j<(int)m_classSDict->count() && + m_classSDict->at(j)->qualifiedName().left(i)==scope) { //printf("skipping over %s\n",classSDict->at(j)->qualifiedName().data()); j++; } //printf("Found scope at index %d\n",j); - classSDict->insertAt(j,qn,cd); + m_classSDict->insertAt(j,qn,cd); found=TRUE; } } if (!found) // no insertion point found -> just append { - classSDict->append(qn,cd); + m_classSDict->append(qn,cd); } } return TRUE; @@ -319,12 +316,12 @@ bool GroupDefImpl::addNamespace(const NamespaceDef *def) static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); if (def->isHidden()) return FALSE; updateLanguage(def); - if (namespaceSDict->find(def->name())==0) + if (m_namespaceSDict->find(def->name())==0) { if (sortBriefDocs) - namespaceSDict->inSort(def->name(),def); + m_namespaceSDict->inSort(def->name(),def); else - namespaceSDict->append(def->name(),def); + m_namespaceSDict->append(def->name(),def); return TRUE; } return FALSE; @@ -334,23 +331,23 @@ void GroupDefImpl::addDir(const DirDef *def) { if (def->isHidden()) return; if (Config_getBool(SORT_BRIEF_DOCS)) - dirList->inSort(def); + m_dirList->inSort(def); else - dirList->append(def); + m_dirList->append(def); } void GroupDefImpl::addPage(PageDef *def) { if (def->isHidden()) return; //printf("Making page %s part of a group\n",def->name.data()); - pageDict->append(def->name(),def); + m_pageDict->append(def->name(),def); def->makePartOfGroup(this); } void GroupDefImpl::addExample(const PageDef *def) { if (def->isHidden()) return; - exampleDict->append(def->name(),def); + m_exampleDict->append(def->name(),def); } @@ -362,12 +359,12 @@ void GroupDefImpl::addMembersToMemberGroup() { if (ml->listType()&MemberListType_declarationLists) { - ::addMembersToMemberGroup(ml,&memberGroupSDict,this); + ::addMembersToMemberGroup(ml,&m_memberGroupSDict,this); } } //printf("GroupDefImpl::addMembersToMemberGroup() memberGroupList=%d\n",memberGroupList->count()); - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -382,7 +379,7 @@ bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly) updateLanguage(md); //printf("GroupDef(%s)::insertMember(%s)\n", title.data(), md->name().data()); MemberNameInfo *mni=0; - if ((mni=(*allMemberNameInfoSDict)[md->name()])) + if ((mni=(*m_allMemberNameInfoSDict)[md->name()])) { // member with this name already found MemberNameInfoIterator srcMnii(*mni); const MemberInfo *srcMi; @@ -427,10 +424,10 @@ bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly) { mni = new MemberNameInfo(md->name()); mni->append(new MemberInfo(md,md->protection(),md->virtualness(),FALSE)); - allMemberNameInfoSDict->append(mni->memberName(),mni); + m_allMemberNameInfoSDict->append(mni->memberName(),mni); } //printf("Added member!\n"); - allMemberList->append(md); + m_allMemberList->append(md); switch(md->memberType()) { case MemberType_Variable: @@ -542,7 +539,7 @@ bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly) void GroupDefImpl::removeMember(MemberDef *md) { // fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", title.data(), md->name().data()); - MemberNameInfo *mni = allMemberNameInfoSDict->find(md->name()); + MemberNameInfo *mni = m_allMemberNameInfoSDict->find(md->name()); if (mni) { MemberNameInfoIterator mnii(*mni); @@ -557,7 +554,7 @@ void GroupDefImpl::removeMember(MemberDef *md) } if( mni->isEmpty() ) { - allMemberNameInfoSDict->remove(md->name()); + m_allMemberNameInfoSDict->remove(md->name()); } removeMemberFromList(MemberListType_allMembersList,md); @@ -632,9 +629,9 @@ bool GroupDefImpl::findGroup(const GroupDef *def) const { return TRUE; } - else if (groupList) + else if (m_groupList) { - GroupListIterator it(*groupList); + GroupListIterator it(*m_groupList); GroupDef *gd; for (;(gd=it.current());++it) { @@ -653,7 +650,7 @@ void GroupDefImpl::addGroup(const GroupDef *def) //if (Config_getBool(SORT_MEMBER_DOCS)) // groupList->inSort(def); //else - groupList->append(def); + m_groupList->append(def); } bool GroupDefImpl::isASubGroup() const @@ -671,9 +668,9 @@ void GroupDefImpl::countMembers() ml->countDecMembers(); ml->countDocMembers(); } - if (memberGroupSDict) + if (m_memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -685,27 +682,27 @@ void GroupDefImpl::countMembers() int GroupDefImpl::numDocMembers() const { - return fileList->count()+ - classSDict->count()+ - namespaceSDict->count()+ - groupList->count()+ - allMemberList->count()+ - pageDict->count()+ - exampleDict->count(); + return m_fileList->count()+ + m_classSDict->count()+ + m_namespaceSDict->count()+ + m_groupList->count()+ + m_allMemberList->count()+ + m_pageDict->count()+ + m_exampleDict->count(); } /*! Compute the HTML anchor names for all members in the group */ void GroupDefImpl::computeAnchors() { //printf("GroupDefImpl::computeAnchors()\n"); - setAnchors(allMemberList); + setAnchors(m_allMemberList); } void GroupDefImpl::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"group\">" << endl; tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; - tagFile << " <title>" << convertToXML(title) << "</title>" << endl; + tagFile << " <title>" << convertToXML(m_title) << "</title>" << endl; tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; QListIterator<LayoutDocEntry> eli( LayoutDocManager::instance().docEntries(LayoutDocManager::Group)); @@ -716,9 +713,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) { case LayoutDocEntry::GroupClasses: { - if (classSDict) + if (m_classSDict) { - SDict<ClassDef>::Iterator ci(*classSDict); + SDict<ClassDef>::Iterator ci(*m_classSDict); ClassDef *cd; for (ci.toFirst();(cd=ci.current());++ci) { @@ -733,9 +730,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupNamespaces: { - if (namespaceSDict) + if (m_namespaceSDict) { - SDict<NamespaceDef>::Iterator ni(*namespaceSDict); + SDict<NamespaceDef>::Iterator ni(*m_namespaceSDict); NamespaceDef *nd; for (ni.toFirst();(nd=ni.current());++ni) { @@ -750,9 +747,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupFiles: { - if (fileList) + if (m_fileList) { - QListIterator<FileDef> it(*fileList); + QListIterator<FileDef> it(*m_fileList); FileDef *fd; for (;(fd=it.current());++it) { @@ -766,9 +763,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupPageDocs: { - if (pageDict) + if (m_pageDict) { - PageSDict::Iterator pdi(*pageDict); + PageSDict::Iterator pdi(*m_pageDict); PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) { @@ -783,9 +780,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupDirs: { - if (dirList) + if (m_dirList) { - QListIterator<DirDef> it(*dirList); + QListIterator<DirDef> it(*m_dirList); DirDef *dd; for (;(dd=it.current());++it) { @@ -799,9 +796,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupNestedGroups: { - if (groupList) + if (m_groupList) { - QListIterator<GroupDef> it(*groupList); + QListIterator<GroupDef> it(*m_groupList); GroupDef *gd; for (;(gd=it.current());++it) { @@ -825,9 +822,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::MemberGroups: { - if (memberGroupSDict) + if (m_memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -851,7 +848,7 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title ) { ol.pushGeneratorState(); - if (pageDict->count()!=numDocMembers()) // not only pages -> classical layout + if (m_pageDict->count()!=(uint)numDocMembers()) // not only pages -> classical layout { ol.pushGeneratorState(); ol.disable(OutputGenerator::Html); @@ -953,7 +950,7 @@ void GroupDefImpl::writeGroupGraph(OutputList &ol) ol.disable(OutputGenerator::Man); //ol.startParagraph(); ol.startGroupCollaboration(); - ol.parseText(theTranslator->trCollaborationDiagram(title)); + ol.parseText(theTranslator->trCollaborationDiagram(m_title)); ol.endGroupCollaboration(graph); //ol.endParagraph(); ol.popGeneratorState(); @@ -964,13 +961,13 @@ void GroupDefImpl::writeGroupGraph(OutputList &ol) void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title) { // write list of files - if (fileList->count()>0) + if (m_fileList->count()>0) { ol.startMemberHeader("files"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - QListIterator<FileDef> it(*fileList); + QListIterator<FileDef> it(*m_fileList); FileDef *fd; for (;(fd=it.current());++it) { @@ -996,16 +993,16 @@ void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title) void GroupDefImpl::writeNamespaces(OutputList &ol,const QCString &title) { // write list of namespaces - namespaceSDict->writeDeclaration(ol,title); + m_namespaceSDict->writeDeclaration(ol,title); } void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) { // write list of groups int count=0; - if (groupList->count()>0) + if (m_groupList->count()>0) { - QListIterator<GroupDef> it(*groupList); + QListIterator<GroupDef> it(*m_groupList); GroupDef *gd; for (;(gd=it.current());++it) { @@ -1020,9 +1017,9 @@ void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) ol.startMemberList(); if (Config_getBool(SORT_GROUP_NAMES)) { - groupList->sort(); + m_groupList->sort(); } - QListIterator<GroupDef> it(*groupList); + QListIterator<GroupDef> it(*m_groupList); GroupDef *gd; for (;(gd=it.current());++it) { @@ -1052,13 +1049,13 @@ void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title) { // write list of directories - if (dirList->count()>0) + if (m_dirList->count()>0) { ol.startMemberHeader("dirs"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - QListIterator<DirDef> it(*dirList); + QListIterator<DirDef> it(*m_dirList); DirDef *dd; for (;(dd=it.current());++it) { @@ -1085,18 +1082,18 @@ void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title) void GroupDefImpl::writeClasses(OutputList &ol,const QCString &title) { // write list of classes - classSDict->writeDeclaration(ol,0,title,FALSE); + m_classSDict->writeDeclaration(ol,0,title,FALSE); } void GroupDefImpl::writeInlineClasses(OutputList &ol) { - classSDict->writeDocumentation(ol); + m_classSDict->writeDocumentation(ol); } void GroupDefImpl::writePageDocumentation(OutputList &ol) { PageDef *pd=0; - PageSDict::Iterator pdi(*pageDict); + PageSDict::Iterator pdi(*m_pageDict); for (pdi.toFirst();(pd=pdi.current());++pdi) { if (!pd->isReference()) @@ -1119,11 +1116,11 @@ void GroupDefImpl::writePageDocumentation(OutputList &ol) void GroupDefImpl::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ - if (memberGroupSDict) + if (m_memberGroupSDict) { - memberGroupSDict->sort(); + m_memberGroupSDict->sort(); /* write user defined member groups */ - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1186,11 +1183,11 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const SrcLangExt lang = getLanguage(); for (eli.toFirst();(lde=eli.current());++eli) { - if ((lde->kind()==LayoutDocEntry::GroupClasses && classSDict->declVisible()) || - (lde->kind()==LayoutDocEntry::GroupNamespaces && namespaceSDict->declVisible()) || - (lde->kind()==LayoutDocEntry::GroupFiles && fileList->count()>0) || - (lde->kind()==LayoutDocEntry::GroupNestedGroups && groupList->count()>0) || - (lde->kind()==LayoutDocEntry::GroupDirs && dirList->count()>0) + if ((lde->kind()==LayoutDocEntry::GroupClasses && m_classSDict->declVisible()) || + (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaceSDict->declVisible()) || + (lde->kind()==LayoutDocEntry::GroupFiles && m_fileList->count()>0) || + (lde->kind()==LayoutDocEntry::GroupNestedGroups && m_groupList->count()>0) || + (lde->kind()==LayoutDocEntry::GroupDirs && m_dirList->count()>0) ) { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; @@ -1224,19 +1221,19 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) { //static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); ol.pushGeneratorState(); - startFile(ol,getOutputFileBase(),name(),title,HLI_Modules); + startFile(ol,getOutputFileBase(),name(),m_title,HLI_Modules); ol.startHeaderSection(); writeSummaryLinks(ol); ol.startTitleHead(getOutputFileBase()); ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - ol.parseText(title); + ol.parseText(m_title); ol.popGeneratorState(); addGroupListToTitle(ol,this); ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - ol.endTitleHead(getOutputFileBase(),title); + ol.endTitleHead(getOutputFileBase(),m_title); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Man); @@ -1250,14 +1247,14 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) Doxygen::searchIndex->setCurrentDoc(this,anchor(),FALSE); static QRegExp we("[a-zA-Z_][-a-zA-Z_0-9]*"); int i=0,p=0,l=0; - while ((i=we.match(title,p,&l))!=-1) // foreach word in the title + while ((i=we.match(m_title,p,&l))!=-1) // foreach word in the title { - Doxygen::searchIndex->addWord(title.mid(i,l),TRUE); + Doxygen::searchIndex->addWord(m_title.mid(i,l),TRUE); p=i+l; } } - Doxygen::indexList->addIndexItem(this,0,0,title); + Doxygen::indexList->addIndexItem(this,0,0,m_title); //---------------------------------------- start flexible part ------------------------------- @@ -1391,7 +1388,7 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) if (Config_getBool(SEPARATE_MEMBER_PAGES)) { - allMemberList->sort(); + m_allMemberList->sort(); writeMemberPages(ol); } @@ -1422,7 +1419,7 @@ void GroupDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *current ol.writeString(" <div class=\"navtab\">\n"); ol.writeString(" <table>\n"); - MemberListIterator mli(*allMemberList); + MemberListIterator mli(*m_allMemberList); MemberDef *md; for (mli.toFirst();(md=mli.current());++mli) { @@ -1653,7 +1650,7 @@ void addExampleToGroups(const Entry *root,PageDef *eg) QCString GroupDefImpl::getOutputFileBase() const { - return fileName; + return m_fileName; } void GroupDefImpl::addListReferences() @@ -1668,7 +1665,7 @@ void GroupDefImpl::addListReferences() 0 ); } - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1763,13 +1760,13 @@ void GroupDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,con void GroupDefImpl::removeMemberFromList(MemberListType lt,MemberDef *md) { - MemberList *ml = getMemberList(lt); - if (ml) ml->remove(md); + MemberList *ml = getMemberList(lt); + if (ml) ml->remove(md); } void GroupDefImpl::sortSubGroups() { - groupList->sort(); + m_groupList->sort(); } bool GroupDefImpl::isLinkableInProject() const diff --git a/src/growbuf.h b/src/growbuf.h index 2d0d503..cd6a67b 100644 --- a/src/growbuf.h +++ b/src/growbuf.h @@ -10,49 +10,49 @@ class GrowBuf { public: - GrowBuf() : str(0), pos(0), len(0) {} - GrowBuf(int initialSize) : pos(0), len(initialSize) { str=(char*)malloc(len); } - ~GrowBuf() { free(str); str=0; pos=0; len=0; } - void clear() { pos=0; } - void addChar(char c) { if (pos>=len) { len+=GROW_AMOUNT; str = (char*)realloc(str,len); } - str[pos++]=c; + GrowBuf() : m_str(0), m_pos(0), m_len(0) {} + GrowBuf(uint initialSize) : m_pos(0), m_len(initialSize) { m_str=(char*)malloc(m_len); } + ~GrowBuf() { free(m_str); } + void clear() { m_pos=0; } + void addChar(char c) { if (m_pos>=m_len) { m_len+=GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } + m_str[m_pos++]=c; } void addStr(const QCString &s) { if (!s.isEmpty()) { - int l=s.length(); - if (pos+l>=len) { len+=l+GROW_AMOUNT; str = (char*)realloc(str,len); } - strcpy(&str[pos],s.data()); - pos+=l; + uint l=s.length(); + if (m_pos+l>=m_len) { m_len+=l+GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } + strcpy(&m_str[m_pos],s.data()); + m_pos+=l; } } void addStr(const char *s) { if (s) { - int l=(int)strlen(s); - if (pos+l>=len) { len+=l+GROW_AMOUNT; str = (char*)realloc(str,len); } - strcpy(&str[pos],s); - pos+=l; + uint l=(uint)strlen(s); + if (m_pos+l>=m_len) { m_len+=l+GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } + strcpy(&m_str[m_pos],s); + m_pos+=l; } } - void addStr(const char *s,int n) { + void addStr(const char *s,uint n) { if (s) { - int l=(int)strlen(s); + uint l=(uint)strlen(s); if (n<l) l=n; - if (pos+l>=len) { len+=l+GROW_AMOUNT; str = (char*)realloc(str,len); } - strncpy(&str[pos],s,n); - pos+=l; + if (m_pos+l>=m_len) { m_len+=l+GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } + strncpy(&m_str[m_pos],s,n); + m_pos+=l; } } - const char *get() { return str; } - int getPos() const { return pos; } - void setPos(const int newPos) { pos = newPos; } - char at(int i) const { return str[i]; } + const char *get() { return m_str; } + uint getPos() const { return m_pos; } + void setPos(uint newPos) { m_pos = newPos; } + char at(uint i) const { return m_str[i]; } private: - char *str; - int pos; - int len; + char *m_str; + uint m_pos; + uint m_len; }; #endif diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index f220646..6e100fb 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -2461,7 +2461,7 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n) nodeIndex--; } if (nodeIndex<0) return; // first visible node in paragraph - DocNode *n = para->children().at(nodeIndex); + n = para->children().at(nodeIndex); if (mustBeOutsideParagraph(n)) return; // previous node already outside paragraph context nodeIndex--; bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,nodeIndex); @@ -2498,7 +2498,7 @@ void HtmlDocVisitor::forceStartParagraph(DocNode *n) } if (nodeIndex<numNodes) { - DocNode *n = para->children().at(nodeIndex); + n = para->children().at(nodeIndex); if (mustBeOutsideParagraph(n)) return; // next element also outside paragraph } else diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 05486d8..0e3b146 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -408,7 +408,7 @@ static QCString removeEmptyLines(const QCString &s) return out.data(); } -static QCString substituteHtmlKeywords(const QCString &s, +static QCString substituteHtmlKeywords(const QCString &str, const QCString &title, const QCString &relPath, const QCString &navPath=QCString()) @@ -576,7 +576,7 @@ static QCString substituteHtmlKeywords(const QCString &s, } // first substitute generic keywords - QCString result = substituteKeywords(s,title, + QCString result = substituteKeywords(str,title, convertToHtml(Config_getString(PROJECT_NAME)), convertToHtml(Config_getString(PROJECT_NUMBER)), convertToHtml(Config_getString(PROJECT_BRIEF))); @@ -2693,7 +2693,6 @@ void HtmlGenerator::writeSearchPage() void HtmlGenerator::writeExternalSearchPage() { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); - static bool disableIndex = Config_getBool(DISABLE_INDEX); QCString fileName = Config_getString(HTML_OUTPUT)+"/search"+Doxygen::htmlFileExtension; QFile f(fileName); if (f.open(IO_WriteOnly)) diff --git a/src/image.cpp b/src/image.cpp index afc67ef..2a8108b 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -207,7 +207,7 @@ static Color palette3[] = }; -Image::Image(int w,int h) +Image::Image(uint w,uint h) { static int hue = Config_getInt(HTML_COLORSTYLE_HUE); static int sat = Config_getInt(HTML_COLORSTYLE_SAT); @@ -236,49 +236,49 @@ Image::Image(int w,int h) palette[3].green = (int)(green2 * 255.0); palette[3].blue = (int)(blue2 * 255.0); - data = new uchar[w*h]; - memset(data,0,w*h); - width = w; - height = h; + m_data = new uchar[w*h]; + memset(m_data,0,w*h); + m_width = w; + m_height = h; } Image::~Image() { - delete[] data; + delete[] m_data; } -void Image::setPixel(int x,int y,uchar val) +void Image::setPixel(uint x,uint y,uchar val) { - if (x>=0 && x<width && y>=0 && y<height) - data[y*width+x] = val; + if (x<m_width && y<m_height) + m_data[y*m_width+x] = val; } -uchar Image::getPixel(int x,int y) const +uchar Image::getPixel(uint x,uint y) const { - if (x>=0 && x<width && y>=0 && y<height) - return data[y*width+x]; + if (x<m_width && y<m_height) + return m_data[y*m_width+x]; else return 0; } -void Image::writeChar(int x,int y,char c,uchar fg) +void Image::writeChar(uint x,uint y,char c,uchar fg) { if (c>=' ') { - int xf,yf,ci=c-' '; - int rowOffset=0; - int cw = charWidth[ci]; - int cp = charPos[ci]; + uint xf,yf,ci=c-' '; + uint rowOffset=0; + uint cw = charWidth[ci]; + uint cp = charPos[ci]; for (yf=0;yf<charHeight;yf++) { unsigned short bitPattern=0; - int bitsLeft=cw; - int byteOffset = rowOffset+(cp>>3); - int bitOffset = cp&7; + uint bitsLeft=cw; + uint byteOffset = rowOffset+(cp>>3); + uint bitOffset = cp&7; // get the bit pattern for row yf of the character from the font data while (bitsLeft>0) { - int bits=8-bitOffset; + uint bits=8-bitOffset; if (bits>bitsLeft) bits=bitsLeft; bitPattern<<=bits; bitPattern|=((fontRaw[byteOffset]<<bitOffset)&0xff)>>(8-bits); @@ -286,7 +286,7 @@ void Image::writeChar(int x,int y,char c,uchar fg) bitOffset=0; byteOffset++; } - int mask=1<<(cw-1); + uint mask=1<<(cw-1); // draw character row yf for (xf=0;xf<cw;xf++) { @@ -298,7 +298,7 @@ void Image::writeChar(int x,int y,char c,uchar fg) } } -void Image::writeString(int x,int y,const char *s,uchar fg) +void Image::writeString(uint x,uint y,const char *s,uchar fg) { if (s) { @@ -313,7 +313,7 @@ void Image::writeString(int x,int y,const char *s,uchar fg) uint Image::stringLength(const char *s) { - int w=0; + uint w=0; if (s) { char c; @@ -322,9 +322,9 @@ uint Image::stringLength(const char *s) return w; } -void Image::drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask) +void Image::drawHorzLine(uint y,uint xs,uint xe,uchar colIndex,uint mask) { - int x,i=0,j=0; + uint x,i=0,j=0; for (x=xs;x<=xe;x++,j++) { if (j&1) i++; @@ -332,38 +332,38 @@ void Image::drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask) } } -void Image::drawHorzArrow(int y,int xs,int xe,uchar colIndex,uint mask) +void Image::drawHorzArrow(uint y,uint xs,uint xe,uchar colIndex,uint mask) { drawHorzLine(y,xs,xe,colIndex,mask); - int i; + uint i; for (i=0;i<6;i++) { - int h=i>>1; + uint h=i>>1; drawVertLine(xe-i,y-h,y+h,colIndex,0xffffffff); } } -void Image::drawVertLine(int x,int ys,int ye,uchar colIndex,uint mask) +void Image::drawVertLine(uint x,uint ys,uint ye,uchar colIndex,uint mask) { - int y,i=0; + uint y,i=0; for (y=ys;y<=ye;y++,i++) { if (mask&(1<<(i&0x1f))) setPixel(x,y,colIndex); } } -void Image::drawVertArrow(int x,int ys,int ye,uchar colIndex,uint mask) +void Image::drawVertArrow(uint x,uint ys,uint ye,uchar colIndex,uint mask) { drawVertLine(x,ys,ye,colIndex,mask); - int i; + uint i; for (i=0;i<6;i++) { - int h=i>>1; + uint h=i>>1; drawHorzLine(ys+i,x-h,x+h,colIndex,0xffffffff); } } -void Image::drawRect(int x,int y,int w,int h,uchar colIndex,uint mask) +void Image::drawRect(uint x,uint y,uint w,uint h,uchar colIndex,uint mask) { drawHorzLine(y,x,x+w-1,colIndex,mask); drawHorzLine(y+h-1,x,x+w-1,colIndex,mask); @@ -371,44 +371,27 @@ void Image::drawRect(int x,int y,int w,int h,uchar colIndex,uint mask) drawVertLine(x+w-1,y,y+h-1,colIndex,mask); } -void Image::fillRect(int x,int y,int lwidth,int lheight,uchar colIndex,uint mask) +void Image::fillRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask) { - int xp,yp,xi,yi; - for (yp=y,yi=0;yp<y+lheight;yp++,yi++) - for (xp=x,xi=0;xp<x+lwidth;xp++,xi++) + uint xp,yp,xi,yi; + for (yp=y,yi=0;yp<y+height;yp++,yi++) + for (xp=x,xi=0;xp<x+width;xp++,xi++) if (mask&(1<<((xi+yi)&0x1f))) setPixel(xp,yp,colIndex); } bool Image::save(const char *fileName,int mode) { -#if 0 - GifEncoder gifenc(data, - mode==0 ? palette : palette2, - width,height, - mode==0 ? 3 : 4, - 0); - QFile file(fileName); - if (file.open(IO_WriteOnly)) - { - gifenc.writeGIF(file); - return TRUE; - } - else - { - return FALSE; - } -#endif static bool useTransparency = Config_getBool(FORMULA_TRANSPARENT); uchar* buffer; size_t bufferSize; LodePNG_Encoder encoder; LodePNG_Encoder_init(&encoder); - int numCols = mode==0 ? 8 : 16; + uint numCols = mode==0 ? 8 : 16; Color *pPal = mode==0 ? palette : useTransparency ? palette2 : palette3 ; - int i; + uint i; for (i=0;i<numCols;i++,pPal++) { LodePNG_InfoColor_addPalette(&encoder.infoPng.color, @@ -416,7 +399,7 @@ bool Image::save(const char *fileName,int mode) } encoder.infoPng.color.colorType = 3; encoder.infoRaw.color.colorType = 3; - LodePNG_encode(&encoder, &buffer, &bufferSize, data, width, height); + LodePNG_encode(&encoder, &buffer, &bufferSize, m_data, m_width, m_height); LodePNG_saveFile(buffer, bufferSize, fileName); free(buffer); LodePNG_Encoder_cleanup(&encoder); @@ -489,7 +472,7 @@ void ColoredImage::hsl2rgb(double h,double s,double l, *pBlue = b; } -ColoredImage::ColoredImage(int width,int height, +ColoredImage::ColoredImage(uint width,uint height, const uchar *greyLevels,const uchar *alphaLevels, int saturation,int hue,int gamma) { @@ -497,7 +480,7 @@ ColoredImage::ColoredImage(int width,int height, m_width = width; m_height = height; m_data = (uchar*)malloc(width*height*4); - int i; + uint i; for (i=0;i<width*height;i++) { uchar r,g,b,a; diff --git a/src/image.h b/src/image.h index 35e6ae3..435321a 100644 --- a/src/image.h +++ b/src/image.h @@ -24,37 +24,37 @@ class Image { public: - Image(int w,int h); + Image(uint w,uint h); ~Image(); - void setPixel(int x,int y,uchar val); - uchar getPixel(int x,int y) const; - void writeChar(int x,int y,char c,uchar fg); - void writeString(int x,int y,const char *s,uchar fg); - void drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask); - void drawHorzArrow(int y,int xs,int xe,uchar colIndex,uint mask); - void drawVertLine(int x,int ys,int ye,uchar colIndex,uint mask); - void drawVertArrow(int x,int ys,int ye,uchar colIndex,uint mask); - void drawRect(int x,int y,int width,int height,uchar colIndex,uint mask); - void fillRect(int x,int y,int width,int height,uchar colIndex,uint mask); + void setPixel(uint x,uint y,uchar val); + uchar getPixel(uint x,uint y) const; + void writeChar(uint x,uint y,char c,uchar fg); + void writeString(uint x,uint y,const char *s,uchar fg); + void drawHorzLine(uint y,uint xs,uint xe,uchar colIndex,uint mask); + void drawHorzArrow(uint y,uint xs,uint xe,uchar colIndex,uint mask); + void drawVertLine(uint x,uint ys,uint ye,uchar colIndex,uint mask); + void drawVertArrow(uint x,uint ys,uint ye,uchar colIndex,uint mask); + void drawRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask); + void fillRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask); bool save(const char *fileName,int mode=0); friend uint stringLength(const char *s); - uint getWidth() const { return width; } - uint getHeight() const { return height; } - uchar *getData() const { return data; } + uint width() const { return m_width; } + uint height() const { return m_height; } + uchar *data() const { return m_data; } static uint stringLength(const char *s); private: - int width; - int height; - uchar *data; + uint m_width; + uint m_height; + uchar *m_data; }; /** Class representing a bitmap image colored based on hue/sat/gamma settings. */ class ColoredImage { public: - ColoredImage(int width,int height, + ColoredImage(uint width,uint height, const uchar *greyLevels,const uchar *alphaLevels, int saturation,int hue,int gamma); ~ColoredImage(); @@ -62,8 +62,8 @@ class ColoredImage static void hsl2rgb(double h,double s,double l, double *pRed,double *pGreen,double *pBlue); private: - int m_width; - int m_height; + uint m_width; + uint m_height; uchar *m_data; bool m_hasAlpha; }; diff --git a/src/index.cpp b/src/index.cpp index 5552ff0..70475a2 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2008,20 +2008,20 @@ class PrefixIgnoreClassList : public ClassList class AlphaIndexTableCell { public: - AlphaIndexTableCell(int row,int col,uint letter,ClassDef *cd) : + AlphaIndexTableCell(int row,int col,uint letter,const ClassDef *cd) : m_letter(letter), m_class(cd), m_row(row), m_col(col) { //printf("AlphaIndexTableCell(%d,%d,%c,%s)\n",row,col,letter!=0 ? letter: '-', // cd!=(ClassDef*)0x8 ? cd->name().data() : "<null>"); } - ClassDef *classDef() const { return m_class; } + const ClassDef *classDef() const { return m_class; } uint letter() const { return m_letter; } int row() const { return m_row; } int column() const { return m_col; } private: uint m_letter; - ClassDef *m_class; + const ClassDef *m_class; int m_row; int m_col; }; @@ -2190,7 +2190,7 @@ static void writeAlphabeticalClassList(OutputList &ol, ClassDef::CompoundType ct row++; ClassListIterator cit(*cl); cit.toFirst(); - ClassDef *cd = cit.current(); + cd = cit.current(); ++cit; tableRows->append(new AlphaIndexTableCell(row,col,0,cd)); row++; @@ -4059,7 +4059,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp* for (mi.toFirst();(md=mi.current());++mi) { const MemberList *enumList = md->enumFieldList(); - bool isDir = enumList!=0 && md->isEnumerate(); + isDir = enumList!=0 && md->isEnumerate(); if (md->isVisible() && !md->isAnonymous()) { Doxygen::indexList->addContentsItem(isDir, @@ -4162,7 +4162,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp* { const SectionInfo *si=0; if (!pd->name().isEmpty()) si=SectionManager::instance().find(pd->name()); - bool hasSubPages = pd->hasSubPages(); + hasSubPages = pd->hasSubPages(); bool hasSections = pd->hasSections(); Doxygen::indexList->addContentsItem( hasSubPages || hasSections, @@ -4638,7 +4638,7 @@ static void writeIndex(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); } - QCString title = pd->title(); + title = pd->title(); if (title.isEmpty()) title=pd->name(); ol.disable(OutputGenerator::Docbook); diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 392e839..1780c36 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -520,10 +520,10 @@ static void writeDefaultHeaderPart1(FTextStream &t) QFileInfo fi(fileName); if (fi.exists()) { - if (checkExtension(fi.fileName().data(), latexStyleExtension)) + if (checkExtension(fi.fileName().data(), LATEX_STYLE_EXTENSION)) { // strip the extension, it will be added by the usepackage in the tex conversion process - t << "\\usepackage{" << stripExtensionGeneral(fi.fileName().data(), latexStyleExtension) << "}\n"; + t << "\\usepackage{" << stripExtensionGeneral(fi.fileName().data(), LATEX_STYLE_EXTENSION) << "}\n"; } else { diff --git a/src/latexgen.h b/src/latexgen.h index 6bd1e17..2c32388 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -22,7 +22,7 @@ class QFile; -static const char *latexStyleExtension = ".sty"; +#define LATEX_STYLE_EXTENSION ".sty" class LatexCodeGenerator : public CodeOutputInterface { diff --git a/src/layout.cpp b/src/layout.cpp index 946b612..0f47f2a 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -1424,15 +1424,15 @@ class LayoutParser : public QXmlDefaultHandler } private: - LayoutParser() : m_sHandler(163), m_eHandler(17), m_invalidEntry(FALSE), m_part(0), m_rootNav(NULL) { } + LayoutParser() : m_sHandler(163), m_eHandler(17) { } ~LayoutParser() { delete m_rootNav; } QDict<StartElementHandler> m_sHandler; QDict<EndElementHandler> m_eHandler; QCString m_scope; - int m_part; - LayoutNavEntry *m_rootNav; - bool m_invalidEntry; + int m_part = 0; + LayoutNavEntry *m_rootNav = 0; + bool m_invalidEntry = false; static int m_userGroupCount; }; diff --git a/src/markdown.cpp b/src/markdown.cpp index b9b92c3..86da735 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -868,13 +868,11 @@ static int processLink(GrowBuf &out,const char *data,int,int size) } if (isToc) // special case for [TOC] { - int level = Config_getInt(TOC_INCLUDE_HEADINGS); - if (level > 0 && level <=5) + int toc_level = Config_getInt(TOC_INCLUDE_HEADINGS); + if (toc_level > 0 && toc_level <=5) { - char levStr[10]; - sprintf(levStr,"%d",level); out.addStr("@tableofcontents{html:"); - out.addStr(levStr); + out.addStr(QCString().setNum(toc_level)); out.addStr("}"); } } @@ -1802,7 +1800,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) int rowNum = 1; while (i<size) { - int ret = findTableColumns(data+i,size-i,start,end,cc); + ret = findTableColumns(data+i,size-i,start,end,cc); if (cc!=columns) break; // end of table j=start+i; @@ -1957,20 +1955,15 @@ void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size) QCString hTag; if (level<5 && !id.isEmpty()) { - SectionType type = SectionType::Anchor; switch(level) { case 1: out.addStr("@section "); - type=SectionType::Section; break; case 2: out.addStr("@subsection "); - type=SectionType::Subsection; break; case 3: out.addStr("@subsubsection "); - type=SectionType::Subsubsection; break; default: out.addStr("@paragraph "); - type=SectionType::Paragraph; break; } out.addStr(id); @@ -2299,7 +2292,7 @@ static QCString processBlocks(const QCString &s,int indent) { //printf("Found header at %d-%d\n",i,end); while (pi<size && data[pi]==' ') pi++; - QCString header,id; + QCString header; convertStringFragment(header,data+pi,i-pi-1); id = extractTitleId(header, level); //printf("header='%s' is='%s'\n",header.data(),id.data()); diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 1d2a54e..57e2b6e 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -1438,7 +1438,7 @@ MemberDefImpl::IMPL::~IMPL() delete classSectionSDict; } -void MemberDefImpl::IMPL::init(Definition *def, +void MemberDefImpl::IMPL::init(Definition *d, const char *t,const char *a,const char *e, Protection p,Specifier v,bool s,Relationship r, MemberType mt,const ArgumentList &tal, @@ -1473,7 +1473,7 @@ void MemberDefImpl::IMPL::init(Definition *def, type=removeRedundantWhiteSpace(type); args=a; args=removeRedundantWhiteSpace(args); - if (type.isEmpty()) decl=def->name()+args; else decl=type+" "+def->name()+args; + if (type.isEmpty()) decl=d->name()+args; else decl=type+" "+d->name()+args; memberGroup=0; virt=v; @@ -1503,7 +1503,7 @@ void MemberDefImpl::IMPL::init(Definition *def, // convert function declaration arguments (if any) if (!args.isEmpty()) { - stringToArgumentList(def->getLanguage(),args,declArgList,&extraTypeChars); + stringToArgumentList(d->getLanguage(),args,declArgList,&extraTypeChars); //printf("setDeclArgList %s to %s const=%d\n",args.data(), // argListToString(declArgList).data(),declArgList->constSpecifier); } @@ -1519,7 +1519,7 @@ void MemberDefImpl::IMPL::init(Definition *def, hasDocumentedParams = FALSE; hasDocumentedReturnType = FALSE; docProvider = 0; - isDMember = def->getDefFileName().right(2).lower()==".d"; + isDMember = d->getDefFileName().right(2).lower()==".d"; } @@ -2640,7 +2640,6 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, ol.writeDoc(rootNode,getOuterScope()?getOuterScope():d,this); if (detailsVisible) { - static bool separateMemberPages = Config_getBool(SEPARATE_MEMBER_PAGES); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); //ol.endEmphasis(); @@ -3337,8 +3336,6 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, { // if this member is in a group find the real scope name. bool hasParameterList = FALSE; - bool inFile = container->definitionType()==Definition::TypeFile; - bool hasDocs = isDetailedSectionVisible(inGroup,inFile); //printf("MemberDefImpl::writeDocumentation(): name='%s' hasDocs='%d' containerType=%d inGroup=%d sectionLinkable=%d\n", // name().data(),hasDocs,container->definitionType(),inGroup,isDetailedSectionLinkable()); @@ -3494,7 +3491,6 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, if (!Config_getBool(HIDE_SCOPE_NAMES)) { bool first=TRUE; - SrcLangExt lang = getLanguage(); if (!m_impl->defTmpArgLists.empty() && lang==SrcLangExt_Cpp) // definition has explicit template parameter declarations { @@ -3567,9 +3563,9 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, { ldef=ldef.left(dp+1); } - int l=ldef.length(); + int dl=ldef.length(); //printf("start >%s<\n",ldef.data()); - int i=l-1; + i=dl-1; while (i>=0 && (isId(ldef.at(i)) || ldef.at(i)==':')) i--; while (i>=0 && isspace((uchar)ldef.at(i))) i--; if (i>0) @@ -4490,7 +4486,7 @@ const MemberList *MemberDefImpl::getSectionList() const { const Definition *d= resolveAlias()->getOuterScope(); char key[20]; - sprintf(key,"%p",d); + sprintf(key,"%p",(void*)d); return (d!=0 && m_impl->classSectionSDict) ? m_impl->classSectionSDict->find(key) : 0; } @@ -4499,7 +4495,7 @@ void MemberDefImpl::setSectionList(MemberList *sl) //printf("MemberDefImpl::setSectionList(%p,%p) name=%s\n",d,sl,name().data()); const Definition *d= resolveAlias()->getOuterScope(); char key[20]; - sprintf(key,"%p",d); + sprintf(key,"%p",(void*)d); if (m_impl->classSectionSDict==0) { m_impl->classSectionSDict = new SDict<MemberList>(7); @@ -4594,7 +4590,7 @@ void MemberDefImpl::writeTagFile(FTextStream &tagFile) const { tagFile << " <enumvalue file=\"" << convertToXML(getOutputFileBase()+Doxygen::htmlFileExtension); tagFile << "\" anchor=\"" << convertToXML(fmd->anchor()); - QCString idStr = fmd->id(); + idStr = fmd->id(); if (!idStr.isEmpty()) { tagFile << "\" clangid=\"" << convertToXML(idStr); diff --git a/src/membergroup.cpp b/src/membergroup.cpp index ee46ced..930426b 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -152,10 +152,10 @@ void MemberGroup::addGroupedInheritedMembers(OutputList &ol,const ClassDef *cd, const MemberList *ml = md->getSectionList(); if (ml && lt==ml->listType()) { - MemberList ml(lt); - ml.append(md); - ml.countDecMembers(); - ml.writePlainDeclarations(ol,cd,0,0,0,inheritedFrom,inheritId); + MemberList mml(lt); + mml.append(md); + mml.countDecMembers(); + mml.writePlainDeclarations(ol,cd,0,0,0,inheritedFrom,inheritId); } } } diff --git a/src/membergroup.h b/src/membergroup.h index dee998b..c1433cf 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -98,7 +98,6 @@ class MemberGroup bool inSameSection = 0; int m_numDecMembers = 0; int m_numDocMembers = 0; - const Definition *m_parent = 0; QCString m_docFile; int m_docLine = 0; std::vector<RefItem*> m_xrefListItems; diff --git a/src/memberlist.cpp b/src/memberlist.cpp index edd164b..8a76a1d 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -419,7 +419,6 @@ void MemberList::writePlainDeclarations(OutputList &ol, ) const { //printf("----- writePlainDeclaration() ----\n"); - static bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); if (numDecMembers()==-1) { err("MemberList::numDecMembers()==-1, so the members of this list have not been counted. Please report as a bug.\n"); @@ -558,8 +557,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, // no variables of the anonymous compound type exist. if (cd) { - MemberListIterator mli(*this); - for ( ; (md=mli.current()) ; ++mli ) + for ( mli.toFirst(); (md=mli.current()) ; ++mli ) { if (md->fromAnonymousScope() && !md->anonymousDeclShown()) { diff --git a/src/memberlist.h b/src/memberlist.h index 422c162..4038453 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -131,7 +131,7 @@ class MemberListIterator : public QListIterator<MemberDef> class MemberDict : public QDict<MemberDef> { public: - MemberDict(int size) : QDict<MemberDef>(size) {} + MemberDict(uint size) : QDict<MemberDef>(size) {} virtual ~MemberDict() {} }; @@ -139,7 +139,7 @@ class MemberDict : public QDict<MemberDef> class MemberSDict : public SDict<MemberDef> { public: - MemberSDict(int size=17) : SDict<MemberDef>(size) {} + MemberSDict(uint size=17) : SDict<MemberDef>(size) {} virtual ~MemberSDict() {} private: int compareValues(const MemberDef *item1,const MemberDef *item2) const; diff --git a/src/membername.h b/src/membername.h index 143dca1..04ceda0 100644 --- a/src/membername.h +++ b/src/membername.h @@ -46,7 +46,7 @@ class MemberNameIterator : public QListIterator<MemberDef> class MemberNameSDict : public SDict<MemberName> { public: - MemberNameSDict(int size) : SDict<MemberName>(size) {} + MemberNameSDict(uint size) : SDict<MemberName>(size) {} ~MemberNameSDict() {} private: @@ -92,7 +92,7 @@ class MemberNameInfoIterator : public QListIterator<MemberInfo> class MemberNameInfoSDict : public SDict<MemberNameInfo> { public: - MemberNameInfoSDict(int size) : SDict<MemberNameInfo>(size) {} + MemberNameInfoSDict(uint size) : SDict<MemberNameInfo>(size) {} ~MemberNameInfoSDict() {} private: int compareValues(const MemberNameInfo *item1,const MemberNameInfo *item2) const diff --git a/src/namespacedef.h b/src/namespacedef.h index 3be54f2..a35f0b1 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -146,7 +146,7 @@ class NamespaceListIterator : public QListIterator<NamespaceDef> class NamespaceDict : public QDict<NamespaceDef> { public: - NamespaceDict(int size) : QDict<NamespaceDef>(size) {} + NamespaceDict(uint size) : QDict<NamespaceDef>(size) {} ~NamespaceDict() {} }; @@ -154,7 +154,7 @@ class NamespaceDict : public QDict<NamespaceDef> class NamespaceSDict : public SDict<NamespaceDef> { public: - NamespaceSDict(int size=17) : SDict<NamespaceDef>(size) {} + NamespaceSDict(uint size=17) : SDict<NamespaceDef>(size) {} ~NamespaceSDict() {} void writeDeclaration(OutputList &ol,const char *title, bool isConstantGroup=false, bool localName=FALSE); diff --git a/src/outputgen.h b/src/outputgen.h index 2b4da98..009225f 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -150,7 +150,7 @@ class BaseOutputDocInterface : public CodeOutputInterface Examples }; - virtual void parseText(const QCString &s) {} + virtual void parseText(const QCString &) {} /*! Start of a bullet list: e.g. \c \<ul\> in html. startItemListItem() is * Used for the bullet items. @@ -447,8 +447,8 @@ class OutputGenerator : public BaseOutputDocInterface virtual void writeSummaryLink(const char *file,const char *anchor,const char *title,bool first) = 0; virtual void startContents() = 0; virtual void endContents() = 0; - virtual void startPageDoc(const char *pageTitle) {}; - virtual void endPageDoc() {}; + virtual void startPageDoc(const char *) {} + virtual void endPageDoc() {} virtual void startTextBlock(bool) = 0; virtual void endTextBlock(bool) = 0; virtual void lastIndexPage() = 0; diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 3f96a4b..15d6ca8 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -47,7 +47,7 @@ class PageDefImpl : public DefinitionImpl, public PageDef virtual QCString title() const { return m_title; } virtual GroupDef * getGroupDef() const; virtual PageSDict * getSubPages() const { return m_subPageDict; } - virtual void addInnerCompound(Definition *d); + virtual void addInnerCompound(const Definition *d); virtual bool visibleInIndex() const; virtual bool documentedPage() const; virtual bool hasSubPages() const; @@ -121,10 +121,11 @@ void PageDefImpl::setFileName(const char *name) m_fileName = name; } -void PageDefImpl::addInnerCompound(Definition *def) +void PageDefImpl::addInnerCompound(const Definition *const_def) { - if (def->definitionType()==Definition::TypePage) + if (const_def->definitionType()==Definition::TypePage) { + Definition *def = const_cast<Definition*>(const_def); // uck: fix me PageDef *pd = dynamic_cast<PageDef*>(def); m_subPageDict->append(pd->name(),pd); def->setOuterScope(this); diff --git a/src/pagedef.h b/src/pagedef.h index f0b68d1..e4d0268 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -46,22 +46,22 @@ class PageDef : virtual public Definition virtual QCString title() const = 0; virtual GroupDef * getGroupDef() const = 0; virtual PageSDict * getSubPages() const = 0; - virtual void addInnerCompound(Definition *d) = 0; + virtual void addInnerCompound(const Definition *) = 0; virtual bool visibleInIndex() const = 0; virtual bool documentedPage() const = 0; virtual bool hasSubPages() const = 0; virtual bool hasParentPage() const = 0; virtual bool hasTitle() const = 0; virtual LocalToc localToc() const = 0; - virtual void setPageScope(Definition *d) = 0; + virtual void setPageScope(Definition *) = 0; virtual Definition *getPageScope() const = 0; virtual QCString displayName(bool=TRUE) const = 0; virtual bool showLineNo() const = 0; - virtual void writeDocumentation(OutputList &ol) = 0; + virtual void writeDocumentation(OutputList &) = 0; virtual void writeTagFile(FTextStream &) = 0; - virtual void setNestingLevel(int l) = 0; - virtual void writePageDocumentation(OutputList &ol) = 0; + virtual void setNestingLevel(int) = 0; + virtual void writePageDocumentation(OutputList &) = 0; }; @@ -70,7 +70,7 @@ PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const cha class PageSDict : public SDict<PageDef> { public: - PageSDict(int size) : SDict<PageDef>(size) {} + PageSDict(uint size) : SDict<PageDef>(size) {} virtual ~PageSDict() {} private: int compareValues(const PageDef *i1,const PageDef *i2) const diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index c19d7c4..0183cdc 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -92,7 +92,7 @@ void PerlModOutputStream::add(int n) if (m_t != 0) (*m_t) << n; else - m_s += n; + m_s += QCString().setNum(n); } void PerlModOutputStream::add(unsigned int n) @@ -100,7 +100,7 @@ void PerlModOutputStream::add(unsigned int n) if (m_t != 0) (*m_t) << n; else - m_s += n; + m_s += QCString().setNum(n); } class PerlModOutput @@ -779,7 +779,7 @@ void PerlModDocVisitor::visit(DocFormula *f) { openItem("formula"); QCString id; - id += f->id(); + id += QCString().setNum(f->id()); m_output.addFieldQuotedString("id", id).addFieldQuotedString("content", f->text()); closeItem(); } @@ -1761,9 +1761,9 @@ void PerlModGenerator::addListOfAllMembers(const ClassDef *cd) for (mii.toFirst();(mi=mii.current());++mii) { const MemberDef *md=mi->memberDef; - const ClassDef *cd=md->getClassDef(); + const ClassDef *mcd=md->getClassDef(); const Definition *d=md->getGroupDef(); - if (d==0) d = cd; + if (d==0) d = mcd; m_output.openHash() .addFieldQuotedString("name", md->name()) @@ -1773,7 +1773,7 @@ void PerlModGenerator::addListOfAllMembers(const ClassDef *cd) if (!mi->ambiguityResolutionScope.isEmpty()) m_output.addFieldQuotedString("ambiguity_scope", mi->ambiguityResolutionScope); - m_output.addFieldQuotedString("scope", cd->name()) + m_output.addFieldQuotedString("scope", mcd->name()) .closeHash(); } } @@ -1871,10 +1871,10 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) { m_output.openList("inner"); ClassSDict::Iterator cli(*cl); - const ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) + const ClassDef *icd; + for (cli.toFirst();(icd=cli.current());++cli) m_output.openHash() - .addFieldQuotedString("name", cd->name()) + .addFieldQuotedString("name", icd->name()) .closeHash(); m_output.closeList(); } @@ -1991,10 +1991,10 @@ void PerlModGenerator::generatePerlModForNamespace(const NamespaceDef *nd) { m_output.openList("namespaces"); NamespaceSDict::Iterator nli(*nl); - const NamespaceDef *nd; - for (nli.toFirst();(nd=nli.current());++nli) + const NamespaceDef *ind; + for (nli.toFirst();(ind=nli.current());++nli) m_output.openHash() - .addFieldQuotedString("name", nd->name()) + .addFieldQuotedString("name", ind->name()) .closeHash(); m_output.closeList(); } diff --git a/src/plantuml.cpp b/src/plantuml.cpp index 7d60e32..7995883 100644 --- a/src/plantuml.cpp +++ b/src/plantuml.cpp @@ -299,12 +299,12 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles, if (list) { QListIterator<QCString> li(*list); - QCString *nb; - for (li.toFirst();(nb=li.current());++li) + QCString *str_p; + for (li.toFirst();(str_p=li.current());++li) { const int maxCmdLine = 40960; QCString epstopdfArgs(maxCmdLine); - epstopdfArgs.sprintf("\"%s%s.eps\" --outfile=\"%s%s.pdf\"",qPrint(pumlOutDir),qPrint(*nb),qPrint(pumlOutDir),qPrint(*nb)); + epstopdfArgs.sprintf("\"%s%s.eps\" --outfile=\"%s%s.pdf\"",qPrint(pumlOutDir),qPrint(*str_p),qPrint(pumlOutDir),qPrint(*str_p)); Portable::sysTimerStart(); if ((exitCode=Portable::system("epstopdf",epstopdfArgs))!=0) { diff --git a/src/portable.cpp b/src/portable.cpp index 8c941b6..d3799c7 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -207,11 +207,6 @@ unsigned int Portable::pid(void) return pid; } -#if defined(_WIN32) && !defined(__CYGWIN__) -#else - static char **last_environ; -#endif - #if !defined(_WIN32) || defined(__CYGWIN__) void loadEnvironment() { @@ -261,9 +256,6 @@ void Portable::unsetenv(const char *variable) SetEnvironmentVariable(variable,0); #else /* Some systems don't have unsetenv(), so we do it ourselves */ - size_t len; - char **ep; - if (variable == NULL || *variable == '\0' || strchr (variable, '=') != NULL) { return; // not properly formatted @@ -348,7 +340,7 @@ char Portable::pathListSeparator(void) #endif } -static const bool ExistsOnPath(const char *fileName) +static bool ExistsOnPath(const char *fileName) { QFileInfo fi1(fileName); if (fi1.exists()) return true; @@ -380,7 +372,7 @@ static const bool ExistsOnPath(const char *fileName) return false; } -const bool Portable::checkForExecutable(const char *fileName) +bool Portable::checkForExecutable(const char *fileName) { #if defined(_WIN32) && !defined(__CYGWIN__) char *extensions[] = {".bat",".com",".exe"}; diff --git a/src/portable.h b/src/portable.h index 6c215a8..bf6cfea 100644 --- a/src/portable.h +++ b/src/portable.h @@ -44,7 +44,7 @@ namespace Portable void setShortDir(void); const char * strnstr(const char *haystack, const char *needle, size_t haystack_len); const char * devNull(); - const bool checkForExecutable(const char *fileName); + bool checkForExecutable(const char *fileName); } @@ -63,11 +63,15 @@ #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + // Toggle for some debugging info //#define DBG_CTX(x) fprintf x #define DBG_CTX(x) do { } while(0) +#if USE_STATE2STRING static const char *stateToString(int state); +#endif struct CondCtx { @@ -86,7 +90,7 @@ struct FileState int curlyCount; BufStr fileBuf; BufStr *oldFileBuf; - int oldFileBufPos; + yy_size_t oldFileBufPos; YY_BUFFER_STATE bufState; QCString fileName; }; @@ -350,9 +354,9 @@ struct preYY_state int level; int lastCContext; int lastCPPContext; - QArray<int> levelGuard; + QArray<bool> levelGuard; BufStr *inputBuf = 0; - int inputBufPos; + yy_size_t inputBufPos; BufStr *outputBuf = 0; int roundCount; bool quoteArg; @@ -378,7 +382,7 @@ struct preYY_state bool insideCS; // C# has simpler preprocessor bool isSource; - int fenceSize = 0; + yy_size_t fenceSize = 0; bool ccomment; QCString delimiter; QDict<void> allIncludes; @@ -407,7 +411,7 @@ static void endCondSection(yyscan_t yyscanner); static void addDefine(yyscan_t yyscanner); static Define * newDefine(yyscan_t yyscanner); static void setFileName(yyscan_t yyscanner,const char *name); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); /* ----------------------------------------------------------------- */ @@ -1392,14 +1396,14 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } <SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { outputArray(yyscanner,yytext,(int)yyleng); - if (yyextra->fenceSize==yyleng) + if (yyextra->fenceSize==(yy_size_t)yyleng) { BEGIN(SkipCComment); } } <SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* { outputArray(yyscanner,yytext,(int)yyleng); - if (yyextra->fenceSize==yyleng) + if (yyextra->fenceSize==(yy_size_t)yyleng) { BEGIN(SkipCComment); } @@ -1631,7 +1635,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) //preYYin = fs->oldYYin; yyextra->inputBuf = fs->oldFileBuf; yyextra->inputBufPos = fs->oldFileBufPos; - yyextra->curlyCount = fs->curlyCount; + yyextra->curlyCount = fs->curlyCount; setFileName(yyscanner,fs->fileName); DBG_CTX((stderr,"######## FileName %s\n",yyextra->yyFileName.data())); @@ -1685,11 +1689,11 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ///////////////////////////////////////////////////////////////////////////////////// -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - int bytesInBuf = state->inputBuf->curPos()-state->inputBufPos; - int bytesToCopy = QMIN(max_size,bytesInBuf); + yy_size_t bytesInBuf = state->inputBuf->curPos()-state->inputBufPos; + yy_size_t bytesToCopy = QMIN(max_size,bytesInBuf); memcpy(buf,state->inputBuf->data()+state->inputBufPos,bytesToCopy); state->inputBufPos+=bytesToCopy; return bytesToCopy; @@ -1992,7 +1996,7 @@ static QCString stringize(const QCString &s) pc=0; while (i<s.length() && inString) { - char c=s.at(i++); + c=s.at(i++); if (c=='"') { result+="\\\""; @@ -2085,7 +2089,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } if (cc!='(') { - unputChar(yyscanner,expr,rest,j,cc); + unputChar(yyscanner,expr,rest,j,(char)cc); return FALSE; } getNextChar(yyscanner,expr,rest,j); // eat the '(' character @@ -2114,12 +2118,12 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin char c=(char)cc; if (c=='(') // argument is a function => search for matching ) { - int level=1; + int lvl=1; arg+=c; //char term='\0'; while ((cc=getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0) { - char c=(char)cc; + c=(char)cc; //printf("processing %c: term=%c (%d)\n",c,term,term); if (c=='\'' || c=='\"') // skip ('s and )'s inside strings { @@ -2128,13 +2132,13 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } if (c==')') { - level--; + lvl--; arg+=c; - if (level==0) break; + if (lvl==0) break; } else if (c=='(') { - level++; + lvl++; arg+=c; } else @@ -2671,7 +2675,7 @@ static QCString removeIdsAndMarkers(const char *s) { nextChar: result+=c; - char lc=tolower(c); + char lc=(char)tolower(c); if (!isId(lc) && lc!='.' /*&& lc!='-' && lc!='+'*/) inNum=FALSE; p++; } @@ -2924,23 +2928,23 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) else if (searchIncludes) // search in INCLUDE_PATH as well { QStrList &includePath = Config_getList(INCLUDE_PATH); - char *s=includePath.first(); - while (s) + char *incPath=includePath.first(); + while (incPath) { - QFileInfo fi(s); - if (fi.exists() && fi.isDir()) + QFileInfo fi3(incPath); + if (fi3.exists() && fi3.isDir()) { - QCString absName = QCString(fi.absFilePath().utf8())+"/"+incFileName; + absName = QCString(fi3.absFilePath().utf8())+"/"+incFileName; //printf("trying absName=%s\n",absName.data()); - QFileInfo fi2(absName); - if (fi2.exists()) + QFileInfo fi4(absName); + if (fi4.exists()) { - absIncFileName=fi2.absFilePath().utf8(); + absIncFileName=fi4.absFilePath().utf8(); break; } //printf( "absIncFileName = %s\n", absIncFileName.data() ); } - s=includePath.next(); + incPath=includePath.next(); } } //printf( "absIncFileName = %s\n", absIncFileName.data() ); @@ -3170,8 +3174,7 @@ static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest else { int cc=yyinput(yyscanner); - returnCharToStream(yyscanner,cc); - //unput((char)cc); + returnCharToStream(yyscanner,(char)cc); //printf("%c=yyinput()\n",cc); return cc; } @@ -3297,14 +3300,14 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output QRegExp reId("[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*"); // regexp matching an id QDict<int> argDict(17); argDict.setAutoDelete(TRUE); - int i=i_obrace+1,p,l,count=0; + int i=i_obrace+1,pi,l,count=0; // gather the formal arguments in a dictionary - while (i<i_cbrace && (p=reId.match(ds,i,&l))) + while (i<i_cbrace && (pi=reId.match(ds,i,&l))) { if (l>0) // see bug375037 { - argDict.insert(ds.mid(p,l),new int(count++)); - i=p+l; + argDict.insert(ds.mid(pi,l),new int(count++)); + i=pi+l; } else { @@ -3317,11 +3320,11 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output i=0; // substitute all occurrences of formal arguments by their // corresponding markers - while ((p=reId.match(tmp,i,&l))!=-1) + while ((pi=reId.match(tmp,i,&l))!=-1) { - if (p>i) definition+=tmp.mid(i,p-i); + if (pi>i) definition+=tmp.mid(i,pi-i); int *argIndex; - if ((argIndex=argDict[tmp.mid(p,l)])!=0) + if ((argIndex=argDict[tmp.mid(pi,l)])!=0) { QCString marker; marker.sprintf(" @%d ",*argIndex); @@ -3329,9 +3332,9 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output } else { - definition+=tmp.mid(p,l); + definition+=tmp.mid(pi,l); } - i=p+l; + i=pi+l; } if (i<(int)tmp.length()) definition+=tmp.mid(i,tmp.length()-i); @@ -3466,5 +3469,6 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output printlex(yy_flex_debug, FALSE, __FILE__, fileName); } - +#if USE_STATE2STRING #include "pre.l.h" +#endif diff --git a/src/pycode.l b/src/pycode.l index 970c221..8cb85a3 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -23,6 +23,7 @@ %option never-interactive %option prefix="pycodeYY" +%option noyy_top_state %top{ #include <stdint.h> } @@ -56,6 +57,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + static ClassSDict g_codeClassSDict(17); static QCString g_curClassName; static QStrList g_curClassBases; @@ -100,7 +103,10 @@ static bool g_endComment; static void endFontClass(); static void adjustScopesAndSuites(unsigned indentLength); + +#if USE_STATE2STRING static const char *stateToString(int state); +#endif /*! Represents a stack of variable to class mappings as found in the @@ -688,19 +694,19 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, DBG_CTX((stderr,"scope=%s locName=%s mcd=%p\n",scope.data(),locName.data(),mcd)); if (mcd) { - MemberDef *md = mcd->getMemberByName(locName); - if (md) + MemberDef *mmd = mcd->getMemberByName(locName); + if (mmd) { - g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope())); - writeMultiLineCodeLink(ol,md,clName); + g_theCallContext.setClass(stripClassName(mmd->typeString(),mmd->getOuterScope())); + writeMultiLineCodeLink(ol,mmd,clName); addToSearchIndex(className); - const Definition *d = md->getOuterScope()==Doxygen::globalScope ? - md->getBodyDef() : md->getOuterScope(); - if (md->getGroupDef()) d = md->getGroupDef(); - if (d && d->isLinkable() && md->isLinkable() && + const Definition *d = mmd->getOuterScope()==Doxygen::globalScope ? + mmd->getBodyDef() : mmd->getOuterScope(); + if (mmd->getGroupDef()) d = mmd->getGroupDef(); + if (d && d->isLinkable() && mmd->isLinkable() && g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,mmd); } return; } @@ -710,20 +716,20 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, const NamespaceDef *mnd = getResolvedNamespace(scope); if (mnd) { - MemberDef *md=mnd->getMemberByName(locName); - if (md) + MemberDef *mmd=mnd->getMemberByName(locName); + if (mmd) { //printf("name=%s scope=%s\n",locName.data(),scope.data()); - g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope())); - writeMultiLineCodeLink(ol,md,clName); + g_theCallContext.setClass(stripClassName(mmd->typeString(),mmd->getOuterScope())); + writeMultiLineCodeLink(ol,mmd,clName); addToSearchIndex(className); - const Definition *d = md->getOuterScope()==Doxygen::globalScope ? - md->getBodyDef() : md->getOuterScope(); - if (md->getGroupDef()) d = md->getGroupDef(); - if (d && d->isLinkable() && md->isLinkable() && + const Definition *d = mmd->getOuterScope()==Doxygen::globalScope ? + mmd->getBodyDef() : mmd->getOuterScope(); + if (mmd->getGroupDef()) d = mmd->getGroupDef(); + if (d && d->isLinkable() && mmd->isLinkable() && g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,mmd); } return; } @@ -846,9 +852,9 @@ static void findMemberLink(CodeOutputInterface &ol,char *symName) #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - int c=0; + yy_size_t c=0; while( c < max_size && g_inputString[g_inputPosition] ) { *buf = g_inputString[g_inputPosition++] ; @@ -1669,5 +1675,6 @@ void PythonCodeParser::resetCodeParserState() ::resetPythonCodeParserState(); } - +#if USE_STATE2STRING #include "pycode.l.h" +#endif diff --git a/src/pyscanner.l b/src/pyscanner.l index 0abaae1..15e1040 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -64,6 +64,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + /* ----------------------------------------------------------------- */ struct pyscannerYY_state @@ -72,7 +74,7 @@ struct pyscannerYY_state CommentScanner commentScanner; OutlineParserInterface *thisParser = 0; const char * inputString = 0; - int inputPosition = 0; + yy_size_t inputPosition = 0; Protection protection = Public; std::shared_ptr<Entry> current_root; std::shared_ptr<Entry> current; @@ -113,7 +115,9 @@ struct pyscannerYY_state }; //----------------------------------------------------------------------------- +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static inline int computeIndent(const char *s); @@ -136,7 +140,8 @@ static void initSpecialBlock(yyscan_t yyscanner); static void searchFoundDef(yyscan_t yyscanner); static void searchFoundClass(yyscan_t yyscanner); static QCString findPackageScope(yyscan_t yyscanner,const char *fileName); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); + +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); //----------------------------------------------------------------------------- /* ----------------------------------------------------------------- */ @@ -1437,10 +1442,10 @@ STARTDOCSYMS "##" //---------------------------------------------------------------------------- -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; const char *p = yyextra->inputString + yyextra->inputPosition; while ( c < max_size && *p ) { *buf++ = *p++; c++; } yyextra->inputPosition+=c; @@ -1740,7 +1745,7 @@ static void parseCompounds(yyscan_t yyscanner,std::shared_ptr<Entry> rt) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("parseCompounds(%s)\n",rt->name.data()); - for (int i=0; i<rt->children().size(); ++i) + for (size_t i=0; i<rt->children().size(); ++i) { std::shared_ptr<Entry> ce = rt->children()[i]; if (!ce->program.isEmpty()) @@ -1865,7 +1870,7 @@ static void parsePrototype(yyscan_t yyscanner,const QCString &text) yyextra->packageCommentAllowed = FALSE; const char *orgInputString; - int orgInputPosition; + yy_size_t orgInputPosition; YY_BUFFER_STATE orgState; // save scanner state @@ -1951,4 +1956,6 @@ void PythonOutlineParser::parsePrototype(const char *text) //---------------------------------------------------------------------------- +#if USE_STATE2STRING #include "pyscanner.l.h" +#endif diff --git a/src/resourcemgr.cpp b/src/resourcemgr.cpp index 8cb831e..0f79c04 100644 --- a/src/resourcemgr.cpp +++ b/src/resourcemgr.cpp @@ -97,14 +97,14 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch { QCString n = name; n = n.left(n.length()-4)+".png"; // replace .lum by .png - uchar *p = (uchar*)res->data; - int width = (p[0]<<8)+p[1]; - int height = (p[2]<<8)+p[3]; + uchar *data = (uchar*)res->data; + ushort width = (data[0]<<8)+data[1]; + ushort height = (data[2]<<8)+data[3]; ColoredImgDataItem images[2]; images[0].name = n; images[0].width = width; images[0].height = height; - images[0].content = &p[4]; + images[0].content = &data[4]; images[0].alpha = 0; images[1].name = 0; // terminator writeColoredImgData(targetDir,images); @@ -115,15 +115,15 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch { QCString n = name; n = n.left(n.length()-5)+".png"; // replace .luma by .png - uchar *p = (uchar*)res->data; - int width = (p[0]<<8)+p[1]; - int height = (p[2]<<8)+p[3]; + uchar *data = (uchar*)res->data; + ushort width = (data[0]<<8)+data[1]; + ushort height = (data[2]<<8)+data[3]; ColoredImgDataItem images[2]; images[0].name = n; images[0].width = width; images[0].height = height; - images[0].content = &p[4]; - images[0].alpha = &p[4+width*height]; + images[0].content = &data[4]; + images[0].alpha = &data[4+width*height]; images[1].name = 0; // terminator writeColoredImgData(targetDir,images); return TRUE; diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 39741dc..221b44c 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -273,15 +273,14 @@ void RTFGenerator::beginRTFDocument() // sort styles ascending by \s-number via an intermediate QArray QDictIterator<StyleData> iter(rtf_Style); - const StyleData* style; + const StyleData* style = 0; unsigned maxIndex = 0; for(; (style = iter.current()); ++iter) { unsigned index = style->index; if (maxIndex < index) maxIndex = index; } - QArray<const StyleData*> array(maxIndex + 1); - array.fill(0); + std::vector<const StyleData*> array(maxIndex + 1, 0); ASSERT(maxIndex < array.size()); iter.toFirst(); @@ -297,10 +296,10 @@ void RTFGenerator::beginRTFDocument() } // write array elements - unsigned size = array.size(); - for(unsigned i = 0; i < size; i++) + size_t size = array.size(); + for(size_t i = 0; i < size; i++) { - const StyleData* style = array.at(i); + style = array.at(i); if (style != 0) t <<"{" << style->reference << style->definition << ";}\n"; } @@ -2463,7 +2462,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl { // null terminate at the last '}' //char *str = strrchr(buffer,'}'); - int pos = lineBuf.findRev('}'); + pos = lineBuf.findRev('}'); if (pos != -1) lineBuf.at(pos) = '\0'; diff --git a/src/rtfstyle.cpp b/src/rtfstyle.cpp index 47a8166..163d5b8 100644 --- a/src/rtfstyle.cpp +++ b/src/rtfstyle.cpp @@ -228,17 +228,20 @@ const QRegExp StyleData::s_clause("\\\\s[0-9]+\\s*"); StyleData::StyleData(const char* reference, const char* definition) { - int start = s_clause.match(reference); ASSERT(start >= 0); - reference += start; - index = (int)atol(reference + 2); ASSERT(index > 0); + const char *ref = reference; + const char *def = definition; - ASSERT(reference != 0); - size_t size = 1 + strlen(reference); - memcpy(this->reference = new char[size], reference, size); + int start = s_clause.match(ref); ASSERT(start >= 0); + ref += start; + index = (int)atol(ref + 2); ASSERT(index > 0); - ASSERT(definition != 0); - size = 1 + strlen(definition); - memcpy(this->definition = new char[size], definition, size); + ASSERT(ref != 0); + size_t size = 1 + strlen(ref); + memcpy(this->reference = new char[size], ref, size); + + ASSERT(def != 0); + size = 1 + strlen(def); + memcpy(this->definition = new char[size], def, size); } StyleData::~StyleData() diff --git a/src/scanner.l b/src/scanner.l index 2342795..479b18a 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -59,6 +59,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + struct scannerYY_state { OutlineParserInterface *thisParser; @@ -190,12 +192,14 @@ struct scannerYY_state int column = 0; - int fencedSize = 0; + uint fencedSize = 0; bool nestedComment = false; std::vector< std::pair<Entry*,std::shared_ptr<Entry> > > outerScopeEntries; }; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif //----------------------------------------------------------------------------- // forward declarations for stateless functions @@ -218,7 +222,7 @@ static bool checkForKnRstyleC(yyscan_t yyscanner); static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &oldStyleArgName); static void addKnRArgInfo(yyscan_t yyscanner,const QCString &type,const QCString &name, const QCString &brief,const QCString &docs); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); /* ----------------------------------------------------------------- */ @@ -6594,10 +6598,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) %% //---------------------------------------------------------------------------- -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -6830,7 +6834,6 @@ static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &ol else // normal "int *var" { int l=si,i=l-1,j; - char c; // look for start of name in "type *name" while (i>=0 && isId(yyextra->current->args.at(i))) i--; j=i+1; @@ -7405,4 +7408,6 @@ void COutlineParser::parsePrototype(const char *text) //---------------------------------------------------------------------------- +#if USE_STATE2STRING #include "scanner.l.h" +#endif diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 329b123..e090717 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -394,8 +394,6 @@ void SearchIndex::write(const char *fileName) } } // write urls - QIntDictIterator<URL> udi(m_urls); - URL *url; for (udi.toFirst();(url=udi.current());++udi) { writeString(f,url->name); @@ -833,9 +831,9 @@ void createJavaScriptSearchIndex() } // index files - FileNameListIterator fnli(*Doxygen::inputNameList); + FileNameListIterator inli(*Doxygen::inputNameList); FileName *fn; - for (;(fn=fnli.current());++fnli) + for (;(fn=inli.current());++inli) { FileNameIterator fni(*fn); FileDef *fd; diff --git a/src/sortdict.h b/src/sortdict.h index 203ae5e..15282ec 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -99,7 +99,7 @@ class SDict private: SList<T> *m_list; QDict<T> *m_dict; - int m_sizeIndex; + uint m_sizeIndex; public: /*! Create an ordered dictionary. @@ -108,7 +108,7 @@ class SDict * \param caseSensitive indicated whether the keys should be sorted * in a case sensitive way. */ - SDict(int size=17,bool caseSensitive=TRUE) : m_sizeIndex(0) + SDict(uint size=17,bool caseSensitive=TRUE) : m_sizeIndex(0) { m_list = new SList<T>(this); #if AUTORESIZE @@ -277,7 +277,7 @@ class SDict /*! Returns the number of items stored in the dictionary */ - int count() const + uint count() const { return m_list->count(); } diff --git a/src/sqlcode.l b/src/sqlcode.l index e73fe4c..58a2fce 100644 --- a/src/sqlcode.l +++ b/src/sqlcode.l @@ -44,6 +44,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + struct sqlcodeYY_state { CodeOutputInterface * code; @@ -65,8 +67,10 @@ struct sqlcodeYY_state const char *currentFontClass; }; -static void codify(const char* text); +#if USE_STATE2STRING static const char *stateToString(int state); +#endif + static void setCurrentDoc(const QCString &anchor,yyscan_t yyscanner); static void startCodeLine(yyscan_t yyscanner); static void endFontClass(yyscan_t yyscanner); @@ -75,7 +79,7 @@ static void nextCodeLine(yyscan_t yyscanner); static void codifyLines(char *text,yyscan_t yyscanner); static void startFontClass(const char *s,yyscan_t yyscanner); static int countLines(yyscan_t yyscanner); -static int yyread(char *buf,int max_size,yyscan_t yyscanner); +static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner); #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner); @@ -193,12 +197,6 @@ commentclose "\*/" %% -static void codify(const char* text, yyscan_t yyscanner) -{ - struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - yyextra->code->codify(text); -} - static void setCurrentDoc(const QCString &anchor, yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; @@ -348,10 +346,10 @@ static int countLines(yyscan_t yyscanner) return count; } -static int yyread(char *buf,int max_size,yyscan_t yyscanner) +static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -487,4 +485,6 @@ void SQLCodeParser::resetCodeParserState() //--------------------------------------------------------------------------------- +#if USE_STATE2STRING #include "sqlcode.l.h" +#endif diff --git a/src/tclscanner.l b/src/tclscanner.l index 7f776ca..10aba97 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -63,7 +63,11 @@ #define MAX_INCLUDE_DEPTH 10 +#define USE_STATE2STRING 0 + +#if USE_STATE2STRING static const char *stateToString(int state); +#endif //! Application error. #define tcl_err \ @@ -470,7 +474,7 @@ struct tcl_struct static tcl_struct tcl; // scanner functions -static int yyread(char *buf,int max_size); +static yy_size_t yyread(char *buf,yy_size_t max_size); static tcl_scan *tcl_scan_start(char type, QCString content, QCString ns, Entry *entry_cls, Entry *entry_fn); static void tcl_scan_end(); static void tcl_comment(int what,const char *text); @@ -1952,25 +1956,25 @@ D // handle leading whitespace/opening brace/double quotes if (elem - token > 0) { - myScan = tcl_codify_token(myScan, "NULL", token.left(elem - token)); + myScan = tcl_codify_token(myScan, "NULL", token.left((uint)(elem - token))); } // handle actual element without braces/double quotes if (nextIsPattern) { - myScan = tcl_codify_token(myScan, "NULL", token.mid(elem - token,size)); + myScan = tcl_codify_token(myScan, "NULL", token.mid((uint)(elem - token),size)); //printf("pattern=%s\n",(const char*) token.mid(elem - token, size)); } else { - myScan = tcl_codify_token(myScan, "script", token.mid(elem - token, size)); + myScan = tcl_codify_token(myScan, "script", token.mid((uint)(elem - token), size)); //printf("script =%s\n", (const char*) token.mid(elem - token, size)); } // handle trailing whitespace/closing brace/double quotes if (next - elem - size > 0) { - myScan = tcl_codify_token(myScan, "NULL", token.mid(elem - token + size, next - elem - size)); + myScan = tcl_codify_token(myScan, "NULL", token.mid((uint)(elem - token + size), (uint)(next - elem - size))); } nextIsPattern = !nextIsPattern; - token = token.mid(next - token); + token = token.mid((int)(next - token)); } if (inBraces) { @@ -2783,7 +2787,7 @@ if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN? char myState='x';// last word: e'x'pr 't'hen 'b'ody 'e'lse else'i'f.. for (unsigned int i = 4; i < tcl.list_commandwords.count(); i = i + 2) { - QCString myStr=(*tcl.list_commandwords.at(i)); + myStr=(*tcl.list_commandwords.at(i)); if (myState=='x') { if (myStr=="then") @@ -3014,9 +3018,9 @@ void TclOutlineParser::parsePrototype(const char *text) (void)text; } -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - int c=0; + yy_size_t c=0; *buf = '\0'; while ( c < max_size && tcl.input_string.at(tcl.input_position) ) @@ -3147,4 +3151,6 @@ void tclDummy() yy_top_state(); } +#if USE_STATE2STRING #include "tclscanner.l.h" +#endif diff --git a/src/template.cpp b/src/template.cpp index ca28c73..1763eec 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -336,7 +336,7 @@ int TemplateList::release() return count; } -int TemplateList::count() const +uint TemplateList::count() const { return p->elems.count(); } @@ -406,9 +406,9 @@ TemplateListIntf::ConstIterator *TemplateList::createIterator() const return new TemplateListConstIterator(*this); } -TemplateVariant TemplateList::at(int index) const +TemplateVariant TemplateList::at(uint index) const { - if (index>=0 && index<(int)p->elems.count()) + if (index<p->elems.count()) { return p->elems[index]; } @@ -780,7 +780,7 @@ class FilterLength } if (v.type()==TemplateVariant::List) { - return TemplateVariant(v.toList()->count()); + return TemplateVariant((int)v.toList()->count()); } else if (v.type()==TemplateVariant::String) { @@ -1125,7 +1125,7 @@ class FilterAlphaIndex { int i=0; if (startLetter>='0' && startLetter<='9') s[i++] = 'x'; - s[i++]=tolower((char)startLetter); + s[i++]=(char)tolower((char)startLetter); s[i++]=0; } else @@ -2268,7 +2268,6 @@ class ExpressionParser if (p==q) // still no valid token found -> error { m_curToken.type = ExprToken::Unknown; - char s[2]; s[0]=c; s[1]=0; warn(m_parser->templateName(),m_line,"Found unknown token '%s' (%d) while parsing %s",s,c,m_tokenStream); @@ -2877,19 +2876,21 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf> stopAt.append("else"); // if 'nodes' - GuardedNodes *guardedNodes = new GuardedNodes; - ExpressionParser ex(parser,line); - guardedNodes->line = line; - guardedNodes->guardAst = ex.parse(data); - parser->parse(this,line,stopAt,guardedNodes->trueNodes); - m_ifGuardedNodes.append(guardedNodes); + { + GuardedNodes *guardedNodes = new GuardedNodes; + ExpressionParser ex(parser,line); + guardedNodes->line = line; + guardedNodes->guardAst = ex.parse(data); + parser->parse(this,line,stopAt,guardedNodes->trueNodes); + m_ifGuardedNodes.append(guardedNodes); + } TemplateToken *tok = parser->takeNextToken(); // elif 'nodes' while (tok && tok->data.left(5)=="elif ") { ExpressionParser ex(parser,line); - guardedNodes = new GuardedNodes; + GuardedNodes *guardedNodes = new GuardedNodes; guardedNodes->line = tok->line; guardedNodes->guardAst = ex.parse(tok->data.mid(5)); parser->parse(this,tok->line,stopAt,guardedNodes->trueNodes); @@ -3119,15 +3120,15 @@ class TemplateNodeRange : public TemplateNodeCreator<TemplateNodeRange> while (!done) { // set the forloop meta-data variable - TemplateAutoRef<TemplateStruct> s(TemplateStruct::alloc()); - s->set("counter0", (int)index); - s->set("counter", (int)(index+1)); - s->set("revcounter", (int)(l-index)); - s->set("revcounter0", (int)(l-index-1)); - s->set("first",index==0); - s->set("last", (int)index==l-1); - s->set("parentloop",parentLoop ? *parentLoop : TemplateVariant()); - c->set("forloop",s.get()); + TemplateAutoRef<TemplateStruct> ls(TemplateStruct::alloc()); + ls->set("counter0", (int)index); + ls->set("counter", (int)(index+1)); + ls->set("revcounter", (int)(l-index)); + ls->set("revcounter0", (int)(l-index-1)); + ls->set("first",index==0); + ls->set("last", (int)index==l-1); + ls->set("parentloop",parentLoop ? *parentLoop : TemplateVariant()); + c->set("forloop",ls.get()); // set the iterator variable c->set(m_var,i); @@ -3278,7 +3279,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> } c->push(); //int index = m_reversed ? list.count() : 0; - TemplateVariant v; + //TemplateVariant v; const TemplateVariant *parentLoop = c->getRef("forloop"); uint index = m_reversed ? listSize-1 : 0; TemplateListIntf::ConstIterator *it = list->createIterator(); @@ -3622,7 +3623,6 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> : TemplateNodeCreator<TemplateNodeCreate>(parser,parent,line), m_templateExpr(0), m_fileExpr(0) { TRACE(("TemplateNodeCreate(%s)\n",data.data())); - ExpressionParser ep(parser,line); if (data.isEmpty()) { parser->warn(m_templateName,line,"create tag is missing arguments"); @@ -4979,7 +4979,7 @@ TemplateToken *TemplateParser::takeNextToken() const TemplateToken *TemplateParser::currentToken() const { return m_tokens.getFirst(); -}; +} void TemplateParser::removeNextToken() { diff --git a/src/template.h b/src/template.h index 4602c53..40bd43f 100644 --- a/src/template.h +++ b/src/template.h @@ -355,10 +355,10 @@ class TemplateListIntf virtual ~TemplateListIntf() {} /** Returns the number of elements in the list */ - virtual int count() const = 0; + virtual uint count() const = 0; /** Returns the element at index position \a index. */ - virtual TemplateVariant at(int index) const = 0; + virtual TemplateVariant at(uint index) const = 0; /** Creates a new iterator for this list. * @note the user should call delete on the returned pointer. @@ -377,8 +377,8 @@ class TemplateList : public TemplateListIntf { public: // TemplateListIntf methods - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef(); virtual int release(); @@ -457,6 +457,7 @@ class TemplateStruct : public TemplateStructIntf class TemplateEscapeIntf { public: + virtual ~TemplateEscapeIntf() {} /** Returns the \a input after escaping certain characters */ virtual QCString escape(const QCString &input) = 0; /** Setting tabbing mode on or off (for LaTeX) */ @@ -469,6 +470,7 @@ class TemplateEscapeIntf class TemplateSpacelessIntf { public: + virtual ~TemplateSpacelessIntf() {} /** Returns the \a input after removing redundant whitespace */ virtual QCString remove(const QCString &input) = 0; /** Reset filter state */ diff --git a/src/translator_dk.h b/src/translator_dk.h index 70e9032..df063ef 100644 --- a/src/translator_dk.h +++ b/src/translator_dk.h @@ -1775,7 +1775,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 const char* base, const char* plurSuffix) { QCString result(base); - if (first_capital) result.at(0) = toupper(result.at(0)); + if (first_capital) result[0] = (char)toupper(result[0]); if (!singular) result+=plurSuffix; return result; } diff --git a/src/util.cpp b/src/util.cpp index df1b748..b7dc69d 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1628,34 +1628,6 @@ const ClassDef *getResolvedClass(const Definition *scope, //------------------------------------------------------------------------- //------------------------------------------------------------------------- -static bool findOperator(const QCString &s,int i) -{ - int b = s.findRev("operator",i); - if (b==-1) return FALSE; // not found - b+=8; - while (b<i) // check if there are only spaces in between - // the operator and the > - { - if (!isspace((uchar)s.at(b))) return FALSE; - b++; - } - return TRUE; -} - -static bool findOperator2(const QCString &s,int i) -{ - int b = s.findRev("operator",i); - if (b==-1) return FALSE; // not found - b+=8; - while (b<i) // check if there are only non-ascii - // characters in front of the operator - { - if (isId((uchar)s.at(b))) return FALSE; - b++; - } - return TRUE; -} - static const char constScope[] = { 'c', 'o', 'n', 's', 't', ':' }; static const char virtualScope[] = { 'v', 'i', 'r', 't', 'u', 'a', 'l', ':' }; static const char operatorScope[] = { 'o', 'p', 'e', 'r', 'a', 't', 'o', 'r', '?', '?', '?' }; @@ -1664,30 +1636,30 @@ struct CharAroundSpace { CharAroundSpace() { - charMap['('].before=FALSE; - charMap['='].before=FALSE; - charMap['&'].before=FALSE; - charMap['*'].before=FALSE; - charMap['['].before=FALSE; - charMap['|'].before=FALSE; - charMap['+'].before=FALSE; - charMap[';'].before=FALSE; - charMap[':'].before=FALSE; - charMap['/'].before=FALSE; - - charMap['='].after=FALSE; - charMap[' '].after=FALSE; - charMap['['].after=FALSE; - charMap[']'].after=FALSE; - charMap['\t'].after=FALSE; - charMap['\n'].after=FALSE; - charMap[')'].after=FALSE; - charMap[','].after=FALSE; - charMap['<'].after=FALSE; - charMap['|'].after=FALSE; - charMap['+'].after=FALSE; - charMap['('].after=FALSE; - charMap['/'].after=FALSE; + charMap[static_cast<int>('(')].before=FALSE; + charMap[static_cast<int>('=')].before=FALSE; + charMap[static_cast<int>('&')].before=FALSE; + charMap[static_cast<int>('*')].before=FALSE; + charMap[static_cast<int>('[')].before=FALSE; + charMap[static_cast<int>('|')].before=FALSE; + charMap[static_cast<int>('+')].before=FALSE; + charMap[static_cast<int>(';')].before=FALSE; + charMap[static_cast<int>(':')].before=FALSE; + charMap[static_cast<int>('/')].before=FALSE; + + charMap[static_cast<int>('=')].after=FALSE; + charMap[static_cast<int>(' ')].after=FALSE; + charMap[static_cast<int>('[')].after=FALSE; + charMap[static_cast<int>(']')].after=FALSE; + charMap[static_cast<int>('\t')].after=FALSE; + charMap[static_cast<int>('\n')].after=FALSE; + charMap[static_cast<int>(')')].after=FALSE; + charMap[static_cast<int>(',')].after=FALSE; + charMap[static_cast<int>('<')].after=FALSE; + charMap[static_cast<int>('|')].after=FALSE; + charMap[static_cast<int>('+')].after=FALSE; + charMap[static_cast<int>('(')].after=FALSE; + charMap[static_cast<int>('/')].after=FALSE; } struct CharElem { @@ -2707,165 +2679,6 @@ exit: return prot; } -#ifndef NEWMATCH -// strip any template specifiers that follow className in string s -static QCString trimTemplateSpecifiers( - const QCString &namespaceName, - const QCString &className, - const QCString &s - ) -{ - //printf("trimTemplateSpecifiers(%s,%s,%s)\n",namespaceName.data(),className.data(),s.data()); - QCString scopeName=mergeScopes(namespaceName,className); - ClassDef *cd=getClass(scopeName); - if (cd==0) return s; // should not happen, but guard anyway. - - QCString result=s; - - int i=className.length()-1; - if (i>=0 && className.at(i)=='>') // template specialization - { - // replace unspecialized occurrences in s, with their specialized versions. - int count=1; - int cl=i+1; - while (i>=0) - { - char c=className.at(i); - if (c=='>') count++,i--; - else if (c=='<') { count--; if (count==0) break; } - else i--; - } - QCString unspecClassName=className.left(i); - int l=i; - int p=0; - while ((i=result.find(unspecClassName,p))!=-1) - { - if (result.at(i+l)!='<') // unspecialized version - { - result=result.left(i)+className+result.right(result.length()-i-l); - l=cl; - } - p=i+l; - } - } - - //printf("result after specialization: %s\n",result.data()); - - QCString qualName=cd->qualifiedNameWithTemplateParameters(); - //printf("QualifiedName = %s\n",qualName.data()); - // We strip the template arguments following className (if any) - if (!qualName.isEmpty()) // there is a class name - { - int is,ps=0; - int p=0,l,i; - - while ((is=getScopeFragment(qualName,ps,&l))!=-1) - { - QCString qualNamePart = qualName.right(qualName.length()-is); - //printf("qualNamePart=%s\n",qualNamePart.data()); - while ((i=result.find(qualNamePart,p))!=-1) - { - int ql=qualNamePart.length(); - result=result.left(i)+cd->name()+result.right(result.length()-i-ql); - p=i+cd->name().length(); - } - ps=is+l; - } - } - //printf("result=%s\n",result.data()); - - return result.stripWhiteSpace(); -} - -/*! - * @param pattern pattern to look for - * @param s string to search in - * @param p position to start - * @param len resulting pattern length - * @returns position on which string is found, or -1 if not found - */ -static int findScopePattern(const QCString &pattern,const QCString &s, - int p,int *len) -{ - int sl=s.length(); - int pl=pattern.length(); - int sp=0; - *len=0; - while (p<sl) - { - sp=p; // start of match - int pp=0; // pattern position - while (p<sl && pp<pl) - { - if (s.at(p)=='<') // skip template arguments while matching - { - int bc=1; - //printf("skipping pos=%d c=%c\n",p,s.at(p)); - p++; - while (p<sl) - { - if (s.at(p)=='<') bc++; - else if (s.at(p)=='>') - { - bc--; - if (bc==0) - { - p++; - break; - } - } - //printf("skipping pos=%d c=%c\n",p,s.at(p)); - p++; - } - } - else if (s.at(p)==pattern.at(pp)) - { - //printf("match at position p=%d pp=%d c=%c\n",p,pp,s.at(p)); - p++; - pp++; - } - else // no match - { - //printf("restarting at %d c=%c pat=%s\n",p,s.at(p),pattern.data()); - p=sp+1; - break; - } - } - if (pp==pl) // whole pattern matches - { - *len=p-sp; - return sp; - } - } - return -1; -} - -static QCString trimScope(const QCString &name,const QCString &s) -{ - int scopeOffset=name.length(); - QCString result=s; - do // for each scope - { - QCString tmp; - QCString scope=name.left(scopeOffset)+"::"; - //printf("Trying with scope='%s'\n",scope.data()); - - int i,p=0,l; - while ((i=findScopePattern(scope,result,p,&l))!=-1) // for each occurrence - { - tmp+=result.mid(p,i-p); // add part before pattern - p=i+l; - } - tmp+=result.right(result.length()-p); // add trailing part - - scopeOffset=name.findRev("::",scopeOffset-1); - result = tmp; - } while (scopeOffset>0); - //printf("trimScope(name=%s,scope=%s)=%s\n",name.data(),s.data(),result.data()); - return result; -} -#endif - void trimBaseClassScope(BaseClassList *bcl,QCString &s,int level=0) { //printf("trimBaseClassScope level=%d '%s'\n",level,s.data()); @@ -3032,276 +2845,6 @@ void stripIrrelevantConstVolatile(QCString &s) //#define MATCH printf("Match at line %d\n",__LINE__); //#define NOMATCH printf("Nomatch at line %d\n",__LINE__); -#ifndef NEWMATCH -static bool matchArgument(const Argument *srcA,const Argument *dstA, - const QCString &className, - const QCString &namespaceName, - NamespaceSDict *usingNamespaces, - SDict<Definition> *usingClasses) -{ - //printf("match argument start '%s|%s' <-> '%s|%s' using nsp=%p class=%p\n", - // srcA->type.data(),srcA->name.data(), - // dstA->type.data(),dstA->name.data(), - // usingNamespaces, - // usingClasses); - - // TODO: resolve any typedefs names that are part of srcA->type - // before matching. This should use className and namespaceName - // and usingNamespaces and usingClass to determine which typedefs - // are in-scope, so it will not be very efficient :-( - - QCString srcAType=trimTemplateSpecifiers(namespaceName,className,srcA->type); - QCString dstAType=trimTemplateSpecifiers(namespaceName,className,dstA->type); - QCString srcAName=srcA->name.stripWhiteSpace(); - QCString dstAName=dstA->name.stripWhiteSpace(); - srcAType.stripPrefix("class "); - dstAType.stripPrefix("class "); - - // allow distinguishing "const A" from "const B" even though - // from a syntactic point of view they would be two names of the same - // type "const". This is not fool prove of course, but should at least - // catch the most common cases. - if ((srcAType=="const" || srcAType=="volatile") && !srcAName.isEmpty()) - { - srcAType+=" "; - srcAType+=srcAName; - } - if ((dstAType=="const" || dstAType=="volatile") && !dstAName.isEmpty()) - { - dstAType+=" "; - dstAType+=dstAName; - } - if (srcAName=="const" || srcAName=="volatile") - { - srcAType+=srcAName; - srcAName.resize(0); - } - else if (dstA->name=="const" || dstA->name=="volatile") - { - dstAType+=dstA->name; - dstAName.resize(0); - } - - stripIrrelevantConstVolatile(srcAType); - stripIrrelevantConstVolatile(dstAType); - - // strip typename keyword - if (qstrncmp(srcAType,"typename ",9)==0) - { - srcAType = srcAType.right(srcAType.length()-9); - } - if (qstrncmp(dstAType,"typename ",9)==0) - { - dstAType = dstAType.right(dstAType.length()-9); - } - - srcAType = removeRedundantWhiteSpace(srcAType); - dstAType = removeRedundantWhiteSpace(dstAType); - - //srcAType=stripTemplateSpecifiersFromScope(srcAType,FALSE); - //dstAType=stripTemplateSpecifiersFromScope(dstAType,FALSE); - - //printf("srcA='%s|%s' dstA='%s|%s'\n",srcAType.data(),srcAName.data(), - // dstAType.data(),dstAName.data()); - - if (srcA->array!=dstA->array) // nomatch for char[] against char - { - NOMATCH - return FALSE; - } - if (srcAType!=dstAType) // check if the argument only differs on name - { - - // remove a namespace scope that is only in one type - // (assuming a using statement was used) - //printf("Trimming %s<->%s: %s\n",srcAType.data(),dstAType.data(),namespaceName.data()); - //trimNamespaceScope(srcAType,dstAType,namespaceName); - //printf("After Trimming %s<->%s\n",srcAType.data(),dstAType.data()); - - //QCString srcScope; - //QCString dstScope; - - // strip redundant scope specifiers - if (!className.isEmpty()) - { - srcAType=trimScope(className,srcAType); - dstAType=trimScope(className,dstAType); - //printf("trimScope: '%s' <=> '%s'\n",srcAType.data(),dstAType.data()); - ClassDef *cd; - if (!namespaceName.isEmpty()) - cd=getClass(namespaceName+"::"+className); - else - cd=getClass(className); - if (cd && cd->baseClasses()) - { - trimBaseClassScope(cd->baseClasses(),srcAType); - trimBaseClassScope(cd->baseClasses(),dstAType); - } - //printf("trimBaseClassScope: '%s' <=> '%s'\n",srcAType.data(),dstAType.data()); - } - if (!namespaceName.isEmpty()) - { - srcAType=trimScope(namespaceName,srcAType); - dstAType=trimScope(namespaceName,dstAType); - } - //printf("#usingNamespace=%d\n",usingNamespaces->count()); - if (usingNamespaces && usingNamespaces->count()>0) - { - NamespaceSDict::Iterator nli(*usingNamespaces); - NamespaceDef *nd; - for (;(nd=nli.current());++nli) - { - srcAType=trimScope(nd->name(),srcAType); - dstAType=trimScope(nd->name(),dstAType); - } - } - //printf("#usingClasses=%d\n",usingClasses->count()); - if (usingClasses && usingClasses->count()>0) - { - SDict<Definition>::Iterator cli(*usingClasses); - Definition *cd; - for (;(cd=cli.current());++cli) - { - srcAType=trimScope(cd->name(),srcAType); - dstAType=trimScope(cd->name(),dstAType); - } - } - - //printf("2. srcA=%s|%s dstA=%s|%s\n",srcAType.data(),srcAName.data(), - // dstAType.data(),dstAName.data()); - - if (!srcAName.isEmpty() && !dstA->type.isEmpty() && - (srcAType+" "+srcAName)==dstAType) - { - MATCH - return TRUE; - } - else if (!dstAName.isEmpty() && !srcA->type.isEmpty() && - (dstAType+" "+dstAName)==srcAType) - { - MATCH - return TRUE; - } - - - uint srcPos=0,dstPos=0; - bool equal=TRUE; - while (srcPos<srcAType.length() && dstPos<dstAType.length() && equal) - { - equal=srcAType.at(srcPos)==dstAType.at(dstPos); - if (equal) srcPos++,dstPos++; - } - uint srcATypeLen=srcAType.length(); - uint dstATypeLen=dstAType.length(); - if (srcPos<srcATypeLen && dstPos<dstATypeLen) - { - // if nothing matches or the match ends in the middle or at the - // end of a string then there is no match - if (srcPos==0 || dstPos==0) - { - NOMATCH - return FALSE; - } - if (isId(srcAType.at(srcPos)) && isId(dstAType.at(dstPos))) - { - //printf("partial match srcPos=%d dstPos=%d!\n",srcPos,dstPos); - // check if a name if already found -> if no then there is no match - if (!srcAName.isEmpty() || !dstAName.isEmpty()) - { - NOMATCH - return FALSE; - } - // types only - while (srcPos<srcATypeLen && isId(srcAType.at(srcPos))) srcPos++; - while (dstPos<dstATypeLen && isId(dstAType.at(dstPos))) dstPos++; - if (srcPos<srcATypeLen || - dstPos<dstATypeLen || - (srcPos==srcATypeLen && dstPos==dstATypeLen) - ) - { - NOMATCH - return FALSE; - } - } - else - { - // otherwise we assume that a name starts at the current position. - while (srcPos<srcATypeLen && isId(srcAType.at(srcPos))) srcPos++; - while (dstPos<dstATypeLen && isId(dstAType.at(dstPos))) dstPos++; - - // if nothing more follows for both types then we assume we have - // found a match. Note that now 'signed int' and 'signed' match, but - // seeing that int is not a name can only be done by looking at the - // semantics. - - if (srcPos!=srcATypeLen || dstPos!=dstATypeLen) - { - NOMATCH - return FALSE; - } - } - } - else if (dstPos<dstAType.length()) - { - if (!isspace((uchar)dstAType.at(dstPos))) // maybe the names differ - { - if (!dstAName.isEmpty()) // dst has its name separated from its type - { - NOMATCH - return FALSE; - } - while (dstPos<dstAType.length() && isId(dstAType.at(dstPos))) dstPos++; - if (dstPos!=dstAType.length()) - { - NOMATCH - return FALSE; // more than a difference in name -> no match - } - } - else // maybe dst has a name while src has not - { - dstPos++; - while (dstPos<dstAType.length() && isId(dstAType.at(dstPos))) dstPos++; - if (dstPos!=dstAType.length() || !srcAName.isEmpty()) - { - NOMATCH - return FALSE; // nope not a name -> no match - } - } - } - else if (srcPos<srcAType.length()) - { - if (!isspace((uchar)srcAType.at(srcPos))) // maybe the names differ - { - if (!srcAName.isEmpty()) // src has its name separated from its type - { - NOMATCH - return FALSE; - } - while (srcPos<srcAType.length() && isId(srcAType.at(srcPos))) srcPos++; - if (srcPos!=srcAType.length()) - { - NOMATCH - return FALSE; // more than a difference in name -> no match - } - } - else // maybe src has a name while dst has not - { - srcPos++; - while (srcPos<srcAType.length() && isId(srcAType.at(srcPos))) srcPos++; - if (srcPos!=srcAType.length() || !dstAName.isEmpty()) - { - NOMATCH - return FALSE; // nope not a name -> no match - } - } - } - } - MATCH - return TRUE; -} - -#endif - static QCString stripDeclKeywords(const QCString &s) { int i=s.find(" class "); @@ -3869,7 +3412,6 @@ static void findMembersWithSpecificName(MemberName *mn, ) { bool match=TRUE; - ArgumentList *argList=0; if (args && !md->isDefine() && qstrcmp(args,"()")!=0) { const ArgumentList &mdAl = md->argumentList(); @@ -4760,7 +4302,7 @@ bool resolveLink(/* in */ const char *scName, } else if ((pd=Doxygen::pageSDict->find(linkRef))) // link to a page { - const GroupDef *gd = pd->getGroupDef(); + gd = pd->getGroupDef(); if (gd) { if (!pd->name().isEmpty()) si=SectionManager::instance().find(pd->name()); @@ -4951,7 +4493,7 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) const int maxAddrSize = 20; char addr[maxAddrSize]; - qsnprintf(addr,maxAddrSize,"%p:",fnDict); + qsnprintf(addr,maxAddrSize,"%p:",(void*)fnDict); QCString key = addr; key+=n; @@ -5402,7 +4944,7 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor else { growBuf.addChar('_'); - growBuf.addChar(tolower(c)); + growBuf.addChar((char)tolower(c)); } break; } @@ -5462,7 +5004,7 @@ QCString unescapeCharsInString(const char *s) default: if (!caseSenseNames && c>='a' && c<='z') // lower to upper case escape, _a -> 'A' { - result+=toupper(*p); + result+=(char)toupper(*p); p++; } else // unknown escape, pass underscore character as-is @@ -6347,7 +5889,6 @@ QCString substituteTemplateArgumentsInString( { result += name.mid(p,i-p); QCString n = name.mid(i,l); - auto formIt = formalArgs.begin(); auto actIt = actualArgs.begin(); // if n is a template argument, then we substitute it @@ -6570,7 +6111,7 @@ int getScopeFragment(const QCString &s,int p,int *l) while (sp<sl && !done) { // TODO: deal with << and >> operators! - char c=s.at(sp++); + c=s.at(sp++); switch(c) { case '<': count++; break; @@ -7480,7 +7021,7 @@ const char *writeUtf8Char(FTextStream &t,const char *s) return s; } -int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos) +int nextUtf8CharPosition(const QCString &utf8Str,uint len,uint startPos) { int bytes=1; if (startPos>=len) return len; @@ -7604,7 +7145,7 @@ static int findEndOfCommand(const char *s) QCString args = extractAliasArgs(p,0); i+=args.length(); } - i+=p-s; + i+=(int)(p-s); } return i; } @@ -442,7 +442,7 @@ bool patternMatch(const QFileInfo &fi,const QStrList *patList); QCString externalLinkTarget(const bool parent = false); QCString externalRef(const QCString &relPath,const QCString &ref,bool href); -int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos); +int nextUtf8CharPosition(const QCString &utf8Str,uint len,uint startPos); const char *writeUtf8Char(FTextStream &t,const char *s); diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 7350bfe..808e5a2 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -53,6 +53,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 + +#define USE_STATE2STRING 0 // Toggle for some debugging info //#define DBG_CTX(x) fprintf x @@ -116,7 +118,10 @@ static bool writeColoredWord(QCString& word ); static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName, bool typeOnly=FALSE, const char *curr_class=0); static void endFontClass(); static void startFontClass(const char *s); + +#if USE_STATE2STRING static const char *stateToString(int state); +#endif //------------------------------------------------------------------- @@ -855,7 +860,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI generateMemLink(*g_code,g_PortMapComp,s1); while (index++<t1.size()) { - char cc=t1.at(index); + cc=t1.at(index); if (cc==' ' || cc=='\t') { char c2[2]; @@ -1647,5 +1652,7 @@ void codeFreeVhdlScanner() #endif } +#if USE_STATE2STRING #include "vhdlcode.l.h" +#endif diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index dfd2aa1..db4f658 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -70,7 +70,6 @@ static QDict<QCString> g_vhdlKeyDict3(17,FALSE); static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCString & fileName,QCString & brief); static void writeUCFLink(const MemberDef* mdef,OutputList &ol); -static void assignBinding(VhdlConfNode* conf); static void addInstance(ClassDef* entity, ClassDef* arch, ClassDef *inst, const std::shared_ptr<Entry> &cur); @@ -768,22 +767,22 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem Definition *d = cd->getOuterScope(); QCString tt=d->name(); - ClassDef *ecd =getClass(tt); - if (!ecd) + ClassDef *acd =getClass(tt); + if (!acd) { tt=tt.upper(); - ecd =getClass(tt); + acd =getClass(tt); } - if (!ecd) + if (!acd) { tt=tt.lower(); - ecd =getClass(tt); + acd =getClass(tt); } - if (ecd) //d && d->definitionType()==Definition::TypeClass) + if (acd) //d && d->definitionType()==Definition::TypeClass) { - if(!packages.contains(ecd)) + if(!packages.contains(acd)) { - VhdlDocGen::findAllPackages(ecd); + VhdlDocGen::findAllPackages(acd); } } } @@ -1154,7 +1153,6 @@ void VhdlDocGen::parseFuncProto(const char* text,QCString& name,QCString& ret,bo } else { - QCString s1(text); s1=s1.stripWhiteSpace(); int i=s1.find("(",0,FALSE); int s=s1.find(QRegExp("[ \\t]")); @@ -2455,10 +2453,10 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b { if (altera) { - int i=temp.find("-name"); - if (i>0) + int in=temp.find("-name"); + if (in>0) { - temp=temp.remove(0,i+5); + temp=temp.remove(0,in+5); } temp.stripPrefix("set_location_assignment"); @@ -2468,8 +2466,8 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b else { QRegExp ee("[\\s=]"); - int i=temp.find(ee); - QCString ff=temp.left(i); + int in=temp.find(ee); + QCString ff=temp.left(in); temp.stripPrefix(ff.data()); ff.append("#"); if (!temp.isEmpty()) @@ -2684,111 +2682,6 @@ QCString VhdlDocGen::parseForBinding(QCString & entity,QCString & arch) } -//@param arch bit0:flipflop -//@param binding e.g entity work.foo(bar) -//@param label |label0|label1 -// label0:architecture name -//@param confVhdl of configuration file (identifier::entity_name) or -// the architecture if isInlineConf TRUE -//@param isInlineConf -//@param confN List of configurations - -void assignBinding(VhdlConfNode * conf) -{ - ClassDef *archClass=0,*entClass=0; - QCString archName; - QCString arcBind,entBind; - - bool others,all; - entBind=conf->binding; - QCString conf2=VhdlDocGen::parseForBinding(entBind,arcBind); - - if (conf2!="configuration") - { - QCString a,c,e; - if (conf->isInlineConf) - { - c=conf->confVhdl; - e=VhdlDocGen::getIndexWord(conf->confVhdl.data(),0); - } - else - { - a=VhdlDocGen::getIndexWord(conf->compSpec.data(),0); - e=VhdlDocGen::getIndexWord(conf->confVhdl.data(),1); - c=e+"::"+a; - } - archClass= VhdlDocGen::findVhdlClass(c.data());//Doxygen::classSDict->find(a.data()); - entClass= VhdlDocGen::findVhdlClass(e.data()); //Doxygen::classSDict->find(e.data()); - } - - QCString label=conf->compSpec.lower(); - //label.prepend("|"); - - if (!archClass) - { - // err("architecture %s not found ! ",conf->confVhdl.data()); - return; - } - - archName=archClass->name(); - QCString allOt=VhdlDocGen::getIndexWord(conf->arch.data(),0); - all=allOt.lower()=="all" ; - others= allOt.lower()=="others"; - - for (const auto &cur : getVhdlInstList()) - { - if (cur->exception.lower()==label || conf->isInlineConf) - { - QCString archy; - - if (all || others) - { - archy=VhdlDocGen::getIndexWord(conf->arch.data(),1); - } - else - { - archy=conf->arch; - } - - QCString inst1=VhdlDocGen::getIndexWord(archy.data(),0).lower(); - QCString comp=VhdlDocGen::getIndexWord(archy.data(),1).lower(); - - QCStringList ql=QCStringList::split(",",inst1); - - for (uint j=0;j<ql.count();j++) - { - QCString archy1,sign1; - if (all || others) - { - archy1=VhdlDocGen::getIndexWord(conf->arch.data(),1); - sign1=cur->type; - } - else - { - archy1=comp+":"+ql[j]; - sign1=cur->type+":"+cur->name; - } - - if (archy1==sign1.lower() && !cur->stat) - { - // fprintf(stderr," \n label [%s] [%s] [%s]",cur->exception.data(),cur->type.data(),cur->name.data()); - ClassDef *ent= VhdlDocGen::findVhdlClass(entBind.data());//Doxygen::classSDict->find(entBind.data()); - - if (entClass==0 || ent==0) - { - continue; - } - - addInstance(ent,archClass,entClass,cur); - cur->stat=TRUE; - break; - } - }// for - } - }//for each element in instList - -}//assignBinding - /* // file foo.vhd @@ -3880,7 +3773,7 @@ void FlowChart::writeShape(FTextStream &t,const FlowChart* fl) else { if (fl->text.isEmpty()) return; - bool var=(fl->type & FlowChart::VARIABLE_NO); + bool isVar=(fl->type & FlowChart::VARIABLE_NO); QCString q=fl->text; if (exit) @@ -3896,7 +3789,7 @@ void FlowChart::writeShape(FTextStream &t,const FlowChart* fl) } t << "[shape=none margin=0.1, label=<\n"; t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n "; - if (var) + if (isVar) { t << "<TR><TD BGCOLOR=\"" << flowCol.varNode << "\" > "; } diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index 22e2e01..725349e 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -731,8 +731,8 @@ void VHDLOutlineParser::error_skipto(int kind) Token *op; do { - Token *t = p->vhdlParser->getNextToken();// step to next token - op=p->vhdlParser->getToken(1); // get first token + p->vhdlParser->getNextToken(); // step to next token + op=p->vhdlParser->getToken(1); // get first token if (op==0) break; //fprintf(stderr,"\n %s",t->image.data()); } while (op->kind != kind); diff --git a/src/xmlcode.l b/src/xmlcode.l index edc98d5..b583bf5 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -72,7 +72,9 @@ static MemberDef * g_currentMemberDef; static bool g_includeCodeFragment; static const char * g_currentFontClass; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static void codify(const char* text) { @@ -438,4 +440,6 @@ void XMLCodeParser::resetCodeParserState() resetXmlCodeParserState(); } +#if USE_STATE2STRING #include "xmlcode.l.h" +#endif diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 21fa77e..33426a7 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -1,9 +1,6 @@ /****************************************************************************** * - * - * - * - * Copyright (C) 1997-2015 by Dimitri van Heesch. + * Copyright (C) 1997-2020 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby @@ -1084,10 +1081,10 @@ void XmlDocVisitor::visitPre(DocParamList *pl) { if (pl->paramTypes().count()>0) { - QListIterator<DocNode> li(pl->paramTypes()); + QListIterator<DocNode> li2(pl->paramTypes()); DocNode *type; m_t << "<parametertype>"; - for (li.toFirst();(type=li.current());++li) + for (li2.toFirst();(type=li2.current());++li2) { if (type->kind()==DocNode::Kind_Word) { diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index d674ed8..bca5f7b 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -1007,7 +1007,6 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream if (mdict) { MemberSDict::Iterator mdi(*mdict); - const MemberDef *rmd; for (mdi.toFirst();(rmd=mdi.current());++mdi) { writeMemberReference(t,def,rmd,"references"); @@ -1017,7 +1016,6 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream if (mdict) { MemberSDict::Iterator mdi(*mdict); - const MemberDef *rmd; for (mdi.toFirst();(rmd=mdi.current());++mdi) { writeMemberReference(t,def,rmd,"referencedby"); diff --git a/vhdlparser/vhdlstring.h b/vhdlparser/vhdlstring.h index a8dfc72..59e9e22 100755 --- a/vhdlparser/vhdlstring.h +++ b/vhdlparser/vhdlstring.h @@ -123,9 +123,6 @@ class VhdlString int m_len; }; -// declare it static otherwise we will get: -// multiple definition of `operator+(char const*, VhdlString)' -// as we are in an include file -static VhdlString operator+ (const char *s, VhdlString v) { return VhdlString(s).append(v); } +inline VhdlString operator+ (const char *s, VhdlString v) { return VhdlString(s).append(v); } #endif |