Update of /cvsroot/perl-win32-gui/Win32-GUI/Win32-GUI-Scintilla In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16697/Win32-GUI-Scintilla
Modified Files: Scintilla.PL Log Message: Fix some buffer size issues Index: Scintilla.PL =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Win32-GUI-Scintilla/Scintilla.PL,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Scintilla.PL 15 Oct 2006 14:07:46 -0000 1.5 --- Scintilla.PL 15 Jul 2007 19:08:40 -0000 1.6 *************** *** 197,205 **** $self->SetUndoCollection(0); ! open F, "<$file" or return 0; ! while ( <F> ) { $self->AppendText($_); } ! close F; $self->SetUndoCollection(1); --- 197,205 ---- $self->SetUndoCollection(0); ! open my $fh, "<$file" or return 0; ! while ( <$fh> ) { $self->AppendText($_); } ! close $fh; $self->SetUndoCollection(1); *************** *** 218,228 **** my ($self, $file) = @_; ! open F, ">$file" or return 0; ! for my $i (0..$self->GetLineCount()) { ! print F $self->GetLine ($i); } ! close F; $self->SetSavePoint(); --- 218,228 ---- my ($self, $file) = @_; ! open my $fh, ">$file" or return 0; ! for my $i (0 .. ($self->GetLineCount() - 1)) { ! print $fh $self->GetLine ($i); } ! close $fh; $self->SetSavePoint(); *************** *** 389,395 **** print ' my ($self) = @_;',"\n"; print ' my $line = $self->GetLineFromPosition ($self->GetCurrentPos());',"\n"; ! print ' my $lenght = $self->LineLength($line);',"\n"; ! print ' my $text = " " x ($lenght+1);',"\n\n"; ! print ' if ($self->SendMessageNP (2027, $lenght, $text)) {',"\n"; print ' return $text;',"\n"; print ' } else {',"\n"; --- 389,395 ---- print ' my ($self) = @_;',"\n"; print ' my $line = $self->GetLineFromPosition ($self->GetCurrentPos());',"\n"; ! print ' my $length = $self->LineLength($line);',"\n"; ! print ' my $text = " " x $length;',"\n\n"; ! print ' if ($self->SendMessageNP (2027, $length, $text)) {',"\n"; print ' return $text;',"\n"; print ' } else {',"\n"; *************** *** 403,408 **** print 'sub GetLine {', "\n"; print ' my ($self, $line) = @_;', "\n"; ! print ' my $lenght = $self->LineLength($line);', "\n"; ! print ' my $text = " " x ($lenght + 1);', "\n\n"; print ' if ($self->SendMessageNP (2153, $line, $text)) {', "\n"; print ' return $text;', "\n"; --- 403,408 ---- print 'sub GetLine {', "\n"; print ' my ($self, $line) = @_;', "\n"; ! print ' my $length = $self->LineLength($line);', "\n"; ! print ' my $text = " " x $length;', "\n\n"; print ' if ($self->SendMessageNP (2153, $line, $text)) {', "\n"; print ' return $text;', "\n"; *************** *** 464,474 **** print 'sub GetText {', "\n"; print ' my $self = shift;', "\n"; ! print ' my $lenght = $self->GetTextLength() + 1;', "\n"; ! print ' my $text = " " x ($lenght+1);', "\n\n"; ! print ' if ($self->SendMessageNP (2182, $lenght, $text)) {', "\n"; ! print ' return $text;', "\n"; ! print ' } else {', "\n"; ! print ' return undef;', "\n"; ! print ' }', "\n"; print '}', "\n"; } --- 464,472 ---- print 'sub GetText {', "\n"; print ' my $self = shift;', "\n"; ! print ' my $length = $self->SendMessageNN(2182, 0, 0); # includes trailing NUL', "\n"; ! print ' my $text = " " x $length;', "\n\n"; ! print ' $self->SendMessageNP (2182, $length, $text);', "\n"; ! print ' $text =~ s/.$//; # remove trailing NUL (regexp is faster than sbstr)', "\n"; ! print ' return $text;', "\n"; print '}', "\n"; } *************** *** 487,491 **** print ' return $pos unless defined wantarray;', "\n"; print ' my @res = unpack("LLpLL", $texttofind);', "\n"; ! print ' return ($res[3], $res[4]); # pos , lenght', "\n"; print '}', "\n"; } --- 485,489 ---- print ' return $pos unless defined wantarray;', "\n"; print ' my @res = unpack("LLpLL", $texttofind);', "\n"; ! print ' return ($res[3], $res[4]); # pos , length', "\n"; print '}', "\n"; } *************** *** 705,709 **** # find out if we are folding or unfolding ! for $lineNum (1..$lineCount) { if ($self->GetFoldLevel($lineNum) & Win32::GUI::Scintilla::SC_FOLDLEVELHEADERFLAG) { $expanding = not $self->GetFoldExpanded($lineNum); --- 703,707 ---- # find out if we are folding or unfolding ! for $lineNum (1..$lineCount) { # XXX Should this be 0 .. $linecount - 1 ??? if ($self->GetFoldLevel($lineNum) & Win32::GUI::Scintilla::SC_FOLDLEVELHEADERFLAG) { $expanding = not $self->GetFoldExpanded($lineNum);