You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Jani Averbach <ja...@jaa.iki.fi> on 2005/01/11 05:01:30 UTC

[PATCH]: svn commit: r12615 - in javahl: `ltoa' undeclared

When I integrated bindings testing to the svntest framework, I found
following:

/srv/svntest/svntest/obj-sh/../svn/svn_trunk/subversion/bindings/java/javahl/native/SVNClient.cpp:2758:
error: `ltoa' undeclared (first use this function)

On 2005-01-06 13:18-0600, pmayweg@tigris.org wrote:
> .. 
> +    std::string value = ltoa(sb.min_rev, JNIUtil::getFormatBuffer(), 10);
> +    if (sb.min_rev != sb.max_rev)
> +    {
> +        value + ":";
> +        value += ltoa(sb.max_rev, JNIUtil::getFormatBuffer(), 10);
> +    }
> ...

ltoa isn't defined here, and I could not find it from anywhere on my system
(gcc (GCC) 3.4.3 ).

The following patch fixes javahl, and make it more C++ like, any
objection to commit this?

BR, Jani

Log:
Don't use ltoa for number to string conversion, it isn't defined
everywhere and it isn't very C++. Use ostringstream instead.

* subversion/bindings/java/javahl/native/SVNClient.cpp
  (SVNClient::getVersionInfo): Use ostringstream instead of ltoa.

-- 
Jani Averbach                 jaa@iki.fi              +1-303-415-0199 

Re: [PATCH]: svn commit: r12615 - in javahl: `ltoa' undeclared

Posted by Patrick Mayweg <ma...@qint.de>.
Hi Jani,
I have commit your patch in r12748.
Thanks,
Patrick

Jani Averbach wrote:

>On 2005-01-11 07:09+0100, Patrick Mayweg wrote:
>  
>
>> 
>>Interesting, I have never thought that ltoa was not defined on any 
>>system. I would have bet on it to be a standard C library function.
>>    
>>
>
>Well, you just lose your money, it isn't. =)
>
>  
>
>>Just for the record, could you tell me more about your platform then
>>just the compiler.
>>    
>>
>
>GNU/Linux, GCC 3.4.3, glibc 2.3.4.
>
>  
>
>>Let me just check how the patch behaves on windows. 
>>    
>>
>
>Thanks for doing this, I know that the name of <sstream> might vary from
>system to system (with old compilers).
>
>BR, Jani
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]: svn commit: r12615 - in javahl: `ltoa' undeclared

Posted by Jani Averbach <ja...@jaa.iki.fi>.
On 2005-01-11 07:09+0100, Patrick Mayweg wrote:
>  
> Interesting, I have never thought that ltoa was not defined on any 
> system. I would have bet on it to be a standard C library function.

Well, you just lose your money, it isn't. =)

> Just for the record, could you tell me more about your platform then
> just the compiler.

GNU/Linux, GCC 3.4.3, glibc 2.3.4.

> Let me just check how the patch behaves on windows. 

Thanks for doing this, I know that the name of <sstream> might vary from
system to system (with old compilers).

BR, Jani

-- 
Jani Averbach


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]: svn commit: r12615 - in javahl: `ltoa' undeclared

Posted by Patrick Mayweg <ma...@qint.de>.
Hi Jani,

Jani Averbach wrote:

>When I integrated bindings testing to the svntest framework, I found
>following:
>
>/srv/svntest/svntest/obj-sh/../svn/svn_trunk/subversion/bindings/java/javahl/native/SVNClient.cpp:2758:
>error: `ltoa' undeclared (first use this function)
>
>On 2005-01-06 13:18-0600, pmayweg@tigris.org wrote:
>  
>
>>.. 
>>+    std::string value = ltoa(sb.min_rev, JNIUtil::getFormatBuffer(), 10);
>>+    if (sb.min_rev != sb.max_rev)
>>+    {
>>+        value + ":";
>>+        value += ltoa(sb.max_rev, JNIUtil::getFormatBuffer(), 10);
>>+    }
>>...
>>    
>>
>
>ltoa isn't defined here, and I could not find it from anywhere on my system
>(gcc (GCC) 3.4.3 ).
>  
>
Interesting, I have never thought that ltoa was not defined on any 
system. I would have bet on it to be a standard C library function. Just 
for the record, could you tell me more about your platform then just the 
compiler.

>The following patch fixes javahl, and make it more C++ like, any
>objection to commit this?
>  
>
Let me just check how the patch behaves on windows. That may take one 
day. Otherwise I think it is fine.

>BR, Jani
>  
>
BR, Patrick

>Log:
>Don't use ltoa for number to string conversion, it isn't defined
>everywhere and it isn't very C++. Use ostringstream instead.
>
>* subversion/bindings/java/javahl/native/SVNClient.cpp
>  (SVNClient::getVersionInfo): Use ostringstream instead of ltoa.
>
>  
>
>------------------------------------------------------------------------
>
>Index: subversion/bindings/java/javahl/native/SVNClient.cpp
>===================================================================
>--- subversion/bindings/java/javahl/native/SVNClient.cpp	(revision 12666)
>+++ subversion/bindings/java/javahl/native/SVNClient.cpp	(working copy)
>@@ -42,6 +42,7 @@
> #include "../include/org_tigris_subversion_javahl_ScheduleKind.h"
> #include "JNIStringHolder.h"
> #include <vector>
>+#include <sstream>
> #include <iostream>
> //////////////////////////////////////////////////////////////////////
> // Construction/Destruction
>@@ -2755,18 +2756,19 @@
>         }
>     }
> 
>-    std::string value = ltoa(sb.min_rev, JNIUtil::getFormatBuffer(), 10);
>+    std::ostringstream value;
>+    value << sb.min_rev;
>     if (sb.min_rev != sb.max_rev)
>     {
>-        value + ":";
>-        value += ltoa(sb.max_rev, JNIUtil::getFormatBuffer(), 10);
>+        value << ":";
>+        value << sb.max_rev;
>     }
>     if (sb.modified)
>-        value += "M";
>+        value << "M";
>     if (sb.switched)
>-        value += "S";
>+        value << "S";
> 
>-    return JNIUtil::makeJString(value.c_str());
>+    return JNIUtil::makeJString(value.str().c_str());
> }
> 
> jobjectArray SVNClient::revProperties(jobject jthis, const char *path, 
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org