upgrade to 1.72

based on diffs from new maintainer Jeremy Evans <jeremyevans0 at gmail.com>
This commit is contained in:
steven 2007-01-18 10:56:27 +00:00
parent 09b3edc7a4
commit 134affccfd
39 changed files with 1173 additions and 1117 deletions

View File

@ -1,17 +1,19 @@
# $OpenBSD: Makefile,v 1.7 2006/10/31 19:52:36 espie Exp $
# $OpenBSD: Makefile,v 1.8 2007/01/18 10:56:27 steven Exp $
COMMENT= "source code editing component for GTK+"
VERSION= 1.54
VERSION= 1.72
DISTNAME= scintilla${VERSION:S/.//}
PKGNAME= scintilla-${VERSION}p2
PKGNAME= scintilla-${VERSION}
CATEGORIES= editors x11
SHARED_LIBS= scintilla 3.0 \
scintilla_lexers 3.0
SHARED_LIBS= scintilla 4.0 \
scintilla_lexers 4.0
HOMEPAGE= http://www.scintilla.org/
MAINTAINER= Jeremy Evans <jeremyevans0@gmail.com>
# old Python license
PERMIT_PACKAGE_CDROM= "may not sell"
PERMIT_PACKAGE_FTP= Yes
@ -21,7 +23,6 @@ PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=scintilla/}
EXTRACT_SUFX= .tgz
USE_X11= Yes
USE_GMAKE= Yes
NO_REGRESS= Yes
@ -29,6 +30,8 @@ MAKE_FILE= makefile
MAKE_ENV= CXX='${CXX}' CXXFLAGS='${CXXFLAGS}' \
NO_SHARED_LIBS='${NO_SHARED_LIBS:L}'
LIB_DEPENDS= gtk-x11-2.0,gdk-x11-2.0::x11/gtk+2
.for n v in ${SHARED_LIBS}
MAKE_ENV+= LIB$n_VERSION=${LIB$n_VERSION}
.endfor
@ -36,10 +39,11 @@ MAKE_ENV+= LIB$n_VERSION=${LIB$n_VERSION}
WRKDIST= ${WRKDIR}/scintilla
WRKSRC= ${WRKDIST}/gtk
LIB_DEPENDS= gtk.>=1.2,gdk.>=1.2::x11/gtk+
post-extract:
perl -pi -e 's|\x0d||' ${WRKDIST}/include/*.h ${WRKDIST}/gtk/*.cxx \
${WRKDIST}/src/*.cxx
pre-build:
perl -pi -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/${MAKE_FILE}
.include <bsd.port.mk>

View File

@ -1,4 +1,4 @@
MD5 (scintilla154.tgz) = c3be0153f1ba81e718fe105c3946357d
RMD160 (scintilla154.tgz) = 66fed3dae3edcaa8ffde26756dbd8c81d4282276
SHA1 (scintilla154.tgz) = 370f03b2c8ad3c52f77859665f94e9a591c98d98
SIZE (scintilla154.tgz) = 439325
MD5 (scintilla172.tgz) = e17aa5b54925a1b09c34e1a1e0d49687
RMD160 (scintilla172.tgz) = 1338538b4636e0b7335b26af469470a0e87fe76c
SHA1 (scintilla172.tgz) = 9d1ce0bb1601930414036d373d7eff0488abfb9a
SIZE (scintilla172.tgz) = 642561

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-gtk_Converter_h,v 1.1 2007/01/18 10:56:27 steven Exp $
--- gtk/Converter.h.orig Sat Jun 24 00:04:42 2006
+++ gtk/Converter.h Wed May 31 06:04:10 2006
@@ -53,8 +53,8 @@ public:
// Try allowing approximate transliterations
if (transliterations) {
char fullDest[200];
- strcpy(fullDest, charSetDestination);
- strcat(fullDest, "//TRANSLIT");
+ strlcpy(fullDest, charSetDestination, sizeof(fullDest));
+ strlcat(fullDest, "//TRANSLIT", sizeof(fullDest));
OpenHandle(fullDest, charSetSource);
}
if (!Succeeded()) {

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
--- gtk/PlatGTK.cxx.orig 2003-08-13 16:46:23.000000000 +1000
+++ gtk/PlatGTK.cxx 2003-08-13 17:01:38.000000000 +1000
@@ -332,7 +332,7 @@ static void GenerateFontSpecStrings(cons
$OpenBSD: patch-gtk_PlatGTK_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- gtk/PlatGTK.cxx.orig Tue Mar 28 17:31:51 2006
+++ gtk/PlatGTK.cxx Tue Mar 28 17:31:51 2006
@@ -351,7 +351,7 @@ static void GenerateFontSpecStrings(cons
if (strchr(fontName, '-')) {
char tmp[300];
char *d1 = NULL, *d2 = NULL, *d3 = NULL;
@ -10,7 +10,7 @@ $OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
d1 = strchr(tmp, '-');
// we know the first dash exists
d2 = strchr(d1 + 1, '-');
@@ -343,25 +343,25 @@ static void GenerateFontSpecStrings(cons
@@ -362,25 +362,25 @@ static void GenerateFontSpecStrings(cons
*d2 = '\0';
foundary[0] = '-';
foundary[1] = '\0';
@ -46,7 +46,7 @@ $OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
}
}
@@ -371,7 +371,7 @@ static void SetLogFont(LOGFONT &lf, cons
@@ -390,7 +390,7 @@ static void SetLogFont(LOGFONT &lf, cons
lf.bold = bold;
lf.italic = italic;
lf.characterSet = characterSet;
@ -55,7 +55,7 @@ $OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
}
/**
@@ -533,9 +533,8 @@ FontID FontCached::CreateNewFont(const c
@@ -552,9 +552,8 @@ FontID FontCached::CreateNewFont(const c
// eg. adobe-courier-iso10646-1,*-courier-iso10646-1,*-*-*-*
if (strchr(fontName, ',')) {
// build a fontspec and use gdk_fontset_load
@ -66,7 +66,7 @@ $OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
char *fn = fontNameCopy;
char *fp = strchr(fn, ',');
for (;;) {
@@ -566,8 +565,7 @@ FontID FontCached::CreateNewFont(const c
@@ -585,8 +584,7 @@ FontID FontCached::CreateNewFont(const c
// we are doing italic, add an oblique font
// to the list
if (italic && fontset[0] == '\0') {
@ -76,7 +76,7 @@ $OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
snprintf(fontspec,
sizeof(fontspec) - 1,
@@ -578,8 +576,7 @@ FontID FontCached::CreateNewFont(const c
@@ -597,8 +595,7 @@ FontID FontCached::CreateNewFont(const c
charset);
}
@ -86,9 +86,9 @@ $OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
if (!fp)
break;
@@ -1967,8 +1964,7 @@ void ListBoxX::GetValue(int n, char *val
break;
@@ -2394,8 +2391,7 @@ void ListBoxX::GetValue(int n, char *val
}
#endif
if (text && len > 0) {
- strncpy(value, text, len);
- value[len - 1] = '\0';
@ -96,7 +96,7 @@ $OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
} else {
value[0] = '\0';
}
@@ -2197,7 +2193,7 @@ void Platform::DebugPrintf(const char *f
@@ -2668,7 +2664,7 @@ void Platform::DebugPrintf(const char *f
char buffer[2000];
va_list pArguments;
va_start(pArguments, format);
@ -105,7 +105,7 @@ $OpenBSD: patch-gtk_PlatGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
va_end(pArguments);
Platform::DebugDisplay(buffer);
}
@@ -2217,8 +2213,7 @@ bool Platform::ShowAssertionPopUps(bool
@@ -2688,8 +2684,7 @@ bool Platform::ShowAssertionPopUps(bool
void Platform::Assert(const char *c, const char *file, int line) {
char buffer[2000];

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-gtk_ScintillaGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
--- gtk/ScintillaGTK.cxx.orig 2003-08-14 01:19:02.000000000 +1000
+++ gtk/ScintillaGTK.cxx 2003-08-14 01:19:03.000000000 +1000
@@ -1020,8 +1020,8 @@ void ScintillaGTK::CreateCallTipWindow(P
$OpenBSD: patch-gtk_ScintillaGTK_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- gtk/ScintillaGTK.cxx.orig Thu Jan 18 08:42:00 2007
+++ gtk/ScintillaGTK.cxx Thu Jan 18 08:42:00 2007
@@ -1335,8 +1335,8 @@ void ScintillaGTK::CreateCallTipWindow(P
void ScintillaGTK::AddToPopUp(const char *label, int cmd, bool enabled) {
char fulllabel[200];
@ -12,12 +12,3 @@ $OpenBSD: patch-gtk_ScintillaGTK_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
GtkItemFactoryCallback menuSig = GtkItemFactoryCallback(PopUpCB);
GtkItemFactoryEntry itemEntry = {
fulllabel, NULL,
@@ -1076,7 +1076,7 @@ char *ScintillaGTK::GetGtkSelectionText(
// Return empty string if selection is not a string
if (selectionData->type != GDK_TARGET_STRING) {
dest = new char[1];
- strcpy(dest, "");
+ dest[0] = 0;
*isRectangular = false;
*len = 0;
return dest;

View File

@ -1,15 +1,16 @@
--- gtk/makefile.orig 2003-08-10 04:55:54.000000000 -0600
+++ gtk/makefile 2004-06-12 23:19:17.000000000 -0600
@@ -5,7 +5,7 @@
# GNU make does not like \r\n line endings so should be saved to CVS in binary form.
# To build for GTK+ 2, define GTK2 on the make command line.
$OpenBSD: patch-gtk_makefile,v 1.5 2007/01/18 10:56:27 steven Exp $
--- gtk/makefile.orig Wed Dec 13 01:19:17 2006
+++ gtk/makefile Thu Jan 18 08:46:52 2007
@@ -7,7 +7,7 @@
# To force GTK+ 2 build, define GTK2 on the make command line.
# To force GTK+ 1 build, define GTK1 on the make command line.
-.SUFFIXES: .cxx .o .h .a
+.SUFFIXES: .cxx .o .h .a .so
-.SUFFIXES: .cxx .c .o .h .a
+.SUFFIXES: .cxx .c .o .h .a .so
CC = g++
CCOMP = gcc
AR = ar
RANLIB = touch
@@ -16,13 +16,16 @@ AR = ar
@@ -17,14 +17,18 @@ ifeq ($(shell uname),Darwin)
RANLIB = ranlib
endif
@ -22,13 +23,16 @@
vpath %.h ../src ../include
vpath %.cxx ../src
INCLUDEDIRS=-I ../include -I ../src
-CXXBASEFLAGS=-W -Wall -DGTK -DSCI_LEXER $(INCLUDEDIRS)
+CXXBASEFLAGS=-W -Wall -DGTK -DSCI_LEXER -Dunix $(INCLUDEDIRS)
-INCLUDEDIRS=-I ../include -I ../src
-CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -Os -DGTK -DSCI_LEXER $(INCLUDEDIRS)
+INCLUDEDIRS=-I ../include -I ../src -I /usr/local/include
+CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -DGTK -DSCI_LEXER -Dunix $(INCLUDEDIRS)
+
ifdef NOTHREADS
THREADFLAGS=-DG_THREADS_IMPL_NONE
@@ -33,7 +36,7 @@ endif
else
@@ -34,7 +38,7 @@ endif
ifdef DEBUG
CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
else
@ -36,8 +40,8 @@
+CXXFLAGS+=-DNDEBUG $(CXXBASEFLAGS) $(THREADFLAGS)
endif
ifdef GTK2
@@ -43,7 +46,9 @@ CONFIGFLAGS=gtk-config --cflags
# If explicit setting of GTK1 or GTK2 then use that else look for
@@ -56,9 +60,13 @@ endif
endif
.cxx.o:
@ -45,20 +49,24 @@
+ $(CXX) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $<
+.cxx.so:
+ $(CXX) -fPIC `$(CONFIGFLAGS)` $(CXXFLAGS) -o $@ -c $<
.c.o:
$(CCOMP) `$(CONFIGFLAGS)` $(CXXFLAGS) -w -c $<
+.c.so:
+ $(CCOMP) -fPIC `$(CONFIGFLAGS)` $(CXXFLAGS) -w -o $@ -c $<
#++Autogenerated -- run src/LexGen.py to regenerate
#**LEXOBJS=\\\n\(\*.o \)
@@ -57,20 +62,50 @@ LexSQL.o LexVB.o
@@ -74,22 +82,52 @@ LexSpecman.o LexSpice.o LexSQL.o LexTADS
LexVerilog.o LexVHDL.o LexYAML.o
#--Autogenerated -- end of automatically generated section
# The LEXOBJS have to be treated specially as the functions in them are not called from external code
-all: $(COMPLIB) $(LEXOBJS)
-all: $(COMPLIB)
+ifeq (${NO_SHARED_LIBS},"yes")
+all: static
+else
+all: static shared
+endif
+
+static: $(COMPLIB) $(LEXERLIB)
+shared: $(SHAREDLIB) $(SHAREDLEXER)
+
@ -73,7 +81,7 @@
+install-shared:
+ install -m 444 ${SHAREDLIB} ${SHAREDLEXER} ${PREFIX}/lib
+endif
+
clean:
rm -f *.o $(COMPLIB)
@ -81,24 +89,26 @@
- $(CC) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak
+ $(CXX) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak
-$(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o Document.o CallTip.o \
+LIBOBJS = DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o Document.o CallTip.o \
-$(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o \
+LIBOBJS = DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o \
CharClassify.o Document.o CallTip.o \
ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.o \
KeyMap.o LineMarker.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
RESearch.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o
RESearch.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
$(MARSHALLER) $(LEXOBJS)
+
+$(COMPLIB): $(LIBOBJS)
$(AR) rc $@ $^
$(RANLIB) $@
+
+$(LEXERLIB): $(LEXOBJS)
+ $(AR) rc $@ $^
+ $(RANLIB) $@
+
+$(LEXERLIB): $(LEXOBJS)
$(AR) rc $@ $^
$(RANLIB) $@
+$(SHAREDLIB): $(addsuffix .so,$(basename $(LIBOBJS)))
+ $(CC) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLIB)) $^
+ $(CXX) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLIB)) $^
+$(SHAREDLEXER): $(addsuffix .so,$(basename $(LEXOBJS)))
+ $(CC) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLEXER)) $^
+
+ $(CXX) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLEXER)) $^
# Automatically generate header dependencies with "make deps"
include deps.mak

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-include_SString_h,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
--- include/SString.h.orig 2003-08-13 20:03:23.000000000 +0200
+++ include/SString.h 2003-08-13 20:04:23.000000000 +0200
@@ -98,13 +98,13 @@ public:
}
SString(int i) : sizeGrowth(sizeGrowthDefault) {
char number[32];
- sprintf(number, "%0d", i);
+ snprintf(number, sizeof(number), "%0d", i);
s = StringAllocate(number);
sSize = sLen = (s) ? strlen(s) : 0;
}
SString(double d, int precision) : sizeGrowth(sizeGrowthDefault) {
char number[32];
- sprintf(number, "%.*f", precision, d);
+ snprintf(number, sizeof(number), "%.*f", precision, d);
s = StringAllocate(number);
sSize = sLen = (s) ? strlen(s) : 0;
}

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-src_AutoComplete_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
--- src/AutoComplete.cxx.orig 2003-08-13 17:04:03.000000000 +1000
+++ src/AutoComplete.cxx 2003-08-13 17:28:29.000000000 +1000
@@ -56,8 +56,7 @@ void AutoComplete::Start(Window &parent,
$OpenBSD: patch-src_AutoComplete_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/AutoComplete.cxx.orig Tue Mar 28 17:31:51 2006
+++ src/AutoComplete.cxx Tue Mar 28 17:31:51 2006
@@ -57,8 +57,7 @@ void AutoComplete::Start(Window &parent,
}
void AutoComplete::SetStopChars(const char *stopChars_) {
@ -11,7 +11,7 @@ $OpenBSD: patch-src_AutoComplete_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
}
bool AutoComplete::IsStopChar(char ch) {
@@ -65,8 +64,7 @@ bool AutoComplete::IsStopChar(char ch) {
@@ -66,8 +65,7 @@ bool AutoComplete::IsStopChar(char ch) {
}
void AutoComplete::SetFillUpChars(const char *fillUpChars_) {
@ -21,16 +21,3 @@ $OpenBSD: patch-src_AutoComplete_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
}
bool AutoComplete::IsFillUpChar(char ch) {
@@ -91,9 +89,10 @@ char AutoComplete::GetTypesep() {
void AutoComplete::SetList(const char *list) {
lb->Clear();
- char *words = new char[strlen(list) + 1];
+ size_t words_len = strlen(list) + 1;
+ char *words = new char[words_len];
if (words) {
- strcpy(words, list);
+ strlcpy(words, list, words_len);
char *startword = words;
char *numword = NULL;
int i = 0;

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-src_CallTip_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
--- src/CallTip.cxx.orig 2003-08-13 17:04:03.000000000 +1000
+++ src/CallTip.cxx 2003-08-13 17:06:32.000000000 +1000
@@ -214,10 +214,11 @@ PRectangle CallTip::CallTipStart(int pos
$OpenBSD: patch-src_CallTip_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/CallTip.cxx.orig Tue Mar 28 17:31:51 2006
+++ src/CallTip.cxx Tue Mar 28 17:31:51 2006
@@ -241,10 +241,11 @@ PRectangle CallTip::CallTipStart(int pos
clickPlace = 0;
if (val)
delete []val;

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-src_Editor_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
--- src/Editor.cxx.orig 2003-08-14 01:19:02.000000000 +1000
+++ src/Editor.cxx 2003-08-14 01:19:03.000000000 +1000
@@ -1583,10 +1583,10 @@ void Editor::PaintSelMargin(Surface *sur
$OpenBSD: patch-src_Editor_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/Editor.cxx.orig Thu Jan 18 08:42:00 2007
+++ src/Editor.cxx Thu Jan 18 08:42:00 2007
@@ -1848,10 +1848,10 @@ void Editor::PaintSelMargin(Surface *sur
char number[100];
number[0] = '\0';
if (firstSubLine)
@ -14,7 +14,7 @@ $OpenBSD: patch-src_Editor_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
(lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_',
(lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_',
lev & SC_FOLDLEVELNUMBERMASK,
@@ -2764,7 +2764,7 @@ long Editor::FormatRange(bool draw, Rang
@@ -3255,7 +3255,7 @@ long Editor::FormatRange(bool draw, Rang
(ypos + vsPrint.lineHeight <= pfr->rc.bottom) &&
(visibleLine >= 0)) {
char number[100];

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-src_ExternalLexer_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
--- src/ExternalLexer.cxx.orig 2003-08-13 17:04:03.000000000 +1000
+++ src/ExternalLexer.cxx 2003-08-13 17:07:47.000000000 +1000
@@ -40,8 +40,9 @@ char **WordListsToStrings(WordList *val[
$OpenBSD: patch-src_ExternalLexer_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/ExternalLexer.cxx.orig Tue Mar 28 17:31:51 2006
+++ src/ExternalLexer.cxx Tue Mar 28 17:31:51 2006
@@ -42,8 +42,9 @@ char **WordListsToStrings(WordList *val[
if (n != val[i]->len - 1)
words += " ";
}
@ -13,7 +13,7 @@ $OpenBSD: patch-src_ExternalLexer_cxx,v 1.1.1.1 2003/08/14 18:24:30 sturm Exp $
}
wls[dim] = 0;
return wls;
@@ -129,7 +130,7 @@ LexerLibrary::LexerLibrary(const char* M
@@ -131,7 +132,7 @@ LexerLibrary::LexerLibrary(const char* M
// Assign a buffer for the lexer name.
char lexname[100];

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_ExternalLexer_h,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/ExternalLexer.h.orig Tue Mar 28 17:54:36 2006
+++ src/ExternalLexer.h Tue Mar 28 17:54:52 2006
@@ -35,7 +35,7 @@ protected:
public:
ExternalLexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){
- strncpy(name, languageName_, sizeof(name));
+ strlcpy(name, languageName_, sizeof(name));
languageName = name;
};
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-src_KeyWords_cxx,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/KeyWords.cxx.orig Wed Sep 13 19:53:23 2006
+++ src/KeyWords.cxx Wed Sep 13 19:54:46 2006
@@ -73,7 +73,8 @@ int LexerModule::GetStyleBitsNeeded() co
const LexerModule *LexerModule::Find(int language) {
const LexerModule *lm = base;
- while (lm) {
+ int i;
+ for(i=0; lm && i < 79; i++) {
if (lm->language == language) {
return lm;
}
@@ -85,7 +86,8 @@ const LexerModule *LexerModule::Find(int
const LexerModule *LexerModule::Find(const char *languageName) {
if (languageName) {
const LexerModule *lm = base;
- while (lm) {
+ int i;
+ for(i=0; lm && i < 79; i++) {
if (lm->languageName && 0 == strcmp(lm->languageName, languageName)) {
return lm;
}

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-src_LexAU3_cxx,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/LexAU3.cxx.orig Tue Mar 28 17:34:16 2006
+++ src/LexAU3.cxx Tue Mar 28 17:35:58 2006
@@ -230,12 +230,7 @@ static void ColouriseAU3Doc(unsigned int
// save the total current word for eof processing
if (IsAWordChar(sc.ch) || sc.ch == '}')
{
- strcpy(s_save,s);
- int tp = strlen(s_save);
- if (tp < 99) {
- s_save[tp] = static_cast<char>(tolower(sc.ch));
- s_save[tp+1] = '\0';
- }
+ strlcpy(s_save,s, sizeof(s_save));
}
// **********************************************
//

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_LexCaml_cxx,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/LexCaml.cxx.orig Tue Mar 28 17:55:58 2006
+++ src/LexCaml.cxx Tue Mar 28 17:56:33 2006
@@ -75,7 +75,7 @@ void Platform::DebugPrintf(const char *f
char buffer[2000];
va_list pArguments;
va_start(pArguments, format);
- vsprintf(buffer,format,pArguments);
+ vsnprintf(buffer,sizeof(buffer),format,pArguments);
va_end(pArguments);
Platform::DebugDisplay(buffer);
}

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_LexEScript_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
--- src/LexEScript.cxx.orig 2003-08-13 17:04:03.000000000 +1000
+++ src/LexEScript.cxx 2003-08-13 17:08:53.000000000 +1000
$OpenBSD: patch-src_LexEScript_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/LexEScript.cxx.orig Tue Mar 28 17:31:51 2006
+++ src/LexEScript.cxx Tue Mar 28 17:31:51 2006
@@ -231,7 +231,7 @@ static void FoldESCRIPTDoc(unsigned int
}
s[j] = '\0';

View File

@ -1,21 +1,21 @@
$OpenBSD: patch-src_LexFortran_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
--- src/LexFortran.cxx.orig 2003-08-13 17:04:03.000000000 +1000
+++ src/LexFortran.cxx 2003-08-13 17:09:32.000000000 +1000
@@ -261,7 +261,7 @@ static void FoldFortranDoc(unsigned int
$OpenBSD: patch-src_LexFortran_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/LexFortran.cxx.orig Tue Mar 28 17:31:51 2006
+++ src/LexFortran.cxx Tue Mar 28 17:31:51 2006
@@ -380,7 +380,7 @@ static void FoldFortranDoc(unsigned int
doLabels[posLabel] = atoi(Label);
}
}
s[j] = '\0';
levelCurrent += classifyFoldPointFortran(s, prevWord);
- strcpy(prevWord, s);
+ strlcpy(prevWord, s, sizeof(prevWord));
}
}
if (atEOL) {
@@ -276,7 +276,7 @@ static void FoldFortranDoc(unsigned int
} else if (style == SCE_F_LABEL) {
if(IsADigit(ch) && !IsADigit(chNext)) {
@@ -410,7 +410,7 @@ static void FoldFortranDoc(unsigned int
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
- strcpy(prevWord, "");
+ prevWord[0] = 0;
}
if (!isspacechar(ch))
/***************************************/
if (!isspacechar(ch)) visibleChars++;

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-src_LexHTML_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
--- src/LexHTML.cxx.orig 2003-08-14 01:19:02.000000000 +1000
+++ src/LexHTML.cxx 2003-08-14 01:21:26.000000000 +1000
@@ -287,7 +287,7 @@ static int classifyWordHTVB(unsigned int
$OpenBSD: patch-src_LexHTML_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/LexHTML.cxx.orig Thu Jan 18 08:42:00 2007
+++ src/LexHTML.cxx Thu Jan 18 08:42:00 2007
@@ -308,7 +308,7 @@ static int classifyWordHTVB(unsigned int
return SCE_HB_DEFAULT;
}
@ -10,7 +10,7 @@ $OpenBSD: patch-src_LexHTML_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
bool wordIsNumber = IsADigit(styler[start]);
char s[30 + 1];
unsigned int i = 0;
@@ -305,7 +305,7 @@ static void classifyWordHTPy(unsigned in
@@ -326,7 +326,7 @@ static void classifyWordHTPy(unsigned in
else if (keywords.InList(s))
chAttr = SCE_HP_WORD;
styler.ColourTo(end, statePrintForState(chAttr, inScriptType));
@ -19,7 +19,7 @@ $OpenBSD: patch-src_LexHTML_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
}
// Update the word colour to default or keyword
@@ -724,7 +724,7 @@ static void ColouriseHyperTextDoc(unsign
@@ -799,7 +799,7 @@ static void ColouriseHyperTextDoc(unsign
classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType);
break;
case SCE_HP_WORD:
@ -28,7 +28,7 @@ $OpenBSD: patch-src_LexHTML_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
break;
case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
@@ -1369,7 +1369,7 @@ static void ColouriseHyperTextDoc(unsign
@@ -1455,7 +1455,7 @@ static void ColouriseHyperTextDoc(unsign
break;
case SCE_HP_WORD:
if (!iswordchar(ch)) {
@ -37,3 +37,21 @@ $OpenBSD: patch-src_LexHTML_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
state = SCE_HP_DEFAULT;
if (ch == '#') {
state = SCE_HP_COMMENTLINE;
@@ -1540,7 +1540,7 @@ static void ColouriseHyperTextDoc(unsign
state = SCE_HPHP_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_HPHP_HSTRING;
- strcpy(phpStringDelimiter, "\"");
+ strlcpy(phpStringDelimiter, "\"", sizeof(phpStringDelimiter));
} else if (styler.Match(i, "<<<")) {
state = SCE_HPHP_HSTRING;
i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler);
@@ -1645,7 +1645,7 @@ static void ColouriseHyperTextDoc(unsign
state = SCE_HPHP_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_HPHP_HSTRING;
- strcpy(phpStringDelimiter, "\"");
+ strlcpy(phpStringDelimiter, "\"", sizeof(phpStringDelimiter));
} else if (styler.Match(i, "<<<")) {
state = SCE_HPHP_HSTRING;
i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler);

View File

@ -1,39 +1,12 @@
$OpenBSD: patch-src_LexRuby_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
--- src/LexRuby.cxx.orig 2003-08-13 17:38:22.000000000 +1000
+++ src/LexRuby.cxx 2003-08-13 17:43:34.000000000 +1000
@@ -19,7 +19,7 @@
#include "Scintilla.h"
#include "SciLexer.h"
-static void ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
+static void ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, size_t prevWord_len) {
char s[100];
bool wordIsNumber = isdigit(styler[start]) != 0;
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
@@ -45,7 +45,7 @@ static void ClassifyWordRb(unsigned int
}
}
$OpenBSD: patch-src_LexRuby_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/LexRuby.cxx.orig Thu Jan 18 08:42:00 2007
+++ src/LexRuby.cxx Thu Jan 18 08:42:00 2007
@@ -136,7 +136,7 @@ static int ClassifyWordRb(unsigned int s
chAttr = SCE_RB_IDENTIFIER;
styler.ColourTo(end, chAttr);
- strcpy(prevWord, s);
+ strlcpy(prevWord, s, prevWord_len);
}
static bool IsRbComment(Accessor &styler, int pos, int len) {
@@ -224,7 +224,7 @@ static void ColouriseRbDoc(unsigned int
}
} else if (state == SCE_P_WORD) {
if (!iswordchar(ch)) {
- ClassifyWordRb(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
+ ClassifyWordRb(styler.GetStartSegment(), i - 1, keywords, styler, prevWord, sizeof(prevWord));
state = SCE_P_DEFAULT;
if (ch == '#') {
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
@@ -294,7 +294,7 @@ static void ColouriseRbDoc(unsigned int
chPrev = ch;
}
if (state == SCE_P_WORD) {
- ClassifyWordRb(styler.GetStartSegment(), lengthDoc-1, keywords, styler, prevWord);
+ ClassifyWordRb(styler.GetStartSegment(), lengthDoc-1, keywords, styler, prevWord, sizeof(prevWord));
if (chAttr == SCE_RB_WORD) {
- strcpy(prevWord, s);
+ strlcpy(prevWord, s, MAX_KEYWORD_LENGTH+1);
} else {
styler.ColourTo(lengthDoc-1, state);
prevWord[0] = 0;
}

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_LexScriptol_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
--- src/LexScriptol.cxx.orig 2003-08-14 01:23:46.000000000 +1000
+++ src/LexScriptol.cxx 2003-08-14 01:25:06.000000000 +1000
$OpenBSD: patch-src_LexScriptol_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/LexScriptol.cxx.orig Tue Mar 28 17:31:51 2006
+++ src/LexScriptol.cxx Tue Mar 28 17:31:51 2006
@@ -17,7 +17,7 @@
#include "Scintilla.h"
#include "SciLexer.h"
@ -8,32 +8,32 @@ $OpenBSD: patch-src_LexScriptol_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
-static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
+static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, size_t prevWord_size)
{
char s[100];
bool wordIsNumber = isdigit(styler[start]) != 0;
char s[100];
bool wordIsNumber = isdigit(styler[start]) != 0;
@@ -39,7 +39,7 @@ static void ClassifyWordSol(unsigned int
}
}
styler.ColourTo(end, chAttr);
- strcpy(prevWord, s);
+ strlcpy(prevWord, s, prevWord_size);
}
}
styler.ColourTo(end, chAttr);
- strcpy(prevWord, s);
+ strlcpy(prevWord, s, prevWord_size);
}
static bool IsSolComment(Accessor &styler, int pos, int len)
@@ -246,7 +246,7 @@ static void ColouriseSolDoc(unsigned int
@@ -244,7 +244,7 @@ static void ColouriseSolDoc(unsigned int
{
if (!iswordchar(ch))
{
- ClassifyWordSol(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
+ ClassifyWordSol(styler.GetStartSegment(), i - 1, keywords, styler, prevWord, sizeof(prevWord));
state = SCE_P_DEFAULT;
state = SCE_SCRIPTOL_DEFAULT;
if (ch == '`')
{
@@ -356,7 +356,7 @@ static void ColouriseSolDoc(unsigned int
@@ -332,7 +332,7 @@ static void ColouriseSolDoc(unsigned int
if (state == SCE_SCRIPTOL_KEYWORD)
{
ClassifyWordSol(styler.GetStartSegment(),
- lengthDoc-1, keywords, styler, prevWord);
+ lengthDoc-1, keywords, styler, prevWord, sizeof(prevWord));
}
if (state == SCE_P_WORD)
{
- ClassifyWordSol(styler.GetStartSegment(), lengthDoc-1, keywords, styler, prevWord);
+ ClassifyWordSol(styler.GetStartSegment(), lengthDoc-1, keywords, styler, prevWord, sizeof(prevWord));
}
else
{
else
{

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-src_LexVHDL_cxx,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/LexVHDL.cxx.orig Tue Mar 28 17:36:16 2006
+++ src/LexVHDL.cxx Tue Mar 28 17:38:32 2006
@@ -222,7 +222,7 @@ static void FoldNoBoxVHDLDoc(
s[k] = '\0';
if(keywords.InList(s)) {
- strcpy(prevWord, s);
+ strlcpy(prevWord, s, sizeof(prevWord));
break;
}
}
@@ -236,7 +236,7 @@ static void FoldNoBoxVHDLDoc(
{
if((ch == ';') && (strcmp(prevWord, "end") == 0))
{
- strcpy(prevWord, ";");
+ strlcpy(prevWord, ";", sizeof(prevWord));
}
}
}
@@ -290,7 +290,7 @@ static void FoldNoBoxVHDLDoc(
{
if((ch == ';') && (strcmp(prevWord, "end") == 0))
{
- strcpy(prevWord, ";");
+ strlcpy(prevWord, ";", sizeof(prevWord));
}
if(!IsAWordChar(chPrev) && IsAWordStart(ch))
@@ -379,7 +379,7 @@ static void FoldNoBoxVHDLDoc(
levelMinCurrentBegin = levelNext - 1;
}
//Platform::DebugPrintf("Line[%04d] Prev[%20s] Cur[%20s] Level[%x]\n", lineCurrent+1, prevWord, s, levelCurrent);
- strcpy(prevWord, s);
+ strlcpy(prevWord, s, sizeof(prevWord));
}
}
}

View File

@ -1,22 +1,25 @@
$OpenBSD: patch-src_PropSet_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
--- src/PropSet.cxx.orig 2003-08-14 01:19:03.000000000 +1000
+++ src/PropSet.cxx 2003-08-14 01:19:03.000000000 +1000
@@ -185,9 +185,10 @@ SString PropSet::Expand(const char *with
break;
size_t newlenbase = strlen(base) + val.length() - lenvar;
char *newbase = new char[newlenbase];
- strncpy(newbase, base, cpvar - base);
- strcpy(newbase + (cpvar - base), val.c_str());
- strcpy(newbase + (cpvar - base) + val.length(), cpendvar + 1);
+ *cpvar = 0;
+ strlcpy(newbase, base, newlenbase);
+ strlcat(newbase, val.c_str(), newlenbase);
+ strlcat(newbase, cpendvar + 1, newlenbase);
delete []var;
delete []base;
base = newbase;
@@ -305,9 +306,10 @@ SString PropSet::GetNewExpand(const char
SString val = GetWild(var, filename);
$OpenBSD: patch-src_PropSet_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/PropSet.cxx.orig Tue Mar 28 17:31:51 2006
+++ src/PropSet.cxx Tue Mar 28 17:57:29 2006
@@ -78,14 +78,14 @@ bool EqualCaseInsensitive(const char *a,
SString::SString(int i) : sizeGrowth(sizeGrowthDefault) {
char number[32];
- sprintf(number, "%0d", i);
+ snprintf(number, sizeof(number), "%0d", i);
s = StringAllocate(number);
sSize = sLen = (s) ? strlen(s) : 0;
}
SString::SString(double d, int precision) : sizeGrowth(sizeGrowthDefault) {
char number[32];
- sprintf(number, "%.*f", precision, d);
+ snprintf(number, sizeof(number), "%.*f", precision, d);
s = StringAllocate(number);
sSize = sLen = (s) ? strlen(s) : 0;
}
@@ -635,9 +635,10 @@ SString PropSet::GetNewExpand(const char
val.clear(); // Self-references evaluate to empty string
size_t newlenbase = strlen(base) + val.length() - lenvar;
char *newbase = new char[newlenbase];
- strncpy(newbase, base, cpvar - base);
@ -29,7 +32,7 @@ $OpenBSD: patch-src_PropSet_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
delete []var;
delete []base;
base = newbase;
@@ -349,18 +351,15 @@ char *PropSet::ToString() {
@@ -679,18 +680,15 @@ char *PropSet::ToString() {
len = 1; // Return as empty string
char *ret = new char [len];
if (ret) {

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_ViewStyle_cxx,v 1.1.1.1 2003/08/14 18:24:31 sturm Exp $
--- src/ViewStyle.cxx.orig 2003-08-13 17:04:03.000000000 +1000
+++ src/ViewStyle.cxx 2003-08-13 17:27:33.000000000 +1000
$OpenBSD: patch-src_ViewStyle_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/ViewStyle.cxx.orig Tue Mar 28 17:31:51 2006
+++ src/ViewStyle.cxx Tue Mar 28 17:31:51 2006
@@ -44,8 +44,9 @@ const char *FontNames::Save(const char *
return names[i];
}

View File

@ -1,27 +1,35 @@
# $OpenBSD: Makefile,v 1.5 2006/10/31 19:52:36 espie Exp $
# $OpenBSD: Makefile,v 1.6 2007/01/18 10:56:27 steven Exp $
COMMENT= "flexible and small GTK+ editor"
VERSION= 1.54
VERSION= 1.72
DISTNAME= scite${VERSION:S/.//}
PKGNAME= scite-${VERSION}p0
PKGNAME= scite-${VERSION}
CATEGORIES= editors x11
HOMEPAGE= http://www.scintilla.org/SciTE.html
MAINTAINER= Jeremy Evans <jeremyevans0@gmail.com>
# old Python license
PERMIT_PACKAGE_CDROM= "may not sell"
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= "may not sell"
PERMIT_DISTFILES_FTP= Yes
WANTLIB= X11 Xext Xi c gdk glib gmodule gtk iconv intl m\
pthread stdc++
WANTLIB= X11 Xext Xrender c m z pthread stdc++ fontconfig \
freetype \
glib-2.0 gobject-2.0 gthread-2.0 gmodule-2.0 \
pango-1.0 pangocairo-1.0 pangoft2-1.0 \
cairo atk-1.0 glitz png
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=scintilla/}
EXTRACT_SUFX= .tgz
LIB_DEPENDS= gthread.>=1.2::devel/glib \
scintilla.>=1,scintilla_lexers.>=1::editors/scintilla
MODULES= devel/gettext
LIB_DEPENDS= gtk-x11-2.0,gdk-x11-2.0,gdk_pixbuf-2.0::x11/gtk+2 \
scintilla.>=4,scintilla_lexers.>=4::editors/scintilla
USE_GMAKE= Yes
USE_X11= Yes
@ -29,8 +37,13 @@ NO_REGRESS= Yes
WRKDIST= ${WRKDIR}/scite
WRKSRC= ${WRKDIST}/gtk
MAKE_FILE= makefile
MAKE_ENV= CXX="${CXX}" CXXFLAGS="${CXXFLAGS}"
post-extract:
perl -pi -e 's|\x0d||' ${WRKDIST}/gtk/*.cxx ${WRKDIST}/src/*.cxx
perl -pi -e 's|\x0d||' ${WRKSRC}/*.cxx ${WRKDIST}/src/*.cxx
pre-build:
perl -pi -e 's|__DOCDIR__|${LOCALBASE}/share/doc/scite|' \
${WRKDIST}/src/*.properties
.include <bsd.port.mk>

View File

@ -1,4 +1,4 @@
MD5 (scite154.tgz) = 5086acda2bb7a637fc34b0655e30930e
RMD160 (scite154.tgz) = efb8c3957e0ff78a1addef823469bcb2e6f5365a
SHA1 (scite154.tgz) = 86318d9b7e9a1ae766d27eefa06db1abff49cbae
SIZE (scite154.tgz) = 840583
MD5 (scite172.tgz) = da4e059117dbd69fb76d87739a98581d
RMD160 (scite172.tgz) = 7ffcfa07f43560122692bc4bd00bc910167e9082
SHA1 (scite172.tgz) = 5cb13215db44a7f37c4625fada8ca7f5e2dfbe96
SIZE (scite172.tgz) = 1335014

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-gtk_DirectorExtension_cxx,v 1.1.1.1 2003/08/14 18:27:25 sturm Exp $
--- gtk/DirectorExtension.cxx.orig 2003-08-13 17:49:48.000000000 +1000
+++ gtk/DirectorExtension.cxx 2003-08-13 18:15:11.000000000 +1000
@@ -240,6 +240,7 @@ bool DirectorExtension::CreatePipe(bool
$OpenBSD: patch-gtk_DirectorExtension_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- gtk/DirectorExtension.cxx.orig Fri Mar 31 21:45:37 2006
+++ gtk/DirectorExtension.cxx Fri Mar 31 21:45:37 2006
@@ -238,6 +238,7 @@ bool DirectorExtension::CreatePipe(bool
bool tryStandardPipeCreation = false;
SString pipeFilename = host->Property("ipc.scite.name");
gchar* pipeName = NULL;
@ -9,20 +9,20 @@ $OpenBSD: patch-gtk_DirectorExtension_cxx,v 1.1.1.1 2003/08/14 18:27:25 sturm Ex
fdReceiver = -1;
inputWatcher = -1;
@@ -249,6 +250,7 @@ bool DirectorExtension::CreatePipe(bool
printf("CreatePipe: if (pipeFilename.size() > 0): %s\n", pipeFilename.c_str());
@@ -247,6 +248,7 @@ bool DirectorExtension::CreatePipe(bool
//fprintf(fdDebug, "CreatePipe: if (pipeFilename.size() > 0): %s\n", pipeFilename.c_str());
//snprintf(pipeName, CHAR_MAX - 1, "%s", pipeFilename.c_str());
pipeName = g_strdup(pipeFilename.c_str());
+ pipeName_size = strlen(pipeName) + 1;
fdReceiver = open(pipeName, O_RDWR | O_NONBLOCK);
if (fdReceiver == -1 && errno == EACCES) {
//fprintf(fdDebug, "CreatePipe: No access\n");
@@ -296,7 +298,7 @@ bool DirectorExtension::CreatePipe(bool
@@ -294,7 +296,7 @@ bool DirectorExtension::CreatePipe(bool
//create the pipe name - we use a number as well just incase multiple people have pipes open
//or we are forceing a new instance of scite (even if there is already one)
- sprintf(pipeName, "/tmp/.SciTE.%d.ipc", i);
+ snprintf(pipeName, pipeName_size, "/tmp/.SciTE.%d.ipc", i);
//fprintf(fdDebug, "Trying pipe %s\n", pipeName);
//check to see if there is already one

View File

@ -1,8 +1,8 @@
$OpenBSD: patch-gtk_SciTEGTK_cxx,v 1.1.1.1 2003/08/14 18:27:25 sturm Exp $
--- gtk/SciTEGTK.cxx.orig 2003-08-14 01:31:52.000000000 +1000
+++ gtk/SciTEGTK.cxx 2003-08-14 01:33:28.000000000 +1000
@@ -340,7 +340,7 @@ SciTEGTK::SciTEGTK(Extension *ext) : Sci
pidShell = 0;
$OpenBSD: patch-gtk_SciTEGTK_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- gtk/SciTEGTK.cxx.orig Thu Jan 18 09:11:18 2007
+++ gtk/SciTEGTK.cxx Thu Jan 18 09:11:18 2007
@@ -495,7 +495,7 @@ SciTEGTK::SciTEGTK(Extension *ext) : Sci
triedKill = false;
exitStatus = 0;
pollID = 0;
- sprintf(resultsFile, "/tmp/SciTE%x.results",
@ -10,136 +10,44 @@ $OpenBSD: patch-gtk_SciTEGTK_cxx,v 1.1.1.1 2003/08/14 18:27:25 sturm Exp $
static_cast<int>(getpid()));
inputHandle = 0;
@@ -462,13 +462,12 @@ void SciTEGTK::GetDefaultDirectory(char
if (where)
#ifdef __vms
@@ -614,9 +614,9 @@ GtkWidget *SciTEGTK::AddMBButton(GtkWidg
// This is an internally used function to create pixmaps.
GdkPixbuf *SciTEGTK::CreatePixbuf(const char *filename) {
char path[MAX_PATH + 20];
- strncpy(path, PIXMAP_PATH, sizeof(path));
- strcat(path, pathSepString);
- strcat(path, filename);
+ strlcpy(path, PIXMAP_PATH, sizeof(path));
+ strlcat(path, pathSepString, sizeof(path));
+ strlcat(path, filename, sizeof(path));
- strncpy(directory, VMSToUnixStyle(where), size);
+ strlcpy(directory, VMSToUnixStyle(where), size);
#else
- strncpy(directory, where, size);
+ strlcpy(directory, where, size);
#endif
- directory[size - 1] = '\0';
}
bool SciTEGTK::GetSciteDefaultHome(char *path, unsigned int lenPath) {
@@ -490,10 +489,10 @@ bool SciTEGTK::GetSciteDefaultHome(char
#endif
if (where) {
#ifdef __vms
- strncpy(path, VMSToUnixStyle(where), lenPath);
+ strlcpy(path, VMSToUnixStyle(where), lenPath);
#else
- strncpy(path, where, lenPath);
+ strlcpy(path, where, lenPath);
#endif
return true;
@@ -507,7 +506,7 @@ bool SciTEGTK::GetSciteUserHome(char *pa
where = getenv("HOME");
}
if (where) {
- strncpy(path, where, lenPath);
+ strlcpy(path, where, lenPath);
return true;
}
return false;
@@ -515,11 +514,11 @@ bool SciTEGTK::GetSciteUserHome(char *pa
GError *error = NULL;
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &error);
@@ -688,11 +688,11 @@ FilePath SciTEGTK::GetSciteUserHome() {
void SciTEGTK::ShowFileInStatus() {
char sbText[1000];
- sprintf(sbText, " File: ");
+ snprintf(sbText, sizeof(sbText), " File: ");
if (fileName[0] == '\0')
if (filePath.IsUntitled())
- strcat(sbText, "Untitled");
+ strlcat(sbText, "Untitled", sizeof(sbText));
else
- strcat(sbText, fullPath);
+ strlcat(sbText, fullPath, sizeof(sbText));
- strcat(sbText, filePath.AsInternal());
+ strlcat(sbText, filePath.AsInternal(), sizeof(sbText));
SetStatusBarText(sbText);
}
@@ -749,7 +748,7 @@ void SciTEGTK::CheckMenus() {
}
}
-char *split(char*& s, char c) {
+static char *split(char*& s, char c) {
char *t = s;
if (s && (s = strchr(s, c)))
* s++ = '\0';
@@ -808,13 +807,13 @@ void SciTEGTK::OpenUriList(const char *l
}
// on Linux return the shortest path equivalent to pathname (remove . and ..)
-void SciTEGTK::AbsolutePath(char *absPath, const char *relativePath, int /*size*/) {
+void SciTEGTK::AbsolutePath(char *absPath, const char *relativePath, int absPath_len) {
char path[MAX_PATH + 1], *cur, *last, *part, *tmp;
if (!absPath)
return ;
if (!relativePath)
return ;
- strcpy(path, relativePath);
+ strlcpy(path, relativePath, sizeof(path));
cur = absPath;
*cur = '\0';
tmp = path;
@@ -831,13 +830,14 @@ void SciTEGTK::AbsolutePath(char *absPat
if (last > absPath)
cur = last;
else
- cur = last + 1;
+ cur = last + 1; // skip leading '/' for absolute paths
*cur = '\0';
@@ -2854,7 +2854,7 @@ void SciTEGTK::CreateTranslatedMenu(int
accelKey.clear(); // Allow user to clear accelerator key
}
userDefinedAccels[i] = new char[accLength + 1];
- strncpy(userDefinedAccels[i], accelKey.c_str(), accLength + 1);
+ strlcpy(userDefinedAccels[i], accelKey.c_str(), accLength + 1);
items[i].accelerator = userDefinedAccels[i];
} else {
- if (cur > absPath && *(cur - 1) != pathSepChar)
- *cur++ = pathSepChar;
- strcpy(cur, part);
- cur += strlen(part);
+ if (cur > absPath && *(cur - 1) != pathSepChar) {
+ strlcat(absPath, pathSepString, absPath_len);
+ }
+ strlcat(absPath, part, absPath_len);
+ cur = absPath + strlen(absPath);
}
}
@@ -2748,7 +2748,7 @@ bool SciTEGTK::CreatePipe(bool forceNew)
// Check we have been given a specific pipe name
if (pipeFilename.size() > 0) {
- snprintf(pipeName, CHAR_MAX - 1, "%s", pipeFilename.c_str());
+ snprintf(pipeName, sizeof(pipeName), "%s", pipeFilename.c_str());
fdPipe = open(pipeName, O_RDWR | O_NONBLOCK);
if (fdPipe == -1 && errno == EACCES) {
@@ -2778,7 +2778,7 @@ bool SciTEGTK::CreatePipe(bool forceNew)
//create the pipe name - we use a number as well just incase multiple people have pipes open
//or we are forceing a new instance of scite (even if there is already one)
- sprintf(pipeName, "/tmp/.SciTE.%d.ipc", i);
+ snprintf(pipeName, sizeof(pipeName), "/tmp/.SciTE.%d.ipc", i);
//printf("Trying pipe %s\n", pipeName);
//check to see if there is already one
@@ -2889,10 +2889,10 @@ void SciTEGTK::CheckAlreadyOpen(const ch
//check to see if path is already absolute
if (cmdLine[0] == '/')
- sprintf(pipeCommand, "open:%s", cmdLine);
+ snprintf(pipeCommand, sizeof(pipeCommand), "open:%s", cmdLine);
//if it isn't then add the absolute path to the from of the command to send.
else
- sprintf(pipeCommand, "open:%s/%s", currentPath, cmdLine);
+ snprintf(pipeCommand, sizeof(pipeCommand), "open:%s/%s", currentPath, cmdLine);
//printf("Sending %s through pipe\n", pipeCommand);
//send it
@@ -2980,10 +2980,10 @@ int main(int argc, char *argv[]) {
userDefinedAccels[i] = NULL;
@@ -3600,10 +3600,10 @@ int main(int argc, char *argv[]) {
#ifdef __vms
// Store the path part of the module name
@ -152,7 +60,7 @@ $OpenBSD: patch-gtk_SciTEGTK_cxx,v 1.1.1.1 2003/08/14 18:27:25 sturm Exp $
}
p = strchr(g_modulePath, ']');
if (p == NULL) {
@@ -2995,8 +2995,11 @@ int main(int argc, char *argv[]) {
@@ -3615,8 +3615,11 @@ int main(int argc, char *argv[]) {
if (p != NULL) {
*(p + 1) = '\0';
}

View File

@ -1,87 +1,130 @@
$OpenBSD: patch-gtk_makefile,v 1.1.1.1 2003/08/14 18:27:25 sturm Exp $
--- gtk/makefile.orig 2003-07-26 14:06:38.000000000 +0200
+++ gtk/makefile 2003-08-14 20:12:49.000000000 +0200
@@ -17,17 +17,17 @@ gnomeprefix:=$(shell pkg-config --variab
$OpenBSD: patch-gtk_makefile,v 1.2 2007/01/18 10:56:27 steven Exp $
--- gtk/makefile.orig Mon Feb 13 08:27:08 2006
+++ gtk/makefile Thu Jan 18 09:11:07 2007
@@ -26,26 +26,26 @@ ifdef GTK2
CONFIGFLAGS=pkg-config --cflags gtk+-2.0
CONFIGLIB=pkg-config --libs gtk+-2.0 gthread-2.0
CONFIGTHREADS=
-gnomeprefix:=$(shell pkg-config --variable=prefix gtk+-2.0 2>/dev/null)
+#gnomeprefix:=$(shell pkg-config --variable=prefix gtk+-2.0 2>/dev/null)
else
CONFIGFLAGS=gtk-config --cflags
CONFIGLIB=gtk-config --libs
CONFIGTHREADS=glib-config --libs gthread
-gnomeprefix:=$(shell gnome-config --prefix 2>/dev/null)
endif
ifndef prefix
ifdef gnomeprefix
prefix=$(gnomeprefix)
datadir=$(gnomeprefix)/share
pixmapdir=$(datadir)/pixmaps
else
- prefix=/usr
+ prefix=$(PREFIX)
endif
endif
datadir=$(prefix)/share
pixmapdir=$(datadir)/pixmaps
bindir=$(prefix)/bin
SYSCONF_PATH=$(prefix)/share/scite
+DOC_PATH=$(prefix)/share/doc/scite
-INSTALL=install -o root -g root
+INSTALL=install -o root -g bin
PROG = ../bin/SciTE
@@ -35,15 +35,17 @@ vpath %.h ../src ../../scintilla/include
@@ -55,16 +55,18 @@ vpath %.h ../src ../../scintilla/include
vpath %.cxx ../src
#CXXFLAGS= -g -DGTK -DSCI_LEXER -DSYSCONF_PATH=\"$(SYSCONF_PATH)\" -Wwrite-strings
-INCLUDEDIRS=-I ../../scintilla/include -I ../src
-CXXBASEFLAGS=-W -Wall -DGTK -DSCI_LEXER -DSYSCONF_PATH=\"$(SYSCONF_PATH)\" $(INCLUDEDIRS)
+INCLUDEDIRS=-I $(prefix)/include/scintilla -I ../src
+CXXBASEFLAGS=-W -Wall -Dunix -DGTK -DSCI_LEXER -DSYSCONF_PATH=\"$(SYSCONF_PATH)\" $(INCLUDEDIRS)
-CXXBASEFLAGS=-W -Wall -pedantic -Os -DGTK -DSCI_LEXER -DPIXMAP_PATH=\"$(pixmapdir)\" -DSYSCONF_PATH=\"$(SYSCONF_PATH)\" $(INCLUDEDIRS)
+INCLUDEDIRS=-I $(prefix)/include/scintilla -I ../src -I $(prefix)/include
+CXXBASEFLAGS=-W -Wall -pedantic -Dunix -DGTK -DSCI_LEXER -DPIXMAP_PATH=\"$(pixmapdir)\" -DSYSCONF_PATH=\"$(SYSCONF_PATH)\" $(INCLUDEDIRS)
ifdef DEBUG
-CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS)
+CXXFLAGS+=-DDEBUG -g $(CXXBASEFLAGS)
-CXXTFLAGS=-DDEBUG -g $(CXXBASEFLAGS)
+CXXTFLAGS+=-DDEBUG -g $(CXXBASEFLAGS)
else
-CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS)
+CXXFLAGS+=-DNDEBUG $(CXXBASEFLAGS)
-CXXTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS)
+CXXTFLAGS+=-DNDEBUG $(CXXBASEFLAGS)
endif
+LIBS= -L $(prefix)/lib -lscintilla -lscintilla_lexers -lscintilla
-ifndef NO_LUA
+LIBS= -L $(prefix)/lib -lscintilla -lscintilla_lexers
+
.cxx.o:
$(CC) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $< -o $@
+ifdef LUA
LUA_CORE_OBJS = lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o \
ltable.o ltests.o ltm.o lundump.o lvm.o lzio.o
@@ -74,14 +76,14 @@ LUA_LIB_OBJS = lauxlib.o lbaselib.o ldbl
LUA_OBJS = LuaExtension.o IFaceTable.o $(LUA_CORE_OBJS) $(LUA_LIB_OBJS)
-INCLUDEDIRS=-I ../../scintilla/include -I ../src -I../lua/include
+INCLUDEDIRS+=-I../lua/include
$(LUA_CORE_OBJS): ../lua/src/*.c
gcc $(INCLUDEDIRS) $(CXXTFLAGS) -c ../lua/src/*.c
$(LUA_LIB_OBJS): ../lua/src/lib/*.c
gcc $(INCLUDEDIRS) $(CXXTFLAGS) -c ../lua/src/lib/*.c
-CXXFLAGS=$(CXXTFLAGS)
+CXXFLAGS+=$(CXXTFLAGS)
else
-CXXFLAGS=$(CXXTFLAGS) -DNO_LUA
+CXXFLAGS+=$(CXXTFLAGS) -DNO_LUA
endif
ifeq ($(shell uname), Darwin)
@@ -89,21 +91,18 @@ CXXFLAGS:=$(CXXFLAGS) -Dunix
endif
.cxx.o:
- $(CC) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $< -o $@
+ $(CXX) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $< -o $@
clean:
rm -f *.o $(PROG)
@@ -55,12 +57,9 @@ clean:
deps:
$(CC) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak
- $(CC) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak
+ $(CXX) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak
-# make should be run in ../../scintilla/gtk to compile all the lexers.
-LEXEROBJS=$(wildcard ../../scintilla/gtk/Lex*.o)
-COMPLIB=../../scintilla/bin/scintilla.a
-
$(PROG): SciTEGTK.o SciTEBase.o SciTEBuffers.o SciTEIO.o Exporters.o DirectorExtension.o \
-SciTEProps.o Utf8_16.o $(LEXEROBJS) ../../scintilla/bin/scintilla.a
- $(CC) `$(CONFIGLIB)` `glib-config --libs gthread` -DGTK $^ -o $@
+SciTEProps.o Utf8_16.o
+ $(CC) $^ $(LIBS) `$(CONFIGLIB)` `glib-config --libs gthread` -o $@
$(PROG): SciTEGTK.o FilePath.o SciTEBase.o SciTEBuffers.o SciTEIO.o Exporters.o \
MultiplexExtension.o DirectorExtension.o SciTEProps.o Utf8_16.o \
$(COMPLIB) $(LUA_OBJS)
- $(CC) `$(CONFIGTHREADS)` -DGTK $^ -o $@ `$(CONFIGLIB)`
+ $(CXX) $^ $(LIBS) `$(CONFIGTHREADS)` -DGTK -o $@ `$(CONFIGLIB)`
# SciTE-static no longer builds. Kept here in case of later need.
SciTE-static: SciTEGTK.o SciTEBase.o SciTEBuffers.o SciTEIO.o Exporters.o SciTEProps.o \
@@ -74,17 +73,18 @@ include deps.mak
# Automatically generate header dependencies with "make deps"
include deps.mak
@@ -112,22 +111,20 @@ include deps.mak
# This is OK - just means no SciTE in the Gnome Applications menu
# Dead: install -D SciTEGTK.properties $(SYSCONF_PATH)/SciTEGlobal.properties
install:
- install -s $(PROG) $(bindir)
- install -d $(SYSCONF_PATH)
- install ../src/*.properties $(SYSCONF_PATH)
- install ../doc/*.html $(SYSCONF_PATH)
- install ../doc/SciTEIco.png $(SYSCONF_PATH)
- install ../doc/PrintHi.png $(SYSCONF_PATH)
+ install -m 755 -s $(PROG) $(bindir)
+ install -d $(SYSCONF_PATH) $(DOC_PATH)
+ install -m 444 ../src/*.properties $(SYSCONF_PATH)
+ install -m 444 ../doc/*.html $(DOC_PATH)
+ install -m 444 ../doc/SciTEIco.png $(DOC_PATH)
+ install -m 444 ../doc/PrintHi.png $(DOC_PATH)
- $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(SYSCONF_PATH)
+ $(INSTALL) -m 755 -d $(bindir) $(SYSCONF_PATH)
- $(INSTALL) -m 755 $(PROG) $(DESTDIR)$(bindir)
+ $(INSTALL) -m 755 $(PROG) $(bindir)
+ $(INSTALL) -m 755 -d $(SYSCONF_PATH) $(DOC_PATH)
+ $(INSTALL) -m 444 ../src/*.properties $(SYSCONF_PATH)
+ $(INSTALL) -m 444 ../doc/*.html ../doc/SciTEIco.png ../doc/PrintHi.png $(DOC_PATH)
- for files in ../src/*.properties ../doc/*.html ../doc/SciTEIco.png ../doc/PrintHi.png; \
- do \
- $(INSTALL) -m 644 $$files $(DESTDIR)$(SYSCONF_PATH); \
- done
-
ifdef gnomeprefix
ifndef GTK2
- install SciTE.desktop $(datadir)/gnome/apps/Applications
+ install -d $(datadir)/gnome/apps/Applications
+ install -m 444 SciTE.desktop $(datadir)/gnome/apps/Applications
ifdef GTK2
$(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop
else
$(INSTALL) -m 755 -D SciTE.desktop $(DESTDIR)$(datadir)/gnome/apps/Applications/SciTE.desktop
endif
- install Sci48M.png $(pixmapdir)
+ install -m 444 Sci48M.png $(pixmapdir)
- $(INSTALL) -m 644 -D Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png
+ $(INSTALL) -m 444 -D Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png
endif
uninstall:

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_Embedded_properties,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/Embedded.properties.orig Mon Jan 15 07:21:24 2007
+++ src/Embedded.properties Thu Jan 18 09:11:22 2007
@@ -78,7 +78,7 @@ if PLAT_WIN
command.scite.help.subsystem=2
if PLAT_GTK
command.print.*=a2ps "$(FileNameExt)"
- command.scite.help=netscape "file://$(SciteDefaultHome)/SciTEDoc.html"
+ command.scite.help=firefox "file://__DOCDIR__/SciTEDoc.html"
code.page=0
@@ -2952,7 +2952,7 @@ if PLAT_WIN
command.go.$(file.patterns.web)="file://$(FilePath)"
command.go.subsystem.$(file.patterns.web)=2
if PLAT_GTK
- command.go.$(file.patterns.web)=netscape "file://$(FilePath)"
+ command.go.$(file.patterns.web)=firefox "file://$(FilePath)"
command.go.$(file.patterns.php)=php -f "$(FileNameExt)"
command.compile.$(file.patterns.php)=php -l "$(FileNameExt)"

View File

@ -1,184 +1,147 @@
$OpenBSD: patch-src_Exporters_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
--- src/Exporters.cxx.orig 2003-08-14 18:11:28.000000000 +0200
+++ src/Exporters.cxx 2003-08-14 18:12:29.000000000 +0200
@@ -128,8 +128,8 @@ int GetRTFHighlight(const char *rgb) { /
return index + 1;
$OpenBSD: patch-src_Exporters_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/Exporters.cxx.orig Mon Jan 15 12:02:13 2007
+++ src/Exporters.cxx Mon Jan 15 12:07:25 2007
@@ -107,7 +107,8 @@ void GetRTFNextControl(char **style, cha
}
-void GetRTFStyleChange(char *delta, char *last, const char *current) { // \f0\fs20\cf0\highlight0\b0\i0
- int lastLen = strlen(last), offset = 2, lastOffset, currentOffset, len;
+void GetRTFStyleChange(char *delta, size_t delta_size, char *last, const char *current) { // \f0\fs20\cf0\highlight0\b0\i0
+ size_t lastLen = strlen(last), offset = 2, lastOffset, currentOffset, len;
*delta = '\0';
// font face
lastOffset = offset + 1;
@@ -146,10 +146,11 @@ void GetRTFStyleChange(char *delta, char
}
len = currentOffset - offset;
memcpy(last + offset, current + offset, len);
- strcat (delta, RTF_SETFONTFACE);
+ strlcat (delta, RTF_SETFONTFACE, delta_size);
lastOffset = strlen(delta);
- memcpy(delta + lastOffset, last + offset, len);
- delta[lastOffset + len] = '\0';
+ strlcat(delta, last + offset, delta_size);
+ if (lastOffset + len < delta_size)
+ delta[lastOffset + len] = '\0';
}
offset = currentOffset + 3;
// size
@@ -167,10 +168,11 @@ void GetRTFStyleChange(char *delta, char
}
len = currentOffset - offset;
memcpy(last + offset, current + offset, len);
- strcat (delta, RTF_SETFONTSIZE);
+ strlcat (delta, RTF_SETFONTSIZE, delta_size);
lastOffset = strlen(delta);
- memcpy(delta + lastOffset, last + offset, len);
- delta[lastOffset + len] = '\0';
+ strlcat(delta, last + offset, delta_size);
+ if (lastOffset + len < delta_size)
+ delta[lastOffset + len] = 0;
}
offset = currentOffset + 3;
// color
@@ -188,10 +190,11 @@ void GetRTFStyleChange(char *delta, char
}
len = currentOffset - offset;
memcpy(last + offset, current + offset, len);
- strcat (delta, RTF_SETCOLOR);
+ strlcat (delta, RTF_SETCOLOR, delta_size);
lastOffset = strlen(delta);
- memcpy(delta + lastOffset, last + offset, len);
- delta[lastOffset + len] = '\0';
+ strlcat(delta, last + offset, delta_size);
+ if (lastOffset + len < delta_size)
+ delta[lastOffset + len] = 0;
}
offset = currentOffset + 10;
// background
@@ -209,22 +212,23 @@ void GetRTFStyleChange(char *delta, char
}
len = currentOffset - offset;
memcpy(last + offset, current + offset, len);
- strcat (delta, RTF_SETBACKGROUND);
+ strlcat (delta, RTF_SETBACKGROUND, delta_size);
lastOffset = strlen(delta);
- memcpy(delta + lastOffset, last + offset, len);
- delta[lastOffset + len] = '\0';
+ strlcat(delta, last + offset, delta_size);
+ if (lastOffset + len < delta_size)
+ delta[lastOffset + len] = 0;
}
offset = currentOffset + 2;
// bold
if (last[offset] != current[offset]) {
if (current[offset] == '\\') { // turn on
memmove (last + offset, last + offset + 1, lastLen-- - offset);
- strcat (delta, RTF_BOLD_ON);
+ strlcat (delta, RTF_BOLD_ON, delta_size);
offset += 2;
} else { // turn off
memmove (last + offset + 1, last + offset, ++lastLen - offset);
last[offset] = '0';
- strcat (delta, RTF_BOLD_OFF);
+ strlcat(delta, RTF_BOLD_OFF, delta_size);
offset += 3;
}
} else
@@ -233,17 +237,15 @@ void GetRTFStyleChange(char *delta, char
if (last[offset] != current[offset]) {
if (current[offset] == '\\') { // turn on
memmove (last + offset, last + offset + 1, lastLen-- - offset);
- strcat (delta, RTF_ITALIC_ON);
+ strlcat (delta, RTF_ITALIC_ON, delta_size);
} else { // turn off
memmove (last + offset + 1, last + offset, ++lastLen - offset);
last[offset] = '0';
- strcat (delta, RTF_ITALIC_OFF);
+ strlcat (delta, RTF_ITALIC_OFF, delta_size);
// extracts control words that are different between two styles
-void GetRTFStyleChange(char *delta, char *last, char *current) { // \f0\fs20\cf0\highlight0\b0\i0
+void GetRTFStyleChange(char *delta, size_t delta_size, char *last, char *current) { // \f0\fs20\cf0\highlight0\b0\i0
+ size_t lastLen = strlen(last);
char lastControl[MAX_STYLEDEF], currentControl[MAX_STYLEDEF];
char *lastPos = last;
char *currentPos = current;
@@ -117,11 +118,11 @@ void GetRTFStyleChange(char *delta, char
GetRTFNextControl(&lastPos, lastControl);
GetRTFNextControl(&currentPos, currentControl);
if (strcmp(lastControl, currentControl)) { // changed
- strcat(delta, currentControl);
+ strlcat(delta, currentControl, delta_size);
}
}
if (*delta) {
- lastOffset = strlen(delta);
- delta[lastOffset] = ' ';
- delta[lastOffset + 1] = '\0';
+ strlcat(delta, " ", delta_size);
}
- if ('\0' != *delta) { strcat(delta, " "); }
- strcpy(last, current);
+ if ('\0' != *delta) { strlcat(delta, " ", delta_size); }
+ strlcpy(last, current, lastLen);
}
@@ -270,14 +272,14 @@ void SciTEBase::SaveToRTF(const char *sa
void SciTEBase::SaveToRTF(FilePath saveName, int start, int end) {
@@ -133,9 +134,9 @@ void SciTEBase::SaveToRTF(FilePath saveN
// Read the default settings
char key[200];
- sprintf(key, "style.*.%0d", STYLE_DEFAULT);
+ snprintf(key, sizeof(key), "style.*.%0d", STYLE_DEFAULT);
char *valdef = StringDup(props.GetExpanded(key).c_str());
- sprintf(key, "style.%s.%0d", language.c_str(), STYLE_DEFAULT);
+ snprintf(key, sizeof(key), "style.%s.%0d", language.c_str(), STYLE_DEFAULT);
char *val = StringDup(props.GetExpanded(key).c_str());
StyleDefinition defaultStyle(valdef);
@@ -173,15 +174,15 @@ void SciTEBase::SaveToRTF(FilePath saveN
char lastStyle[MAX_STYLEDEF], deltaStyle[MAX_STYLEDEF];
int fontCount = 1, colorCount = 1, i;
int fontCount = 1, colorCount = 2, i;
fputs(RTF_HEADEROPEN RTF_FONTDEFOPEN, fp);
- strncpy(*fonts, fontFace.c_str(), MAX_FONTDEF);
+ strlcpy(fonts[0], fontFace.c_str(), sizeof(fonts[0]));
fprintf(fp, RTF_FONTDEF, 0, characterset, fontFace.c_str());
- strncpy(*colors, "#000000", MAX_COLORDEF);
+ strlcpy(colors[0], "#000000", sizeof(colors[0]));
for (int istyle = 0; istyle <= STYLE_DEFAULT; istyle++) {
char key[200];
- strncpy(fonts[0], defaultStyle.font.c_str(), MAX_FONTDEF);
+ strlcpy(fonts[0], defaultStyle.font.c_str(), sizeof(fonts[0]));
fprintf(fp, RTF_FONTDEF, 0, characterset, defaultStyle.font.c_str());
- strncpy(colors[0], defaultStyle.fore.c_str(), MAX_COLORDEF);
- strncpy(colors[1], defaultStyle.back.c_str(), MAX_COLORDEF);
+ strlcpy(colors[0], defaultStyle.fore.c_str(), sizeof(colors[0]));
+ strlcpy(colors[1], defaultStyle.back.c_str(), sizeof(colors[1]));
for (int istyle = 0; istyle < STYLE_DEFAULT; istyle++) {
- sprintf(key, "style.*.%0d", istyle);
+ snprintf(key, sizeof(key), "style.*.%0d", istyle);
char *valdef = StringDup(props.GetExpanded(key).c_str());
- sprintf(key, "style.%s.%0d", language.c_str(), istyle);
+ snprintf(key, sizeof(key), "style.%s.%0d", language.c_str(), istyle);
char *val = StringDup(props.GetExpanded(key).c_str());
SString family;
SString fore;
@@ -353,30 +355,30 @@ void SciTEBase::SaveToRTF(const char *sa
if (EqualCaseInsensitive(family.c_str(), fonts[i]))
StyleDefinition sd(valdef);
@@ -193,15 +194,15 @@ void SciTEBase::SaveToRTF(FilePath saveN
if (EqualCaseInsensitive(sd.font.c_str(), fonts[i]))
break;
if (i >= fontCount) {
- strncpy(fonts[fontCount++], family.c_str(), MAX_FONTDEF);
+ strlcpy(fonts[fontCount++], family.c_str(), sizeof(fonts[0]));
fprintf(fp, RTF_FONTDEF, i, characterset, family.c_str());
- strncpy(fonts[fontCount++], sd.font.c_str(), MAX_FONTDEF);
+ strlcpy(fonts[fontCount++], sd.font.c_str(), sizeof(fonts[0]));
fprintf(fp, RTF_FONTDEF, i, characterset, sd.font.c_str());
}
- sprintf(lastStyle, RTF_SETFONTFACE "%d", i);
+ snprintf(lastStyle, sizeof(lastStyle), RTF_SETFONTFACE "%d", i);
} else
} else {
- strcpy(lastStyle, RTF_SETFONTFACE "0");
- sprintf(lastStyle + strlen(lastStyle), RTF_SETFONTSIZE "%d",
+ strlcpy(lastStyle, RTF_SETFONTFACE "0", sizeof(lastStyle));
}
- sprintf(lastStyle + strlen(lastStyle), RTF_SETFONTSIZE "%d",
+ snprintf(lastStyle + strlen(lastStyle), sizeof(lastStyle) - strlen(lastStyle), RTF_SETFONTSIZE "%d",
wysiwyg && size ? size << 1 : fontSize);
if (fore.length()) {
for (i = 0; i < colorCount; i++)
if (EqualCaseInsensitive(fore.c_str(), colors[i]))
wysiwyg && sd.size ? sd.size << 1 : defaultStyle.size);
if (sd.specified & StyleDefinition::sdFore) {
@@ -209,39 +210,39 @@ void SciTEBase::SaveToRTF(FilePath saveN
if (EqualCaseInsensitive(sd.fore.c_str(), colors[i]))
break;
if (i >= colorCount)
- strncpy(colors[colorCount++], fore.c_str(), MAX_COLORDEF);
- strncpy(colors[colorCount++], sd.fore.c_str(), MAX_COLORDEF);
- sprintf(lastStyle + strlen(lastStyle), RTF_SETCOLOR "%d", i);
+ strlcpy(colors[colorCount++], fore.c_str(), sizeof(colors[0]));
+ strlcpy(colors[colorCount++], sd.fore.c_str(), sizeof(colors[0]));
+ snprintf(lastStyle + strlen(lastStyle), sizeof(lastStyle) - strlen(lastStyle), RTF_SETCOLOR "%d", i);
} else
- strcat(lastStyle, RTF_SETCOLOR "0");
- sprintf(lastStyle + strlen(lastStyle), RTF_SETBACKGROUND "%d",
+ strlcat(lastStyle, RTF_SETCOLOR "0", sizeof(lastStyle));
+ snprintf(lastStyle + strlen(lastStyle), sizeof(lastStyle) - strlen(lastStyle), RTF_SETBACKGROUND "%d",
back.length() ? GetRTFHighlight(back.c_str()) : 0);
- strcat(lastStyle, bold ? RTF_BOLD_ON : RTF_BOLD_OFF);
- strcat(lastStyle, italics ? RTF_ITALIC_ON : RTF_ITALIC_OFF);
} else {
- strcat(lastStyle, RTF_SETCOLOR "0"); // Default fore
+ strlcat(lastStyle, RTF_SETCOLOR "0", sizeof(lastStyle)); // Default fore
}
// PL: highlights doesn't seems to follow a distinct table, at least with WordPad and Word 97
// Perhaps it is different for Word 6?
-// sprintf(lastStyle + strlen(lastStyle), RTF_SETBACKGROUND "%d",
+// snprintf(lastStyle + strlen(lastStyle), sizeof(lastStyle) - strlen(lastStyle), RTF_SETBACKGROUND "%d",
// sd.back.length() ? GetRTFHighlight(sd.back.c_str()) : 0);
if (sd.specified & StyleDefinition::sdBack) {
for (i = 0; i < colorCount; i++)
if (EqualCaseInsensitive(sd.back.c_str(), colors[i]))
break;
if (i >= colorCount)
- strncpy(colors[colorCount++], sd.back.c_str(), MAX_COLORDEF);
- sprintf(lastStyle + strlen(lastStyle), RTF_SETBACKGROUND "%d", i);
+ strlcpy(colors[colorCount++], sd.back.c_str(), sizeof(colors[0]));
+ snprintf(lastStyle + strlen(lastStyle), sizeof(lastStyle) - strlen(lastStyle), RTF_SETBACKGROUND "%d", i);
} else {
- strcat(lastStyle, RTF_SETBACKGROUND "1"); // Default back
+ strlcat(lastStyle, RTF_SETBACKGROUND "1", sizeof(lastStyle)); // Default back
}
if (sd.specified & StyleDefinition::sdBold) {
- strcat(lastStyle, sd.bold ? RTF_BOLD_ON : RTF_BOLD_OFF);
+ strlcat(lastStyle, sd.bold ? RTF_BOLD_ON : RTF_BOLD_OFF, sizeof(lastStyle));
} else {
- strcat(lastStyle, defaultStyle.bold ? RTF_BOLD_ON : RTF_BOLD_OFF);
+ strlcat(lastStyle, defaultStyle.bold ? RTF_BOLD_ON : RTF_BOLD_OFF, sizeof(lastStyle));
}
if (sd.specified & StyleDefinition::sdItalics) {
- strcat(lastStyle, sd.italics ? RTF_ITALIC_ON : RTF_ITALIC_OFF);
+ strlcat(lastStyle, sd.italics ? RTF_ITALIC_ON : RTF_ITALIC_OFF, sizeof(lastStyle));
} else {
- strcat(lastStyle, defaultStyle.italics ? RTF_ITALIC_ON : RTF_ITALIC_OFF);
+ strlcat(lastStyle, defaultStyle.italics ? RTF_ITALIC_ON : RTF_ITALIC_OFF, sizeof(lastStyle));
}
- strncpy(styles[istyle], lastStyle, MAX_STYLEDEF);
+ strlcat(lastStyle, bold ? RTF_BOLD_ON : RTF_BOLD_OFF, sizeof(lastStyle));
+ strlcat(lastStyle, italics ? RTF_ITALIC_ON : RTF_ITALIC_OFF, sizeof(lastStyle));
+ strlcpy(styles[istyle], lastStyle, sizeof(styles[0]));
} else
} else {
- sprintf(styles[istyle], RTF_SETFONTFACE "0" RTF_SETFONTSIZE "%d"
+ snprintf(styles[istyle], sizeof(styles[0]), RTF_SETFONTFACE "0" RTF_SETFONTSIZE "%d"
RTF_SETCOLOR "0" RTF_SETBACKGROUND "0"
RTF_BOLD_OFF RTF_ITALIC_OFF, fontSize);
if (val)
@@ -391,7 +393,7 @@ void SciTEBase::SaveToRTF(const char *sa
RTF_SETCOLOR "0" RTF_SETBACKGROUND "1"
RTF_BOLD_OFF RTF_ITALIC_OFF, defaultStyle.size);
}
@@ -257,7 +258,7 @@ void SciTEBase::SaveToRTF(FilePath saveN
}
fprintf(fp, RTF_COLORDEFCLOSE RTF_HEADERCLOSE RTF_BODYOPEN RTF_SETFONTFACE "0"
RTF_SETFONTSIZE "%d" RTF_SETCOLOR "0 ", fontSize);
RTF_SETFONTSIZE "%d" RTF_SETCOLOR "0 ", defaultStyle.size);
- sprintf(lastStyle, RTF_SETFONTFACE "0" RTF_SETFONTSIZE "%d"
+ snprintf(lastStyle, sizeof(lastStyle), RTF_SETFONTFACE "0" RTF_SETFONTSIZE "%d"
RTF_SETCOLOR "0" RTF_SETBACKGROUND "0"
RTF_BOLD_OFF RTF_ITALIC_OFF, fontSize);
RTF_SETCOLOR "0" RTF_SETBACKGROUND "1"
RTF_BOLD_OFF RTF_ITALIC_OFF, defaultStyle.size);
bool prevCR = false;
@@ -403,7 +405,7 @@ void SciTEBase::SaveToRTF(const char *sa
@@ -270,7 +271,7 @@ void SciTEBase::SaveToRTF(FilePath saveN
if (style > STYLE_DEFAULT)
style = 0;
if (style != styleCurrent) {
@ -187,181 +150,287 @@ $OpenBSD: patch-src_Exporters_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
if (*deltaStyle)
fputs(deltaStyle, fp);
styleCurrent = style;
@@ -506,9 +508,9 @@ void SciTEBase::SaveToHTML(const char *s
@@ -396,9 +397,9 @@ void SciTEBase::SaveToHTML(FilePath save
SString bgColour;
char key[200];
- sprintf(key, "style.*.%0d", STYLE_DEFAULT);
+ snprintf(key, sizeof(key), "style.*.%0d", STYLE_DEFAULT);
char *valdef = StringDup(props.GetExpanded(key).c_str());
- sprintf(key, "style.%s.%0d", language.c_str(), STYLE_DEFAULT);
+ snprintf(key, sizeof(key), "style.%s.%0d", language.c_str(), STYLE_DEFAULT);
char *val = StringDup(props.GetExpanded(key).c_str());
StyleDefinition sddef(valdef);
@@ -417,9 +418,9 @@ void SciTEBase::SaveToHTML(FilePath save
if ((istyle > STYLE_DEFAULT) && (istyle <= STYLE_LASTPREDEFINED))
continue;
if (styleIsUsed[istyle]) {
char key[200];
- sprintf(key, "style.*.%0d", istyle);
+ snprintf(key, sizeof(key), "style.*.%0d", istyle);
char *valdef = StringDup(props.GetExpanded(key).c_str());
valdef = StringDup(props.GetExpanded(key).c_str());
- sprintf(key, "style.%s.%0d", language.c_str(), istyle);
+ snprintf(key, sizeof(key), "style.%s.%0d", language.c_str(), istyle);
char *val = StringDup(props.GetExpanded(key).c_str());
SString family;
SString fore;
@@ -768,7 +770,7 @@ void SciTEBase::SaveToPDF(const char *sa
if (!LengthDocument()) {
// no content to export, issue an error message
char msg[200];
- strcpy(msg, "Nothing to export as PDF");
+ strlcpy(msg, "Nothing to export as PDF", sizeof(msg));
dialogsOnScreen++;
WindowMessageBox(wSciTE, msg, MB_OK);
dialogsOnScreen--;
@@ -778,9 +780,9 @@ void SciTEBase::SaveToPDF(const char *sa
if (!fp) {
// couldnt open the file for saving, issue an error message
char msg[200];
- strcpy(msg, "Could not save file \"");
- strcat(msg, fullPath);
- strcat(msg, "\".");
+ strlcpy(msg, "Could not save file \"", sizeof(msg));
+ strlcat(msg, fullPath, sizeof(msg));
+ strlcat(msg, "\".", sizeof(msg));
dialogsOnScreen++;
WindowMessageBox(wSciTE, msg, MB_OK);
dialogsOnScreen--;
@@ -797,9 +799,9 @@ void SciTEBase::SaveToPDF(const char *sa
// or the default style if no language is available...
for (int istyle = 0; istyle <= STYLE_DEFAULT; istyle++) {
char key[200];
- sprintf(key, "style.*.%0d", istyle);
+ snprintf(key, sizeof(key), "style.*.%0d", istyle);
char *valdef = StringDup(props.GetExpanded(key).c_str());
- sprintf(key, "style.%s.%0d", language.c_str(), istyle);
+ snprintf(key, sizeof(key), "style.%s.%0d", language.c_str(), istyle);
char *val = StringDup(props.GetExpanded(key).c_str());
SString family;
SString fore;
@@ -866,7 +868,7 @@ void SciTEBase::SaveToPDF(const char *sa
sscanf(buffer, "%x", &blue);
val = StringDup(props.GetExpanded(key).c_str());
// at last, we got the PDF colour!!!
- sprintf(buffer, "%3.2f %3.2f %3.2f", (red / 256.0f), (green / 256.0f), (blue / 256.0f) );
+ snprintf(buffer, sizeof(buffer), "%3.2f %3.2f %3.2f", (red / 256.0f), (green / 256.0f), (blue / 256.0f) );
PDFColours[istyle] = StringDup(buffer);
}
}
@@ -918,8 +920,9 @@ void SciTEBase::SaveToPDF(const char *sa
stream += "ET\n";
StyleDefinition sd(valdef);
@@ -701,18 +702,18 @@ static short PDFfontAscenders[] = { 629
static short PDFfontDescenders[] = { 157, 207, 217 };
static short PDFfontWidths[] = { 600, 0, 0 };
// patch in the stream size (minus 1 since the newline is not counted... go figure)
- char *buffer = new char[textObj.size() + 1 + 200]; // Copied Neil's [2/22/2003 21:04]
- sprintf(buffer, textObj.c_str(), stream.length() - 1); // Length instead of size [2/22/2003 21:08]
+ size_t buffer_size = textObj.size() + 1 + 200;
+ char *buffer = new char[buffer_size]; // Copied Neil's [2/22/2003 21:04]
+ snprintf(buffer, buffer_size, textObj.c_str(), stream.length() - 1); // Length instead of size [2/22/2003 21:08]
textObj = buffer;
delete [] buffer;
@@ -938,7 +941,7 @@ void SciTEBase::SaveToPDF(const char *sa
// open a text object
char buffer[20];
- sprintf( buffer, "%d 0 obj\n", textObjNumber);
+ snprintf( buffer, sizeof(buffer), "%d 0 obj\n", textObjNumber);
textObj = buffer;
textObj += "<< /Length %d >>\n"; // we should patch the length here correctly...
textObj += "stream\n";
@@ -1012,7 +1015,7 @@ void SciTEBase::SaveToPDF(const char *sa
} else if ( (ch == ')') || (ch == '(') || (ch == '\\') ) {
// you should escape those characters for PDF 1.2+
char buffer[10];
- sprintf(buffer, "\\%c", ch);
+ snprintf(buffer, sizeof(buffer), "\\%c", ch);
stream += buffer;
-inline void getPDFRGB(char* pdfcolour, const char* stylecolour) {
+inline void getPDFRGB(char* pdfcolour, size_t pdfcolour_size, const char* stylecolour) {
// grab colour components (max string length produced = 18)
for (int i = 1; i < 6; i += 2) {
char val[20];
// 3 decimal places for enough dynamic range
int c = (IntFromHexByte(stylecolour + i) * 1000 + 127) / 255;
if (c == 0 || c == 1000) { // optimise
- sprintf(val, "%d ", c / 1000);
+ snprintf(val, sizeof(val), "%d ", c / 1000);
} else {
// write the character normally...
@@ -1032,8 +1035,9 @@ void SciTEBase::SaveToPDF(const char *sa
stream += "ET\n";
// patch in the stream size (minus 1 since the newline is not counted... go figure)
- char *buffer = new char[textObj.size() + 1 + 200]; // 200 by Neil as this is quite indeterminate
- sprintf(buffer, textObj.c_str(), stream.length() - 1); // Length instead of size [2/22/2003 21:08]
+ size_t buffer_size = textObj.size() + 1 + 200;
+ char *buffer = new char[buffer_size]; // 200 by Neil as this is quite indeterminate
+ snprintf(buffer, buffer_size, textObj.c_str(), stream.length() - 1); // Length instead of size [2/22/2003 21:08]
textObj = buffer;
delete [] buffer;
@@ -1055,10 +1059,10 @@ void SciTEBase::SaveToPDF(const char *sa
for (int k = 100; k < pageObjNumber; k += 2 ) {
//
char buffer[20];
- sprintf( buffer, "%% page number %d\n", (k - 99));
+ snprintf( buffer, sizeof(buffer), "%% page number %d\n", (k - 99));
fputs(buffer, fp);
- sprintf( buffer, "%d 0 obj\n", k );
+ snprintf( buffer, sizeof(buffer), "%d 0 obj\n", k );
fputs(buffer, fp);
fputs("<< /Type /Page\n", fp);
fputs("/Parent 3 0 R\n", fp);
@@ -1066,7 +1070,7 @@ void SciTEBase::SaveToPDF(const char *sa
// we need to patch in the corresponding page text object!
int textObjNumber = (k + 1);
- sprintf( buffer, "/Contents %d 0 R\n", textObjNumber);
+ snprintf( buffer, sizeof(buffer), "/Contents %d 0 R\n", textObjNumber);
fputs(buffer, fp);
fputs("/Resources << /ProcSet 6 0 R\n", fp);
@@ -1076,7 +1080,7 @@ void SciTEBase::SaveToPDF(const char *sa
fputs("endobj\n", fp);
// add this to the list of page number references...
- sprintf( buffer, "%d 0 R ", k);
+ snprintf( buffer, sizeof(buffer), "%d 0 R ", k);
pageRefs += buffer;
// increment the page count...
@@ -1098,7 +1102,7 @@ void SciTEBase::SaveToPDF(const char *sa
{
char buffer[20];
- sprintf(buffer, "/Count %d\n", pageCount);
+ snprintf(buffer, sizeof(buffer), "/Count %d\n", pageCount);
fputs(buffer, fp); // we need to patch also the number of page objects created
}
@@ -1202,12 +1206,12 @@ static void fillTexStyle(TexStyle* style
- sprintf(val, "0.%03d ", c);
+ snprintf(val, sizeof(val), "0.%03d ", c);
}
- strcat(pdfcolour, val);
+ strlcat(pdfcolour, val, pdfcolour_size);
}
}
@@ -742,7 +743,7 @@ void SciTEBase::SaveToPDF(FilePath saveN
}
void write(int objectData) {
char val[20];
- sprintf(val, "%d", objectData);
+ snprintf(val, sizeof(val), "%d", objectData);
write(val);
}
// returns object number assigned to the supplied data
@@ -777,7 +778,7 @@ void SciTEBase::SaveToPDF(FilePath saveN
// so extra space added; also the first entry is special
write("\n0000000000 65535 f \n");
for (int i = 0; i < index - 1; i++) {
- sprintf(val, "%010d 00000 n \n", offsetList[i]);
+ snprintf(val, sizeof(val), "%010d 00000 n \n", offsetList[i]);
write(val);
}
return xrefStart;
@@ -801,6 +802,8 @@ void SciTEBase::SaveToPDF(FilePath saveN
int styleCurrent, stylePrev;
double leading;
char *buffer;
+ size_t buffer_size;
+ size_t segStyle_size;
public:
PDFObjectTracker *oT;
PDFStyle *style;
@@ -813,8 +816,10 @@ void SciTEBase::SaveToPDF(FilePath saveN
pageStarted = false;
pageCount = 0;
style = NULL;
- buffer = new char[250];
- segStyle = new char[100];
+ buffer_size = 250;
+ buffer = new char[buffer_size];
+ segStyle_size = 100;
+ segStyle = new char[segStyle_size];
}
~PDFRender() {
if (style) { delete []style; }
@@ -825,20 +830,20 @@ void SciTEBase::SaveToPDF(FilePath saveN
double fontToPoints(int thousandths) {
return (double)fontSize * thousandths / 1000.0;
}
- void setStyle(char *buff, int style_) {
+ void setStyle(char *buff, size_t buff_size, int style_) {
int styleNext = style_;
if (style_ == -1) { styleNext = styleCurrent; }
*buff = '\0';
if (styleNext != styleCurrent || style_ == -1) {
if (style[styleCurrent].font != style[styleNext].font
|| style_ == -1) {
- sprintf(buff, "/F%d %d Tf ",
+ snprintf(buff, buff_size, "/F%d %d Tf ",
style[styleNext].font + 1, fontSize);
}
if (strcmp(style[styleCurrent].fore, style[styleNext].fore) != 0
|| style_ == -1) {
- strcat(buff, style[styleNext].fore);
- strcat(buff, "rg ");
+ strlcat(buff, style[styleNext].fore, buff_size);
+ strlcat(buff, "rg ", buff_size);
}
}
}
@@ -867,7 +872,7 @@ void SciTEBase::SaveToPDF(FilePath saveN
// *expected* to start from index 1 since they are the first objects
// to be inserted (PDF1.4Ref(p317))
for (int i = 0; i < 4; i++) {
- sprintf(buffer, "<</Type/Font/Subtype/Type1"
+ snprintf(buffer, buffer_size, "<</Type/Font/Subtype/Type1"
"/Name/F%d/BaseFont/%s/Encoding/"
PDF_ENCODING
">>\n", i + 1,
@@ -890,7 +895,7 @@ void SciTEBase::SaveToPDF(FilePath saveN
int pageObjectStart = oT->index;
int pagesRef = pageObjectStart + pageCount;
for (int i = 0; i < pageCount; i++) {
- sprintf(buffer, "<</Type/Page/Parent %d 0 R\n"
+ snprintf(buffer, buffer_size, "<</Type/Page/Parent %d 0 R\n"
"/MediaBox[ 0 0 %d %d"
"]\n/Contents %d 0 R\n"
"/Resources %d 0 R\n>>\n",
@@ -901,19 +906,19 @@ void SciTEBase::SaveToPDF(FilePath saveN
// create page tree object (PDF1.4Ref(p86))
pageData = "<</Type/Pages/Kids[\n";
for (int j = 0; j < pageCount; j++) {
- sprintf(buffer, "%d 0 R\n", pageObjectStart + j);
+ snprintf(buffer, buffer_size, "%d 0 R\n", pageObjectStart + j);
pageData += buffer;
}
- sprintf(buffer, "]/Count %d\n>>\n", pageCount);
+ snprintf(buffer, buffer_size, "]/Count %d\n>>\n", pageCount);
pageData += buffer;
oT->add(pageData.c_str());
// create catalog object (PDF1.4Ref(p83))
- sprintf(buffer, "<</Type/Catalog/Pages %d 0 R >>\n", pagesRef);
+ snprintf(buffer, buffer_size, "<</Type/Catalog/Pages %d 0 R >>\n", pagesRef);
int catalogRef = oT->add(buffer);
// append the cross reference table (PDF1.4Ref(p64))
int xref = oT->xref();
// end the file with the trailer (PDF1.4Ref(p67))
- sprintf(buffer, "trailer\n<< /Size %d /Root %d 0 R\n>>"
+ snprintf(buffer, buffer_size, "trailer\n<< /Size %d /Root %d 0 R\n>>"
"\nstartxref\n%d\n%%%%EOF\n",
oT->index, catalogRef, xref);
oT->write(buffer);
@@ -934,7 +939,7 @@ void SciTEBase::SaveToPDF(FilePath saveN
if (style_ != styleCurrent) {
flushSegment();
// output code (if needed) for new style
- setStyle(segStyle, style_);
+ setStyle(segStyle, segStyle_size, style_);
stylePrev = styleCurrent;
styleCurrent = style_;
}
@@ -967,11 +972,11 @@ void SciTEBase::SaveToPDF(FilePath saveN
double fontAscender = fontToPoints(PDFfontAscenders[fontSet]);
yPos = pageHeight - pageMargin.top - fontAscender;
// start a new page
- sprintf(buffer, "BT 1 0 0 1 %d %d Tm\n",
+ snprintf(buffer, buffer_size, "BT 1 0 0 1 %d %d Tm\n",
pageMargin.left, (int)yPos);
// force setting of initial font, colour
- setStyle(segStyle, -1);
- strcat(buffer, segStyle);
+ setStyle(segStyle, segStyle_size, -1);
+ strlcat(buffer, segStyle, buffer_size);
pageData = buffer;
xPos = pageMargin.left;
segment.clear();
@@ -984,7 +989,7 @@ void SciTEBase::SaveToPDF(FilePath saveN
// PDF1.4Ref(p38) EOL marker preceding endstream not counted
char *textObj = new char[pageData.length() + 100];
// concatenate stream within the text object
- sprintf(textObj, "<</Length %d>>\nstream\n%s"
+ snprintf(textObj, pageData.length() + 100, "<</Length %d>>\nstream\n%s"
"ET\nendstream\n",
static_cast<int>(pageData.length() - 1 + 3),
pageData.c_str());
@@ -1006,10 +1011,10 @@ void SciTEBase::SaveToPDF(FilePath saveN
return;
}
if (firstLine) {
- sprintf(buffer, "0 -%.1f TD\n", leading);
+ snprintf(buffer, buffer_size, "0 -%.1f TD\n", leading);
firstLine = false;
} else {
- sprintf(buffer, "T*\n");
+ snprintf(buffer, buffer_size, "T*\n");
}
pageData += buffer;
}
@@ -1038,7 +1043,8 @@ void SciTEBase::SaveToPDF(FilePath saveN
}
// page size: width, height
propItem = props.GetExpanded("export.pdf.pagesize");
- char *buffer = new char[200];
+ size_t buffer_size = 200;
+ char *buffer = new char[buffer_size];
char *ps = StringDup(propItem.c_str());
const char *next = GetNextPropItem(ps, buffer, 32);
if (0 >= (pr.pageWidth = atol(buffer))) {
@@ -1077,9 +1083,9 @@ void SciTEBase::SaveToPDF(FilePath saveN
pr.style[i].font = 0;
pr.style[i].fore[0] = '\0';
- sprintf(buffer, "style.*.%0d", i);
+ snprintf(buffer, buffer_size, "style.*.%0d", i);
char *valdef = StringDup(props.GetExpanded(buffer).c_str());
- sprintf(buffer, "style.%s.%0d", language.c_str(), i);
+ snprintf(buffer, buffer_size, "style.%s.%0d", language.c_str(), i);
char *val = StringDup(props.GetExpanded(buffer).c_str());
StyleDefinition sd(valdef);
@@ -1089,9 +1095,9 @@ void SciTEBase::SaveToPDF(FilePath saveN
if (sd.italics) { pr.style[i].font |= 2; }
if (sd.bold) { pr.style[i].font |= 1; }
if (sd.fore.length()) {
- getPDFRGB(pr.style[i].fore, sd.fore.c_str());
+ getPDFRGB(pr.style[i].fore, sizeof(pr.style[0].fore), sd.fore.c_str());
} else if (i == STYLE_DEFAULT) {
- strcpy(pr.style[i].fore, "0 0 0 ");
+ strlcpy(pr.style[i].fore, "0 0 0 ", sizeof(pr.style[i].fore));
}
// grab font size from default style
if (i == STYLE_DEFAULT) {
@@ -1107,7 +1113,7 @@ void SciTEBase::SaveToPDF(FilePath saveN
// patch in default foregrounds
for (int j = 0; j <= STYLE_MAX; j++) {
if (pr.style[j].fore[0] == '\0') {
- strcpy(pr.style[j].fore, pr.style[STYLE_DEFAULT].fore);
+ strlcpy(pr.style[j].fore, pr.style[STYLE_DEFAULT].fore, sizeof(pr.style[j].fore));
}
}
delete []buffer;
@@ -1165,12 +1171,12 @@ void SciTEBase::SaveToPDF(FilePath saveN
//---------- Save to TeX ----------
-static char* getTexRGB(char* texcolor, const char* stylecolor) {
+static char* getTexRGB(char* texcolor, size_t texcolor_size, const char* stylecolor) {
//texcolor[rgb]{0,0.5,0}{....}
float r = GetHexByte(stylecolor + 1) / 256.0;
float g = GetHexByte(stylecolor + 3) / 256.0;
float b = GetHexByte(stylecolor + 5) / 256.0;
float r = IntFromHexByte(stylecolor + 1) / 256.0;
float g = IntFromHexByte(stylecolor + 3) / 256.0;
float b = IntFromHexByte(stylecolor + 5) / 256.0;
- sprintf(texcolor, "%.1f, %.1f, %.1f", r, g, b);
+ snprintf(texcolor, texcolor_size, "%.1f, %.1f, %.1f", r, g, b);
return texcolor;
}
@@ -1236,11 +1240,11 @@ static void defineTexStyle(TexStyle* sty
@@ -1199,11 +1205,11 @@ static void defineTexStyle(StyleDefiniti
closing_brackets++;
}
if (style->fore.length()) {
- fprintf(fp, "\\textcolor[rgb]{%s}{", getTexRGB(rgb, style->fore.c_str()) );
+ fprintf(fp, "\\textcolor[rgb]{%s}{", getTexRGB(rgb, sizeof(rgb), style->fore.c_str()) );
if (style.fore.length()) {
- fprintf(fp, "\\textcolor[rgb]{%s}{", getTexRGB(rgb, style.fore.c_str()) );
+ fprintf(fp, "\\textcolor[rgb]{%s}{", getTexRGB(rgb, sizeof(rgb), style.fore.c_str()) );
closing_brackets++;
}
if (style->back.length()) {
- fprintf(fp, "\\colorbox[rgb]{%s}{", getTexRGB( rgb, style->back.c_str()) );
+ fprintf(fp, "\\colorbox[rgb]{%s}{", getTexRGB( rgb, sizeof(rgb), style->back.c_str()) );
if (style.back.length()) {
- fprintf(fp, "\\colorbox[rgb]{%s}{", getTexRGB( rgb, style.back.c_str()) );
+ fprintf(fp, "\\colorbox[rgb]{%s}{", getTexRGB( rgb, sizeof(rgb), style.back.c_str()) );
closing_brackets++;
}
fputs("#1", fp);
@@ -1287,9 +1291,9 @@ void SciTEBase::SaveToTEX(const char *sa
style.italics = false;
style.bold = false;
style.size = 0;
- sprintf(key, "style.*.%0d", i);
+ snprintf(key, sizeof(key), "style.*.%0d", i);
char *valdef = StringDup(props.GetExpanded(key).c_str());
- sprintf(key, "style.%s.%0d", language.c_str(), i);
+ snprintf(key, sizeof(key), "style.%s.%0d", language.c_str(), i);
char *val = StringDup(props.GetExpanded(key).c_str());
fillTexStyle(&style, valdef); //check default properties
fillTexStyle(&style, val); //check language properties
@@ -1247,9 +1253,9 @@ void SciTEBase::SaveToTEX(FilePath saveN
for (i = 0; i < STYLE_MAX; i++) { // get keys
if (styleIsUsed[i]) {
- sprintf(key, "style.*.%0d", i);
+ snprintf(key, sizeof(key), "style.*.%0d", i);
char *valdef = StringDup(props.GetExpanded(key).c_str());
- sprintf(key, "style.%s.%0d", language.c_str(), i);
+ snprintf(key, sizeof(key), "style.%s.%0d", language.c_str(), i);
char *val = StringDup(props.GetExpanded(key).c_str());
StyleDefinition sd(valdef); //check default properties

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-src_FilePath_cxx,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/FilePath.cxx.orig Thu Jan 18 09:11:18 2007
+++ src/FilePath.cxx Thu Jan 18 11:32:20 2007
@@ -245,7 +245,7 @@ static char *split(char*& s, char c) {
FilePath FilePath::NormalizePath() const {
char *path = new char[fileName.length() + 1];
- strcpy(path, AsInternal());
+ strlcpy(path, AsInternal(), fileName.length() + 1);
#ifdef WIN32
// Convert unix path separators to Windows
for (char *cp = path; *cp; cp++) {
@@ -276,7 +276,7 @@ FilePath FilePath::NormalizePath() const
} else {
if (cur > absPath && *(cur - 1) != pathSepChar)
*cur++ = pathSepChar;
- strcpy(cur, part);
+ strlcpy(cur, part, fileName.length() + 1 + (absPath - cur));
cur += strlen(part);
}
}
@@ -307,7 +307,7 @@ FilePath FilePath::VMSToUnixStyle() {
if (strstr (vmsName, "//") == NULL) {
return FilePath(vmsName);
}
- strcpy(unixStyleFileName, vmsName);
+ strlcpy(unixStyleFileName, vmsName, sizeof(unixStyleFileName));
char *p;
while ((p = strstr (unixStyleFileName, "//")) != NULL) {
strcpy (p, p + 1);
@@ -320,10 +320,10 @@ FilePath FilePath::VMSToUnixStyle() {
// o [dir.dir]file.type
if (vmsName [0] == '/') {
- strcpy(unixStyleFileName, vmsName);
+ strlcpy(unixStyleFileName, vmsName, sizeof(unixStyleFileName));
} else {
unixStyleFileName [0] = '/';
- strcpy(unixStyleFileName + 1, vmsName);
+ strlcpy(unixStyleFileName + 1, vmsName, sizeof(unixStyleFileName));
char *p = strstr(unixStyleFileName, ":[");
if (p == NULL) {
// o logical:file.type

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-src_IFaceTable_cxx,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/IFaceTable.cxx.orig Fri Mar 31 21:45:37 2006
+++ src/IFaceTable.cxx Fri Mar 31 21:45:37 2006
@@ -96,8 +96,8 @@ int IFaceTable::GetConstantName(int valu
if (functions[funcIdx].value == value) {
size_t len = strlen(functions[funcIdx].name) + 4;
if (nameOut && (nameBufferLen > len)) {
- strcpy(nameOut, "SCI_");
- strcat(nameOut, functions[funcIdx].name);
+ strlcpy(nameOut, "SCI_", nameBufferLen);
+ strlcat(nameOut, functions[funcIdx].name, nameBufferLen);
// fix case
for (char *nm = nameOut + 4; *nm; ++nm) {
if (*nm >= 'a' && *nm <= 'z') {
@@ -115,7 +115,7 @@ int IFaceTable::GetConstantName(int valu
if (constants[constIdx].value == value) {
size_t len = strlen(constants[constIdx].name);
if (nameOut && (nameBufferLen > len)) {
- strcpy(nameOut, constants[constIdx].name);
+ strlcpy(nameOut, constants[constIdx].name, nameBufferLen);
return len;
} else {
return -1 - len;

View File

@ -1,7 +1,16 @@
$OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
--- src/SciTEBase.cxx.orig 2003-08-14 01:31:52.000000000 +1000
+++ src/SciTEBase.cxx 2003-08-14 01:31:52.000000000 +1000
@@ -1874,7 +1874,7 @@ bool SciTEBase::StartInsertAbbreviation(
$OpenBSD: patch-src_SciTEBase_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/SciTEBase.cxx.orig Mon Jan 15 12:02:13 2007
+++ src/SciTEBase.cxx Mon Jan 15 12:02:56 2007
@@ -2048,7 +2048,7 @@ void SciTEBase::EliminateDuplicateWords(
if (firstLen == secondLen &&
!strncmp(firstWord, secondWord, firstLen)) {
- strcpy(firstWord, secondWord);
+ strlcpy(firstWord, secondWord, firstLen);
firstSpace = strchr(firstWord, ' ');
} else {
firstWord = secondWord;
@@ -2176,7 +2176,7 @@ bool SciTEBase::StartInsertAbbreviation(
}
char *expbuf = new char[dataLength + 1];
@ -9,8 +18,8 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
+ strlcpy(expbuf, data.c_str(), dataLength + 1);
UnSlash(expbuf);
size_t expbuflen = strlen(expbuf);
int caret_pos = SendEditor(SCI_GETSELECTIONEND);
@@ -1966,7 +1966,7 @@ bool SciTEBase::StartExpandAbbreviation(
int caret_pos = SendEditor(SCI_GETSELECTIONSTART);
@@ -2322,7 +2322,7 @@ bool SciTEBase::StartExpandAbbreviation(
}
char *expbuf = new char[dataLength + 1];
@ -19,7 +28,7 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
UnSlash(expbuf);
size_t expbuflen = strlen(expbuf);
int caret_pos = -1; // caret position
@@ -2361,17 +2361,17 @@ void SciTEBase::SetTextProperties(
@@ -2721,7 +2721,7 @@ void SciTEBase::SetTextProperties(
int eolMode = SendEditor(SCI_GETEOLMODE);
ps.Set("EOLMode", eolMode == SC_EOL_CRLF ? "CR+LF" : (eolMode == SC_EOL_LF ? "LF" : "CR"));
@ -28,19 +37,36 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
ps.Set("BufferLength", temp);
ps.SetInteger("NbOfLines", SendEditor(SCI_GETLINECOUNT));
CharacterRange crange = GetSelection();
- sprintf(temp, "%ld", crange.cpMax - crange.cpMin);
+ snprintf(temp, sizeof(temp), "%ld", crange.cpMax - crange.cpMin);
@@ -2736,22 +2736,22 @@ void SciTEBase::SetTextProperties(
int endPos = SendEditor(SCI_GETLINESELENDPOSITION, line);
charCount += endPos - startPos;
}
- sprintf(temp, "%ld", charCount);
+ snprintf(temp, sizeof(temp), "%ld", charCount);
} else {
- sprintf(temp, "%ld", crange.cpMax - crange.cpMin);
+ snprintf(temp, sizeof(temp), "%ld", crange.cpMax - crange.cpMin);
}
ps.Set("SelLength", temp);
int selFirstLine = SendEditor(SCI_LINEFROMPOSITION, crange.cpMin);
int selLastLine = SendEditor(SCI_LINEFROMPOSITION, crange.cpMax);
- sprintf(temp, "%d", selLastLine - selFirstLine + 1);
+ snprintf(temp, sizeof(temp), "%d", selLastLine - selFirstLine + 1);
int caretPos = SendEditor(SCI_GETCURRENTPOS);
int selAnchor = SendEditor(SCI_GETANCHOR);
if (0 == (crange.cpMax - crange.cpMin)) {
- sprintf(temp, "%d", 0);
+ snprintf(temp, sizeof(temp), "%d", 0);
} else if (selLastLine == selFirstLine) {
- sprintf(temp, "%d", 1);
+ snprintf(temp, sizeof(temp), "%d", 1);
} else if ((SendEditor(SCI_GETCOLUMN, caretPos) == 0 && (selAnchor <= caretPos)) ||
((SendEditor( SCI_GETCOLUMN, selAnchor) == 0) && (selAnchor > caretPos ))) {
- sprintf(temp, "%d", selLastLine - selFirstLine);
+ snprintf(temp, sizeof(temp), "%d", selLastLine - selFirstLine);
} else {
- sprintf(temp, "%d", selLastLine - selFirstLine + 1);
+ snprintf(temp, sizeof(temp), "%d", selLastLine - selFirstLine + 1);
}
ps.Set("SelHeight", temp);
}
@@ -2389,7 +2389,7 @@ void SciTEBase::UpdateStatusBar(bool bUp
@@ -2770,7 +2770,7 @@ void SciTEBase::UpdateStatusBar(bool bUp
propsStatus.Set("OverType", SendEditor(SCI_GETOVERTYPE) ? "OVR" : "INS");
char sbKey[32];
@ -49,16 +75,16 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
SString msg = propsStatus.GetExpanded(sbKey);
if (msg.size() && sbValue != msg) { // To avoid flickering, update only if needed
SetStatusBarText(msg.c_str());
@@ -3754,7 +3754,7 @@ void SciTEBase::Notify(SCNotification *n
@@ -4334,7 +4334,7 @@ void SciTEBase::Notify(SCNotification *n
case SCN_DWELLSTART: {
char message[200];
if (INVALID_POSITION == notification->position) {
char message[200];
- sprintf(message, "%0d (%0d,%0d)", notification->position, notification->x, notification->y);
+ snprintf(message, sizeof(message), "%0d (%0d,%0d)", notification->position, notification->x, notification->y);
} else {
int lengthDoc = SendEditor(SCI_GETLENGTH);
RangeExtendAndGrab(wEditor, message, sizeof(message),
@@ -4040,11 +4040,11 @@ void SciTEBase::SendOneProperty(const ch
int endWord = notification->position;
SString message =
@@ -4657,11 +4657,11 @@ void SciTEBase::SendOneProperty(const ch
size_t keysize = strlen(kind) + 1 + strlen(key) + 1 + strlen(val) + 1;
char *m = new char[keysize];
if (m) {
@ -75,7 +101,7 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
extender->SendProperty(m);
delete []m;
}
@@ -4082,12 +4082,14 @@ bool SciTEBase::RecordMacroCommand(SCNot
@@ -4699,12 +4699,14 @@ bool SciTEBase::RecordMacroCommand(SCNot
t = (char*)(notification->lParam);
if (t != NULL) {
//format : "<message>;<wParam>;1;<text>"
@ -94,7 +120,7 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
}
handled = extender->OnMacro("macro:record", szMessage);
delete []szMessage;
@@ -4177,7 +4179,7 @@ void SciTEBase::ExecuteMacroCommand(cons
@@ -4794,7 +4796,7 @@ void SciTEBase::ExecuteMacroCommand(cons
//extract message,wParam ,lParam
uptr_t message = ReadNum(nextarg);
@ -103,7 +129,7 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
nextarg += 4;
if (*(params + 1) == 'R') {
// in one function wParam is a string : void SetProperty(string key,string name)
@@ -4187,7 +4189,7 @@ void SciTEBase::ExecuteMacroCommand(cons
@@ -4804,7 +4806,7 @@ void SciTEBase::ExecuteMacroCommand(cons
int lstring1 = nextarg - s1;
string1 = new char[lstring1 + 1];
if (lstring1 > 0)
@ -112,7 +138,7 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
*(string1 + lstring1) = '\0';
wParam = reinterpret_cast<uptr_t>(string1);
nextarg++;
@@ -4234,15 +4236,16 @@ void SciTEBase::ExecuteMacroCommand(cons
@@ -4851,15 +4853,16 @@ void SciTEBase::ExecuteMacroCommand(cons
}
size_t alen = strlen(answercmd);
@ -132,7 +158,16 @@ $OpenBSD: patch-src_SciTEBase_cxx,v 1.1.1.1 2003/08/14 18:27:26 sturm Exp $
extender->OnMacro("macro", tbuff);
delete []tbuff;
}
@@ -4361,9 +4364,10 @@ void SciTEBase::Trace(const char *s) {
@@ -4916,7 +4919,7 @@ bool SciTEBase::ProcessCommandLine(SStri
if (wlArgs[i+1][3] == 'b')
gf = static_cast<GrepFlags>(gf | grepBinary);
char unquoted[1000];
- strcpy(unquoted, wlArgs[i+3]);
+ strlcpy(unquoted, wlArgs[i+3], sizeof(unquoted));
UnSlash(unquoted);
InternalGrep(gf, FilePath::GetWorkingDirectory().AsInternal(), wlArgs[i+2], unquoted);
exit(0);
@@ -5005,9 +5008,10 @@ void SciTEBase::Trace(const char *s) {
char *SciTEBase::Property(const char *key) {
SString value = props.GetExpanded(key);

View File

@ -1,80 +1,7 @@
$OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
--- src/SciTEBuffers.cxx.orig 2003-08-14 01:31:52.000000000 +1000
+++ src/SciTEBuffers.cxx 2003-08-14 01:31:52.000000000 +1000
@@ -273,14 +273,14 @@ void SciTEBase::InitialiseBuffers() {
}
}
-static void EnsureEndsWithPathSeparator(char *path) {
+static void EnsureEndsWithPathSeparator(char *path, size_t path_size) {
size_t pathLen = strlen(path);
if ((pathLen > 0) && path[pathLen - 1] != pathSepChar) {
- strcat(path, pathSepString);
+ strlcat(path, pathSepString, path_size);
}
}
-static void RecentFilePath(char *path, const char *name) {
+static void RecentFilePath(char *path, size_t path_size, const char *name) {
char *where = getenv("SciTE_HOME");
if (!where)
where = getenv("HOME");
@@ -296,16 +296,16 @@ static void RecentFilePath(char *path, c
#endif
} else {
- strcpy(path, where);
- EnsureEndsWithPathSeparator(path);
+ strlcpy(path, where, path_size);
+ EnsureEndsWithPathSeparator(path, path_size);
}
- strcat(path, configFileVisibilityString);
- strcat(path, name);
+ strlcat(path, configFileVisibilityString, path_size);
+ strlcat(path, name, path_size);
}
void SciTEBase::LoadRecentMenu() {
char recentPathName[MAX_PATH + 1];
- RecentFilePath(recentPathName, recentFileName);
+ RecentFilePath(recentPathName, sizeof(recentPathName), recentFileName);
FILE *recentFile = fopen(recentPathName, fileRead);
if (!recentFile) {
DeleteFileStackMenu();
@@ -325,7 +325,7 @@ void SciTEBase::LoadRecentMenu() {
void SciTEBase::SaveRecentStack() {
char recentPathName[MAX_PATH + 1];
- RecentFilePath(recentPathName, recentFileName);
+ RecentFilePath(recentPathName, sizeof(recentPathName), recentFileName);
FILE *recentFile = fopen(recentPathName, fileWrite);
if (!recentFile)
return;
@@ -346,9 +346,9 @@ void SciTEBase::SaveRecentStack() {
void SciTEBase::LoadSession(const char *sessionName) {
char sessionPathName[MAX_PATH + 1];
if (sessionName[0] == '\0') {
- RecentFilePath(sessionPathName, defaultSessionFileName);
+ RecentFilePath(sessionPathName, sizeof(sessionPathName), defaultSessionFileName);
} else {
- strcpy(sessionPathName, sessionName);
+ strlcpy(sessionPathName, sessionName, sizeof(sessionPathName));
}
FILE *sessionFile = fopen(sessionPathName, fileRead);
if (!sessionFile)
@@ -379,9 +379,9 @@ void SciTEBase::LoadSession(const char *
void SciTEBase::SaveSession(const char *sessionName) {
char sessionPathName[MAX_PATH + 1];
if (sessionName[0] == '\0') {
- RecentFilePath(sessionPathName, defaultSessionFileName);
+ RecentFilePath(sessionPathName, sizeof(sessionPathName), defaultSessionFileName);
} else {
- strcpy(sessionPathName, sessionName);
+ strlcpy(sessionPathName, sessionName, sizeof(sessionPathName));
}
FILE *sessionFile = fopen(sessionPathName, fileWrite);
if (!sessionFile)
@@ -615,15 +615,15 @@ void SciTEBase::BuffersMenu() {
$OpenBSD: patch-src_SciTEBuffers_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/SciTEBuffers.cxx.orig Wed May 31 04:46:17 2006
+++ src/SciTEBuffers.cxx Wed May 31 04:46:17 2006
@@ -774,15 +774,15 @@ void SciTEBase::BuffersMenu() {
#if PLAT_WIN
if (pos < 10) {
@ -92,9 +19,9 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
+ strlcat(entry, untitled.c_str(), sizeof(entry));
+ strlcat(titleTab, untitled.c_str(), sizeof(titleTab));
} else {
SString path = buffers.buffers[pos].FullPath();
SString path = buffers.buffers[pos].AsInternal();
#if PLAT_WIN
@@ -635,13 +635,13 @@ void SciTEBase::BuffersMenu() {
@@ -794,22 +794,22 @@ void SciTEBase::BuffersMenu() {
amp += 2;
}
#endif
@ -111,8 +38,9 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
}
}
// For short file names:
@@ -649,8 +649,8 @@ void SciTEBase::BuffersMenu() {
//strcat(entry, cpDirEnd + 1);
//char *cpDirEnd = strrchr(buffers.buffers[pos]->fileName, pathSepChar);
- //strcat(entry, cpDirEnd + 1);
+ //strlcat(entry, cpDirEnd + 1, sizeof(entry));
if (buffers.buffers[pos].isDirty) {
- strcat(entry, " *");
@ -122,7 +50,7 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
}
SetMenuItem(menuBuffers, menuStart + pos + 1, itemID, entry);
@@ -712,10 +712,10 @@ void SciTEBase::SetFileStackMenu() {
@@ -874,10 +874,10 @@ void SciTEBase::SetFileStackMenu() {
entry[0] = '\0';
#if PLAT_WIN
@ -130,12 +58,12 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
+ snprintf(entry, sizeof(entry), "&%d ", (stackPos + 1) % 10);
#endif
- strcat(entry, recentFileStack[stackPos].FullPath());
+ strlcat(entry, recentFileStack[stackPos].FullPath(), sizeof(entry));
- strcat(entry, recentFileStack[stackPos].AsInternal());
+ strlcat(entry, recentFileStack[stackPos].AsInternal(), sizeof(entry));
SetMenuItem(menuFile, MRU_START + stackPos + 1, itemID, entry);
}
}
@@ -1015,8 +1015,7 @@ int DecodeMessage(char *cdoc, char *sour
@@ -1294,8 +1294,7 @@ int DecodeMessage(char *cdoc, char *sour
char *endPath = strchr(startPath, '\"');
int length = endPath - startPath;
if (length > 0) {
@ -144,38 +72,38 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
+ strlcpy(sourcePath, startPath, length);
}
endPath++;
while (*endPath && !isdigit(*endPath)) {
@@ -1036,8 +1035,7 @@ int DecodeMessage(char *cdoc, char *sour
}
int sourceNumber = atoi(cdoc + j) - 1;
if (j > 0) {
- strncpy(sourcePath, cdoc, j - 1);
- sourcePath[j - 1] = 0;
+ strlcpy(sourcePath, cdoc, j - 1);
while (*endPath && !isdigitchar(*endPath)) {
@@ -1314,8 +1313,7 @@ int DecodeMessage(char *cdoc, char *sour
if (cdoc[i] == ':' && isdigitchar(cdoc[i + 1])) {
int sourceNumber = atoi(cdoc + i + 1) - 1;
if (i > 0) {
- strncpy(sourcePath, cdoc, i);
- sourcePath[i] = 0;
+ strlcpy(sourcePath, cdoc, i);
}
return sourceNumber;
}
@@ -1049,8 +1047,7 @@ int DecodeMessage(char *cdoc, char *sour
char *endPath = strchr(cdoc, '(');
int length = endPath - cdoc;
@@ -1331,8 +1329,7 @@ int DecodeMessage(char *cdoc, char *sour
char *endPath = strchr(start, '(');
int length = endPath - start;
if ((length > 0) && (length < MAX_PATH)) {
- strncpy(sourcePath, cdoc, length);
- strncpy(sourcePath, start, length);
- sourcePath[length] = 0;
+ strlcpy(sourcePath, cdoc, length);
+ strlcpy(sourcePath, start, length);
}
endPath++;
return atoi(endPath) - 1;
@@ -1071,8 +1068,7 @@ int DecodeMessage(char *cdoc, char *sour
char *space2 = strchr(space, ' ');
if (space2) {
unsigned int length = space2 - space;
- strncpy(sourcePath, space, length);
- sourcePath[length] = '\0';
+ strlcpy(sourcePath, space, length);
return atoi(space2) - 1;
@@ -1369,8 +1366,7 @@ int DecodeMessage(char *cdoc, char *sour
int length = space2 - space;
if (length > 0) {
- strncpy(sourcePath, space, length);
- sourcePath[length] = '\0';
+ strlcpy(sourcePath, space, length);
return atoi(space2) - 1;
}
}
}
@@ -1084,8 +1080,7 @@ int DecodeMessage(char *cdoc, char *sour
@@ -1383,8 +1379,7 @@ int DecodeMessage(char *cdoc, char *sour
char *line = strstr(cdoc, " line ");
int length = line - (at + 4);
if (at && line && length > 0) {
@ -185,7 +113,7 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
line += 6;
return atoi(line) - 1;
}
@@ -1097,8 +1092,7 @@ int DecodeMessage(char *cdoc, char *sour
@@ -1396,8 +1391,7 @@ int DecodeMessage(char *cdoc, char *sour
char *line = strstr(cdoc, ":line ");
if (in && line && (line > in)) {
in += 4;
@ -195,17 +123,17 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
line += 6;
return atoi(line) - 1;
}
@@ -1115,8 +1109,7 @@ int DecodeMessage(char *cdoc, char *sour
char *quote = strstr(file, "'");
size_t length = quote - (file + lenFile + 1);
@@ -1415,8 +1409,7 @@ int DecodeMessage(char *cdoc, char *sour
char *quote = strstr(fileStart, "'");
size_t length = quote - fileStart;
if (quote && length > 0) {
- strncpy(sourcePath, file + lenFile + 1, length);
- strncpy(sourcePath, fileStart, length);
- sourcePath[length] = '\0';
+ strlcpy(sourcePath, file + lenFile + 1, length);
+ strlcpy(sourcePath, fileStart, length);
}
line += lenLine;
return atoi(line) - 1;
@@ -1140,8 +1133,7 @@ int DecodeMessage(char *cdoc, char *sour
@@ -1434,8 +1427,7 @@ int DecodeMessage(char *cdoc, char *sour
if (strchr("\t\n\r \"$%'*,;<>?[]^`{|}", cdoc[j])) {
j++;
}
@ -215,7 +143,7 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
// Because usually the address is a searchPattern, lineNumber has to be evaluated later
return 0;
}
@@ -1158,8 +1150,7 @@ int DecodeMessage(char *cdoc, char *sour
@@ -1452,8 +1444,7 @@ int DecodeMessage(char *cdoc, char *sour
if (line && file && (line > file)) {
file += lenFile;
size_t length = line - file;
@ -225,17 +153,17 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
line += lenLine;
return atoi(line) - 1;
}
@@ -1182,8 +1173,7 @@ int DecodeMessage(char *cdoc, char *sour
@@ -1476,8 +1467,7 @@ int DecodeMessage(char *cdoc, char *sour
file++;
}
size_t length = strlen(file);
- strncpy(sourcePath, file, length);
- sourcePath[length] = '\0';
+ strlcpy(sourcePath, file, length);
return atoi(line)-1;
return atoi(line) - 1;
}
}
@@ -1206,8 +1196,7 @@ int DecodeMessage(char *cdoc, char *sour
@@ -1500,8 +1490,7 @@ int DecodeMessage(char *cdoc, char *sour
file++;
char *endfile = strchr(file, ')');
size_t length = endfile - file;
@ -245,3 +173,52 @@ $OpenBSD: patch-src_SciTEBuffers_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
line++;
return atoi(line) - 1;
}
@@ -1521,11 +1510,10 @@ int DecodeMessage(char *cdoc, char *sour
if (line && file && (line > file)) {
file += lenFile;
size_t length = line - file;
- strncpy(sourcePath, file, length);
- sourcePath[length] = '\0';
+ strlcpy(sourcePath, file, length);
line += lenLine;
length = column - line;
- strncpy(line, line, length);
+ strlcpy(line, line, length);
return atoi(line) - 1;
}
break;
@@ -1545,12 +1533,11 @@ int DecodeMessage(char *cdoc, char *sour
if (line && file && (line > file)) {
file += lenFile;
size_t length = line - file;
- strncpy(sourcePath, file, length);
- sourcePath[length] = '\0';
+ strlcpy(sourcePath, file, length);
line += lenLine;
if ((lineend > line)) {
length = lineend - line;
- strncpy(line, line, length);
+ strlcpy(line, line, length);
return atoi(line) - 1;
}
}
@@ -1590,8 +1577,7 @@ int DecodeMessage(char *cdoc, char *sour
char *endPath = strchr(startPath, ':');
int length = endPath - startPath;
if (length > 0) {
- strncpy(sourcePath, startPath, length);
- sourcePath[length] = 0;
+ strlcpy(sourcePath, startPath, length);
int sourceNumber = atoi(endPath+1) - 1;
return sourceNumber;
}
@@ -1605,8 +1591,7 @@ int DecodeMessage(char *cdoc, char *sour
char *endPath = strchr(startPath, '\t');
if (endPath) {
int length = endPath - startPath;
- strncpy(sourcePath, startPath, length);
- sourcePath[length] = 0;
+ strlcpy(sourcePath, startPath, length);
return 0;
}
break;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_SciTEGlobal_properties,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/SciTEGlobal.properties.orig Wed Dec 13 01:19:18 2006
+++ src/SciTEGlobal.properties Thu Jan 18 09:11:22 2007
@@ -205,7 +205,7 @@ if PLAT_WIN
command.scite.help.subsystem=2
if PLAT_GTK
command.print.*=a2ps "$(FileNameExt)"
- command.scite.help=netscape "file://$(SciteDefaultHome)/SciTEDoc.html"
+ command.scite.help=firefox "file://__DOCDIR__/SciTEDoc.html"
# Internationalisation
# Japanese input code page 932 and ShiftJIS character set 128

View File

@ -1,147 +1,17 @@
$OpenBSD: patch-src_SciTEIO_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
--- src/SciTEIO.cxx.orig 2003-08-14 18:12:50.000000000 +0200
+++ src/SciTEIO.cxx 2003-08-14 18:14:14.000000000 +0200
@@ -146,10 +146,10 @@ const char *VMSToUnixStyle(const char *f
if (strstr (fileName, "//") == NULL) {
return fileName;
}
- strcpy(unixStyleFileName, fileName);
+ strlcpy(unixStyleFileName, fileName, sizeof(unixStyleFileName));
char *p;
while ((p = strstr (unixStyleFileName, "//")) != NULL) {
- strcpy (p, p + 1);
+ memmove(p, p + 1, strlen(p + 1)+1);
}
return unixStyleFileName;
}
@@ -159,10 +159,10 @@ const char *VMSToUnixStyle(const char *f
// o [dir.dir]file.type
if (fileName [0] == '/') {
- strcpy(unixStyleFileName, fileName);
+ strlcpy(unixStyleFileName, fileName, sizeof(unixStyleFileName));
} else {
unixStyleFileName [0] = '/';
- strcpy(unixStyleFileName + 1, fileName);
+ strlcpy(unixStyleFileName + 1, fileName, sizeof(unixStyleFileName));
char *p = strstr(unixStyleFileName, ":[");
if (p == NULL) {
// o logical:file.type
@@ -170,7 +170,7 @@ const char *VMSToUnixStyle(const char *f
*p = '/';
} else {
*p = '/';
- strcpy(p + 1, p + 2);
+ memmove(p + 1, p + 2, strlen(p + 2)+1);
char *end = strchr(unixStyleFileName, ']');
if (*end != NULL) {
*end = '/';
@@ -189,7 +189,7 @@ void SciTEBase::SetFileName(const char *
$OpenBSD: patch-src_SciTEIO_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/SciTEIO.cxx.orig Mon Jan 15 12:02:13 2007
+++ src/SciTEIO.cxx Mon Jan 15 12:02:56 2007
@@ -78,8 +78,7 @@ void SciTEBase::SetFileName(FilePath ope
if (openName.AsInternal()[0] == '\"') {
// openName is surrounded by double quotes
char pathCopy[MAX_PATH + 1];
pathCopy[0] = '\0';
- strncpy(pathCopy, openName + 1, MAX_PATH);
+ strlcpy(pathCopy, openName + 1, sizeof(pathCopy));
pathCopy[MAX_PATH] = '\0';
- strncpy(pathCopy, openName.AsInternal() + 1, MAX_PATH);
- pathCopy[MAX_PATH] = '\0';
+ strlcpy(pathCopy, openName.AsInternal() + 1, sizeof(pathCopy));
if (pathCopy[strlen(pathCopy) - 1] == '\"') {
pathCopy[strlen(pathCopy) - 1] = '\0';
@@ -206,9 +206,10 @@ void SciTEBase::SetFileName(const char *
char *cpDirEnd = strrchr(fullPath, pathSepChar);
if (IsAbsolutePath(fullPath)) {
// Absolute path
- strcpy(fileName, cpDirEnd + 1);
- strcpy(dirName, fullPath);
- dirName[cpDirEnd - fullPath] = '\0';
+ strlcpy(fileName, cpDirEnd + 1, sizeof(fileName));
+ strlcpy(dirName, fullPath, sizeof(dirName));
+ if ((size_t)(cpDirEnd - fullPath) < sizeof(dirName))
+ dirName[cpDirEnd - fullPath] = 0;
//Platform::DebugPrintf("SetFileName: <%s> <%s>\n", fileName, dirName);
} else {
// Relative path. Since we ran AbsolutePath, we probably are here because fullPath is empty.
@@ -216,20 +217,20 @@ void SciTEBase::SetFileName(const char *
//Platform::DebugPrintf("Working directory: <%s>\n", dirName);
if (cpDirEnd) {
// directories and file name
- strcpy(fileName, cpDirEnd + 1);
+ strlcpy(fileName, cpDirEnd + 1, sizeof(fileName));
*cpDirEnd = '\0';
- strncat(dirName, pathSepString, sizeof(dirName));
- strncat(dirName, fullPath, sizeof(dirName));
+ strlcat(dirName, pathSepString, sizeof(dirName));
+ strlcat(dirName, fullPath, sizeof(dirName));
} else {
// Just a file name
- strcpy(fileName, fullPath);
+ strlcpy(fileName, fullPath, sizeof(fileName));
}
}
// Rebuild fullPath from directory and name
- strcpy(fullPath, dirName);
- strcat(fullPath, pathSepString);
- strcat(fullPath, fileName);
+ strlcpy(fullPath, dirName, sizeof(fullPath));
+ strlcat(fullPath, pathSepString, sizeof(fullPath));
+ strlcat(fullPath, fileName, sizeof(fullPath));
//Platform::DebugPrintf("Path: <%s>\n", fullPath);
if (fixCase) {
@@ -237,11 +238,11 @@ void SciTEBase::SetFileName(const char *
}
char fileBase[MAX_PATH];
- strcpy(fileBase, fileName);
+ strlcpy(fileBase, fileName, sizeof(fileBase));
char *extension = strrchr(fileBase, '.');
if (extension) {
*extension = '\0';
- strcpy(fileExt, extension + 1);
+ strlcpy(fileExt, extension + 1, sizeof(fileExt));
} else { // No extension
fileExt[0] = '\0';
}
@@ -265,13 +266,13 @@ void SciTEBase::SetFileName(const char *
bool SciTEBase::Exists(const char *dir, const char *path, char *testPath) {
char copyPath[MAX_PATH];
if (IsAbsolutePath(path) || !dir) {
- strcpy(copyPath, path);
+ strlcpy(copyPath, path, sizeof(copyPath));
} else if (dir) {
if ((strlen(dir) + strlen(pathSepString) + strlen(path) + 1) > MAX_PATH)
return false;
- strcpy(copyPath, dir);
- strcat(copyPath, pathSepString);
- strcat(copyPath, path);
+ strlcpy(copyPath, dir, sizeof(copyPath));
+ strlcat(copyPath, pathSepString, sizeof(copyPath));
+ strlcat(copyPath, path, sizeof(copyPath));
}
FILE *fp = fopen(copyPath, fileRead);
if (!fp)
@@ -286,9 +287,9 @@ bool BuildPath(char *path, const char *d
unsigned int lenPath) {
*path = '\0';
if ((strlen(dir) + strlen(pathSepString) + strlen(fileName)) < lenPath) {
- strcpy(path, dir);
- strcat(path, pathSepString);
- strcat(path, fileName);
+ strlcpy(path, dir, lenPath);
+ strlcat(path, pathSepString, lenPath);
+ strlcat(path, fileName, lenPath);
return true;
}
return false;
@@ -455,7 +456,7 @@ bool SciTEBase::Open(const char *file, O
}
#ifdef __vms
static char fixedFileName [MAX_PATH];
- strcpy(fixedFileName, VMSToUnixStyle(file));
+ strlcpy(fixedFileName, VMSToUnixStyle(file), sizeof(fixedFileName));
file = fixedFileName;
#endif
@@ -527,7 +528,7 @@ bool SciTEBase::OpenSelected() {
@@ -490,7 +489,7 @@ bool SciTEBase::OpenSelected() {
unsigned long lineNumber = 0;
SString selName = SelectionFilename();
@ -150,21 +20,30 @@ $OpenBSD: patch-src_SciTEIO_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
selectedFilename[MAX_PATH - 1] = '\0';
if (selectedFilename[0] == '\0') {
WarnUser(warnWrongFile);
@@ -544,7 +545,7 @@ bool SciTEBase::OpenSelected() {
strlen(fileName) + strlen(PROPERTIES_EXTENSION) < MAX_PATH) {
// We are in a properties file, we append the correct extension
// to open the include
@@ -498,7 +497,7 @@ bool SciTEBase::OpenSelected() {
}
SString fileNameForExtension = ExtensionFileName();
SString openSuffix = props.GetNewExpand("open.suffix.", fileNameForExtension.c_str());
- strcat(selectedFilename, openSuffix.c_str());
+ strlcat(selectedFilename, openSuffix.c_str(), sizeof(selectedFilename));
if (EqualCaseInsensitive(selectedFilename, FileNameExt().AsInternal()) || EqualCaseInsensitive(selectedFilename, filePath.AsInternal())) {
WarnUser(warnWrongFile);
@@ -513,7 +512,7 @@ bool SciTEBase::OpenSelected() {
// we suppose we want to open an imported .properties file
// So we append the correct extension to open the included file.
// Maybe we should check if the filename is preceded by "import"...
- strcat(selectedFilename, PROPERTIES_EXTENSION);
+ strlcat(selectedFilename, PROPERTIES_EXTENSION, sizeof(selectedFilename));
} else {
// Check if we have a line number (error message or grep result)
// A bit of duplicate work with DecodeMessage, but we don't know
@@ -636,7 +637,7 @@ void SciTEBase::CheckReload() {
if (props.GetInt("load.on.activate")) {
// Make a copy of fullPath as otherwise it gets aliased in Open
char fullPathToCheck[MAX_PATH];
- strcpy(fullPathToCheck, fullPath);
+ strlcpy(fullPathToCheck, fullPath, sizeof(fullPathToCheck));
time_t newModTime = GetModTime(fullPathToCheck);
//Platform::DebugPrintf("Times are %d %d\n", fileModTime, newModTime);
if (newModTime > fileModTime) {
@@ -1057,7 +1056,7 @@ public:
}
lineToShow[i] = '\0';
lineNum++;
- strcpy(lineToCompare, lineToShow);
+ strlcpy(lineToCompare, lineToShow, sizeof(lineToCompare));
if (!caseSensitive) {
for (int j=0; j<i; j++) {
if (lineToCompare[j] >= 'A' && lineToCompare[j] <= 'Z') {

View File

@ -1,20 +1,7 @@
$OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
--- src/SciTEProps.cxx.orig 2003-08-14 01:31:52.000000000 +1000
+++ src/SciTEProps.cxx 2003-08-14 01:31:53.000000000 +1000
@@ -116,9 +116,9 @@ bool PropSetFile::ReadLine(const char *l
ifIsTrue = GetInt(expr);
} else if (isprefix(lineBuffer, "import ") && directoryForImports) {
char importPath[1024];
- strcpy(importPath, directoryForImports);
- strcat(importPath, lineBuffer + strlen("import") + 1);
- strcat(importPath, ".properties");
+ strlcpy(importPath, directoryForImports, sizeof(importPath));
+ strlcat(importPath, lineBuffer + strlen("import") + 1, sizeof(importPath));
+ strlcat(importPath, ".properties", sizeof(importPath));
if (Read(importPath, directoryForImports, imports, sizeImports)) {
if (imports) {
for (int i = 0; i < sizeImports; i++) {
@@ -170,7 +170,7 @@ bool PropSetFile::Read(const char *filen
$OpenBSD: patch-src_SciTEProps_cxx,v 1.2 2007/01/18 10:56:27 steven Exp $
--- src/SciTEProps.cxx.orig Mon Jan 15 12:02:13 2007
+++ src/SciTEProps.cxx Mon Jan 15 12:02:56 2007
@@ -175,7 +175,7 @@ bool PropSetFile::Read(FilePath filename
void PropSetFile::SetInteger(const char *key, sptr_t i) {
char tmp[32];
@ -23,60 +10,7 @@ $OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
Set(key, tmp);
}
@@ -251,12 +251,12 @@ void SciTEBase::ReadGlobalPropFile() {
char propdir[MAX_PATH + 20];
propsBase.Clear();
if (GetDefaultPropertiesFileName(propfile, propdir, sizeof(propfile))) {
- strcat(propdir, pathSepString);
+ strlcat(propdir, pathSepString, sizeof(propdir));
propsBase.Read(propfile, propdir, importFiles, importMax);
}
propsUser.Clear();
if (GetUserPropertiesFileName(propfile, propdir, sizeof(propfile))) {
- strcat(propdir, pathSepString);
+ strlcat(propdir, pathSepString, sizeof(propdir));
propsUser.Read(propfile, propdir, importFiles, importMax);
}
if (!localisationRead) {
@@ -269,7 +269,7 @@ void SciTEBase::ReadAbbrevPropFile() {
char propdir[MAX_PATH + 20];
propsAbbrev.Clear();
if (GetAbbrevPropertiesFileName(propfile, propdir, sizeof(propfile))) {
- strcat(propdir, pathSepString);
+ strlcat(propdir, pathSepString, sizeof(propdir));
propsAbbrev.Read(propfile, propdir, importFiles, importMax);
}
}
@@ -283,8 +283,7 @@ void ChopTerminalSlash(char *path) {
void SciTEBase::GetDocumentDirectory(char *docDir, int len) {
if (dirName[0]) {
- strncpy(docDir, dirName, len);
- docDir[len - 1] = '\0';
+ strlcpy(docDir, dirName, len);
} else {
getcwd(docDir, len);
docDir[len - 1] = '\0';
@@ -298,14 +297,14 @@ void SciTEBase::ReadLocalPropFile() {
char propdir[MAX_PATH + 20];
GetDocumentDirectory(propdir, sizeof(propdir));
char propfile[MAX_PATH + 20];
- strcpy(propfile, propdir);
+ strlcpy(propfile, propdir, sizeof(propfile));
#ifndef __vms
- strcat(propdir, pathSepString);
- strcat(propfile, pathSepString);
+ strlcat(propdir, pathSepString, sizeof(propdir));
+ strlcat(propfile, pathSepString, sizeof(propfile));
#endif
- strcat(propfile, propFileName);
+ strlcat(propfile, propFileName, sizeof(propfile));
propsLocal.Clear();
propsLocal.Read(propfile, propdir);
//Platform::DebugPrintf("Reading local properties from %s\n", propfile);
@@ -370,8 +369,7 @@ const char *SciTEBase::GetNextPropItem(
@@ -342,8 +342,7 @@ const char *SciTEBase::GetNextPropItem(
}
pNext++;
}
@ -86,7 +20,7 @@ $OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
return pNext;
}
@@ -502,7 +500,7 @@ void SciTEBase::SetStyleFor(Window &win,
@@ -499,7 +498,7 @@ void SciTEBase::SetStyleFor(Window &win,
for (int style = 0; style <= STYLE_MAX; style++) {
if (style != STYLE_DEFAULT) {
char key[200];
@ -95,16 +29,16 @@ $OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
SString sval = props.GetExpanded(key);
SetOneStyle(win, style, sval.c_str());
}
@@ -522,7 +520,7 @@ SString SciTEBase::ExtensionFileName() {
else if (fileName[0]) {
// Force extension to lower case
char fileNameWithLowerCaseExtension[MAX_PATH];
- strcpy(fileNameWithLowerCaseExtension, fileName);
+ strlcpy(fileNameWithLowerCaseExtension, fileName, sizeof(fileNameWithLowerCaseExtension));
char *extension = strrchr(fileNameWithLowerCaseExtension, '.');
if (extension) {
LowerCaseString(extension);
@@ -786,7 +784,7 @@ void SciTEBase::ReadProperties() {
@@ -523,7 +522,7 @@ SString SciTEBase::ExtensionFileName() {
if (name.IsSet()) {
// Force extension to lower case
char fileNameWithLowerCaseExtension[MAX_PATH];
- strcpy(fileNameWithLowerCaseExtension, name.AsInternal());
+ strlcpy(fileNameWithLowerCaseExtension, name.AsInternal(), sizeof(fileNameWithLowerCaseExtension));
char *extension = strrchr(fileNameWithLowerCaseExtension, '.');
if (extension) {
LowerCaseString(extension);
@@ -927,7 +926,7 @@ void SciTEBase::ReadProperties() {
}
char bracesStyleKey[200];
@ -113,7 +47,7 @@ $OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
bracesStyle = props.GetInt(bracesStyleKey, 0);
char key[200];
@@ -800,13 +798,13 @@ void SciTEBase::ReadProperties() {
@@ -945,13 +944,13 @@ void SciTEBase::ReadProperties() {
calltipEndDefinition = FindLanguageProperty("calltip.*.end.definition");
@ -129,7 +63,7 @@ $OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
autoCompleteFillUpCharacters = props.GetExpanded(key);
if (autoCompleteFillUpCharacters == "")
autoCompleteFillUpCharacters =
@@ -814,10 +812,10 @@ void SciTEBase::ReadProperties() {
@@ -959,10 +958,10 @@ void SciTEBase::ReadProperties() {
SendEditorString(SCI_AUTOCSETFILLUPS, 0,
autoCompleteFillUpCharacters.c_str());
@ -142,7 +76,7 @@ $OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
sval = props.GetNewExpand(key);
if (sval != "")
autoCompleteIgnoreCase = sval == "1";
@@ -835,12 +833,12 @@ void SciTEBase::ReadProperties() {
@@ -1236,12 +1235,12 @@ void SciTEBase::ReadFontProperties() {
SendEditor(SCI_STYLERESETDEFAULT, 0, 0);
SendOutput(SCI_STYLERESETDEFAULT, 0, 0);
@ -157,7 +91,7 @@ $OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
sval = props.GetNewExpand(key);
SetOneStyle(wEditor, STYLE_DEFAULT, sval.c_str());
@@ -851,7 +849,7 @@ void SciTEBase::ReadProperties() {
@@ -1252,7 +1251,7 @@ void SciTEBase::ReadFontProperties() {
SendOutput(SCI_STYLECLEARALL, 0, 0);
@ -166,27 +100,3 @@ $OpenBSD: patch-src_SciTEProps_cxx,v 1.1.1.1 2003/08/14 18:27:28 sturm Exp $
sval = props.GetNewExpand(key);
SetOneStyle(wOutput, STYLE_DEFAULT, sval.c_str());
@@ -1171,7 +1169,7 @@ void SciTEBase::ReadLocalisation() {
}
if (GetSciteDefaultHome(propdir, sizeof propdir)
&& BuildPath(propfile, propdir, title, sizeof propfile)) {
- strcat(propdir, pathSepString);
+ strlcat(propdir, pathSepString, sizeof(propdir));
propsUI.Read(propfile, propdir, importFiles, importMax);
}
localisationRead = true;
@@ -1288,11 +1286,11 @@ void SciTEBase::OpenProperties(int props
GetDocumentDirectory(propfile, sizeof(propfile));
#ifdef __vms
- strcpy(propfile, VMSToUnixStyle(propfile));
+ strlcpy(propfile, VMSToUnixStyle(propfile), sizeof(propfile));
#endif
- strcat(propfile, pathSepString);
- strcat(propfile, propFileName);
+ strlcat(propfile, pathSepString, sizeof(propfile));
+ strlcat(propfile, propFileName, sizeof(propfile));
Open(propfile, ofQuiet);
} else if (propsFile == IDM_OPENUSERPROPERTIES) {
if (GetUserPropertiesFileName(propfile, propdir, sizeof(propfile))) {

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_html_properties,v 1.1 2007/01/18 10:56:27 steven Exp $
--- src/html.properties.orig Thu Jan 18 08:09:15 2007
+++ src/html.properties Thu Jan 18 08:10:37 2007
@@ -516,7 +516,7 @@ if PLAT_WIN
command.go.$(file.patterns.web)="file://$(FilePath)"
command.go.subsystem.$(file.patterns.web)=2
if PLAT_GTK
- command.go.$(file.patterns.web)=netscape "file://$(FilePath)"
+ command.go.$(file.patterns.web)=firefox "file://$(FilePath)"
command.go.$(file.patterns.php)=php -f "$(FileNameExt)"
command.compile.$(file.patterns.php)=php -l "$(FileNameExt)"

View File

@ -1,18 +1,21 @@
@comment $OpenBSD: PLIST,v 1.2 2004/09/15 18:01:07 espie Exp $
@comment $OpenBSD: PLIST,v 1.3 2007/01/18 10:56:27 steven Exp $
bin/SciTE
share/doc/scite/
share/doc/scite/CommandValues.html
share/doc/scite/PrintHi.png
share/doc/scite/SciTE.html
share/doc/scite/SciTEDirector.html
share/doc/scite/SciTEDoc.html
share/doc/scite/SciTEDownload.html
share/doc/scite/SciTEExtension.html
share/doc/scite/SciTEExternalLexer.html
share/doc/scite/SciTEExtras.html
share/doc/scite/SciTEFAQ.html
share/doc/scite/SciTEIco.png
share/doc/scite/SciTEImage.html
share/doc/scite/SciTELexer.html
share/doc/scite/SciTELua.html
share/doc/scite/SciTERegEx.html
share/doc/scite/SciTETranslation.html
share/scite/
share/scite/Embedded.properties
share/scite/SciTE.properties
@ -20,32 +23,56 @@ share/scite/SciTEGlobal.properties
share/scite/abbrev.properties
share/scite/ada.properties
share/scite/asm.properties
share/scite/asn1.properties
share/scite/au3.properties
share/scite/ave.properties
share/scite/baan.properties
share/scite/blitzbasic.properties
share/scite/bullant.properties
share/scite/caml.properties
share/scite/conf.properties
share/scite/cpp.properties
share/scite/csound.properties
share/scite/css.properties
share/scite/d.properties
share/scite/eiffel.properties
share/scite/erlang.properties
share/scite/escript.properties
share/scite/flagship.properties
share/scite/forth.properties
share/scite/fortran.properties
share/scite/freebasic.properties
share/scite/html.properties
share/scite/inno.properties
share/scite/kix.properties
share/scite/latex.properties
share/scite/lisp.properties
share/scite/lot.properties
share/scite/lout.properties
share/scite/lua.properties
share/scite/matlab.properties
share/scite/metapost.properties
share/scite/mmixal.properties
share/scite/nncrontab.properties
share/scite/nsis.properties
share/scite/opal.properties
share/scite/others.properties
share/scite/pascal.properties
share/scite/perl.properties
share/scite/pov.properties
share/scite/ps.properties
share/scite/purebasic.properties
share/scite/python.properties
share/scite/rebol.properties
share/scite/ruby.properties
share/scite/scriptol.properties
share/scite/smalltalk.properties
share/scite/specman.properties
share/scite/spice.properties
share/scite/sql.properties
share/scite/tcl.properties
share/scite/tex.properties
share/scite/vb.properties
share/scite/verilog.properties
share/scite/vhdl.properties
share/scite/yaml.properties