Another fix to warning
parent
3a1dffd8df
commit
361a8c4ddd
|
@ -3608,15 +3608,15 @@ CBotTypResult CScriptFunctions::cfwrite (CBotVar* pThis, CBotVar* &pVar)
|
||||||
// process FILE :: readln
|
// process FILE :: readln
|
||||||
|
|
||||||
// execution
|
// 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
|
// it shouldn't be any parameters
|
||||||
if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; }
|
if (pVar != NULL) { Exception = CBotErrOverParam; return false; }
|
||||||
|
|
||||||
// retrieve the item "handle"
|
// retrieve the item "handle"
|
||||||
pVar = pThis->GetItem("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();
|
int fileHandle = pVar->GetValInt();
|
||||||
|
|
||||||
|
@ -3624,11 +3624,12 @@ bool CScriptFunctions::rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult,
|
||||||
|
|
||||||
char chaine[2000];
|
char chaine[2000];
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0 ; i < 2000 ; i++ ) chaine[i] = 0;
|
for (i = 0; i < 2000; i++) chaine[i] = 0;
|
||||||
|
|
||||||
(void) fgets(chaine, 1999, pFile);
|
if (fgets(chaine, 1999, pFile) != nullptr)
|
||||||
|
{
|
||||||
for ( i = 0 ; i < 2000 ; i++ ) if (chaine[i] == '\n') chaine[i] = 0;
|
for (i = 0; i < 2000; i++) if (chaine[i] == '\n') chaine[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// if an error occurs generate an exception
|
// if an error occurs generate an exception
|
||||||
if ( ferror(pFile) ) { Exception = CBotErrRead; return false; }
|
if ( ferror(pFile) ) { Exception = CBotErrRead; return false; }
|
||||||
|
|
Loading…
Reference in New Issue