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

« back to all changes in this revision

Viewing changes to ogr/ogrsf_frmts/pgeo/ogrpgeodriver.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: ogrpgeodriver.cpp 18168 2009-12-03 23:56:59Z warmerdam $
 
2
 * $Id: ogrpgeodriver.cpp 21550 2011-01-22 18:01:57Z rouault $
3
3
 *
4
4
 * Project:  OpenGIS Simple Features Reference Implementation
5
5
 * Purpose:  Implements Personal Geodatabase driver.
30
30
#include "ogr_pgeo.h"
31
31
#include "cpl_conv.h"
32
32
 
33
 
CPL_CVSID("$Id: ogrpgeodriver.cpp 18168 2009-12-03 23:56:59Z warmerdam $");
 
33
CPL_CVSID("$Id: ogrpgeodriver.cpp 21550 2011-01-22 18:01:57Z rouault $");
34
34
 
35
35
/************************************************************************/
36
36
/*                            ~OGRODBCDriver()                            */
65
65
        && !EQUAL(CPLGetExtension(pszFilename),"mdb") )
66
66
        return NULL;
67
67
 
 
68
    if( !EQUALN(pszFilename,"PGEO:",5) &&
 
69
        EQUAL(CPLGetExtension(pszFilename),"mdb") )
 
70
    {
 
71
        VSILFILE* fp = VSIFOpenL(pszFilename, "rb");
 
72
        if (!fp)
 
73
            return NULL;
 
74
        GByte* pabyHeader = (GByte*) CPLMalloc(100000);
 
75
        VSIFReadL(pabyHeader, 100000, 1, fp);
 
76
        VSIFCloseL(fp);
 
77
 
 
78
        /* Look for GDB_GeomColumns table */
 
79
        const GByte pabyNeedle[] = { 'G', 0, 'D', 0, 'B', 0, '_', 0, 'G', 0, 'e', 0, 'o', 0, 'm', 0, 'C', 0, 'o', 0, 'l', 0, 'u', 0, 'm', 0, 'n', 0, 's' };
 
80
        int bFound = FALSE;
 
81
        for(int i=0;i<100000 - (int)sizeof(pabyNeedle);i++)
 
82
        {
 
83
            if (memcmp(pabyHeader + i, pabyNeedle, sizeof(pabyNeedle)) == 0)
 
84
            {
 
85
                bFound = TRUE;
 
86
                break;
 
87
            }
 
88
        }
 
89
        CPLFree(pabyHeader);
 
90
        if (!bFound)
 
91
            return NULL;
 
92
    }
 
93
 
68
94
#ifndef WIN32
69
95
    // Try to register MDB Tools driver
70
96
    //