Revision 34246 trunk/libraries/libjni-gdal/src/main/native/jgdal/gdal_interfaz.c

View differences:

gdal_interfaz.c
119 119
  	longitud = (*env)->GetArrayLength(env, pszF); 
120 120
  	pszFilename = (*env)->GetByteArrayElements(env, pszF, 0);
121 121
  	
122
  	#ifdef __linux__
123
		pszFilename = (jbyte *)realloc(pszFilename, longitud + 1);
124
	#else
125
		aux = (jbyte *)malloc(sizeof(jbyte) * (longitud + 1));
126
	  	memcpy(aux, pszFilename, longitud);
127
	  	free(pszFilename);
128
	  	pszFilename = aux;
129
	#endif
122
	aux = (jbyte *)malloc(sizeof(jbyte) * (longitud + 1));
123
  	memcpy(aux, pszFilename, longitud);
124
	(*env)->ReleaseByteArrayElements(env, pszF, pszFilename, 0);
125
  	pszFilename = aux;
130 126
  		
131 127
	pszFilename[longitud] = '\0';
132
	
133
	fich = fopen( pszFilename, "r" );
134
	if( fich )
135
		fclose(fich);
136
	else		
137
      	return -1;
138 128
   	
139 129
   	GDALAllRegister();
140 130
  	dataset = GDALOpen((char *)pszFilename,(int)acc);

Also available in: Unified diff