-
Couldn't load subscription status.
- Fork 13
Visual Studio and RAD Studio 32 and 64 bit compilation issues #22
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1877,11 +1877,20 @@ int XMLDoc_parse_file_SAX(const SXML_CHAR* filename, const SAX_Callbacks* sax, v | |
|
|
||
| int XMLDoc_parse_buffer_SAX_len(const SXML_CHAR* buffer, int buffer_len, const SXML_CHAR* name, const SAX_Callbacks* sax, void* user) | ||
| { | ||
| DataSourceBuffer dsb = { buffer, buffer_len, 0 }; | ||
| #ifdef _MSC_VER | ||
| SAX_Data sd = {0}; | ||
| #else | ||
| #ifdef __CODEGEARC__ | ||
| SAX_Data sd; | ||
| DataSourceBuffer dsb; | ||
| dsb.buf = buffer; | ||
| dsb.buf_len = buffer_len; | ||
| dsb.cur_pos = 0; | ||
| #else | ||
| DataSourceBuffer dsb = { buffer, buffer_len, 0 }; | ||
|
|
||
| #ifdef _MSC_VER | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand this is specific to MS Visual Studio. Does it complain about a structure not being initialized? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason why I added this ifdef (as well as some similar in several other locations) is that I have a huge list of warnings claimed by Visual Studio otherwise, saying more or less that this value may be used without be initialized. It was somewhat annoying for me, because this drowned out other important warnings I should not miss. |
||
| SAX_Data sd = {0}; | ||
| #else | ||
| SAX_Data sd; | ||
| #endif | ||
| #endif | ||
|
|
||
| if (sax == NULL || buffer == NULL) | ||
|
|
@@ -2178,7 +2187,7 @@ int read_line_alloc(void* in, DataSourceType in_type, SXML_CHAR** line, int* sz_ | |
| } else | ||
| *line = pt; | ||
| } | ||
| if (sz_line && n < *sz_line) | ||
| if (line && sz_line && n < *sz_line) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which version of sxmlc are you using? In the latest (4.5.1), There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, and I understand that you're puzzled. I added that because Visual Studio was claiming a Buffer Overrun on this line. All in all this resolved nothing, I just forgotten to remove it, you can thus get rid of that. The warning I receive is the following: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE I'm compiling in 64 bit, it's may be the reason why I receive many more warnings than other users ;-) |
||
| (*line)[n] = NULC; /* If we reached the 'to' character and we want to strip it, 'n' hasn't changed and 'line[n]' (which is 'to') will be replaced by '\0' */ | ||
| if (ch == to) { | ||
| ret = n; | ||
|
|
@@ -2627,6 +2636,4 @@ int regstrcmp(SXML_CHAR* str, SXML_CHAR* pattern) | |
| break; | ||
| } | ||
| } | ||
|
|
||
| return FALSE; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this does not compile with RAD Studio? Which C version does the compiler use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact this code isn't working with Embarcadero RAD studio XE7. It's the reason for the #ifdef CODEGEARC instead of #ifdef _MSC_VER, as for the other ifdefs. On the other hands I compiled this code without issue with Visual Studio 2019, Code::Blocks and xCode :-)