Skip to content

Commit 2f089f6

Browse files
committed
- Minor fixes.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12577 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 099185e commit 2f089f6

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Compiler/runtime/FMIImpl.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ char* FMIImpl__importFMU(const char* fileName, const char* workingDirectory)
9797
if (!SystemImpl__regularFileExists(fileName)) {
9898
const char* c_tokens[1]={fileName};
9999
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("File not Found: %s."), c_tokens, 1);
100-
return "";
100+
return strdup("");
101101
}
102102
// JM callbacks
103103
jm_callbacks callbacks;
@@ -115,31 +115,28 @@ char* FMIImpl__importFMU(const char* fileName, const char* workingDirectory)
115115
// FMI context
116116
fmi_import_context_t *context;
117117
context = fmi_import_allocate_context(&callbacks);
118-
fmi_version_enu_t version;
119118
// extract the fmu file and read the version
119+
fmi_version_enu_t version;
120120
version = fmi_import_get_fmi_version(context, fileName, workingDirectory);
121121
if (version != fmi_version_1_enu) {
122-
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("Only version 1.0 is supported so far."), NULL, 1);
123-
return "";
122+
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("Only version 1.0 is supported so far."), NULL, 0);
123+
return strdup("");
124124
}
125125
// parse the xml file
126126
fmi1_import_t *fmu;
127127
fmu = fmi1_import_parse_xml(context, workingDirectory);
128128
if(!fmu) {
129129
const char* c_tokens[1]={fileName};
130130
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("Error parsing the XML file contained in %s."), c_tokens, 1);
131-
return "";
131+
return strdup("");
132132
}
133-
// check the platform of FMU.
134-
const char* platform = fmi1_import_get_model_types_platform(fmu);
135-
fprintf(stderr, "Platform is : %s", platform);
136133
//fprintf(stderr, "Path is %s\n", fmu->dirPath); fflush(NULL);
137134
// Load the dll
138135
jm_status_enu_t status;
139136
status = fmi1_import_create_dllfmu(fmu, callBackFunctions, 0);
140137
if (status == jm_status_error) {
141-
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("Could not create the DLL loading mechanism(C-API)."), NULL, 1);
142-
return "";
138+
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("Could not create the DLL loading mechanism(C-API)."), NULL, 0);
139+
return strdup("");
143140
}
144141
// create a file name for generated Modelica code
145142
char* generatedFileName;

0 commit comments

Comments
 (0)