This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot.
commit 361a8c4ddd5c80e3ee5bdad0a7c20969fb4c3668 Author: Tomasz Kapuściński <tomaszka...@gmail.com> Date: Tue May 19 17:24:07 2015 +0200 Another fix to warning --- src/script/scriptfunc.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index 945839c..b1e8992 100644 --- a/src/script/scriptfunc.cpp +++ b/src/script/scriptfunc.cpp @@ -3608,28 +3608,29 @@ CBotTypResult CScriptFunctions::cfwrite (CBotVar* pThis, CBotVar* &pVar) // process FILE :: readln // execution -bool CScriptFunctions::rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) +bool CScriptFunctions::rfread(CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) { // it shouldn't be any parameters - if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; } - + if (pVar != NULL) { Exception = CBotErrOverParam; return false; } + // retrieve the item "handle" pVar = pThis->GetItem("handle"); - - if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - + + if (pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + int fileHandle = pVar->GetValInt(); FILE* pFile = m_files[fileHandle]; - + char chaine[2000]; int i; - for ( i = 0 ; i < 2000 ; i++ ) chaine[i] = 0; - - (void) fgets(chaine, 1999, pFile); - - for ( i = 0 ; i < 2000 ; i++ ) if (chaine[i] == '\n') chaine[i] = 0; - + for (i = 0; i < 2000; i++) chaine[i] = 0; + + if (fgets(chaine, 1999, pFile) != nullptr) + { + for (i = 0; i < 2000; i++) if (chaine[i] == '\n') chaine[i] = 0; + } + // if an error occurs generate an exception if ( ferror(pFile) ) { Exception = CBotErrRead; return false; } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits