Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
[x64 fix]: Scintilla structures required correction for x64
Browse files Browse the repository at this point in the history
- ScNotification struct had incorrect data type 'int' for lineNumber, position, etc fields
- This might cause misinterpretation of data block eventually leading to corruption.
- Scintilla interface method signatures were incorrectly using int.
- This would cause truncation of data in x64 environment and possible data corruption.
- Enums in GatewayDomain.cs required [Flags] attribute to combine using OR.
  • Loading branch information
mahee96 committed May 26, 2021
1 parent e0c80f0 commit 4014916
Show file tree
Hide file tree
Showing 7 changed files with 669 additions and 599 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ UpgradeLog*.XML
*.pyc

Visual Studio Project Template C#/$projectname$.sln
.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def ReadFromFile(self, name):
currentCategory = ""
currentComment = []
currentCommentFinished = 0
import os, os.path, inspect
if '__file__' not in locals():
__file__ = inspect.getframeinfo(inspect.currentframe())[0]
os.chdir(os.path.dirname(os.path.realpath(__file__)))
file = open(name)
for line in file.readlines():
line = sanitiseLine(line)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ def isTypeUnsupported(t):
if t in ["formatrange"]: return True
return False

def translateType(t):
def translateType(t:str):
if t == "cells": return "Cells"
if t == "colour": return "Colour"
if t == "line": return "int"
if t == "line": return "long"
if t == "pointer": return "IntPtr"
if t == "position": return "int"
if t == "position": return "long"
if t == "textrange": return "TextRange"
if t == "findtext": return "TextToFind"
if t == "keymod": return "KeyModifier"
Expand Down Expand Up @@ -79,10 +79,11 @@ def getUnsafeModifier(returnType, param1Type, param2Type):


def translateReturnType(v, param1Type, param2Type):
typ = v["ReturnType"];
if param1Type == "stringresult" or param2Type == "stringresult":
return "string"
else:
return translateType(v["ReturnType"])
elif typ and typ[0].isupper(): return "long"
return translateType(v["ReturnType"])

def getParameterList(param1Type, param1Name, param2Type, param2Name):
first = param1Type + " " + param1Name if param1Type and param1Type != "stringresult" else ""
Expand All @@ -100,6 +101,7 @@ def printEnumDefinitions(f):
if v["FeatureType"] in ["enu"] and name not in ["Keys"]: # for all except excluded enums [conflicting]
appendComment(indent, out, v)
prefix = v["Value"]
out.append(indent + "[Flags]")
out.append(indent + "public enum " + name)
out.append(indent + "{")
for ename in f.order:
Expand Down Expand Up @@ -189,10 +191,6 @@ def printLexGatewayFile(f):
out.append(iindent + "return 1 == (int)" +res+ ";")
elif returnType == "Colour":
out.append(iindent + "return new Colour((int) " +res+ ");")
# elif returnType == "Line":
# out.append(iindent + "return new Line((int) " +res+ ");")
# elif returnType == "Position":
# out.append(iindent + "return new Position((int) " +res+ ");")
elif returnType == "string":
out.append(iindent + res + ";")
out.append(iindent + "return Encoding.UTF8.GetString("+bufferVariableName+").TrimEnd('\\0');")
Expand Down
Loading

0 comments on commit 4014916

Please sign in to comment.