Skip to content

Commit

Permalink
MiraMonVector: fixing accepted metadata versions/subversions
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelPau authored and github-actions[bot] committed Jun 3, 2024
1 parent 5b3d3b4 commit 92f3b27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions ogr/ogrsf_frmts/miramon/mm_gdal_driver_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ CPL_C_START // Necessary for compiling in GDAL project
#define KEY_Vers "Vers"
#define KEY_SubVers "SubVers"
#define MM_VERS 4
#define MM_SUBVERS_ACCEPTED 0
#define MM_SUBVERS 3
#define KEY_VersMetaDades "VersMetaDades"
#define KEY_SubVersMetaDades "SubVersMetaDades"
#define MM_VERS_METADADES_ACCEPTED 4
#define MM_VERS_METADADES 5
#define MM_SUBVERS_METADADES 0
#define SECTION_METADADES "METADADES"
Expand Down
16 changes: 8 additions & 8 deletions ogr/ogrsf_frmts/miramon/mm_wrlayr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6104,16 +6104,16 @@ int MMCheck_REL_FILE(const char *szREL_file)
return 1;
}

// SubVers>=3?
// SubVers>=0?
pszLine = MMReturnValueFromSectionINIFile(szREL_file, SECTION_VERSIO,
KEY_SubVers);
if (pszLine)
{
if (*pszLine == '\0' || atoi(pszLine) < (int)MM_SUBVERS)
if (*pszLine == '\0' || atoi(pszLine) < (int)MM_SUBVERS_ACCEPTED)
{
MMCPLError(CE_Failure, CPLE_OpenFailed,
"The file \"%s\" must have %s>=%d.", szREL_file,
KEY_SubVers, MM_SUBVERS);
KEY_SubVers, MM_SUBVERS_ACCEPTED);

free_function(pszLine);
return 1;
Expand All @@ -6124,20 +6124,20 @@ int MMCheck_REL_FILE(const char *szREL_file)
{
MMCPLError(CE_Failure, CPLE_OpenFailed,
"The file \"%s\" must have %s>=%d.", szREL_file, KEY_SubVers,
MM_SUBVERS);
MM_SUBVERS_ACCEPTED);
return 1;
}

// VersMetaDades>=5?
// VersMetaDades>=4?
pszLine = MMReturnValueFromSectionINIFile(szREL_file, SECTION_VERSIO,
KEY_VersMetaDades);
if (pszLine)
{
if (*pszLine == '\0' || atoi(pszLine) < (int)MM_VERS_METADADES)
if (*pszLine == '\0' || atoi(pszLine) < (int)MM_VERS_METADADES_ACCEPTED)
{
MMCPLError(CE_Failure, CPLE_OpenFailed,
"The file \"%s\" must have %s>=%d.", szREL_file,
KEY_VersMetaDades, MM_VERS_METADADES);
KEY_VersMetaDades, MM_VERS_METADADES_ACCEPTED);
free_function(pszLine);
return 1;
}
Expand All @@ -6147,7 +6147,7 @@ int MMCheck_REL_FILE(const char *szREL_file)
{
MMCPLError(CE_Failure, CPLE_OpenFailed,
"The file \"%s\" must have %s>=%d.", szREL_file,
KEY_VersMetaDades, MM_VERS_METADADES);
KEY_VersMetaDades, MM_VERS_METADADES_ACCEPTED);
return 1;
}

Expand Down

0 comments on commit 92f3b27

Please sign in to comment.