You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mt...@apache.org on 2004/06/25 12:26:03 UTC
cvs commit: jakarta-commons/daemon/src/native/nt/procrun/src utils.c
mturk 2004/06/25 03:26:03
Modified: daemon/src/native/nt/procrun/src utils.c
Log:
Enable to process the negaive numbers
Revision Changes Path
1.2 +7 -2 jakarta-commons/daemon/src/native/nt/procrun/src/utils.c
Index: utils.c
===================================================================
RCS file: /home/cvs/jakarta-commons/daemon/src/native/nt/procrun/src/utils.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- utils.c 7 Apr 2004 11:24:47 -0000 1.1
+++ utils.c 25 Jun 2004 10:26:03 -0000 1.2
@@ -595,11 +595,16 @@
{
ULONG rv = 0;
DWORD sh = 1;
+ int s = 1;
LPCWSTR p = szNum;
/* go to the last digit */
if (!p || !*p)
return 0;
+ if (*p == L'-') {
+ s = -1;
+ ++p;
+ }
while (*(p + 1)) p++;
/* go back */
@@ -617,13 +622,13 @@
case L'8': v = 8UL; break;
case L'9': v = 9UL; break;
default:
- return rv;
+ return rv * s;
break;
}
rv = rv + (v * sh);
sh = sh * 10;
}
- return rv;
+ return rv * s;
}
/* Make the unique system resource name from prefix and process id
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org