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

X64 pointer arithmetic issue #18

@chcg

Description

@chcg

See https://notepad-plus-plus.org/community/topic/12633/npppluginnet-64-bit.

Issue is caused by problematic pointer arithmetic in

public void Add(FuncItem funcItem)

and

public void RefreshItems()

in class FuncItems in NppPluginNETHelper.cs, like:

    IntPtr ptrPosNewItem = (IntPtr)((int)newPointer + oldSize);

So the cast to int from type IntPtr shortens the pointer for X64, see e.g.

https://blogs.msdn.microsoft.com/jaredpar/2008/11/11/properly-incrementing-an-intptr/
or
https://stackoverflow.com/questions/1866236/add-offset-to-intptr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions