void F77_FUNC(xdrfwrapstring,XDRFWRAPSTRING)(int *xdrid, char *sp_ptr, int *ret, int sp_len) { char *tsp; int maxsize; xdr_fortran_lock(); maxsize = (sp_len) + 1; tsp = (char*) malloc((size_t)(maxsize * sizeof(char))); if (tsp == NULL) { *ret = -1; return; xdr_fortran_unlock(); } if (ftocstr(tsp, maxsize, sp_ptr, sp_len)) { *ret = -1; free(tsp); return; xdr_fortran_unlock(); } *ret = xdr_string(xdridptr[*xdrid], (char **) &tsp, (u_int)maxsize); ctofstr( sp_ptr, sp_len, tsp); cnt += maxsize; free(tsp); xdr_fortran_unlock(); }
void F77_FUNC(xdrfstring,XDRFSTRING)(int *xdrid, char * sp_ptr, int *maxsize, int *ret, int sp_len) { char *tsp; tsp = (char*) malloc((size_t)(((sp_len) + 1) * sizeof(char))); if (tsp == NULL) { *ret = -1; return; } if (ftocstr(tsp, *maxsize+1, sp_ptr, sp_len)) { *ret = -1; free(tsp); return; } *ret = xdr_string(xdridptr[*xdrid], (char **) &tsp, (unsigned int) *maxsize); ctofstr( sp_ptr, sp_len , tsp); cnt += *maxsize; free(tsp); }