Fix ConvertAndFreeCoTaskMemString for 32 bit platforms #277
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is submitted on behalf of askariv.
Based on align.go line 367:
if Widthptr == 4 && w != int64(int32(w)) {
yyerror("type %v too large”, t)
}
The idea in this case is to convert to a slice of a large array of uint16s so it can be used with practically any size of a string, since ‘func UTF16ToString(s []uint16) string’.
The original code had [1<<30] of uint16 elemets which make the width 1 << 31 or 2147483648 (0x80000000) meaning -2147483648 in 32bit!
This is why [1<<29] works, and it is large enough for any real purpose, after all it is a string.
Please let us know if you have a better idea on how to do the type cast.