Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release/3.9] MiraMonVector: fixing accepted metadata versions/subversions #10113

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading