From fbebfae209139fccb15fde8fb7d1bdbb4b941875 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 2 Mar 2020 20:10:51 +0100 Subject: Fix a number of compiler warnings in the 64bit build for Windows --- addon/doxysearch/doxyindexer.cpp | 4 ++-- addon/doxysearch/doxysearch.cpp | 42 ++++++++++++++++++++-------------------- libmscgen/gd.c | 4 ++-- libmscgen/mscgen_api.c | 17 ++++++++-------- libmscgen/mscgen_gd_out.c | 2 +- libmscgen/mscgen_language.y | 2 +- qtools/qcstring.h | 2 +- qtools/qdatastream.cpp | 10 +++++----- src/classlist.cpp | 4 ++-- src/commentscan.l | 4 ++-- src/definition.cpp | 20 +++++++++---------- src/doctokenizer.l | 6 +++--- src/formula.cpp | 2 +- src/fortrancode.l | 6 +++--- src/fortranscanner.l | 14 +++++++------- src/htmlgen.cpp | 10 ++++++++-- src/message.cpp | 2 +- src/pre.l | 12 ++++++------ src/pycode.l | 4 ++-- src/section.h | 2 +- src/util.cpp | 2 +- src/vhdldocgen.cpp | 8 ++++---- vhdlparser/vhdlstring.h | 4 ++-- 23 files changed, 95 insertions(+), 88 deletions(-) diff --git a/addon/doxysearch/doxyindexer.cpp b/addon/doxysearch/doxyindexer.cpp index 12d3e9a..df596a2 100644 --- a/addon/doxysearch/doxyindexer.cpp +++ b/addon/doxysearch/doxyindexer.cpp @@ -52,7 +52,7 @@ static std::string trim(const std::string& str, return ""; // no content size_t strEnd = str.find_last_not_of(whitespace); - int strRange = strEnd - strBegin + 1; + size_t strRange = strEnd - strBegin + 1; return str.substr(strBegin, strRange); } @@ -72,7 +72,7 @@ static std::string reduce(const std::string& str, while (beginSpace != std::string::npos) { size_t endSpace = result.find_first_not_of(whitespace, beginSpace); - int range = endSpace - beginSpace; + size_t range = endSpace - beginSpace; result.replace(beginSpace, range, fill); diff --git a/addon/doxysearch/doxysearch.cpp b/addon/doxysearch/doxysearch.cpp index 98adab4..4c4dc72 100644 --- a/addon/doxysearch/doxysearch.cpp +++ b/addon/doxysearch/doxysearch.cpp @@ -76,7 +76,7 @@ static std::string uriDecode(const std::string & sSrc) // (0-9, A-F) are reserved for future extension" const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); - const int SRC_LEN = sSrc.length(); + const size_t SRC_LEN = sSrc.length(); const unsigned char * const SRC_END = pSrc + SRC_LEN; // last decodable '%' const unsigned char * const SRC_LAST_DEC = SRC_END - 2; @@ -140,9 +140,9 @@ T fromString(const std::string& s) /** Class that holds the starting position of a word */ struct WordPosition { - WordPosition(int s,int i) : start(s), index(i) {} - int start; - int index; + WordPosition(size_t s,size_t i) : start(s), index(i) {} + size_t start; + size_t index; }; /** Class representing the '<' operator for WordPosition objects based on position. */ @@ -174,20 +174,20 @@ struct Fragment_greater /** Class representing a range within a string */ struct Range { - Range(int s,int e) : start(s), end(e) {} - int start; - int end; + Range(size_t s,size_t e) : start(s), end(e) {} + size_t start; + size_t end; }; /** Returns true if [start..start+len] is inside one of the \a ranges. */ -static bool insideRange(const std::vector &ranges,int start,int len) +static bool insideRange(const std::vector &ranges,size_t start,size_t len) { for (std::vector::const_iterator it = ranges.begin(); it!=ranges.end(); ++it ) { Range r = *it; - if (start>=r.start && start+len=r.start && start+len"; const std::string spanEnd=""; const std::string dots="..."; - const int fragLen = 60; - int sl=s.length(); + const size_t fragLen = 60; + size_t sl=s.length(); // find positions of words in s - size_t j=0; + int j=0; std::vector positions; for (std::vector::const_iterator it=words.begin(); it!=words.end(); ++it,++j ) { - int pos=0; + size_t pos=0; size_t i; std::string word = *it; while ((i=s.find(word,pos))!=std::string::npos) @@ -236,8 +236,8 @@ static void highlighter(const std::string &s, { WordPosition wp = *it; std::string w = words[wp.index]; - int i=wp.start; - int wl=w.length(); + size_t i=wp.start; + size_t wl=w.length(); if (!insideRange(ranges,i,wl)) { if (wl>fragLen) @@ -248,8 +248,8 @@ static void highlighter(const std::string &s, else { std::string startFragment,endFragment; - int bi=i-(fragLen-wl)/2; - int ei=i+wl+(fragLen-wl)/2; + size_t bi=i-(fragLen-wl)/2; + size_t ei=i+wl+(fragLen-wl)/2; int occ=0; if (bi<0) { ei-=bi; bi=0; } else startFragment=dots; if (ei>sl) { ei=sl; } else endFragment=dots; @@ -257,14 +257,14 @@ static void highlighter(const std::string &s, while (ei::const_iterator it2=positions.begin(); it2!=positions.end(); ++it2) { WordPosition wp2 = *it2; std::string w2 = words[wp2.index]; - int wl2 = w2.length(); + size_t wl2 = w2.length(); if (wp2.start>=bi && wp2.start+wl2<=ei) // word is inside the range! { fragment+=s.substr(pos,wp2.start-pos)+ @@ -288,10 +288,10 @@ static void highlighter(const std::string &s, static std::string escapeString(const std::string &s) { std::stringstream dst; - for (unsigned int i=0;iw; @@ -1982,7 +1982,7 @@ BGD_DECLARE(void) gdImageStringUp (gdImagePtr im, gdFontPtr f, { int i; int l; - l = strlen ((char *) s); + l = (int)strlen((char *) s); for (i = 0; (i < l); i++) { gdImageCharUp (im, f, x, y, s[i], color); y -= f->w; diff --git a/libmscgen/mscgen_api.c b/libmscgen/mscgen_api.c index b28d653..376b9d8 100644 --- a/libmscgen/mscgen_api.c +++ b/libmscgen/mscgen_api.c @@ -300,7 +300,7 @@ static char *splitStringToWidth(Context *ctx, char *l, unsigned int width) /* Copy the remaining line to the start of the string */ m = 0; - n = (p - l); + n = (int)(p - l); while (isspace(orig[n]) && orig[n] != '\0') { @@ -390,7 +390,7 @@ static unsigned int computeLabelLines(Context *ctx, char *nextLine = strstr(label, "\\n"); if (nextLine) { - const int lineLen = nextLine - label; + const int lineLen = (int)(nextLine - label); /* Allocate storage and duplicate the line */ retLines[c] = malloc_s(lineLen + 1); @@ -633,11 +633,11 @@ static char *getLine(const char *string, /* Determine the length of the line */ if(lineEnd != NULL) { - lineLen = lineEnd - lineStart; + lineLen = (unsigned int)(lineEnd - lineStart); } else { - lineLen = strlen(string) - (lineStart - string); + lineLen = (unsigned int)(strlen(string) - (lineStart - string)); } /* Clamp the length to the buffer */ @@ -1328,8 +1328,8 @@ static void arcLine(Context *ctx, hasArrows = FALSE; /* Get co-ordinates of the arc end-point */ - ADrawComputeArcPoint(sx, y - 1, ctx->opts.entitySpacing - 8, - ctx->opts.loopArcHeight, 180.0f - 45.0f, + ADrawComputeArcPoint((float)sx, (float)(y - 1), (float)(ctx->opts.entitySpacing - 8), + (float)ctx->opts.loopArcHeight, 180.0f - 45.0f, &px, &py); /* Draw a cross */ @@ -1392,8 +1392,9 @@ static void arcLine(Context *ctx, hasArrows = FALSE; /* Get co-ordinates of the arc end-point */ - ADrawComputeArcPoint(sx, y - 1, ctx->opts.entitySpacing - 8, - ctx->opts.loopArcHeight, 45.0f, + ADrawComputeArcPoint((float)sx, (float)(y - 1), + (float)(ctx->opts.entitySpacing - 8), + (float)ctx->opts.loopArcHeight, 45.0f, &px, &py); /* Draw a cross */ diff --git a/libmscgen/mscgen_gd_out.c b/libmscgen/mscgen_gd_out.c index 8d8198c..72c79f5 100644 --- a/libmscgen/mscgen_gd_out.c +++ b/libmscgen/mscgen_gd_out.c @@ -180,7 +180,7 @@ unsigned int gdoTextWidth(struct ADrawTag *ctx, const char *string) { #ifndef USE_FREETYPE - const unsigned int l = strlen(string); + const unsigned int l = (unsigned int)strlen(string); /* Remove 1 pixel since there is usually an uneven gap at * the right of the last character for the fixed width diff --git a/libmscgen/mscgen_language.y b/libmscgen/mscgen_language.y index 0c0ab50..02b36bb 100644 --- a/libmscgen/mscgen_language.y +++ b/libmscgen/mscgen_language.y @@ -179,7 +179,7 @@ int yywrap() char *removeEscapes(char *in) { - const uint16_t l = strlen(in); + const uint16_t l = (uint16_t)strlen(in); char *r = (char *)malloc_s(l + 1); uint16_t t, u; diff --git a/qtools/qcstring.h b/qtools/qcstring.h index e1414b5..f54cf2f 100644 --- a/qtools/qcstring.h +++ b/qtools/qcstring.h @@ -403,7 +403,7 @@ public: else // need to make a copy { LSData *newData = LSData::create(size); - int len = d->len; + uint len = d->len; if (len>=size) len=size-1; memcpy(newData->toStr(),d->toStr(),len); newData->toStr()[len]=0; diff --git a/qtools/qdatastream.cpp b/qtools/qdatastream.cpp index 5190b53..a2e5c3b 100644 --- a/qtools/qdatastream.cpp +++ b/qtools/qdatastream.cpp @@ -730,7 +730,7 @@ QDataStream &QDataStream::operator<<( Q_INT16 i ) if ( printable ) { // printable data char buf[16]; sprintf( buf, "%d\n", i ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else if ( noswap ) { // no conversion needed dev->writeBlock( (char *)&i, sizeof(Q_INT16) ); } else { // swap bytes @@ -761,7 +761,7 @@ QDataStream &QDataStream::operator<<( Q_INT32 i ) if ( printable ) { // printable data char buf[16]; sprintf( buf, "%d\n", i ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else if ( noswap ) { // no conversion needed dev->writeBlock( (char *)&i, sizeof(Q_INT32) ); } else { // swap bytes @@ -793,7 +793,7 @@ QDataStream &QDataStream::operator<<( Q_INT64 i ) if ( printable ) { // printable data char buf[20]; sprintf( buf, "%ld\n", i ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else if ( noswap ) { // no conversion needed dev->writeBlock( (char *)&i, sizeof(Q_INT64) ); } else { // swap bytes @@ -839,7 +839,7 @@ QDataStream &QDataStream::operator<<( float f ) if ( printable ) { // printable data char buf[32]; sprintf( buf, "%g\n", (double)f ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else { float g = f; // fixes float-on-stack problem if ( noswap ) { // no conversion needed @@ -869,7 +869,7 @@ QDataStream &QDataStream::operator<<( double f ) if ( printable ) { // printable data char buf[32]; sprintf( buf, "%g\n", f ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else if ( noswap ) { // no conversion needed dev->writeBlock( (char *)&f, sizeof(double) ); } else { // swap bytes diff --git a/src/classlist.cpp b/src/classlist.cpp index f06f744..5e14051 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -168,7 +168,7 @@ void GenericsSDict::insert(const QCString &key,ClassDef *cd) if (i==-1) return; ArgumentList argList; stringToArgumentList(SrcLangExt_CSharp, key.mid(i),argList); - int c = argList.size(); + int c = (int)argList.size(); if (c==0) return; GenericsCollection *collection = m_dict.find(key.left(i)); if (collection==0) // new name @@ -201,7 +201,7 @@ ClassDef *GenericsSDict::find(const QCString &key) { ArgumentList argList; stringToArgumentList(SrcLangExt_CSharp,key.mid(i),argList); - int c = argList.size(); + int c = (int)argList.size(); return collection->find(c); } } diff --git a/src/commentscan.l b/src/commentscan.l index 053436c..13ea0c1 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -735,9 +735,9 @@ RCSTAG "$"{ID}":"[^\n$]+"$" yyextra->parseMore=TRUE; yyextra->needNewEntry = TRUE; #if YY_FLEX_MAJOR_VERSION>=2 && (YY_FLEX_MINOR_VERSION>5 || (YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>=33)) - yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + strlen(yytext); + yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + (int)strlen(yytext); #else - yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - yy_current_buffer->yy_ch_buf) + strlen(yytext); + yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - yy_current_buffer->yy_ch_buf) + (int)strlen(yytext); #endif yyterminate(); } diff --git a/src/definition.cpp b/src/definition.cpp index 043e210..28b552b 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -695,7 +695,7 @@ void DefinitionImpl::setInbodyDocumentation(const char *d,const char *inbodyFile struct FilterCacheItem { portable_off_t filePos; - uint fileSize; + size_t fileSize; }; /*! Cache for storing the result of filtering a file */ @@ -722,7 +722,7 @@ class FilterCache if (f) { bool success=TRUE; - str.resize(item->fileSize+1); + str.resize(static_cast(item->fileSize+1)); if (Portable::fseek(f,item->filePos,SEEK_SET)==-1) { err("Failed to seek to position %d in filter database file %s\n",(int)item->filePos,qPrint(Doxygen::filterDBFileName)); @@ -730,7 +730,7 @@ class FilterCache } if (success) { - int numBytes = fread(str.data(),1,item->fileSize,f); + size_t numBytes = fread(str.data(),1,item->fileSize,f); if (numBytes!=item->fileSize) { err("Failed to read %d bytes from position %d in filter database file %s: got %d bytes\n", @@ -768,16 +768,16 @@ class FilterCache return FALSE; } // append the filtered output to the database file - int size=0; + size_t size=0; while (!feof(f)) { - int bytesRead = fread(buf,1,blockSize,f); - int bytesWritten = fwrite(buf,1,bytesRead,bf); + size_t bytesRead = fread(buf,1,blockSize,f); + size_t bytesWritten = fwrite(buf,1,bytesRead,bf); if (bytesRead!=bytesWritten) { // handle error err("Failed to write to filter database %s. Wrote %d out of %d bytes\n", - qPrint(Doxygen::filterDBFileName),bytesWritten,bytesRead); + qPrint(Doxygen::filterDBFileName),(int)bytesWritten,(int)bytesRead); str.addChar('\0'); delete item; Portable::pclose(f); @@ -785,7 +785,7 @@ class FilterCache return FALSE; } size+=bytesWritten; - str.addArray(buf,bytesWritten); + str.addArray(buf,static_cast(bytesWritten)); } str.addChar('\0'); item->fileSize = size; @@ -805,8 +805,8 @@ class FilterCache f = Portable::fopen(fileName,"r"); while (!feof(f)) { - int bytesRead = fread(buf,1,blockSize,f); - str.addArray(buf,bytesRead); + size_t bytesRead = fread(buf,1,blockSize,f); + str.addArray(buf,static_cast(bytesRead)); } str.addChar('\0'); fclose(f); diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 0f8cb1c..5b10e5c 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -1033,7 +1033,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} if (yytext[0] =='"') { g_token->name=yytext+1; - g_token->name=g_token->name.left(yyleng-2); + g_token->name=g_token->name.left(static_cast(yyleng)-2); } else { @@ -1170,9 +1170,9 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} } [^ \t\n,@\\]+ { g_token->name = yytext; - if (g_token->name.at(yyleng-1)==':') + if (g_token->name.at(static_cast(yyleng)-1)==':') { - g_token->name=g_token->name.left(yyleng-1); + g_token->name=g_token->name.left(static_cast(yyleng)-1); } return TK_WORD; } diff --git a/src/formula.cpp b/src/formula.cpp index de004ed..3130122 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -468,7 +468,7 @@ int FormulaManager::addFormula(const char *formulaText) return it->second; } // store new formula - int id = p->formulas.size(); + int id = (int)p->formulas.size(); p->formulaMap.insert(std::pair(key,id)); p->formulas.push_back(key); return id; diff --git a/src/fortrancode.l b/src/fortrancode.l index 4d8dc1c..bf6c22e 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -78,7 +78,7 @@ const int fixedCommentAfter = 72; int yy_old_start = 0; int yy_my_start = 0; int yy_end = 1; -#define YY_USER_ACTION {yy_old_start = yy_my_start; yy_my_start = yy_end; yy_end += yyleng;} +#define YY_USER_ACTION {yy_old_start = yy_my_start; yy_my_start = yy_end; yy_end += static_cast(yyleng);} #define YY_FTN_RESET {yy_old_start = 0; yy_my_start = 0; yy_end = 1;} #define YY_FTN_REJECT {yy_end = yy_my_start; yy_my_start = yy_old_start; REJECT;} @@ -1120,7 +1120,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") g_contLineNr++; yy_old_start = 0; yy_my_start = 1; - yy_end = yyleng; + yy_end = static_cast(yyleng); } // Actually we should see if ! on position 6, can be continuation // but the chance is very unlikely, so no effort to solve it here @@ -1141,7 +1141,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") g_contLineNr++; yy_old_start = 0; yy_my_start = 1; - yy_end = yyleng; + yy_end = static_cast(yyleng); // Actually we should see if ! on position 6, can be continuation // but the chance is very unlikely, so no effort to solve it here docBlock+=yytext; diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 3a5123c..0265fc3 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -927,7 +927,7 @@ private { if (strt != 0) lft = yyextra->current_root->type.left(strt).stripWhiteSpace(); if ((yyextra->current_root->type.length() - strt - strlen("function"))!= 0) { - rght = yyextra->current_root->type.right(yyextra->current_root->type.length() - strt - strlen("function")).stripWhiteSpace(); + rght = yyextra->current_root->type.right(yyextra->current_root->type.length() - strt - (int)strlen("function")).stripWhiteSpace(); } yyextra->current_root->type = lft; if (rght.length() > 0) @@ -1567,7 +1567,7 @@ const char* prepassFixedForm(const char* contents, int *hasContLine) bool fullCommentLine=TRUE; bool artificialComment=FALSE; bool spaces=TRUE; - int newContentsSize = strlen(contents)+3; // \000, \n (when necessary) and one spare character (to avoid reallocation) + int newContentsSize = (int)strlen(contents)+3; // \000, \n (when necessary) and one spare character (to avoid reallocation) char* newContents = (char*)malloc(newContentsSize); int curLine = 1; @@ -1643,7 +1643,7 @@ const char* prepassFixedForm(const char* contents, int *hasContLine) return NULL; } newContents[j]='\000'; - newContentsSize = strlen(newContents); + newContentsSize = (int)strlen(newContents); if (newContents[newContentsSize - 1] != '\n') { // to be on the safe side @@ -1786,7 +1786,7 @@ const char* prepassFixedForm(const char* contents, int *hasContLine) free(newContents); return NULL; } - newContentsSize = strlen(newContents); + newContentsSize = (int)strlen(newContents); if (newContents[newContentsSize - 1] != '\n') { // to be on the safe side @@ -2569,7 +2569,7 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b (directionParam[dir1] == directionParam[SymbolModifiers::IN])) { // strip direction - loc_doc = loc_doc.right(loc_doc.length()-strlen(directionParam[SymbolModifiers::IN])); + loc_doc = loc_doc.right(loc_doc.length()-(int)strlen(directionParam[SymbolModifiers::IN])); loc_doc.stripWhiteSpace(); // in case of empty documentation or (now) just name, consider it as no documentation if (!loc_doc.isEmpty() && (loc_doc.lower() != yyextra->argName.lower())) @@ -2593,7 +2593,7 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b if ((directionParam[dir1] == directionParam[SymbolModifiers::NONE_D]) || (directionParam[dir1] == directionParam[SymbolModifiers::OUT])) { - loc_doc = loc_doc.right(loc_doc.length()-strlen(directionParam[SymbolModifiers::OUT])); + loc_doc = loc_doc.right(loc_doc.length()-(int)strlen(directionParam[SymbolModifiers::OUT])); loc_doc.stripWhiteSpace(); if (loc_doc.isEmpty() || (loc_doc.lower() == yyextra->argName.lower())) { @@ -2617,7 +2617,7 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b if ((directionParam[dir1] == directionParam[SymbolModifiers::NONE_D]) || (directionParam[dir1] == directionParam[SymbolModifiers::INOUT])) { - loc_doc = loc_doc.right(loc_doc.length()-strlen(directionParam[SymbolModifiers::INOUT])); + loc_doc = loc_doc.right(loc_doc.length()-(int)strlen(directionParam[SymbolModifiers::INOUT])); loc_doc.stripWhiteSpace(); if (!loc_doc.isEmpty() && (loc_doc.lower() != yyextra->argName.lower())) { diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 2dc62fa..05486d8 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -166,8 +166,14 @@ static QCString getConvertLatexMacro() return ""; } i++; - if (!qstrncmp(data + i, "newcommand", strlen("newcommand"))) i += strlen("newcommand"); - else if (!qstrncmp(data + i, "renewcommand", strlen("renewcommand"))) i += strlen("renewcommand"); + if (!qstrncmp(data + i, "newcommand", (uint)strlen("newcommand"))) + { + i += (int)strlen("newcommand"); + } + else if (!qstrncmp(data + i, "renewcommand", (uint)strlen("renewcommand"))) + { + i += (int)strlen("renewcommand"); + } else { warn(macrofile,line, "file contains non valid code, expected 'newcommand' or 'renewcommand'"); diff --git a/src/message.cpp b/src/message.cpp index 9a5eaca..dbbc6dd 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -174,7 +174,7 @@ static void do_warn(bool enabled, const char *file, int line, const char *prefix int l=0; if (prefix) { - l=strlen(prefix); + l=(int)strlen(prefix); } // determine needed buffersize based on: // format + arguments diff --git a/src/pre.l b/src/pre.l index fbf7bde..648c2c5 100644 --- a/src/pre.l +++ b/src/pre.l @@ -475,7 +475,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <*>"??"[=/'()!<>-] { // Trigraph unput(resolveTrigraph(yytext[2])); } -^{B}*"#" { BEGIN(Command); yyextra->yyColNr+=yyleng; yyextra->yyMLines=0;} +^{B}*"#" { BEGIN(Command); yyextra->yyColNr+=(int)yyleng; yyextra->yyMLines=0;} ^{B}*/[^#] { outputArray(yyscanner,yytext,(int)yyleng); BEGIN(CopyLine); @@ -795,7 +795,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } ("cmake")?"define"{B}+ { //printf("!!!DefName\n"); - yyextra->yyColNr+=yyleng; + yyextra->yyColNr+=(int)yyleng; BEGIN(DefName); } "ifdef"/{B}*"(" { @@ -879,7 +879,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) yyextra->yyLineNr++; } . -. {yyextra->yyColNr+=yyleng;} +. {yyextra->yyColNr+=(int)yyleng;} {ID} { Define *def; if ((def=yyextra->defineManager.isDefined(yytext)) @@ -1239,7 +1239,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) else { outputArray(yyscanner,yytext,(int)yyleng); - yyextra->fenceSize=yyleng; + yyextra->fenceSize=(int)yyleng; BEGIN(SkipVerbatim); } } @@ -1252,7 +1252,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) else { outputArray(yyscanner,yytext,(int)yyleng); - yyextra->fenceSize=yyleng; + yyextra->fenceSize=(int)yyleng; BEGIN(SkipVerbatim); } } @@ -1890,7 +1890,7 @@ static FileState *findFile(yyscan_t yyscanner, const char *fileName,bool localIn static QCString extractTrailingComment(const char *s) { if (s==0) return ""; - int i=strlen(s)-1; + int i=(int)strlen(s)-1; while (i>=0) { char c=s[i]; diff --git a/src/pycode.l b/src/pycode.l index 9dee2e8..970c221 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -1269,7 +1269,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT // level that is about to be // used. codifyLines(yytext); - g_indents.push(yyleng); + g_indents.push(static_cast(yyleng)); // printf("Captured indent of %d [line %d]\n", yyleng, g_yyLineNr); BEGIN( Suite ); } @@ -1283,7 +1283,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT // should be improved. // (translate tabs to space, etc) codifyLines(yytext); - adjustScopesAndSuites((int)yyleng); + adjustScopesAndSuites(static_cast(yyleng)); } "\n"|({BB}"\n") { diff --git a/src/section.h b/src/section.h index 9bdfb3b..9f1916e 100644 --- a/src/section.h +++ b/src/section.h @@ -115,7 +115,7 @@ class SectionRefs const_iterator begin() const { return m_entries.cbegin(); } const_iterator end() const { return m_entries.cend(); } bool empty() const { return m_entries.empty(); } - int size() const { return m_entries.size(); } + int size() const { return (int)m_entries.size(); } private: SectionInfoVec m_entries; diff --git a/src/util.cpp b/src/util.cpp index fae2e90..df1b748 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -5157,7 +5157,7 @@ QCString substitute(const QCString &s,const QCString &src,const QCString &dst,in r+=dstLen; } qstrcpy(r,p); - result.resize(strlen(result.data())+1); + result.resize((int)strlen(result.data())+1); //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data()); return result; } diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index c54bf78..dfd2aa1 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -1421,7 +1421,7 @@ void VhdlDocGen::formatString(const QCString &s, OutputList& ol,const MemberDef* void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList &al,const MemberDef* mdef) { bool sem=FALSE; - int len=al.size(); + size_t len=al.size(); ol.docify("( "); if (len > 2) { @@ -1477,7 +1477,7 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList &al,const { if (!al.hasParameters()) return; bool sem=FALSE; - int len=al.size(); + size_t len=al.size(); ol.startBold(); ol.docify(" ( "); ol.endBold(); @@ -1586,7 +1586,7 @@ bool VhdlDocGen::writeFuncProcDocu( //bool sem=FALSE; ol.enableAll(); - int index=al.size(); + size_t index=al.size(); if (index==0) { ol.docify(" ( ) "); @@ -3959,7 +3959,7 @@ void FlowChart::writeEdge(FTextStream &t,int fl_from,int fl_to,int i,bool bFrom, void FlowChart::alignFuncProc( QCString & q,const ArgumentList &al,bool isFunc) { - int index=al.size(); + size_t index=al.size(); if (index==0) return; int len=q.length()+VhdlDocGen::getFlowMember()->name().length(); diff --git a/vhdlparser/vhdlstring.h b/vhdlparser/vhdlstring.h index ee01b06..a8dfc72 100755 --- a/vhdlparser/vhdlstring.h +++ b/vhdlparser/vhdlstring.h @@ -58,7 +58,7 @@ class VhdlString } VhdlString(const char *s) { - m_len = strlen(s); + m_len = (int)strlen(s); m_str=(char*)malloc(m_len+1); memcpy(m_str,s,m_len+1); } @@ -87,7 +87,7 @@ class VhdlString } VhdlString& append(const char *s) { - return append(s,strlen(s)); + return append(s,(int)strlen(s)); } VhdlString& append(const VhdlString &other) { -- cgit v0.12