You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/11/04 11:14:56 UTC

svn commit: r1405517 - in /subversion/trunk/subversion/bindings/javahl/native: CopySources.cpp CreateJ.cpp SVNClient.cpp StringArray.cpp Targets.cpp

Author: stefan2
Date: Sun Nov  4 10:14:56 2012
New Revision: 1405517

URL: http://svn.apache.org/viewvc?rev=1405517&view=rev
Log:
Silence integer size conversion warnings in JavaHL under Win64 by casting 
the values explicitly.  We assume that argument counts and property sizes
are all well below the 2G limit.

* subversion/bindings/javahl/native/CopySources.cpp
  (CopySources::array): cast size_t -> int
* subversion/bindings/javahl/native/CreateJ.cpp
  (CreateJ::Checksum, 
   CreateJ::PropertyMap): ditto
* subversion/bindings/javahl/native/StringArray.cpp
  (StringArray::array): ditto
* subversion/bindings/javahl/native/SVNClient.cpp
  (SVNClient::logMessages,
   SVNClient::merge,
   SVNClient::propertyGet,
   SVNClient::revProperty): same here ...
* subversion/bindings/javahl/native/Targets.cpp
  (Targets::array): ... and here

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CopySources.cpp
    subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
    subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp
    subversion/trunk/subversion/bindings/javahl/native/Targets.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/CopySources.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CopySources.cpp?rev=1405517&r1=1405516&r2=1405517&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CopySources.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CopySources.cpp Sun Nov  4 10:14:56 2012
@@ -95,7 +95,7 @@ CopySources::array(SVN::Pool &pool)
   std::vector<jobject> sources = m_copySources.vector();
 
   apr_array_header_t *copySources =
