patch-ac, ad: fix compilation with Sun Studio 11 compilers, patch

from author via segv in PR 32155.
patch-ae: from martin@, fixes recursion self-test (not installed).
This commit is contained in:
wiz 2005-11-24 19:34:01 +00:00
parent dc73dcb087
commit 81e3bd9b4b
4 changed files with 55 additions and 1 deletions

View file

@ -1,7 +1,10 @@
$NetBSD: distinfo,v 1.16 2005/10/31 20:33:24 tv Exp $
$NetBSD: distinfo,v 1.17 2005/11/24 19:34:01 wiz Exp $
SHA1 (pcre-6.4.tar.bz2) = 778fb963b7ec24e0dce34c8e21b8633b32a02704
RMD160 (pcre-6.4.tar.bz2) = c2e48a301fa08ce255aa60ecb5a8961a8266aa53
Size (pcre-6.4.tar.bz2) = 566309 bytes
SHA1 (patch-aa) = e32943de7fb5dad5d40e1fc8e942be7439b43907
SHA1 (patch-ab) = 1bb79ce010f30fdd4ab3b579faa45fa06c01ce90
SHA1 (patch-ac) = 14e67eb1b7c4d343b0b3acf62484b5c556b7a739
SHA1 (patch-ad) = 771d41edfa41c8600fcb90cf676a3d767c59aae9
SHA1 (patch-ae) = 561cb7239ebe019de58f92ae9d8a24a620250de9

View file

@ -0,0 +1,26 @@
$NetBSD: patch-ac,v 1.1 2005/11/24 19:34:01 wiz Exp $
--- pcre_scanner.cc.orig 2005-09-12 10:45:39.000000000 +0200
+++ pcre_scanner.cc
@@ -30,7 +30,6 @@
// Author: Sanjay Ghemawat
#include <vector>
-#include <algorithm> // for count()
#include <assert.h>
#include "config.h"
#include "pcre_scanner.h"
@@ -90,7 +89,12 @@ void Scanner::EnableSkip() {
int Scanner::LineNumber() const {
// TODO: Make it more efficient by keeping track of the last point
// where we computed line numbers and counting newlines since then.
- return 1 + std::count(data_.data(), input_.data(), '\n');
+ // We could use std:count, but not all systems have it (HPUX). :-(
+ int count = 1;
+ for (const char* p = data_.data(); p < input_.data(); ++p)
+ if (*p == '\n')
+ ++count;
+ return count;
}
int Scanner::Offset() const {

View file

@ -0,0 +1,12 @@
$NetBSD: patch-ad,v 1.1 2005/11/24 19:34:01 wiz Exp $
--- pcre_scanner_unittest.cc.orig 2005-09-12 10:45:39.000000000 +0200
+++ pcre_scanner_unittest.cc
@@ -68,6 +68,7 @@ static void TestScanner() {
s.Consume(re, &var, &number);
CHECK_EQ(var, "alpha");
CHECK_EQ(number, 1);
+ CHECK_EQ(s.LineNumber(), 3);
s.GetNextComments(&comments);
CHECK_EQ(comments.size(), 1);
CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");

View file

@ -0,0 +1,13 @@
$NetBSD: patch-ae,v 1.1 2005/11/24 19:34:01 wiz Exp $
--- pcrecpp_unittest.cc.orig 2005-09-12 10:45:39.000000000 +0200
+++ pcrecpp_unittest.cc
@@ -1022,7 +1022,7 @@ int main(int argc, char** argv) {
}
// Test that recursion is stopped: there will be some errors reported
- int matchlimit = 5000;
+ int matchlimit = 500;
int bytes = 15 * 1024; // enough to crash if there was no match limit
TestRecursion(bytes, ".", matchlimit);
TestRecursion(bytes, "a", matchlimit);