Fixed array allocation syntax error and removed std namespace for VC6.0 users

This commit is contained in:
Caspian Rychlik-Prince 2002-11-24 22:46:39 +00:00
parent 963237b3fc
commit 2530b45005
4 changed files with 25 additions and 7 deletions

View File

@ -65,7 +65,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpDire
jboolean transposeDest
)
{
if (transposeSource == transposeDest)
static float * temp_matrix = 0;
static int temp_matrix_size = 0;
if (transposeSource == transposeDest)
{
transposeSource = JNI_FALSE;
transposeDest = JNI_FALSE;
@ -85,7 +88,13 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpDire
float * srcMatrix, * destMatrix;
int temp_side = source.width-1;
float temp_matrix [temp_side*temp_side];
if (temp_matrix_size < temp_side) {
if (temp_matrix)
delete[] temp_matrix;
temp_matrix = new float[temp_side * temp_side];
temp_matrix_size = temp_side;
}
for (int i = 0; i < source.elements; i++)
{

View File

@ -68,7 +68,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpSafe
)
{
if (transposeSource == transposeDest)
static float * temp_matrix = 0;
static int temp_matrix_size = 0;
if (transposeSource == transposeDest)
{
transposeSource = JNI_FALSE;
transposeDest = JNI_FALSE;
@ -85,9 +88,15 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpSafe
float * srcMatrix, * destMatrix;
int temp_side = source.width-1;
float temp_matrix [temp_side*temp_side];
for (int i = 0; i < source.elements; i++)
if (temp_matrix_size < temp_side) {
if (temp_matrix)
delete[] temp_matrix;
temp_matrix = new float[temp_side * temp_side];
temp_matrix_size = temp_side;
}
for (int i = 0; i < source.elements; i++)
{
srcMatrix = source.nextMatrix();
destMatrix = dest.nextMatrix();

View File

@ -44,7 +44,7 @@
#include "MatrixOpCommon.h"
#include <cmath>
using namespace std;
//using namespace std;
/*
* Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect

View File

@ -44,7 +44,7 @@
#include "MatrixOpCommon.h"
#include <cmath>
using namespace std;
//using namespace std;
/*
* Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe