Changeset 297 for IO_handling


Ignore:
Timestamp:
22/11/04 15:11:22 (15 years ago)
Author:
spascoe
Message:

FIXED! Missing out <stdlib.h> was preventing the cast of a long long argument
to calloc.

Location:
IO_handling/trunk/ppio/cu2netcdf
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • IO_handling/trunk/ppio/cu2netcdf/Makefile

    r296 r297  
    55 
    66# Configuration for Stephen on Hurricane 
    7 CDAT_SRC = /research/home/spascoe/src/cpdn/cdunifpp/cdat-4.0b3 
    8 NETCDF_INC = /usr/local/include 
    9 NETCDF_LIB = /usr/local/lib 
     7#CDAT_SRC = /research/home/spascoe/src/cpdn/cdunifpp/cdat-4.0b3 
     8#NETCDF_INC = /usr/local/include 
     9#NETCDF_LIB = /usr/local/lib 
    1010 
    1111# Configuration for Stephen's laptop 
    12 #CDAT_SRC = /home/spascoe/cvs/IO_handling/ppio/cdat-4.0b3 
    13 #NETCDF_INC = /usr/include 
    14 #NETCDF_LIB = /usr/lib 
     12CDAT_SRC = /home/spascoe/cvs/IO_handling/ppio/cdat-4.0b3 
     13NETCDF_INC = /usr/include 
     14NETCDF_LIB = /usr/lib 
    1515 
    1616 
     
    2020# DMALLOC_INC = include dmalloc.h 
    2121#CPP_FLAGS = -DDEBUG -DNC3 -DDMALLOC_INC 
    22 CPP_FLAGS = -DDEBUG 
     22CPP_FLAGS = -DDEBUG -DNC3 
    2323 
    2424############################################################################# 
     
    3232#               -I$(HOME)/include 
    3333LIBS = -L$(HOME)/lib -L$(NETCDF_LIB) -L$(LIBCDMS) \ 
    34         -lcdms -lnetcdf -lm #-ldmalloc 
     34        -lcdms -lnetcdf -lm #-lefence #-ldmalloc 
    3535 
    3636all: cu2netcdf 
    3737 
    3838cu2netcdf.o: cu2netcdf.c 
    39         gcc -c -g $(INCLUDES) $(CPP_FLAGS) -o cu2netcdf.o cu2netcdf.c 
     39        gcc -c -g -Wall $(INCLUDES) $(CPP_FLAGS) -o cu2netcdf.o cu2netcdf.c 
    4040 
    4141 
  • IO_handling/trunk/ppio/cu2netcdf/cu2netcdf.c

    r296 r297  
    88#include <stdio.h> 
    99#include <limits.h> 
     10#include <stdlib.h> 
    1011#include "netcdf.h" 
    1112#include "cdunif.h" 
     
    168169  if (cuattget(c->infileid, invarid, attname, attval) == -1)  
    169170    ERROR("cuattget failed"); 
     171  if (atttype == CuChar) ((char *)attval)[attlen] = '\0'; 
    170172   
    171173#ifdef NC3 
     
    237239 
    238240void put_variable(Context *c, int invarid) { 
    239   int nvatts, nvdims, i, chunklen; 
     241  int nvatts, nvdims, i; 
    240242  char varname[CU_MAX_NAME]; 
    241243  CuType vartype; 
     
    254256  for (i = 0; i < nvdims; i++) { 
    255257    varlen *= count[i] = c->dimlens[vdims[i]]; 
     258 
    256259    start[i] = 0;  
    257260  } 
     
    260263    /* Variable small enough to copy in one go. */ 
    261264     
     265 
     266 
    262267    if ((data = (void *)calloc(varlen, cutypelen(vartype))) == NULL) 
    263268      ERROR("calloc failed"); 
     269 
    264270    if (cuvarget(c->infileid, invarid, start, count, data) 
    265271        != CU_SUCCESS) ERROR("cuvarget failed"); 
     
    315321    } 
    316322#else 
     323 
    317324    if (ncvarput(c->outfileid, c->varid_map[invarid], start, count, data) 
    318325        == -1) 
    319326      ERROR("ncvarput failed"); 
     327 
     328 
    320329#endif 
    321330    free(data); 
     
    327336    ERROR("Variable too big for transfer"); 
    328337  } 
     338 
    329339}     
    330340 
     
    332342  char *input_file, *output_file; 
    333343  int ndims, nvars, natts, recdim; 
    334   int i, j; 
     344  int i; 
    335345  Context c; 
    336346  int nc_status; 
Note: See TracChangeset for help on using the changeset viewer.