@@ -646,8 +646,8 @@ static int cf_pane_textrange(lua_State *L) {
646
646
NppExtensionAPI::Pane p = check_pane_object (L, 1 );
647
647
648
648
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 ));
651
651
652
652
if (cpMax >= 0 ) {
653
653
char *range = host->Range (p, cpMin, cpMax);
@@ -668,24 +668,24 @@ static int cf_pane_textrange(lua_State *L) {
668
668
669
669
static int cf_pane_insert (lua_State *L) {
670
670
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 ) );
672
672
const char *s = luaL_checkstring (L, 3 );
673
673
host->Insert (p, pos, s);
674
674
return 0 ;
675
675
}
676
676
677
677
static int cf_pane_remove (lua_State *L) {
678
678
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 ));
681
681
host->Remove (p, cpMin, cpMax);
682
682
return 0 ;
683
683
}
684
684
685
685
static int cf_pane_append (lua_State *L) {
686
686
NppExtensionAPI::Pane p = check_pane_object (L, 1 );
687
687
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);
689
689
return 0 ;
690
690
}
691
691
@@ -719,17 +719,17 @@ static int cf_pane_findtext(lua_State *L) {
719
719
720
720
if (!hasError) {
721
721
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 ));
723
723
hasError = (lua_gettop (L) > nArgs);
724
724
}
725
725
}
726
726
727
727
if (!hasError) {
728
728
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 ));
730
730
hasError = (lua_gettop (L) > nArgs);
731
731
} 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 );
733
733
}
734
734
}
735
735
@@ -759,10 +759,10 @@ static int cf_pane_findtext(lua_State *L) {
759
759
760
760
struct PaneMatchObject {
761
761
NppExtensionAPI::Pane pane;
762
- int startPos;
763
- int endPos;
762
+ intptr_t startPos;
763
+ intptr_t endPos;
764
764
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
766
766
};
767
767
768
768
static int cf_match_replace (lua_State *L) {
@@ -786,7 +786,7 @@ static int cf_match_replace(lua_State *L) {
786
786
host->Send (pmo->pane , SCI_SETTARGETSTART, pmo->startPos , 0 );
787
787
host->Send (pmo->pane , SCI_SETTARGETEND, pmo->endPos , 0 );
788
788
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 );
790
790
return 0 ;
791
791
}
792
792
@@ -878,7 +878,7 @@ static int cf_pane_match(lua_State *L) {
878
878
if (nargs >= 3 ) {
879
879
pmo->flags = (int )luaL_checkinteger (L, 3 );
880
880
if (nargs >= 4 ) {
881
- pmo->endPos = pmo->endPosOrig = (int )luaL_checkinteger (L, 4 );
881
+ pmo->endPos = pmo->endPosOrig = (intptr_t )luaL_checkinteger (L, 4 );
882
882
if (pmo->endPos < 0 ) {
883
883
raise_error (L, " Invalid argument 3 for <pane>:match. Positive number or zero expected." );
884
884
return 0 ;
@@ -921,7 +921,7 @@ static int cf_pane_match_generator(lua_State *L) {
921
921
return 0 ;
922
922
}
923
923
924
- int searchPos = pmo->endPos ;
924
+ intptr_t searchPos = pmo->endPos ;
925
925
if ((pmo->startPos == pmo->endPosOrig ) && (pmo->endPos == pmo->endPosOrig )) {
926
926
// prevent infinite loop on zero-length match by stepping forward
927
927
searchPos++;
@@ -935,8 +935,8 @@ static int cf_pane_match_generator(lua_State *L) {
935
935
if (ft.chrg .cpMax > ft.chrg .cpMin ) {
936
936
sptr_t result = host->Send (pmo->pane , SCI_FINDTEXT, static_cast <uptr_t >(pmo->flags ), SptrFromPointer (&ft));
937
937
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 ;
940
940
lua_pushvalue (L, 2 );
941
941
return 1 ;
942
942
}
@@ -1921,57 +1921,57 @@ struct StylingContext {
1921
1921
1922
1922
void Colourize () {
1923
1923
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 ;
1926
1926
styler->ColourTo (end, state);
1927
1927
}
1928
1928
1929
1929
static int Line (lua_State *L) {
1930
1930
StylingContext *context = Context (L);
1931
- int position = (int )luaL_checkinteger (L, 2 );
1931
+ intptr_t position = (intptr_t )luaL_checkinteger (L, 2 );
1932
1932
lua_pushinteger (L, context->styler ->GetLine (position));
1933
1933
return 1 ;
1934
1934
}
1935
1935
1936
1936
static int CharAt (lua_State *L) {
1937
1937
StylingContext *context = Context (L);
1938
- int position = (int )luaL_checkinteger (L, 2 );
1938
+ intptr_t position = (intptr_t )luaL_checkinteger (L, 2 );
1939
1939
lua_pushinteger (L, context->styler ->SafeGetCharAt (position));
1940
1940
return 1 ;
1941
1941
}
1942
1942
1943
1943
static int StyleAt (lua_State *L) {
1944
1944
StylingContext *context = Context (L);
1945
- int position = (int )luaL_checkinteger (L, 2 );
1945
+ intptr_t position = (intptr_t )luaL_checkinteger (L, 2 );
1946
1946
lua_pushinteger (L, context->styler ->StyleAt (position));
1947
1947
return 1 ;
1948
1948
}
1949
1949
1950
1950
static int LevelAt (lua_State *L) {
1951
1951
StylingContext *context = Context (L);
1952
- int line = (int )luaL_checkinteger (L, 2 );
1952
+ intptr_t line = (intptr_t )luaL_checkinteger (L, 2 );
1953
1953
lua_pushinteger (L, context->styler ->LevelAt (line));
1954
1954
return 1 ;
1955
1955
}
1956
1956
1957
1957
static int SetLevelAt (lua_State *L) {
1958
1958
StylingContext *context = Context (L);
1959
- int line = (int )luaL_checkinteger (L, 2 );
1959
+ intptr_t line = (intptr_t )luaL_checkinteger (L, 2 );
1960
1960
int level = (int )luaL_checkinteger (L, 3 );
1961
1961
context->styler ->SetLevel (line, level);
1962
1962
return 0 ;
1963
1963
}
1964
1964
1965
1965
static int LineState (lua_State *L) {
1966
1966
StylingContext *context = Context (L);
1967
- int line = (int )luaL_checkinteger (L, 2 );
1967
+ intptr_t line = (intptr_t )luaL_checkinteger (L, 2 );
1968
1968
lua_pushinteger (L, context->styler ->GetLineState (line));
1969
1969
return 1 ;
1970
1970
}
1971
1971
1972
1972
static int SetLineState (lua_State *L) {
1973
1973
StylingContext *context = Context (L);
1974
- int line = (int )luaL_checkinteger (L, 2 );
1974
+ intptr_t line = (intptr_t )luaL_checkinteger (L, 2 );
1975
1975
int stateOfLine = (int )luaL_checkinteger (L, 3 );
1976
1976
context->styler ->SetLineState (line, stateOfLine);
1977
1977
return 0 ;
@@ -2018,7 +2018,7 @@ struct StylingContext {
2018
2018
(currentPos >= endPos);
2019
2019
}
2020
2020
2021
- void StartStyling (unsigned int startPos_, unsigned int length, int initStyle_) {
2021
+ void StartStyling (uintptr_t startPos_, uintptr_t length, int initStyle_) {
2022
2022
endDoc = styler->Length ();
2023
2023
endPos = startPos_ + length;
2024
2024
if (endPos == endDoc)
@@ -2049,8 +2049,8 @@ struct StylingContext {
2049
2049
2050
2050
static int StartStyling (lua_State *L) {
2051
2051
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 );
2054
2054
int initialStyle = (int )luaL_checkinteger (L, 4 );
2055
2055
context->StartStyling (startPosStyle, lengthStyle, initialStyle);
2056
2056
return 0 ;
0 commit comments