From a31c9fffec6b5145ac8509d77da826d2e196ed1e Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 25 Oct 2014 19:09:31 +0200 Subject: Compilation fixes for Windows for new string implementation. --- qtools/qcstring.cpp | 28 ++++++++++++++-------------- src/definition.cpp | 6 +++--- src/htmlgen.cpp | 4 ++-- src/tclscanner.l | 10 +++++++--- src/util.cpp | 4 ++-- winbuild/qtools.vcproj | 6 +----- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/qtools/qcstring.cpp b/qtools/qcstring.cpp index 16c168b..2f622df 100644 --- a/qtools/qcstring.cpp +++ b/qtools/qcstring.cpp @@ -31,7 +31,7 @@ QCString &QCString::sprintf( const char *format, ... ) const int minlen=256; if (length()len) return -1; // bad index @@ -133,11 +133,11 @@ int QCString::findRev( const char *str, int index, bool cs) const register char *pos = data()+index; if (cs) // case sensitive { - for (int i=index; i>=0; i--) if (strncmp(pos--,str,slen)==0) return i; + for (int i=index; i>=0; i--) if (qstrncmp(pos--,str,slen)==0) return i; } else // case insensitive { - for (int i=index; i>=0; i--) if (strncasecmp(pos,str,slen)==0) return i; + for (int i=index; i>=0; i--) if (qstrnicmp(pos,str,slen)==0) return i; } return -1; } @@ -174,16 +174,16 @@ int QCString::contains( const char *str, bool cs ) const if (str==0 || length()==0) return 0; int count=0; const char *pos = data(); - int len = strlen(str); + int len = qstrlen(str); while (*pos) { if (cs) { - if (strncmp(pos,str,len)==0) count++; + if (qstrncmp(pos,str,len)==0) count++; } else { - if (strncasecmp(pos,str,len)==0) count++; + if (qstrnicmp(pos,str,len)==0) count++; } pos++; } @@ -199,8 +199,8 @@ int QCString::contains( const QRegExp &rx ) const bool QCString::stripPrefix(const char *prefix) { if (prefix==0 || length()==0) return FALSE; - int len = strlen(prefix); - if (strncmp(prefix,data(),len)==0) + int len = qstrlen(prefix); + if (qstrncmp(prefix,data(),len)==0) { int newlen = length()-len+1; qmemmove(data(),data()+len,newlen); @@ -247,7 +247,7 @@ QCString QCString::mid( uint index, uint len) const { int slen = length(); if (len==0xffffffff) len = slen-index; - if (isEmpty() || (int)index>=slen) + if (isEmpty() || (int)index>=slen || len==0) { return QCString(); } @@ -255,7 +255,7 @@ QCString QCString::mid( uint index, uint len) const { register char *p = data()+index; QCString s(len+1); - memcpy(s.data(),p,len); + qstrncpy( s.data(), p, len+1 ); return s; } } @@ -541,7 +541,7 @@ char *qstrdup( const char *str ) { if ( !str ) return 0; - char *dst = new char[strlen(str)+1]; + char *dst = new char[qstrlen(str)+1]; CHECK_PTR( dst ); return strcpy( dst, str ); } diff --git a/src/definition.cpp b/src/definition.cpp index 4a8c65d..4491bc4 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -896,11 +896,11 @@ QCString Definition::getSourceAnchor() const { if (Htags::useHtags) { - snprintf(anchorStr,maxAnchorStrLen,"L%d",m_impl->body->startLine); + qsnprintf(anchorStr,maxAnchorStrLen,"L%d",m_impl->body->startLine); } else { - snprintf(anchorStr,maxAnchorStrLen,"l%05d",m_impl->body->startLine); + qsnprintf(anchorStr,maxAnchorStrLen,"l%05d",m_impl->body->startLine); } } return anchorStr; @@ -1166,7 +1166,7 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, } const int maxLineNrStr = 10; char anchorStr[maxLineNrStr]; - snprintf(anchorStr,maxLineNrStr,"l%05d",md->getStartBodyLine()); + qsnprintf(anchorStr,maxLineNrStr,"l%05d",md->getStartBodyLine()); //printf("Write object link to %s\n",md->getBodyDef()->getSourceFileBase().data()); ol.writeObjectLink(0,md->getBodyDef()->getSourceFileBase(),anchorStr,name); ol.popGeneratorState(); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index b459446..1ee3c16 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -1311,8 +1311,8 @@ void HtmlCodeGenerator::writeLineNumber(const char *ref,const char *filename, const int maxLineNrStr = 10; char lineNumber[maxLineNrStr]; char lineAnchor[maxLineNrStr]; - snprintf(lineNumber,maxLineNrStr,"%5d",l); - snprintf(lineAnchor,maxLineNrStr,"l%05d",l); + qsnprintf(lineNumber,maxLineNrStr,"%5d",l); + qsnprintf(lineAnchor,maxLineNrStr,"l%05d",l); m_t << "
"; m_t << ""; diff --git a/src/tclscanner.l b/src/tclscanner.l index 88e3d1d..f162637 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -2833,14 +2833,18 @@ tcl_inf("TCL_SUBST: use '%s'\n",s); } } - if (tcl.input_string.at(tcl.input_string.length()-1) == '\n') + if (tcl.input_string.at(tcl.input_string.length()-1) == 0x1A) + { + } + else if (tcl.input_string.at(tcl.input_string.length()-1) == '\n') { tcl.input_string[tcl.input_string.length()-1] = 0x1A; - } - else + } + else { tcl.input_string += 0x1A; } + tcl.code = NULL; tcl.code_font=NULL; tcl.code_line=1; diff --git a/src/util.cpp b/src/util.cpp index 666fd04..bc39cfb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -266,7 +266,7 @@ QCString generateMarker(int id) { const int maxMarkerStrLen = 20; char result[maxMarkerStrLen]; - snprintf(result,maxMarkerStrLen,"@%d",id); + qsnprintf(result,maxMarkerStrLen,"@%d",id); return result; } @@ -4916,7 +4916,7 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) const int maxAddrSize = 20; char addr[maxAddrSize]; - snprintf(addr,maxAddrSize,"%p:",fnDict); + qsnprintf(addr,maxAddrSize,"%p:",fnDict); QCString key = addr; key+=n; diff --git a/winbuild/qtools.vcproj b/winbuild/qtools.vcproj index adc1ba9..6e94d3f 100644 --- a/winbuild/qtools.vcproj +++ b/winbuild/qtools.vcproj @@ -1328,7 +1328,7 @@ - - -- cgit v0.12