From 695df58bc928d9b93b7357e08fcb885f497fe0b8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 10 Dec 2007 11:34:00 +0000 Subject: [PATCH] Refactored record allocation to fix build errors under Windows. --- src/osgPlugins/shp/XBaseParser.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/shp/XBaseParser.cpp b/src/osgPlugins/shp/XBaseParser.cpp index 5bc504655..ef0944374 100644 --- a/src/osgPlugins/shp/XBaseParser.cpp +++ b/src/osgPlugins/shp/XBaseParser.cpp @@ -140,11 +140,12 @@ bool XBaseParser::parse(int fd) // ** read each record and store them in the ShapeAttributeListList - char record[_xBaseHeader._recordLength]; + char* record = new char[_xBaseHeader._recordLength]; + std::vector::iterator it, end = _xBaseFieldDescriptorList.end(); for (Integer i = 0; i < _xBaseHeader._numRecord; ++i) { - if ((nbytes = ::read( fd, &record, sizeof(record))) <= 0) return false; + if ((nbytes = ::read( fd, record, _xBaseHeader._recordLength)) <= 0) return false; char * recordPtr = record; osgSim::ShapeAttributeList * shapeAttributeList = new osgSim::ShapeAttributeList; @@ -201,6 +202,8 @@ bool XBaseParser::parse(int fd) _shapeAttributeListList.push_back(shapeAttributeList); } + delete [] record; + close (fd); return true;