Conversation
GitMensch
left a comment
There was a problem hiding this comment.
just a quick note for the first iteration; note that Chucks changes are based on mlio from August 2025, so the "real" version may be easier to get by checking out a previous commit, then replace the file and commit locally, then fetch the newer commit with rebase-merging
tests/testsuite.src/run_ml.at
Outdated
| ]) | ||
|
|
||
| AT_CHECK([$COMPILE -w prog.cob], [0], [], []) | ||
| AT_CHECK([$COMPILE -Wno-pending prog.cob], [0], [], []) |
There was a problem hiding this comment.
the follow-up commit will drop the pending from cobc, of course, and therefore should drop the -Wno-pending for the XML code cases
|
|
||
| #include <json-c/linkhash.h> | ||
| #include <json-c/json.h> | ||
| #elif defined (HAVE_JSON_H) |
There was a problem hiding this comment.
you want to keep all that above (merge gone bad here), which will possibly solve the compile error as well
Chuck's new code may need some more headers but we want to go with the specific ones needed
|
@chuck-haatvedt passed me the newest file (you may do a diff to add a changelog entry) which looks much better concerning libxml version compat. It is from November 14th: mlio.c with a note
|
GitMensch
left a comment
There was a problem hiding this comment.
Thanks for inspecting / working on necessary changes.
I think we can have those in at least a second commit :-)
| xml_event_initialized (struct xml_event *event) { | ||
| struct xml_event_data *data; | ||
| for (data = event->first; data; data = data->next) { | ||
| data->data_ptr = NULL; | ||
| } | ||
| event->last = event->first; | ||
| event->text_ptr = NULL; | ||
| event->text_len = 0; | ||
| event->namespace_ptr = NULL; | ||
| event->namespace_len = 0; | ||
| event->prefix_ptr = NULL; | ||
| event->prefix_len = 0; | ||
| return event; | ||
| } |
There was a problem hiding this comment.
the old code did something useful, if we go with that then the structure should likely be memset(0) instead (and have the event assigned then); if we still want this function then its doc has to be adjusted
| event = event->next; | ||
| } | ||
| switch (sreg) { | ||
| case SREG_XML_TEXT : |
There was a problem hiding this comment.
Does that mean that each event type has only one of the given buffers?
If this is the case then we should simplify it more and don't have three couples where only one is set.
| if (state->eof == 0) { | ||
| state->eof = 1; | ||
| } else { | ||
| // xml_code = 1; |
There was a problem hiding this comment.
drop of switch to #ifdef 0
| SREG_XML_TEXT, | ||
| localname, | ||
| xmlStrlen (localname)); | ||
| /* TODO: cleanup and code namespace stuff and check what to do on endElement */ |
| switch (ctxt->standalone) { | ||
| case 1 : |
There was a problem hiding this comment.
Change to simple condition?
| const xmlChar *attr_name = attributes[cntr]; // ATTRIBUTE-NAME | ||
| const xmlChar *attr_prefix = attributes[cntr + 1]; // ATTRIBUTE-NAMESPACE | ||
| const xmlChar *attr_value_start = attributes[cntr + 3]; // ATTRIBUTE-CHARACTERS start | ||
| const xmlChar *attr_value_end = attributes[cntr + 4]; // ATTRIBUTE-CHARACTERS end | ||
|
|
||
| // Calculate attribute value length | ||
| attr_value_len = attr_value_end - attr_value_start; | ||
|
|
||
| // Use the extracted information |
| fprintf(stderr, "WARNING: Encoding mismatch detected!\n"); | ||
| fprintf(stderr, "Message: %s\n", error->message); | ||
| if (error->str1) { | ||
| fprintf(stderr, "Declared encoding: %s\n", error->str1); | ||
| } | ||
| if (error->str2) { | ||
| fprintf(stderr, "Auto-detected encoding: %s\n", error->str2); |
There was a problem hiding this comment.
these should be done with cob_runtime_warning and possilby (partially) into #ifdef DEBUG.
| "Encoding declaration '%s' appears incompatible with input data\n" | ||
| "The current runtime character encoding is %s \n" | ||
| "This caused XML declaration parsing to fail with: %s", | ||
| state->ctx->encoding, locale_charset(), error->message); |
There was a problem hiding this comment.
Shouldn't this be acquired by locale (in common.c)? If this is the single place then the function call + header as well as conditional compilation may go away as well.
| "This caused XML declaration parsing to fail with: %s", | ||
| state->ctx->encoding, error->message); | ||
| #endif | ||
| fprintf(stderr, |
There was a problem hiding this comment.
all of those with cob_runtime_warning and possibly in a debug conditional
| #if LIBXML_VERSION >= 21200 | ||
| int options = xmlCtxtGetOptions(state->ctx); | ||
| #else | ||
| int options = state->ctx->options; | ||
| #endif |
There was a problem hiding this comment.
Maybe go with the approach of fileio and define a macro for get/set at the start, then just using them here?
Note: initial commit from Chuck, fixes to come