cSvn CGI Script

cSvn CGI Script – is a web frontend for Subversion™ Repositories

115 Commits   0 Branches   5 Tags   |
Index: configure.ac
===================================================================
--- configure.ac	(revision 68)
+++ configure.ac	(revision 69)
@@ -95,7 +95,7 @@
 AC_CHECK_HEADERS( sys/time.h )
 AC_CHECK_HEADERS( limits.h )
 AC_CHECK_HEADERS( endian.h )
-AC_CHECK_HEADERS( pcre.h )
+AC_CHECK_HEADERS( pcre2.h )
 AC_CHECK_HEADERS( wchar.h )
 AC_CHECK_HEADERS( wctype.h )
 AC_CHECK_HEADERS( math.h )
@@ -117,8 +117,8 @@
 dnl ============================================================
 dnl ============================================================
 AC_MSG_CFG_PART(Test for libraries)
-AC_CHECK_LIB([pcre],[pcre_compile],[],[AC_MSG_ERROR([Unable to find required libpcre])])
-AC_CHECK_LIB([pcre32],[pcre32_compile],[],[AC_MSG_ERROR([Unable to find required libpcre32])])
+AC_CHECK_LIB([pcre2-8],[pcre2_compile_8],[],[AC_MSG_ERROR([Unable to find required libpcre2-8])])
+AC_CHECK_LIB([pcre2-32],[pcre2_compile_32],[],[AC_MSG_ERROR([Unable to find required libpcre2-32])])
 AC_CHECK_LIB([rt],[aio_suspend],[],[AC_MSG_ERROR([Unable to find required librt])])
 AC_CHECK_LIB([m],[round],[],[AC_MSG_ERROR([Unable to find required libm])])
 AC_CHECK_LIB([md4c],[md_parse],[],[AC_MSG_ERROR([Unable to find required libmd4c])])
Index: csvncgi/strbuf.c
===================================================================
--- csvncgi/strbuf.c	(revision 68)
+++ csvncgi/strbuf.c	(revision 69)
@@ -24,8 +24,10 @@
 #include <grp.h>
 #include <stdarg.h>
 #include <unistd.h>
-#include <pcre.h>
 
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+
 #include <nls.h>
 
 #include <defs.h>
@@ -485,28 +487,33 @@
 
 static int is_html_quoted( const char *str )
 {
-  int         rc = 0;
-  int         match[32];
-  const char *error = NULL;
-  int         offset = 0;
+  int         rc = 0, error = 0;
+  PCRE2_SIZE  offset = 0;
   const char  pattern[] = "^(&[#A-Za-z0-9]*;)";
 
-  pcre *regexp = pcre_compile( pattern, 0, &error, &offset, NULL );
+  pcre2_match_data *match;
+
+  pcre2_code *regexp = pcre2_compile( (PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED, 0, &error, &offset, NULL );
   if( regexp == NULL )
   {
     return 0; /* PCRE compilation failed */
   }
 
-  rc = pcre_exec( regexp, NULL, (PCRE_SPTR)str, (int)strlen(str), 0, 0,
-                  match, sizeof(match)/sizeof(match[0]) );
+  match = pcre2_match_data_create_from_pattern( regexp, NULL );
+
+  rc = pcre2_match( regexp, (PCRE2_SPTR)str, (PCRE2_SIZE)strlen(str), 0, 0, match, NULL ); /* sizeof(match)/sizeof(match[0]) */
   if( rc < 0 )
   {
-    pcre_free( regexp ); /* not match */
+    /* not match */
+    pcre2_match_data_free( match );
+    pcre2_code_free( regexp );
     return 0;
   }
   else
   {
-    pcre_free( regexp ); /* match */
+    /* match */
+    pcre2_match_data_free( match );
+    pcre2_code_free( regexp );
     return 1;
   }
 }
Index: csvncgi/ui-shared.c
===================================================================
--- csvncgi/ui-shared.c	(revision 68)
+++ csvncgi/ui-shared.c	(revision 69)
@@ -782,10 +782,14 @@
               name = xmlNodeGetContent( param );
             }
           }
