1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-11 10:44:53 +03:00
occt/src/ExprIntrp/ExprIntrp_yacclex.cxx
abv 2a54ebbf29 0024897: Possibility of uncontrolled exit if scanner fails in ExprIntrp
Macro YY_FATAL_ERROR() is defined in ExprIntrp.lex in order to have exception instead of program exit in case of scanner error. Fixed-length string buffers are replaced by TCollection_AsciiString to avoid buffer overflow.
Some code refactoring: declarations of functions moved to header file, unused global declarations and variables removed, compiler warnings fixed or disabled, obsolete EDL file removed.
Test case for issue CR24897
Correction of MSVC compiler warning when scanner is generated using Flex 2.5.35 on Linux
2014-05-29 15:06:48 +04:00

49 lines
1.3 KiB
C++

// Created on: 1993-12-14
// Created by: Arnaud BOUZY
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <string.h>
#include <ExprIntrp_yaccintrf.hxx>
static TCollection_AsciiString ExprIntrp_curres;
static int ExprIntrp_degree;
#ifndef WNT
extern char* ExprIntrptext;
#else
extern "C" char* ExprIntrptext;
#endif // WNT
extern "C" void ExprIntrp_SetResult()
{
ExprIntrp_curres = ExprIntrptext;
}
extern "C" void ExprIntrp_SetDegree()
{
ExprIntrp_degree = (int)strlen(ExprIntrptext);
}
int ExprIntrp_GetDegree()
{
return ExprIntrp_degree;
}
const TCollection_AsciiString& ExprIntrp_GetResult ()
{
return ExprIntrp_curres;
}