[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Patrick Mayweg <mayweg_at_qint.de>
Date: 2005-01-11 07:09:35 CET

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
Received on Tue Jan 11 07:10:51 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.