~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to ogr/ogrsf_frmts/kml/ogrkmldatasource.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: ogrkmldatasource.cpp 16908 2009-05-02 14:53:26Z rouault $
 
2
 * $Id: ogrkmldatasource.cpp 23589 2011-12-17 14:21:01Z rouault $
3
3
 *
4
4
 * Project:  KML Driver
5
5
 * Purpose:  Implementation of OGRKMLDataSource class.
66
66
{
67
67
    if( fpOutput_ != NULL )
68
68
    {
69
 
        VSIFPrintf( fpOutput_, "%s", "</Folder></Document></kml>\n" );
 
69
        VSIFPrintfL( fpOutput_, "%s", "</Folder></Document></kml>\n" );
70
70
 
71
 
        if( fpOutput_ != stdout )
72
 
            VSIFClose( fpOutput_ );
 
71
        VSIFCloseL( fpOutput_ );
73
72
    }
74
73
 
75
74
    CSLDestroy( papszCreateOptions_ );
135
134
/* -------------------------------------------------------------------- */
136
135
/*      Classify the nodes                                              */
137
136
/* -------------------------------------------------------------------- */
138
 
    poKMLFile_->classifyNodes();
 
137
    if( !poKMLFile_->classifyNodes() )
 
138
    {
 
139
        delete poKMLFile_;
 
140
        poKMLFile_ = NULL;
 
141
        return FALSE;
 
142
    }
139
143
 
140
144
/* -------------------------------------------------------------------- */
141
145
/*      Eliminate the empty containers                                  */
280
284
/* -------------------------------------------------------------------- */
281
285
/*      Create the output file.                                         */
282
286
/* -------------------------------------------------------------------- */
 
287
 
 
288
    if (strcmp(pszName, "/dev/stdout") == 0)
 
289
        pszName = "/vsistdout/";
 
290
 
283
291
    pszName_ = CPLStrdup( pszName );
284
292
 
285
 
    if( EQUAL(pszName, "stdout") )
286
 
        fpOutput_ = stdout;
287
 
    else
288
 
        fpOutput_ = VSIFOpen( pszName, "wt+" );
289
 
 
 
293
    fpOutput_ = VSIFOpenL( pszName, "wb" );
290
294
    if( fpOutput_ == NULL )
291
295
    {
292
296
        CPLError( CE_Failure, CPLE_OpenFailed, 
297
301
/* -------------------------------------------------------------------- */
298
302
/*      Write out "standard" header.                                    */
299
303
/* -------------------------------------------------------------------- */
300
 
    VSIFPrintf( fpOutput_, "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" );   
301
 
 
302
 
    nSchemaInsertLocation_ = VSIFTell( fpOutput_ );
 
304
    VSIFPrintfL( fpOutput_, "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" );  
303
305
    
304
 
    VSIFPrintf( fpOutput_, "<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n<Document>" );
 
306
    VSIFPrintfL( fpOutput_, "<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n<Document>" );
305
307
 
306
308
    return TRUE;
307
309
}
336
338
/* -------------------------------------------------------------------- */
337
339
    if (GetLayerCount() > 0)
338
340
    {
339
 
        VSIFPrintf( fpOutput_, "</Folder>\n");
 
341
        VSIFPrintfL( fpOutput_, "</Folder>\n");
 
342
        ((OGRKMLLayer*)GetLayer(GetLayerCount()-1))->SetClosedForWriting();
340
343
    }
341
344
    
342
345
/* -------------------------------------------------------------------- */
351
354
                  "Layer name '%s' adjusted to '%s' for XML validity.",
352
355
                  pszLayerName, pszCleanLayerName );
353
356
    }
354
 
    VSIFPrintf( fpOutput_, "<Folder><name>%s</name>\n", pszCleanLayerName);
 
357
    VSIFPrintfL( fpOutput_, "<Folder><name>%s</name>\n", pszCleanLayerName);
355
358
    
356
359
/* -------------------------------------------------------------------- */
357
360
/*      Create the layer object.                                        */