subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1360103 [7/18] - in /subversion/branches/ev2-export: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ build/win32/ contrib/server-side/ notes/wc-ng/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/or...
Date Wed, 11 Jul 2012 10:26:26 GMT
Modified: subversion/branches/ev2-export/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/dirent_uri.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/dirent_uri.c Wed Jul 11 10:26:19
2012
@@ -104,7 +104,7 @@ canonicalize_to_lower(char c)
   if (c < 'A' || c > 'Z')
     return c;
   else
-    return c - 'A' + 'a';
+    return (char)(c - 'A' + 'a');
 }
 
 /* Locale insensitive toupper() for converting parts of dirents and urls
@@ -115,7 +115,7 @@ canonicalize_to_upper(char c)
   if (c < 'a' || c > 'z')
     return c;
   else
-    return c - 'a' + 'A';
+    return (char)(c - 'a' + 'A');
 }
 
 /* Calculates the length of the dirent absolute or non absolute root in
@@ -1562,10 +1562,32 @@ svn_dirent_get_absolute(const char **pab
                                APR_FILEPATH_NOTRELATIVE,
                                pool);
   if (apr_err)
-    return svn_error_createf(SVN_ERR_BAD_FILENAME,
-                             svn_error_create(apr_err, NULL, NULL),
-                             _("Couldn't determine absolute path of '%s'"),
-                             svn_dirent_local_style(relative, pool));
+    {
+      /* In some cases when the passed path or its ancestor(s) do not exist
+         or no longer exist apr returns an error.
+
+         In many of these cases we would like to return a path anyway, when the
+         passed path was already a safe absolute path. So check for that now to
+         avoid an error.
+
+         svn_dirent_is_absolute() doesn't perform the necessary checks to see
+         if the path doesn't need post processing to be in the canonical absolute
+         format.
+         */
+
+      if (svn_dirent_is_absolute(relative)
+          && svn_dirent_is_canonical(relative, pool)
+          && !svn_path_is_backpath_present(relative))
+        {
+          *pabsolute = apr_pstrdup(pool, relative);
+          return SVN_NO_ERROR;
+        }
+
+      return svn_error_createf(SVN_ERR_BAD_FILENAME,
+                               svn_error_create(apr_err, NULL, NULL),
+                               _("Couldn't determine absolute path of '%s'"),
+                               svn_dirent_local_style(relative, pool));
+    }
 
   SVN_ERR(svn_path_cstring_to_utf8(pabsolute, buffer, pool));
   *pabsolute = svn_dirent_canonicalize(*pabsolute, pool);

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/io.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/io.c Wed Jul 11 10:26:19 2012
@@ -185,7 +185,7 @@ try_utf8_from_internal_style(const char 
   /* Special case. */
   if (path == NULL)
     return "(NULL)";
-  
+
   /* (try to) convert PATH to UTF-8. If that fails, continue with the plain
    * PATH because it is the best we have. It may actually be UTF-8 already.
    */
@@ -1311,6 +1311,43 @@ svn_io_filesizes_different_p(svn_boolean
 
 
 svn_error_t *
+svn_io_filesizes_three_different_p(svn_boolean_t *different_p12,
+                                   svn_boolean_t *different_p23,
+                                   svn_boolean_t *different_p13,
+                                   const char *file1,
+                                   const char *file2,
+                                   const char *file3,
+                                   apr_pool_t *scratch_pool)
+{
+  apr_finfo_t finfo1, finfo2, finfo3;
+  apr_status_t status1, status2, status3;
+  const char *file1_apr, *file2_apr, *file3_apr;
+
+  /* Not using svn_io_stat() because don't want to generate
+     svn_error_t objects for non-error conditions. */
+
+  SVN_ERR(cstring_from_utf8(&file1_apr, file1, scratch_pool));
+  SVN_ERR(cstring_from_utf8(&file2_apr, file2, scratch_pool));
+  SVN_ERR(cstring_from_utf8(&file3_apr, file3, scratch_pool));
+
+  /* Stat all three files */
+  status1 = apr_stat(&finfo1, file1_apr, APR_FINFO_MIN, scratch_pool);
+  status2 = apr_stat(&finfo2, file2_apr, APR_FINFO_MIN, scratch_pool);
+  status3 = apr_stat(&finfo3, file3_apr, APR_FINFO_MIN, scratch_pool);
+
+  /* If we got an error stat'ing a file, it could be because the
+     file was removed... or who knows.  Whatever the case, we
+     don't know if the filesizes are definitely different, so
+     assume that they're not. */
+  *different_p12 = !status1 && !status2 && finfo1.size != finfo2.size;
+  *different_p23 = !status2 && !status3 && finfo2.size != finfo3.size;
+  *different_p13 = !status1 && !status3 && finfo1.size != finfo3.size;
+
+  return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
 svn_io_file_checksum2(svn_checksum_t **checksum,
                       const char *file,
                       svn_checksum_kind_t kind,
@@ -1391,28 +1428,32 @@ get_default_file_perms(apr_fileperms_t *
     {
       apr_finfo_t finfo;
       apr_file_t *fd;
+      const char *fname_base, *fname;
+      apr_uint32_t randomish;
+      svn_error_t *err;
 
       /* Get the perms for a newly created file to find out what bits
         should be set.
 
-        Normally del_on_close can be problematic because APR might
-        delete the file if we spawned any child processes. In this
-        case, the lifetime of this file handle is about 3 lines of
-        code, so we can safely use del_on_close here.
-
-        Not so fast! If some other thread forks off a child, then the
-        APR cleanups run, and the file will disappear. So use
-        del_on_pool_cleanup instead.
+        Explictly delete the file because we want this file to be as
+        short-lived as possible since its presence means other
+        processes may have to try multiple names.
 
         Using svn_io_open_uniquely_named() here because other tempfile
         creation functions tweak the permission bits of files they create.
       */
-      SVN_ERR(svn_io_open_uniquely_named(&fd, NULL, NULL, "default-perms", NULL,
-                                         svn_io_file_del_on_pool_cleanup,
-                                         scratch_pool, scratch_pool));
-      SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_PROT, fd, scratch_pool));
-      SVN_ERR(svn_io_file_close(fd, scratch_pool));
+      randomish = ((apr_uint32_t)(apr_uintptr_t)scratch_pool
+                   + (apr_uint32_t)apr_time_now());
+      fname_base = apr_psprintf(scratch_pool, "svn-%08x", randomish);
 
+      SVN_ERR(svn_io_open_uniquely_named(&fd, &fname, NULL, fname_base,
+                                         NULL, svn_io_file_del_none,
+                                         scratch_pool, scratch_pool));
+      err = svn_io_file_info_get(&finfo, APR_FINFO_PROT, fd, scratch_pool);
+      err = svn_error_compose_create(err, svn_io_file_close(fd, scratch_pool));
+      err = svn_error_compose_create(err, svn_io_remove_file2(fname, TRUE,
+                                                              scratch_pool));
+      SVN_ERR(err);
       *perms = finfo.protection;
       default_perms = finfo.protection;
     }
@@ -1990,7 +2031,7 @@ svn_io_unlock_open_file(apr_file_t *lock
   if (apr_err)
     return svn_error_wrap_apr(apr_err, _("Can't unlock file '%s'"),
                               try_utf8_from_internal_style(fname, pool));
-  
+
 /* On Windows and OS/2 file locks are automatically released when
    the file handle closes */
 #if !defined(WIN32) && !defined(__OS2__)
@@ -2126,7 +2167,7 @@ stringbuf_from_aprfile(svn_stringbuf_t *
         {
           apr_finfo_t finfo;
           if (! (status = apr_stat(&finfo, filename, APR_FINFO_MIN, pool)))
-            res_initial_len = finfo.size;
+            res_initial_len = (apr_size_t)finfo.size;
         }
     }
 
@@ -4020,8 +4061,8 @@ contents_identical_p(svn_boolean_t *iden
   apr_size_t bytes_read1, bytes_read2;
   char *buf1 = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
   char *buf2 = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
-  apr_file_t *file1_h = NULL;
-  apr_file_t *file2_h = NULL;
+  apr_file_t *file1_h;
+  apr_file_t *file2_h;
   svn_boolean_t eof1 = FALSE;
   svn_boolean_t eof2 = FALSE;
 
@@ -4072,6 +4113,138 @@ contents_identical_p(svn_boolean_t *iden
 
 
 
+/* Do a byte-for-byte comparison of FILE1, FILE2 and FILE3. */
+static svn_error_t *
+contents_three_identical_p(svn_boolean_t *identical_p12,
+                           svn_boolean_t *identical_p23,
+                           svn_boolean_t *identical_p13,
+                           const char *file1,
+                           const char *file2,
+                           const char *file3,
+                           apr_pool_t *scratch_pool)
+{
+  svn_error_t *err;
+  apr_size_t bytes_read1, bytes_read2, bytes_read3;
+  char *buf1 = apr_palloc(scratch_pool, SVN__STREAM_CHUNK_SIZE);
+  char *buf2 = apr_palloc(scratch_pool, SVN__STREAM_CHUNK_SIZE);
+  char *buf3 = apr_palloc(scratch_pool, SVN__STREAM_CHUNK_SIZE);
+  apr_file_t *file1_h;
+  apr_file_t *file2_h;
+  apr_file_t *file3_h;
+  svn_boolean_t eof1 = FALSE;
+  svn_boolean_t eof2 = FALSE;
+  svn_boolean_t eof3 = FALSE;
+  svn_boolean_t read_1, read_2, read_3;
+
+  SVN_ERR(svn_io_file_open(&file1_h, file1, APR_READ, APR_OS_DEFAULT,
+                           scratch_pool));
+
+  err = svn_io_file_open(&file2_h, file2, APR_READ, APR_OS_DEFAULT,
+                         scratch_pool);
+
+  if (err)
+    return svn_error_trace(
+               svn_error_compose_create(err,
+                                        svn_io_file_close(file1_h, scratch_pool)));
+
+  err = svn_io_file_open(&file3_h, file3, APR_READ, APR_OS_DEFAULT,
+                         scratch_pool);
+
+  if (err)
+      return svn_error_trace(
+               svn_error_compose_create(
+                    err,
+                    svn_error_compose_create(svn_io_file_close(file1_h,
+                                                          scratch_pool),
+                                             svn_io_file_close(file2_h,
+                                                          scratch_pool))));
+
+  /* assume TRUE, until disproved below */
+  *identical_p12 = *identical_p23 = *identical_p13 = TRUE;
+  /* We need to read as long as no error occurs, and as long as one of the
+   * flags could still change due to a read operation */
+  while (!err
+        && ((*identical_p12 && !eof1 && !eof2)
+            || (*identical_p23 && !eof2 && !eof3)
+            || (*identical_p13 && !eof1 && !eof3)))
+    {
+      read_1 = read_2 = read_3 = FALSE;
+
+      /* As long as a file is not at the end yet, and it is still
+       * potentially identical to another file, we read the next chunk.*/
+      if (!eof1 && (identical_p12 || identical_p13))
+        {
+          err = svn_io_file_read_full2(file1_h, buf1,
+                                   SVN__STREAM_CHUNK_SIZE, &bytes_read1,
+                                   &eof1, scratch_pool);
+          if (err)
+              break;
+          read_1 = TRUE;
+        }
+
+      if (!eof2 && (identical_p12 || identical_p23))
+        {
+          err = svn_io_file_read_full2(file2_h, buf2,
+                                   SVN__STREAM_CHUNK_SIZE, &bytes_read2,
+                                   &eof2, scratch_pool);
+          if (err)
+              break;
+          read_2 = TRUE;
+        }
+
+      if (!eof3 && (identical_p13 || identical_p23))
+        {
+          err = svn_io_file_read_full2(file3_h, buf3,
+                                   SVN__STREAM_CHUNK_SIZE, &bytes_read3,
+                                   &eof3, scratch_pool);
+          if (err)
+              break;
+          read_3 = TRUE;
+        }
+
+      /* If the files are still marked identical, and at least one of them
+       * is not at the end of file, we check whether they differ, and set
+       * their flag to false then. */
+      if (*identical_p12
+          && (read_1 || read_2)
+          && ((eof1 != eof2)
+              || (bytes_read1 != bytes_read2)
+              || memcmp(buf1, buf2, bytes_read1)))
+        {
+          *identical_p12 = FALSE;
+        }
+
+      if (*identical_p23
+          && (read_2 || read_3)
+          && ((eof2 != eof3)
+              || (bytes_read2 != bytes_read3)
+              || memcmp(buf2, buf3, bytes_read2)))
+        {
+          *identical_p23 = FALSE;
+        }
+
+      if (*identical_p13
+          && (read_1 || read_3)
+          && ((eof1 != eof3)
+              || (bytes_read1 != bytes_read3)
+              || memcmp(buf1, buf3, bytes_read3)))
+        {
+          *identical_p13 = FALSE;
+        }
+    }
+
+  return svn_error_trace(
+           svn_error_compose_create(
+                err,
+                svn_error_compose_create(
+                    svn_io_file_close(file1_h, scratch_pool),
+                    svn_error_compose_create(
+                        svn_io_file_close(file2_h, scratch_pool),
+                        svn_io_file_close(file3_h, scratch_pool)))));
+}
+
+
+
 svn_error_t *
 svn_io_files_contents_same_p(svn_boolean_t *same,
                              const char *file1,
@@ -4084,16 +4257,65 @@ svn_io_files_contents_same_p(svn_boolean
 
   if (q)
     {
-      *same = 0;
+      *same = FALSE;
       return SVN_NO_ERROR;
     }
 
   SVN_ERR(contents_identical_p(&q, file1, file2, pool));
 
   if (q)
-    *same = 1;
+    *same = TRUE;
   else
-    *same = 0;
+    *same = FALSE;
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_io_files_contents_three_same_p(svn_boolean_t *same12,
+                                   svn_boolean_t *same23,
+                                   svn_boolean_t *same13,
+                                   const char *file1,
+                                   const char *file2,
+                                   const char *file3,
+                                   apr_pool_t *scratch_pool)
+{
+  svn_boolean_t diff_size12, diff_size23, diff_size13;
+
+  SVN_ERR(svn_io_filesizes_three_different_p(&diff_size12,
+                                             &diff_size23,
+                                             &diff_size13,
+                                             file1,
+                                             file2,
+                                             file3,
+                                             scratch_pool));
+
+  if (diff_size12 && diff_size23 && diff_size13)
+    {
+      *same12 = *same23 = *same13 = FALSE;
+    }
+  else if (diff_size12 && diff_size23)
+    {
+      *same12 = *same23 = FALSE;
+      SVN_ERR(contents_identical_p(same13, file1, file3, scratch_pool));
+    }
+  else if (diff_size23 && diff_size13)
+    {
+      *same23 = *same13 = FALSE;
+      SVN_ERR(contents_identical_p(same12, file1, file2, scratch_pool));
+    }
+  else if (diff_size12 && diff_size13)
+    {
+      *same12 = *same13 = FALSE;
+      SVN_ERR(contents_identical_p(same23, file2, file3, scratch_pool));
+    }
+  else
+    {
+      SVN_ERR_ASSERT(!diff_size12 && !diff_size23 && !diff_size13);
+      SVN_ERR(contents_three_identical_p(same12, same23, same13,
+                                         file1, file2, file3,
+                                         scratch_pool));
+    }
 
   return SVN_NO_ERROR;
 }
@@ -4347,3 +4569,86 @@ svn_io_open_unique_file3(apr_file_t **fi
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_io_file_readline(apr_file_t *file,
+                     svn_stringbuf_t **stringbuf,
+                     const char **eol,
+                     svn_boolean_t *eof,
+                     apr_size_t max_len,
+                     apr_pool_t *result_pool,
+                     apr_pool_t *scratch_pool)
+{
+  svn_stringbuf_t *str;
+  const char *eol_str;
+  apr_size_t numbytes;
+  char c;
+  apr_size_t len;
+  svn_boolean_t found_eof;
+
+  str = svn_stringbuf_create_ensure(80, result_pool);
+
+  /* Read bytes into STR up to and including, but not storing,
+   * the next EOL sequence. */
+  eol_str = NULL;
+  numbytes = 1;
+  len = 0;
+  found_eof = FALSE;
+  while (!found_eof)
+    {
+      if (len < max_len)
+        SVN_ERR(svn_io_file_read_full2(file, &c, sizeof(c), &numbytes,
+                                       &found_eof, scratch_pool));
+      len++;
+      if (numbytes != 1 || len > max_len)
+        {
+          found_eof = TRUE;
+          break;
+        }
+
+      if (c == '\n')
+        {
+          eol_str = "\n";
+        }
+      else if (c == '\r')
+        {
+          eol_str = "\r";
+
+          if (!found_eof && len < max_len)
+            {
+              apr_off_t pos;
+
+              /* Check for "\r\n" by peeking at the next byte. */
+              pos = 0;
+              SVN_ERR(svn_io_file_seek(file, APR_CUR, &pos, scratch_pool));
+              SVN_ERR(svn_io_file_read_full2(file, &c, sizeof(c), &numbytes,
+                                             &found_eof, scratch_pool));
+              if (numbytes == 1 && c == '\n')
+                {
+                  eol_str = "\r\n";
+                  len++;
+                }
+              else
+                {
+                  /* Pretend we never peeked. */
+                  SVN_ERR(svn_io_file_seek(file, APR_SET, &pos, scratch_pool));
+                  found_eof = FALSE;
+                  numbytes = 1;
+                }
+            }
+        }
+      else
+        svn_stringbuf_appendbyte(str, c);
+
+      if (eol_str)
+        break;
+    }
+
+  if (eol)
+    *eol = eol_str;
+  if (eof)
+    *eof = found_eof;
+  *stringbuf = str;
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/quoprint.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/quoprint.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/quoprint.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/quoprint.c Wed Jul 11 10:26:19 2012
@@ -233,7 +233,7 @@ decode_bytes(svn_stringbuf_t *str, const
           find2 = strchr(hextab, inbuf[2]);
           if (find1 != NULL && find2 != NULL)
             {
-              c = ((find1 - hextab) << 4) | (find2 - hextab);
+              c = (char)(((find1 - hextab) << 4) | (find2 - hextab));
               svn_stringbuf_appendbyte(str, c);
             }
           *inbuflen = 0;

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/skel.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/skel.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/skel.c Wed Jul 11 10:26:19 2012
@@ -136,41 +136,6 @@ getsize(const char *data, apr_size_t len
     }
 }
 
-/* Store the ASCII decimal representation of VALUE at DATA.  Return
-   the length of the representation if all goes well; return zero if
-   the result doesn't fit in LEN bytes.  */
-static apr_size_t
-putsize(char *data, apr_size_t len, apr_size_t value)
-{
-  apr_size_t i = 0;
-
-  /* Generate the digits, least-significant first.  */
-  do
-    {
-      if (i >= len)
-        return 0;
-
-      data[i] = (value % 10) + '0';
-      value /= 10;
-      i++;
-    }
-  while (value > 0);
-
-  /* Put the digits in most-significant-first order.  */
-  {
-    apr_size_t left, right;
-
-    for (left = 0, right = i-1; left < right; left++, right--)
-      {
-        char t = data[left];
-        data[left] = data[right];
-        data[right] = t;
-      }
-  }
-
-  return i;
-}
-
 
 /* Checking validity of skels. */
 static svn_error_t *
@@ -434,7 +399,7 @@ estimate_unparsed_size(const svn_skel_t 
     }
   else
     {
-      int total_len;
+      apr_size_t total_len;
       svn_skel_t *child;
 
       /* Allow space for opening and closing parens, and a space
@@ -491,11 +456,12 @@ unparse(const svn_skel_t *skel, svn_stri
         svn_stringbuf_appendbytes(str, skel->data, skel->len);
       else
         {
-          /* Append the length to STR.  */
-          char buf[200];
+          /* Append the length to STR.  Ensure enough space for at least
+           * one 64 bit int. */
+          char buf[200 + SVN_INT64_BUFFER_SIZE];
           apr_size_t length_len;
 
-          length_len = putsize(buf, sizeof(buf), skel->len);
+          length_len = svn__ui64toa(buf, skel->len);
 
           SVN_ERR_ASSERT_NO_RETURN(length_len > 0);
 

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c Wed Jul 11 10:26:19 2012
@@ -291,7 +291,7 @@ read_data(struct memblock_t **mem,
   /* NOTE: mem's size/next are uninitialized.  */
 
   if (buf->spill_size < buf->blocksize)
-    (*mem)->size = buf->spill_size;
+    (*mem)->size = (apr_size_t)buf->spill_size;
   else
     (*mem)->size = buf->blocksize;  /* The size of (*mem)->data  */
   (*mem)->next = NULL;

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c Wed Jul 11 10:26:19 2012
@@ -1116,13 +1116,15 @@ wrapped_func(sqlite3_context *context,
              sqlite3_value *values[])
 {
   struct function_wrapper_baton_t *fwb = sqlite3_user_data(context);
-  svn_sqlite__context_t sctx = { context };
+  svn_sqlite__context_t sctx;
   svn_sqlite__value_t **local_vals =
                             apr_palloc(fwb->scratch_pool,
                                        sizeof(svn_sqlite__value_t *) * argc);
   svn_error_t *err;
   int i;
 
+  sctx.context = context;
+
   for (i = 0; i < argc; i++)
     {
       local_vals[i] = apr_palloc(fwb->scratch_pool, sizeof(*local_vals[i]));

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/string.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/string.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/string.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/string.c Wed Jul 11 10:26:19 2012
@@ -976,7 +976,7 @@ svn__ui64toa(char * dest, apr_uint64_t n
       /* Number is larger than 100^4, i.e. we can write 4x2 chars.
        * Also, use 32 bit DIVs as these are about twice as fast.
        */
-      reduced = number % 100000000;
+      reduced = (apr_uint32_t)(number % 100000000);
       number /= 100000000;
 
       COPY_TWO_BYTES(target - 0, decimal_table[reduced % 100]);

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/win32_crypto.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/win32_crypto.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/win32_crypto.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/win32_crypto.c Wed Jul 11 10:26:19
2012
@@ -64,7 +64,8 @@ encrypt_data(const svn_string_t *orig,
   if (CryptProtectData(&blobin, description, NULL, NULL, NULL,
                        CRYPTPROTECT_UI_FORBIDDEN, &blobout))
     {
-      crypted = svn_string_ncreate(blobout.pbData, blobout.cbData, pool);
+      crypted = svn_string_ncreate((const char *)blobout.pbData,
+                                   blobout.cbData, pool);
       LocalFree(blobout.pbData);
     }
   return crypted;
@@ -87,7 +88,8 @@ decrypt_data(const svn_string_t *crypted
                          CRYPTPROTECT_UI_FORBIDDEN, &blobout))
     {
       if (0 == lstrcmpW(descr, description))
-        orig = svn_string_ncreate(blobout.pbData, blobout.cbData, pool);
+        orig = svn_string_ncreate((const char *)blobout.pbData,
+                                  blobout.cbData, pool);
       LocalFree(blobout.pbData);
       LocalFree(descr);
     }

Modified: subversion/branches/ev2-export/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/adm_ops.c?rev=1360103&r1=1360102&r2=1360103&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/adm_ops.c Wed Jul 11 10:26:19 2012
@@ -691,8 +691,8 @@ svn_wc__delete_many(svn_wc_context_t *wc
 
       /* Read conflicts, to allow deleting the markers after updating the DB */
       if (!keep_local && conflicted)
-        SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
-                                          scratch_pool, iterpool));
+        SVN_ERR(svn_wc__read_conflicts(&conflicts, db, local_abspath,
+                                       scratch_pool, iterpool));
 
     }
 
@@ -836,12 +836,13 @@ svn_wc__delete_internal(svn_wc_context_t
 
   /* Read conflicts, to allow deleting the markers after updating the DB */
   if (!keep_local && conflicted)
-    SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
-                                      scratch_pool, scratch_pool));
+    SVN_ERR(svn_wc__read_conflicts(&conflicts, db, local_abspath,
+                                   scratch_pool, scratch_pool));
 
   SVN_ERR(svn_wc__db_op_delete(db, local_abspath, moved_to_abspath,
-                               notify_func, notify_baton,
+                               NULL, NULL,
                                cancel_func, cancel_baton,
+                               notify_func, notify_baton,
                                pool));
 
   if (!keep_local && conflicted && conflicts != NULL)
@@ -1609,10 +1610,7 @@ revert_restore(svn_wc__db_t *db,
   svn_kind_t kind;
   svn_node_kind_t on_disk;
   svn_boolean_t notify_required;
-  const char *conflict_old;
-  const char *conflict_new;
-  const char *conflict_working;
-  const char *prop_reject;
+  const apr_array_header_t *conflict_files;
   svn_filesize_t recorded_size;
   apr_time_t recorded_mod_time;
   apr_finfo_t finfo;
@@ -1626,8 +1624,7 @@ revert_restore(svn_wc__db_t *db,
     SVN_ERR(cancel_func(cancel_baton));
 
   SVN_ERR(svn_wc__db_revert_list_read(&notify_required,
-                                      &conflict_old, &conflict_new,
-                                      &conflict_working, &prop_reject,
+                                      &conflict_files,
                                       &copied_here, &reverted_kind,
                                       db, local_abspath,
                                       scratch_pool, scratch_pool));
@@ -1894,14 +1891,17 @@ revert_restore(svn_wc__db_t *db,
       notify_required = TRUE;
     }
 
-  SVN_ERR(remove_conflict_file(&notify_required, conflict_old,
-                               local_abspath, scratch_pool));
-  SVN_ERR(remove_conflict_file(&notify_required, conflict_new,
-                               local_abspath, scratch_pool));
-  SVN_ERR(remove_conflict_file(&notify_required, conflict_working,
-                               local_abspath, scratch_pool));
-  SVN_ERR(remove_conflict_file(&notify_required, prop_reject,
-                               local_abspath, scratch_pool));
+  if (conflict_files)
+    {
+      int i;
+      for (i = 0; i < conflict_files->nelts; i++)
+        {
+          SVN_ERR(remove_conflict_file(&notify_required,
+                                       APR_ARRAY_IDX(conflict_files, i,
+                                                     const char *),
+                                       local_abspath, scratch_pool));
+        }
+    }
 
   if (notify_func && notify_required)
     notify_func(notify_baton,
@@ -2265,7 +2265,7 @@ typedef struct get_pristine_lazyopen_bat
 {
   svn_wc_context_t *wc_ctx;
   const char *wri_abspath;
-  const svn_checksum_t *sha1_checksum;
+  const svn_checksum_t *checksum;
 
 } get_pristine_lazyopen_baton_t;
 
@@ -2278,9 +2278,19 @@ get_pristine_lazyopen_func(svn_stream_t 
                            apr_pool_t *scratch_pool)
 {
   get_pristine_lazyopen_baton_t *b = baton;
+  const svn_checksum_t *sha1_checksum;
+
+  /* svn_wc__db_pristine_read() wants a SHA1, so if we have an MD5,
+     we'll use it to lookup the SHA1. */
+  if (b->checksum->kind == svn_checksum_sha1)
+    sha1_checksum = b->checksum;
+  else
+    SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, b->wc_ctx->db,
+                                         b->wri_abspath, b->checksum,
+                                         scratch_pool, scratch_pool));
 
   SVN_ERR(svn_wc__db_pristine_read(stream, NULL, b->wc_ctx->db,
-                                   b->wri_abspath, b->sha1_checksum,
+                                   b->wri_abspath, sha1_checksum,
                                    result_pool, scratch_pool));
   return SVN_NO_ERROR;
 }
@@ -2289,7 +2299,7 @@ svn_error_t *
 svn_wc__get_pristine_contents_by_checksum(svn_stream_t **contents,
                                           svn_wc_context_t *wc_ctx,
                                           const char *wri_abspath,
-                                          const svn_checksum_t *sha1_checksum,
+                                          const svn_checksum_t *checksum,
                                           apr_pool_t *result_pool,
                                           apr_pool_t *scratch_pool)
 {
@@ -2298,7 +2308,7 @@ svn_wc__get_pristine_contents_by_checksu
   *contents = NULL;
 
   SVN_ERR(svn_wc__db_pristine_check(&present, wc_ctx->db, wri_abspath,
-                                    sha1_checksum, scratch_pool));
+                                    checksum, scratch_pool));
 
   if (present)
     {
@@ -2307,7 +2317,7 @@ svn_wc__get_pristine_contents_by_checksu
       gpl_baton = apr_pcalloc(result_pool, sizeof(*gpl_baton));
       gpl_baton->wc_ctx = wc_ctx;
       gpl_baton->wri_abspath = wri_abspath;
-      gpl_baton->sha1_checksum = sha1_checksum;
+      gpl_baton->checksum = checksum;
       
       *contents = svn_stream_lazyopen_create(get_pristine_lazyopen_func,
                                              gpl_baton, result_pool);
@@ -2696,8 +2706,12 @@ svn_wc_get_changelists(svn_wc_context_t 
                        void *cancel_baton,
                        apr_pool_t *scratch_pool)
 {
-  struct get_cl_fn_baton gnb = { wc_ctx->db, NULL,
-                                 callback_func, callback_baton };
+  struct get_cl_fn_baton gnb;
+
+  gnb.db = wc_ctx->db;
+  gnb.clhash = NULL;
+  gnb.callback_func = callback_func;
+  gnb.callback_baton = callback_baton;
 
   if (changelist_filter)
     SVN_ERR(svn_hash_from_cstring_keys(&gnb.clhash, changelist_filter,



Mime
View raw message