Changeset 1735


Ignore:
Timestamp:
06/11/11 10:42:45 (7 months ago)
Author:
Freddie Akeroyd
Message:

Remove some warnings and allow passing of globals (e.g. warnings) C/C++ flag in CMake
Refs #286

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r1727 r1735  
    134134 
    135135if (HDF5_FOUND) 
    136    set (HDF5_CPP "-DHDF5 -DH5_USE_16_API") 
     136#   set (HDF5_CPP "-DHDF5 -DH5_USE_16_API") 
     137   set (HDF5_CPP "-DHDF5 -DH5_NO_DEPRECATED_SYMBOLS -DH5Acreate_vers=2 -DH5Aiterate_vers=2 -DH5Dcreate_vers=2 -DH5Dopen_vers=2 -DH5Eclear_vers=2 -DH5Eprint_vers=2 -DH5Epush_vers=2 -DH5Eset_auto_vers=2 -DH5Eget_auto_vers=2 -DH5Ewalk_vers=2 -DH5Gcreate_vers=2 -DH5Gopen_vers=2 -DH5Pget_filter_vers=2 -DH5Pget_filter_by_id_vers=2 -DH5Pinsert_vers=2 -DH5Pregister_vers=2 -DH5Rget_obj_type_vers=2 -DH5Tarray_create_vers=2 -DH5Tcommit_vers=2 -DH5Tget_array_dims_vers=2 -DH5Topen_vers=2") 
    137138endif (HDF5_FOUND) 
    138139 
     
    234235 
    235236file(WRITE ${CMAKE_SOURCE_DIR}/include/nxconfig.h "/*A dummy config*/") 
     237 
     238# warning 4820 is byte padding in structures 
     239# warning 4996 is about using _strdup ratherthan strdup etc 
     240# /W4 rather than /Wall 
     241set(NX_CFLAGS "/W4 /wd4820 /wd4996") 
     242set(NX_CPP -D_CRT_SECURE_NO_WARNINGS) 
    236243 
    237244# Recurse into the subdirectories. 
  • trunk/Windows_extra/libNeXus-0-x64.def

    r1674 r1735  
    7676putNXDatasetValueAt 
    7777nxigetpath_ 
     78nxilinkexternaldataset_ 
     79nxiisexternaldataset_ 
  • trunk/bindings/cpp/CMakeLists.txt

    r1674 r1735  
    2727#==================================================================== 
    2828 
    29 add_definitions(-DIN_NEXUS_CPP_LIBRARY=1 ) 
     29add_definitions(-DIN_NEXUS_CPP_LIBRARY=1 ${NX_CPP}) 
    3030 
    3131#Make NeXus CPP Bindings Static Library 
     
    3333set (HEADERS NeXusFile.hpp NeXusException.hpp NeXusStream.hpp) 
    3434set (SOURCES NeXusFile.hpp NeXusFile.cpp NeXusException.hpp NeXusException.cpp NeXusStream.hpp NeXusStream.cpp) 
     35 
     36set_property(SOURCE ${SOURCES} APPEND PROPERTY COMPILE_FLAGS ${NX_CFLAGS}) 
    3537 
    3638add_library (NeXus_CPP_Static_Library STATIC ${HEADERS} ${SOURCES}) 
  • trunk/bindings/cpp/NeXusFile.cpp

    r1732 r1735  
    144144 
    145145static void inner_malloc(void* & data, const std::vector<int64_t>& dims, NXnumtype type) { 
    146   size_t rank = dims.size(); 
     146  int rank = dims.size(); 
    147147  int64_t c_dims[NX_MAXRANK]; 
    148148  for (size_t i = 0; i < rank; i++) { 
     
    363363template <typename NumT> 
    364364void File::writeData(const string& name, const vector<NumT>& value) { 
    365   vector<int> dims(1, value.size()); 
     365  vector<int64_t> dims(1, value.size()); 
    366366  this->writeData(name, value, dims); 
    367367} 
     
    375375} 
    376376 
     377template <typename NumT> 
     378void File::writeData(const string& name, const vector<NumT>& value, 
     379                     const vector<int64_t>& dims) { 
     380  this->makeData(name, getType<NumT>(), dims, true); 
     381  this->putData(value); 
     382  this->closeData(); 
     383} 
    377384 
    378385 
     
    642649template <typename NumT> 
    643650void File::putSlab(vector<NumT>& data, int64_t start, int64_t size) { 
    644   vector<int> start_v; 
     651  vector<int64_t> start_v; 
    645652  start_v.push_back(start); 
    646   vector<int> size_v; 
     653  vector<int64_t> size_v; 
    647654  size_v.push_back(size); 
    648655  this->putSlab(data, start_v, size_v); 
     
    10121019 
    10131020  int rank = start.size(); 
    1014   int i_start[NX_MAXRANK]; 
    1015   for (int i = 0; i < rank; i++) { 
    1016     i_start[i] = start[i]; 
    1017   } 
    1018   int i_size[NX_MAXRANK]; 
    1019   for (int i = 0; i < rank; i++) { 
    1020     i_size[i] = size[i]; 
    1021   } 
    1022  
    1023   NXstatus status = NXgetslab(this->m_file_id, data, i_start, i_size); 
     1021 
     1022  NXstatus status = NXgetslab64(this->m_file_id, data, &(start[0]), &(size[0])); 
    10241023  if (status != NX_OK) { 
    10251024    throw Exception("NXgetslab failed", status); 
  • trunk/bindings/cpp/NeXusFile.hpp

    r1732 r1735  
    332332                   const std::vector<int>& dims); 
    333333 
     334        /** 
     335     * Create a n-dimension data field, insert the data, and close the data. 
     336     * 
     337     * \param name The name of the field to create. 
     338     * \param value The data to put into the file. 
     339     * \param dims The dimensions of the data. 
     340     * \tparam NumT numeric data type of \a value 
     341     */ 
     342    template <typename NumT> 
     343    void writeData(const std::string& name, const std::vector<NumT>& value, 
     344                   const std::vector<int64_t>& dims); 
    334345 
    335346    /** Create a 1D data field with an unlimited dimension, insert the data, and close the data. 
  • trunk/include/napi.h

    r1734 r1735  
    600600   * @copydoc NXgetslab() 
    601601   */ 
    602 extern  NXstatus  NXgetslab64(NXhandle handle, void* data, int64_t start[], int64_t size[]); 
     602extern  NXstatus  NXgetslab64(NXhandle handle, void* data, const int64_t start[], const int64_t size[]); 
    603603 
    604604/** 
     
    907907        NXstatus ( *nxgetinfo64)(NXhandle handle, int* rank, int64_t dimension[], int* datatype); 
    908908        NXstatus ( *nxgetnextentry)(NXhandle handle, NXname name, NXname nxclass, int* datatype); 
    909         NXstatus ( *nxgetslab64)(NXhandle handle, void* data, int64_t start[], int64_t size[]); 
     909        NXstatus ( *nxgetslab64)(NXhandle handle, void* data, const int64_t start[], const int64_t size[]); 
    910910        NXstatus ( *nxgetnextattr)(NXhandle handle, NXname pName, int *iLength, int *iType); 
    911911        NXstatus ( *nxgetattr)(NXhandle handle, char* name, void* data, int* iDataLen, int* iType); 
  • trunk/src/CMakeLists.txt

    r1674 r1735  
    2727#==================================================================== 
    2828 
    29 add_definitions(-DIN_NEXUS_LIBRARY ${HDF5_DEFINITIONS} ${HDF5_CPP} ${HDF4_CPP} ${MXML_CPP}) 
     29add_definitions(-DIN_NEXUS_LIBRARY ${HDF5_DEFINITIONS} ${HDF5_CPP} ${HDF4_CPP} ${MXML_CPP} ${NX_CPP}) 
    3030 
    3131set (NAPISRC napi.c napiu.c nxstack.c nxstack.h stptok.c  nxdataset.c nxdataset.h nx_stptok.h) 
     
    4545 
    4646set (NAPISRC ${NAPISRC} nxxml.c nxio.c nxio.h) 
     47 
     48set_property(SOURCE ${NAPISRC} APPEND PROPERTY COMPILE_FLAGS ${NX_CFLAGS}) 
    4749 
    4850file(STRINGS ${PROJECT_SOURCE_DIR}/src/nexus_symbols.txt NEXUS_SYMBOLS) 
     
    6668#  file(WRITE ${PROJECT_SOURCE_DIR}/src/nexus_symbols.sym ${NEXUS_SYMBOLS}) 
    6769#endif (MINGW_MSYS) 
    68  
    6970 
    7071#Make NeXus Static Library 
  • trunk/src/napi.c

    r1731 r1735  
    880880  NXstatus  NXputslab (NXhandle fid, void *data, int iStart[], int iSize[]) 
    881881  { 
    882           int i, status, iType, rank; 
     882          int i, iType, rank; 
    883883          int64_t iStart64[NX_MAXRANK], iSize64[NX_MAXRANK]; 
    884884          if (NXgetinfo64(fid, &rank, iStart64, &iType) != NX_OK) 
     
    961961                                   int dimensions[], int datatype) 
    962962  { 
    963           int i, status; 
     963          int status; 
    964964          int64_t* dims64 = dupDimsArray(dimensions, rank); 
    965965          status = NXmalloc64(data, rank, dims64, datatype); 
     
    10411041char *nxitrim(char *str) 
    10421042{ 
    1043       char *ibuf = str, *obuf = str; 
    1044       int i = 0, cnt = 0; 
     1043      char *ibuf = str; 
     1044      int i = 0; 
    10451045 
    10461046      /* 
     
    11011101                                    int64_t dimension[], int *iType) 
    11021102  { 
    1103     char *pPtr = NULL; 
    11041103    pNexusFunction pFunc = handleToNexusFunc(fid); 
    11051104    return LOCKED_CALL(pFunc->nxgetinfo64(pFunc->pNexusData, rank, dimension, iType)); 
     
    11101109  { 
    11111110    int i, status; 
    1112     char *pPtr = NULL; 
    11131111        int64_t dims64[NX_MAXRANK]; 
    11141112    pNexusFunction pFunc = handleToNexusFunc(fid); 
     
    11641162                                    int iStart[], int iSize[]) 
    11651163  { 
    1166           int i, status, iType, rank; 
     1164          int i, iType, rank; 
    11671165          int64_t iStart64[NX_MAXRANK], iSize64[NX_MAXRANK]; 
    11681166          if (NXgetinfo64(fid, &rank, iStart64, &iType) != NX_OK) 
     
    11791177   
    11801178  NXstatus  NXgetslab64 (NXhandle fid, void *data,  
    1181                                     int64_t iStart[], int64_t iSize[]) 
     1179                                    const int64_t iStart[], const int64_t iSize[]) 
    11821180  { 
    11831181    pNexusFunction pFunc = handleToNexusFunc(fid); 
     
    14251423  char nxurl[1024], exfile[512], expath[512]; 
    14261424  pNexusFunction pFunc = handleToNexusFunc(fid); 
    1427   int64_t rank = 1; 
     1425  int rank = 1; 
    14281426  int64_t dims[1] = {1}; 
    14291427   
  • trunk/src/napi4.c

    r1728 r1735  
    16181618 
    16191619   
    1620   NXstatus  NX4getslab64 (NXhandle fid, void *data, int64_t iStart[], int64_t iSize[]) 
     1620  NXstatus  NX4getslab64 (NXhandle fid, void *data, const int64_t iStart[], const int64_t iSize[]) 
    16211621  { 
    16221622    pNexusFile pFile; 
  • trunk/src/napi5.c

    r1731 r1735  
    17841784   /*-------------------------------------------------------------------------*/ 
    17851785 
    1786    NXstatus  NX5getslab64 (NXhandle fid, void *data, int64_t iStart[], int64_t iSize[]) 
     1786   NXstatus  NX5getslab64 (NXhandle fid, void *data, const int64_t iStart[], const int64_t iSize[]) 
    17871787   { 
    17881788     pNexusFile5 pFile; 
     
    20322032   { 
    20332033     pNexusFile5 pFile; 
    2034      char *iname = NULL;  
    20352034     hid_t idx; 
    20362035     int vid; 
     
    21282127     herr_t ret; 
    21292128     H5L_info_t link_buff; 
    2130      int size=1024; 
    2131      char linkval_buff[size]; 
     2129     char linkval_buff[1024]; 
    21322130     const char *filepath, *objpath; 
    21332131 
     
    21392137     } 
    21402138 
    2141      ret = H5Lget_val(pFile->iFID, name, linkval_buff, size, H5P_DEFAULT); 
     2139     ret = H5Lget_val(pFile->iFID, name, linkval_buff, sizeof(linkval_buff), H5P_DEFAULT); 
    21422140     if (ret < 0) { 
    21432141       return NX_ERROR; 
    21442142     } 
    21452143 
    2146      ret = H5Lunpack_elink_val(linkval_buff, size, 0, &filepath, &objpath); 
     2144     ret = H5Lunpack_elink_val(linkval_buff, sizeof(linkval_buff), 0, &filepath, &objpath); 
    21472145     if (ret < 0 || link_buff.type != H5L_TYPE_EXTERNAL) { 
    21482146       return NX_ERROR; 
  • trunk/src/nxstack.c

    r1636 r1735  
    7171/*----------------------------------------------------------------------*/ 
    7272void pushFileStack(pFileStack self, pNexusFunction pDriv, char *file){ 
    73   int length; 
     73  size_t length; 
    7474 
    7575  self->fileStackPointer++; 
     
    123123/*-----------------------------------------------------------------------*/ 
    124124int buildPath(pFileStack self, char *path, int pathlen){ 
    125   int i, totalPathLength; 
     125  int i; 
     126  size_t totalPathLength; 
    126127  char *totalPath; 
    127128 
     
    129130    totalPathLength += strlen(self->pathStack[i]) + 1; 
    130131  } 
    131   totalPath = malloc(totalPathLength*sizeof(char)); 
     132  totalPath = (char*)malloc(totalPathLength*sizeof(char)); 
    132133  if(totalPath == NULL){ 
    133134    return 0; 
  • trunk/src/nxxml.c

    r1728 r1735  
    11461146/*----------------------------------------------------------------------*/ 
    11471147NXstatus  NXXgetslab64 (NXhandle fid, void *data,  
    1148                                    int64_t iStart[], int64_t iSize[]){ 
     1148                                   const int64_t iStart[], const int64_t iSize[]){ 
    11491149  pXMLNexus xmlHandle = NULL; 
    11501150  mxml_node_t *userData = NULL; 
Note: See TracChangeset for help on using the changeset viewer.