commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1148809 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/platform/windows/ native/os/win32/
Date Wed, 20 Jul 2011 15:01:48 GMT
Author: mturk
Date: Wed Jul 20 15:01:46 2011
New Revision: 1148809

URL: http://svn.apache.org/viewvc?rev=1148809&view=rev
Log:
Convert String array to char block in Java instead inside native

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Service.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControlManager.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java
    commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Service.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Service.java?rev=1148809&r1=1148808&r2=1148809&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Service.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Service.java
Wed Jul 20 15:01:46 2011
@@ -679,7 +679,7 @@ public final class Service implements Cl
                                            SERVICE_NO_CHANGE,
                                            null,
                                            null,
-                                           dependencies,
+                                           Utils.stringArrayToCharBlock(dependencies),
                                            null,
                                            null,
                                            null);

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControlManager.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControlManager.java?rev=1148809&r1=1148808&r2=1148809&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControlManager.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControlManager.java
Wed Jul 20 15:01:46 2011
@@ -191,7 +191,7 @@ public class ServiceControlManager imple
                                        startType.valueOf(),
                                        errorControl.valueOf(),
                                        path, loadOrderGroup,
-                                       dependencies,
+                                       Utils.stringArrayToCharBlock(dependencies),
                                        username, password);
         if (svc == 0L)
             throw new SystemException(Errno.msg());

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java?rev=1148809&r1=1148808&r2=1148809&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java
Wed Jul 20 15:01:46 2011
@@ -87,7 +87,7 @@ final class Win32
                                                   int errorControl,
                                                   String binaryPathName,
                                                   String loadOrderGroup,
-                                                  String[] dependencies,
+                                                  char[] dependencies,
                                                   String serviceStartName,
                                                   String password);
     public static native int        ChangeServiceConfig(long svc,
@@ -96,7 +96,7 @@ final class Win32
                                                   int errorControl,
                                                   String binaryPathName,
                                                   String loadOrderGroup,
-                                                  String[] dependencies,
+                                                  char[] dependencies,
                                                   String serviceStartName,
                                                   String password,
                                                   String displayName);

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c?rev=1148809&r1=1148808&r2=1148809&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c Wed Jul 20 15:01:46 2011
@@ -335,7 +335,7 @@ ACR_WIN_EXPORT(jlong, Win32, CreateServi
                                             jstring name, jstring display,
                                             jint acc, jint stype, jint sstart,
                                             jint errc, jstring path, jstring ldgrp,
-                                            jobjectArray deps, jstring user,
+                                            jcharArray deps, jstring user,
                                             jstring password)
 {
     int rc = 0;
@@ -348,7 +348,9 @@ ACR_WIN_EXPORT(jlong, Win32, CreateServi
     WITH_DWCS(ldgrp) {
     WITH_DWCS(user) {
     WITH_DWCS(password) {
-        wchar_t *wdeps = AcrMszJavaStringArrayW(env, deps);
+        wchar_t *wdeps = 0;        
+        if (deps != 0)
+            wdeps = (wchar_t *)(*env)->GetPrimitiveArrayCritical(env, deps, 0);
 
         svc = CreateServiceW(scm,
                              J2S(name),
@@ -365,7 +367,8 @@ ACR_WIN_EXPORT(jlong, Win32, CreateServi
                              J2S(password));
         if (svc == 0)
             ACR_SAVE_OS_ERROR();
-        AcrFree(wdeps);
+        if (wdeps != 0)
+            (*env)->ReleasePrimitiveArrayCritical(env, deps, wdeps, 0);
     } DONE_WITH_STR(password);
     } DONE_WITH_STR(user);
     } DONE_WITH_STR(ldgrp);
@@ -379,7 +382,7 @@ ACR_WIN_EXPORT(jlong, Win32, CreateServi
 ACR_WIN_EXPORT(jint, Win32, ChangeServiceConfig)(JNI_STDARGS, jlong hsvc,
                                             jint stype, jint sstart,
                                             jint errc, jstring path, jstring ldgrp,
-                                            jobjectArray deps, jstring user,
+                                            jcharArray deps, jstring user,
                                             jstring password, jstring display)
 {
     int rc = 0;
@@ -390,7 +393,9 @@ ACR_WIN_EXPORT(jint, Win32, ChangeServic
     WITH_DWCS(ldgrp) {
     WITH_DWCS(user) {
     WITH_DWCS(password) {
-        wchar_t *wdeps = AcrMszJavaStringArrayW(env, deps);
+        wchar_t *wdeps = 0;        
+        if (deps != 0)
+            wdeps = (wchar_t *)(*env)->GetPrimitiveArrayCritical(env, deps, 0);
         /* Call the real API */
         if (!ChangeServiceConfigW(svc,
                                   stype,
@@ -404,7 +409,8 @@ ACR_WIN_EXPORT(jint, Win32, ChangeServic
                                   J2S(password),
                                   J2S(display)))
             rc = ACR_GET_OS_ERROR();
-        AcrFree(wdeps);
+        if (wdeps != 0)
+            (*env)->ReleasePrimitiveArrayCritical(env, deps, wdeps, 0);
     } DONE_WITH_STR(password);
     } DONE_WITH_STR(user);
     } DONE_WITH_STR(ldgrp);



Mime
View raw message