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

windows compilation issue when building huge msg #49

Open
muratory opened this issue Sep 2, 2020 · 1 comment
Open

windows compilation issue when building huge msg #49

muratory opened this issue Sep 2, 2020 · 1 comment

Comments

@muratory
Copy link

muratory commented Sep 2, 2020

when using custom message with big structure, we may reach the windows compilator limit of 65535 character for a string.

This happens in msg creation when building the comment string in escape_message_definition function.

proposed patch is to break when 64000 size limit is reached 👍
def escape_message_definition(definition):
lines = definition.splitlines()
if not lines:
lines.append('')
s = StringIO()
count = 0
for line in lines:
line = _escape_string(line)
# individual string literals cannot be too long; need to utilize string concatenation for long strings
# https://docs.microsoft.com/en-us/cpp/c-language/maximum-string-length?view=vs-2017
s.write('"%s\n"\n' % (line))
#patch to exit when line total greater than 64000 due to windows compil limitation
count = count + len(line) + 6
if count > 64000:
break
val = s.getvalue()
s.close()
return val

@dirk-thomas
Copy link
Member

Please consider to create a pull request with your proposed patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants