diff options
author | tradke <tradke@21a6bef8-4479-4f54-8f8d-0db94a2919ef> | 2003-07-16 12:25:20 +0000 |
---|---|---|
committer | tradke <tradke@21a6bef8-4479-4f54-8f8d-0db94a2919ef> | 2003-07-16 12:25:20 +0000 |
commit | 44f6a3df3291a764e4cf781f637bb7f3fbd0d25e (patch) | |
tree | d2d972148845d5b188693e6bdc18f301c080910c /src/IO.cc | |
parent | 1d84179ab337f680817248a565ecec8c9ea7b0ef (diff) |
Sync with cvs.cactuscode.org:/packages/FlexIO.
Mainly adding debug statements. One important fix for AMRwriter.cc to get the
min_ext[] and grid_placement_refinement[] attributes right again.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusExternal/FlexIO/trunk@46 21a6bef8-4479-4f54-8f8d-0db94a2919ef
Diffstat (limited to 'src/IO.cc')
-rw-r--r-- | src/IO.cc | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -126,8 +126,19 @@ int f_io_seek(Long8 *deviceID,int *dataset_index){ //--------------Annotations int f_io_writenote(Long8 *deviceID,char *annotation,int size){ IObase *dev=(IObase*)(*deviceID); +#if 0 annotation[size]='\0'; // Yeah! its unsafe I know..!! (but it works!) return dev->writeAnnotation(annotation); +#else + // well, the problem is that it does not work if the annotation + // string resides in a readonly text segment... (Werner) +char*ann = new char[size+1]; + strncpy(ann, annotation, size); + ann[size] = '\0'; +int i = dev->writeAnnotation(ann); + delete ann; + return i; +#endif } int f_io_readnote(Long8 *deviceID,int *idx,char *annotation,int maxsize){ @@ -149,10 +160,25 @@ int f_io_numnote(Long8 *deviceID){ int f_io_writeatt(Long8 *deviceID,char *name, int *datatype,Long *nelements,const void *data,int namesize){ IObase *dev=(IObase*)(*deviceID); +#if 0 name[namesize]='\0'; // cap name (to be certain).. unsafe but it works // should copy into a flexarray which will be destroyed on return IObase::DataType typeID = IObase::Int2DataType(*datatype); return dev->writeAttribute(name,typeID,*nelements,data); + +#else + // well, the problem is that it does not work if the annotation + // string resides in a readonly text segment... (Werner) +char*tmp = new char[namesize+1]; + strncpy(tmp, name, namesize); + tmp[namesize] = '\0'; + IObase::DataType typeID = IObase::Int2DataType(*datatype); +int i = dev->writeAttribute(tmp,typeID,*nelements,data); + delete tmp; + return i; +#endif + + } int f_io_attinfo(Long8 *deviceID,char *name, |