-    apr_array_make(p, sources.size(), sizeof(svn_client_copy_source_t *));
+    apr_array_make(p, (int)sources.size(), sizeof(svn_client_copy_source_t *));
   for (std::vector<jobject>::const_iterator it = sources.begin();
         it < sources.end(); ++it)
     {

Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=1405517&r1=1405516&r2=1405517&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Sun Nov  4 10:14:56 2012
@@ -208,7 +208,7 @@ CreateJ::Checksum(const svn_checksum_t *
 
   jbyteArray jdigest = JNIUtil::makeJByteArray(
                             (const signed char *)checksum->digest,
-                            svn_checksum_size(checksum));
+                            (int)svn_checksum_size(checksum));
   if (JNIUtil::isExceptionThrown())
     POP_AND_RETURN_NULL;
 
@@ -1033,7 +1033,8 @@ jobject CreateJ::PropertyMap(apr_hash_t 
         POP_AND_RETURN_NULL;
 
       jbyteArray jpropVal = JNIUtil::makeJByteArray(
-                                    (const signed char *)val->data, val->len);
+                                    (const signed char *)val->data,
+                                    (int)val->len);
       if (JNIUtil::isJavaExceptionThrown())
         POP_AND_RETURN_NULL;
 

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=1405517&r1=1405516&r2=1405517&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Sun Nov  4 10:14:56 2012
@@ -195,7 +195,7 @@ void SVNClient::logMessages(const char *
     SVN_JNI_ERR(target.error_occured(), );
 
     apr_array_header_t *ranges =
-        apr_array_make(subPool.getPool(), logRanges.size(),
+        apr_array_make(subPool.getPool(), (int)logRanges.size(),
                        sizeof(svn_opt_revision_range_t *));
 
     std::vector<RevisionRange>::const_iterator it;
@@ -644,7 +644,7 @@ void SVNClient::merge(const char *path, 
         return;
 
     apr_array_header_t *ranges =
-      apr_array_make(subPool.getPool(), rangesToMerge.size(),
+      apr_array_make(subPool.getPool(), (int)rangesToMerge.size(),
                      sizeof(const svn_opt_revision_range_t *));
 
     std::vector<RevisionRange>::const_iterator it;
@@ -854,7 +854,7 @@ jbyteArray SVNClient::propertyGet(const 
         return NULL;
 
     return JNIUtil::makeJByteArray((const signed char *)propval->data,
-                                   propval->len);
+                                   (int)propval->len);
 }
 
 void SVNClient::properties(const char *path, Revision &revision,
@@ -1158,7 +1158,7 @@ jbyteArray SVNClient::revProperty(const 
         return NULL;
 
     return JNIUtil::makeJByteArray((const signed char *)propval->data,
-                                   propval->len);
+                                   (int)propval->len);
 }
 void SVNClient::relocate(const char *from, const char *to, const char *path,
                          bool ignoreExternals)

Modified: subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp?rev=1405517&r1=1405516&r2=1405517&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp Sun Nov  4 10:14:56 2012
@@ -39,7 +39,7 @@ StringArray::~StringArray()
 const apr_array_header_t *StringArray::array(const SVN::Pool &pool)
 {
   apr_array_header_t *strings
-    = apr_array_make(pool.getPool(), m_strings.size(), sizeof(char *));
+    = apr_array_make(pool.getPool(), (int)m_strings.size(), sizeof(char *));
 
   std::vector<std::string>::const_iterator it;
   for (it = m_strings.begin(); it < m_strings.end(); ++it)

Modified: subversion/trunk/subversion/bindings/javahl/native/Targets.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Targets.cpp?rev=1405517&r1=1405516&r2=1405517&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Targets.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Targets.cpp Sun Nov  4 10:14:56 2012
@@ -73,7 +73,7 @@ const apr_array_header_t *Targets::array
 
   apr_pool_t *apr_pool = pool.getPool();
   apr_array_header_t *apr_targets = apr_array_make (apr_pool,
-                                                    m_targets.size(),
+                                                    (int)m_targets.size(),
                                                     sizeof(const char *));
 
   for (it = m_targets.begin(); it != m_targets.end(); ++it)



Re: svn commit: r1405517 - in /subversion/trunk/subversion/bindings/javahl/native: CopySources.cpp CreateJ.cpp SVNClient.cpp StringArray.cpp Targets.cpp

Posted by Stefan Fuhrmann <st...@wandisco.com>.
On Sun, Nov 4, 2012 at 3:40 PM, Branko Čibej <br...@wandisco.com> wrote:

> On 04.11.2012 12:37, Blair Zajac wrote:
> > On Nov 4, 2012, at 2:14 AM, stefan2@apache.org wrote:
> >
> >> Author: stefan2
> >> Date: Sun Nov  4 10:14:56 2012
> >> New Revision: 1405517
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1405517&view=rev
> >> Log:
> >> Silence integer size conversion warnings in JavaHL under Win64 by
> casting
> >> the values explicitly.  We assume that argument counts and property
> sizes
> >> are all well below the 2G limit.
> > Hi Stefan,
> >
> > Since you're in C++ here you could switch to using static_cast<> or
> reinterpret_cast<> instead, that would be better for self documentation,
> although that doesn't seem to be the style in the code.
>
> static_cast. *not* reinterpret_cast, which we should never need in
> high-level code.
>

Yes, if APR and JNI would provide a proper C++ interfaces ...

Currently, we need to cast void*->something,
char*->unsigned char* etc. But at least a simple
grep will now find them all.

-- Stefan^2.


-- 
Certified & Supported Apache Subversion Downloads:
*

http://www.wandisco.com/subversion/download
*

Re: svn commit: r1405517 - in /subversion/trunk/subversion/bindings/javahl/native: CopySources.cpp CreateJ.cpp SVNClient.cpp StringArray.cpp Targets.cpp

Posted by Branko Čibej <br...@wandisco.com>.
On 04.11.2012 12:37, Blair Zajac wrote:
> On Nov 4, 2012, at 2:14 AM, stefan2@apache.org wrote:
>
>> Author: stefan2
>> Date: Sun Nov  4 10:14:56 2012
>> New Revision: 1405517
>>
>> URL: http://svn.apache.org/viewvc?rev=1405517&view=rev
>> Log:
>> Silence integer size conversion warnings in JavaHL under Win64 by casting 
>> the values explicitly.  We assume that argument counts and property sizes
>> are all well below the 2G limit.
> Hi Stefan,
>
> Since you're in C++ here you could switch to using static_cast<> or reinterpret_cast<> instead, that would be better for self documentation, although that doesn't seem to be the style in the code.

static_cast. *not* reinterpret_cast, which we should never need in
high-level code.

-- Brane


Re: svn commit: r1405517 - in /subversion/trunk/subversion/bindings/javahl/native: CopySources.cpp CreateJ.cpp SVNClient.cpp StringArray.cpp Targets.cpp

Posted by Blair Zajac <bl...@orcaware.com>.
On Nov 4, 2012, at 2:14 AM, stefan2@apache.org wrote:

> Author: stefan2
> Date: Sun Nov  4 10:14:56 2012
> New Revision: 1405517
> 
> URL: http://svn.apache.org/viewvc?rev=1405517&view=rev
> Log:
> Silence integer size conversion warnings in JavaHL under Win64 by casting 
> the values explicitly.  We assume that argument counts and property sizes
> are all well below the 2G limit.

Hi Stefan,

Since you're in C++ here you could switch to using static_cast<> or reinterpret_cast<> instead, that would be better for self documentation, although that doesn't seem to be the style in the code.

Blair