1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Fixes from Alex

This commit is contained in:
Alain Magloire 2002-11-19 18:53:30 +00:00
parent 280c95fcfe
commit bb4a4631b5

View file

@ -22,7 +22,7 @@
#include "jni.h"
#include "io.h"
#define DEBUG_MONITOR
// #define DEBUG_MONITOR
#define PIPE_SIZE 512
#define MAX_CMD_SIZE 1024
@ -156,6 +156,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
jsize len = (*env) -> GetStringUTFLength(env, item);
int nCpyLen;
const char * str = (*env) -> GetStringUTFChars(env, item, 0);
if(NULL != str)
{
if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, MAX_CMD_SIZE - nPos)))
{
ThrowByName(env, "java/Exception", "Too long command line");
@ -166,6 +168,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
++nPos;
(*env) -> ReleaseStringUTFChars(env, item, str);
}
}
szCmdLine[nPos] = '\0';
@ -178,6 +181,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
jsize len = (*env) -> GetStringUTFLength(env, item);
int nCpyLen;
const char * str = (*env) -> GetStringUTFChars(env, item, 0);
if(NULL != str)
{
if(0 > (nCpyLen = copyTo(szEnvBlock + nPos, str, len, MAX_ENV_SIZE - nPos - 1)))
{
ThrowByName(env, "java/Exception", "Too many environment variables");
@ -188,6 +193,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
++nPos;
(*env) -> ReleaseStringUTFChars(env, item, str);
}
}
szEnvBlock[nPos] = '\0';
envBlk = szEnvBlock;
}
@ -196,10 +202,13 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
if (dir != 0)
{
const char * str = NULL;
cwd = strdup((*env) -> GetStringUTFChars(env, dir, 0));
const char * str = (*env) -> GetStringUTFChars(env, dir, 0);
if(NULL != str)
{
cwd = strdup(str);
(*env) -> ReleaseStringUTFChars(env, dir, str);
}
}
memset(&si, 0, sizeof(si));
@ -355,6 +364,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
jsize len = (*env) -> GetStringUTFLength(env, item);
int nCpyLen;
const char * str = (*env) -> GetStringUTFChars(env, item, 0);
if(NULL != str)
{
if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, MAX_CMD_SIZE - nPos)))
{
ThrowByName(env, "java/Exception", "Too long command line");
@ -365,6 +376,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
++nPos;
(*env) -> ReleaseStringUTFChars(env, item, str);
}
}
szCmdLine[nPos] = '\0';
@ -377,6 +389,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
jsize len = (*env) -> GetStringUTFLength(env, item);
int nCpyLen;
const char * str = (*env) -> GetStringUTFChars(env, item, 0);
if(NULL != str)
{
if(0 > (nCpyLen = copyTo(szEnvBlock + nPos, str, len, MAX_ENV_SIZE - nPos - 1)))
{
ThrowByName(env, "java/Exception", "Too many environment variables");
@ -387,6 +401,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
++nPos;
(*env) -> ReleaseStringUTFChars(env, item, str);
}
}
szEnvBlock[nPos] = '\0';
envBlk = szEnvBlock;
}
@ -395,10 +410,13 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
if (dir != 0)
{
const char * str = NULL;
cwd = strdup((*env) -> GetStringUTFChars(env, dir, 0));
const char * str = (*env) -> GetStringUTFChars(env, dir, 0);
if(NULL != str)
{
cwd = strdup(str);
(*env) -> ReleaseStringUTFChars(env, dir, str);
}
}
memset(&si, 0, sizeof(si));