@@ -646,8 +646,8 @@ static int cf_pane_textrange(lua_State *L) {
646646 NppExtensionAPI::Pane p = check_pane_object (L, 1 );
647647
648648 if (lua_gettop (L) >= 3 ) {
649- int cpMin = static_cast <int >(luaL_checkinteger (L, 2 ));
650- int cpMax = static_cast <int >(luaL_checkinteger (L, 3 ));
649+ intptr_t cpMin = static_cast <intptr_t >(luaL_checkinteger (L, 2 ));
650+ intptr_t cpMax = static_cast <intptr_t >(luaL_checkinteger (L, 3 ));
651651
652652 if (cpMax >= 0 ) {
653653 char *range = host->Range (p, cpMin, cpMax);
@@ -668,24 +668,24 @@ static int cf_pane_textrange(lua_State *L) {
668668
669669static int cf_pane_insert (lua_State *L) {
670670 NppExtensionAPI::Pane p = check_pane_object (L, 1 );
671- int pos = ( int ) luaL_checkinteger (L, 2 );
671+ intptr_t pos = static_cast < intptr_t >( luaL_checkinteger (L, 2 ) );
672672 const char *s = luaL_checkstring (L, 3 );
673673 host->Insert (p, pos, s);
674674 return 0 ;
675675}
676676
677677static int cf_pane_remove (lua_State *L) {
678678 NppExtensionAPI::Pane p = check_pane_object (L, 1 );
679- int cpMin = static_cast <int >(luaL_checkinteger (L, 2 ));
680- int cpMax = static_cast <int >(luaL_checkinteger (L, 3 ));
679+ intptr_t cpMin = static_cast <intptr_t >(luaL_checkinteger (L, 2 ));
680+ intptr_t cpMax = static_cast <intptr_t >(luaL_checkinteger (L, 3 ));
681681 host->Remove (p, cpMin, cpMax);
682682 return 0 ;
683683}
684684
685685static int cf_pane_append (lua_State *L) {
686686 NppExtensionAPI::Pane p = check_pane_object (L, 1 );
687687 const char *s = luaL_checkstring (L, 2 );
688- host->Insert (p, static_cast < int >( host->Send (p, SCI_GETLENGTH, 0 , 0 ) ), s);
688+ host->Insert (p, host->Send (p, SCI_GETLENGTH, 0 , 0 ), s);
689689 return 0 ;
690690}
691691
@@ -719,17 +719,17 @@ static int cf_pane_findtext(lua_State *L) {
719719
720720 if (!hasError) {
721721 if (nArgs > 3 ) {
722- ft.chrg .cpMin = static_cast <int >(luaL_checkinteger (L, 4 ));
722+ ft.chrg .cpMin = static_cast <intptr_t >(luaL_checkinteger (L, 4 ));
723723 hasError = (lua_gettop (L) > nArgs);
724724 }
725725 }
726726
727727 if (!hasError) {
728728 if (nArgs > 4 ) {
729- ft.chrg .cpMax = static_cast <int >(luaL_checkinteger (L, 5 ));
729+ ft.chrg .cpMax = static_cast <intptr_t >(luaL_checkinteger (L, 5 ));
730730 hasError = (lua_gettop (L) > nArgs);
731731 } else {
732- ft.chrg .cpMax = static_cast < long >( host->Send (p, SCI_GETLENGTH, 0 , 0 ) );
732+ ft.chrg .cpMax = host->Send (p, SCI_GETLENGTH, 0 , 0 );
733733 }
734734 }
735735
@@ -759,10 +759,10 @@ static int cf_pane_findtext(lua_State *L) {
759759
760760struct PaneMatchObject {
761761 NppExtensionAPI::Pane pane;
762- int startPos;
763- int endPos;
762+ intptr_t startPos;
763+ intptr_t endPos;
764764 int flags; // this is really part of the state, but is kept here for convenience
765- int endPosOrig; // has to do with preventing infinite loop on a 0-length match
765+ intptr_t endPosOrig; // has to do with preventing infinite loop on a 0-length match
766766};
767767
768768static int cf_match_replace (lua_State *L) {
@@ -786,7 +786,7 @@ static int cf_match_replace(lua_State *L) {
786786 host->Send (pmo->pane , SCI_SETTARGETSTART, pmo->startPos , 0 );
787787 host->Send (pmo->pane , SCI_SETTARGETEND, pmo->endPos , 0 );
788788 host->Send (pmo->pane , SCI_REPLACETARGET, lua_rawlen (L, 2 ), SptrFromString (replacement));
789- pmo->endPos = static_cast < int >( host->Send (pmo->pane , SCI_GETTARGETEND, 0 , 0 ) );
789+ pmo->endPos = host->Send (pmo->pane , SCI_GETTARGETEND, 0 , 0 );
790790 return 0 ;
791791}
792792
@@ -878,7 +878,7 @@ static int cf_pane_match(lua_State *L) {
878878 if (nargs >= 3 ) {
879879 pmo->flags = (int )luaL_checkinteger (L, 3 );
880880 if (nargs >= 4 ) {
881- pmo->endPos = pmo->endPosOrig = (int )luaL_checkinteger (L, 4 );
881+ pmo->endPos = pmo->endPosOrig = (intptr_t )luaL_checkinteger (L, 4 );
882882 if (pmo->endPos < 0 ) {
883883 raise_error (L, " Invalid argument 3 for <pane>:match. Positive number or zero expected." );
884884 return 0 ;
@@ -921,7 +921,7 @@ static int cf_pane_match_generator(lua_State *L) {
921921 return 0 ;
922922 }
923923
924- int searchPos = pmo->endPos ;
924+ intptr_t searchPos = pmo->endPos ;
925925 if ((pmo->startPos == pmo->endPosOrig ) && (pmo->endPos == pmo->endPosOrig )) {
926926 // prevent infinite loop on zero-length match by stepping forward
927927 searchPos++;
@@ -935,8 +935,8 @@ static int cf_pane_match_generator(lua_State *L) {
935935 if (ft.chrg .cpMax > ft.chrg .cpMin ) {
936936 sptr_t result = host->Send (pmo->pane , SCI_FINDTEXT, static_cast <uptr_t >(pmo->flags ), SptrFromPointer (&ft));
937937 if (result >= 0 ) {
938- pmo->startPos = static_cast < int >( ft.chrgText .cpMin ) ;
939- pmo->endPos = pmo->endPosOrig = static_cast < int >( ft.chrgText .cpMax ) ;
938+ pmo->startPos = ft.chrgText .cpMin ;
939+ pmo->endPos = pmo->endPosOrig = ft.chrgText .cpMax ;
940940 lua_pushvalue (L, 2 );
941941 return 1 ;
942942 }
@@ -1921,57 +1921,57 @@ struct StylingContext {
19211921
19221922 void Colourize () {
19231923 intptr_t end = currentPos - 1 ;
1924- if (end >= static_cast <int >(endDoc))
1925- end = static_cast < int >( endDoc)- 1 ;
1924+ if (end >= static_cast <intptr_t >(endDoc))
1925+ end = endDoc - 1 ;
19261926 styler->ColourTo (end, state);
19271927 }
19281928
19291929 static int Line (lua_State *L) {
19301930 StylingContext *context = Context (L);
1931- int position = (int )luaL_checkinteger (L, 2 );
1931+ intptr_t position = (intptr_t )luaL_checkinteger (L, 2 );
19321932 lua_pushinteger (L, context->styler ->GetLine (position));
19331933 return 1 ;
19341934 }
19351935
19361936 static int CharAt (lua_State *L) {
19371937 StylingContext *context = Context (L);
1938- int position = (int )luaL_checkinteger (L, 2 );
1938+ intptr_t position = (intptr_t )luaL_checkinteger (L, 2 );
19391939 lua_pushinteger (L, context->styler ->SafeGetCharAt (position));
19401940 return 1 ;
19411941 }
19421942
19431943 static int StyleAt (lua_State *L) {
19441944 StylingContext *context = Context (L);
1945- int position = (int )luaL_checkinteger (L, 2 );
1945+ intptr_t position = (intptr_t )luaL_checkinteger (L, 2 );
19461946 lua_pushinteger (L, context->styler ->StyleAt (position));
19471947 return 1 ;
19481948 }
19491949
19501950 static int LevelAt (lua_State *L) {
19511951 StylingContext *context = Context (L);
1952- int line = (int )luaL_checkinteger (L, 2 );
1952+ intptr_t line = (intptr_t )luaL_checkinteger (L, 2 );
19531953 lua_pushinteger (L, context->styler ->LevelAt (line));
19541954 return 1 ;
19551955 }
19561956
19571957 static int SetLevelAt (lua_State *L) {
19581958 StylingContext *context = Context (L);
1959- int line = (int )luaL_checkinteger (L, 2 );
1959+ intptr_t line = (intptr_t )luaL_checkinteger (L, 2 );
19601960 int level = (int )luaL_checkinteger (L, 3 );
19611961 context->styler ->SetLevel (line, level);
19621962 return 0 ;
19631963 }
19641964
19651965 static int LineState (lua_State *L) {
19661966 StylingContext *context = Context (L);
1967- int line = (int )luaL_checkinteger (L, 2 );
1967+ intptr_t line = (intptr_t )luaL_checkinteger (L, 2 );
19681968 lua_pushinteger (L, context->styler ->GetLineState (line));
19691969 return 1 ;
19701970 }
19711971
19721972 static int SetLineState (lua_State *L) {
19731973 StylingContext *context = Context (L);
1974- int line = (int )luaL_checkinteger (L, 2 );
1974+ intptr_t line = (intptr_t )luaL_checkinteger (L, 2 );
19751975 int stateOfLine = (int )luaL_checkinteger (L, 3 );
19761976 context->styler ->SetLineState (line, stateOfLine);
19771977 return 0 ;
@@ -2018,7 +2018,7 @@ struct StylingContext {
20182018 (currentPos >= endPos);
20192019 }
20202020
2021- void StartStyling (unsigned int startPos_, unsigned int length, int initStyle_) {
2021+ void StartStyling (uintptr_t startPos_, uintptr_t length, int initStyle_) {
20222022 endDoc = styler->Length ();
20232023 endPos = startPos_ + length;
20242024 if (endPos == endDoc)
@@ -2049,8 +2049,8 @@ struct StylingContext {
20492049
20502050 static int StartStyling (lua_State *L) {
20512051 StylingContext *context = Context (L);
2052- unsigned int startPosStyle = (int )luaL_checkinteger (L, 2 );
2053- unsigned int lengthStyle = (int )luaL_checkinteger (L, 3 );
2052+ uintptr_t startPosStyle = (uintptr_t )luaL_checkinteger (L, 2 );
2053+ uintptr_t lengthStyle = (uintptr_t )luaL_checkinteger (L, 3 );
20542054 int initialStyle = (int )luaL_checkinteger (L, 4 );
20552055 context->StartStyling (startPosStyle, lengthStyle, initialStyle);
20562056 return 0 ;
0 commit comments