diff options
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, |