+
           if( name && strcmp( (char *)name, "deadwood" ) )
           {
             count += 1;
           }
+
+          if( name )
+            xmlFree( name );
         }
         xmlFree( content );
       }
Index: csvnd/bconf.c
===================================================================
--- csvnd/bconf.c	(revision 68)
+++ csvnd/bconf.c	(revision 69)
@@ -43,8 +43,8 @@
 
 static int  snum, rnum, dnum, global_dnum, global_rnum, indent;
 
-static unsigned char *ftab, *stab;
-static Bcf32_Off      stabsz;
+static unsigned char *ftab, *stab = NULL;
+static Bcf32_Off      stabsz = 0;
 
 static Bcf32_Off  shoff; /* section header table’s file offset in bytes */
 static Bcf32_Off  rhoff; /* repository header table’s file offset in bytes */
@@ -92,7 +92,7 @@
      */
     stabsz = (Bcf32_Off)(strlen( val ) + 2);
     stab = (unsigned char *)xmalloc( (size_t)stabsz );
-    (void)strncpy( (char *)(stab + off), val, stabsz );
+    (void)strncpy( (char *)&stab[1], val, stabsz - 1 );
     return off;
   }
   else
Index: csvnd/lex.c
===================================================================
--- csvnd/lex.c	(revision 68)
+++ csvnd/lex.c	(revision 69)
@@ -12,8 +12,10 @@
 #include <locale.h>
 #include <wchar.h>
 #include <wctype.h>
-#include <pcre.h>
 
+#define PCRE2_CODE_UNIT_WIDTH 32
+#include <pcre2.h>
+
 #include <defs.h>
 
 #include <main.h>
@@ -347,28 +349,33 @@
 
 int html_symbol_name( wchar_t *str )
 {
-  int         rc = 0;
-  int         match[32];
-  const char *error = NULL;
-  int         offset = 0;
+  int         rc = 0, error = 0;
+  PCRE2_SIZE  offset = 0;
   wchar_t     pattern[] = L"^(&[#A-Za-z0-9]*;)";
 
-  pcre32 *regexp = pcre32_compile( (PCRE_SPTR32)pattern, 0, &error, &offset, NULL );
+  pcre2_match_data *match;
+
+  pcre2_code *regexp = pcre2_compile( (PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED, 0, &error, &offset, NULL );
   if( regexp == NULL )
   {
     return 0; /* PCRE compilation failed */
   }
 
-  rc = pcre32_exec( regexp, NULL, (PCRE_SPTR32)str, (int)wcslen(str), 0, 0,
-                    match, sizeof(match)/sizeof(match[0]) );
+  match = pcre2_match_data_create_from_pattern( regexp, NULL );
+
+  rc = pcre2_match( regexp, (PCRE2_SPTR)str, (int)wcslen(str), 0, 0, match, NULL );
   if( rc < 0 )
   {
-    pcre32_free( regexp ); /* not match */
+    /* not match */
+    pcre2_match_data_free( match );
+    pcre2_code_free( regexp );
     return 0;
   }
   else
   {
-    pcre32_free( regexp ); /* match */
+    /* match */
+    pcre2_match_data_free( match );
+    pcre2_code_free( regexp );
     return 1;
   }
 }
Index: csvnd/main.c
===================================================================
--- csvnd/main.c	(revision 68)
+++ csvnd/main.c	(revision 69)
@@ -331,7 +331,6 @@
 
   /* Create CSVN_PID_DIR if not exists: */
   {
-    struct stat st;
     char  *pid_dir = NULL, *dir = strdup( pid_fname );
 
     pid_dir = dirname( dir );
@@ -369,7 +368,6 @@
 
   /* Create CSVN_LOG_DIR if not exists: */
   {
-    struct stat st;
     char  *log_dir = NULL, *dir = strdup( log_fname );
 
     log_dir = dirname( dir );