diff options
Diffstat (limited to 'src/filedef.cpp')
-rw-r--r-- | src/filedef.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/filedef.cpp b/src/filedef.cpp index 9e8a61c..1b58cdf 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -1657,16 +1657,19 @@ void FileDef::acquireFileVersion() } const int bufSize=1024; char buf[bufSize]; - int numRead = (int)fread(buf,1,bufSize,f); + int numRead = (int)fread(buf,1,bufSize-1,f); portable_pclose(f); - if (numRead>0 && !(m_fileVersion=QCString(buf,numRead).stripWhiteSpace()).isEmpty()) + if (numRead>0 && numRead<bufSize) { - msg("%s\n",m_fileVersion.data()); - } - else - { - msg("no version available\n"); + buf[numRead]='\0'; + m_fileVersion=QCString(buf,numRead).stripWhiteSpace(); + if (!m_fileVersion.isEmpty()) + { + msg("%s\n",m_fileVersion.data()); + return; + } } + msg("no version available\n"); } } |