=================================================================== RCS file: /home/cvs/OpenXM/src/ox_ntl/ntlconv.cpp,v retrieving revision 1.2 retrieving revision 1.6 diff -u -p -r1.2 -r1.6 --- OpenXM/src/ox_ntl/ntlconv.cpp 2003/11/15 09:06:20 1.2 +++ OpenXM/src/ox_ntl/ntlconv.cpp 2013/10/18 01:28:52 1.6 @@ -1,9 +1,11 @@ -/* $OpenXM: OpenXM/src/ox_ntl/ntlconv.cpp,v 1.1 2003/11/08 12:34:00 iwane Exp $ */ +/* $OpenXM: OpenXM/src/ox_ntl/ntlconv.cpp,v 1.5 2003/11/27 14:19:50 iwane Exp $ */ #include #include -#include +#include +#include +#include #include "ntl.h" @@ -11,6 +13,9 @@ #define __NTL_PRINT (1) #endif +/*==========================================================================* + * Block interrupt input + *==========================================================================*/ #define BLOCK_NEW_CMO() BLOCK_INPUT() #define UNBLOCK_NEW_CMO() UNBLOCK_INPUT() @@ -145,14 +150,17 @@ cmo_zz * ZZ_to_cmo_zz(const ZZ &z) { cmo_zz *c; + const char *ptr; - ostrstream sout; + std::ostringstream sout; sout << z << '\0'; + std::string tmp = sout.str(); + ptr = tmp.c_str(); BLOCK_NEW_CMO(); - c = new_cmo_zz_set_string(sout.str()); + c = new_cmo_zz_set_string((char*)ptr); UNBLOCK_NEW_CMO(); - + return (c); } @@ -215,7 +223,6 @@ cmo_list * mat_zz_to_cmo(mat_ZZ &mat) { cmo_list *list; - int ret; cmo_zz *zz; int row, col; @@ -308,12 +315,6 @@ cmo_to_mat_zz(mat_ZZ &mat, cmo *m) - - - - - - /**************************************************************************** * convert cmo to ZZX which is polynomial in Z[x] * @@ -339,7 +340,7 @@ cmo_to_ZZX(ZZX &f, cmo *m, cmo_indeterminate *&x) return (NTL_FAILURE); } { - istrstream sin(str, strlen(str)); + std::istringstream sin(str); sin >> f; } break; @@ -348,14 +349,12 @@ cmo_to_ZZX(ZZX &f, cmo *m, cmo_indeterminate *&x) cmo_recursive_polynomial *rec = (cmo_recursive_polynomial *)m; cmo_polynomial_in_one_variable *poly = (cmo_polynomial_in_one_variable *)rec->coef; cell *el; - int len; if (poly->tag != CMO_POLYNOMIAL_IN_ONE_VARIABLE) { return (NTL_FAILURE); } el = list_first((cmo_list *)poly); - len = list_length((cmo_list *)poly); f = 0; @@ -386,6 +385,8 @@ cmo_to_ZZX(ZZX &f, cmo *m, cmo_indeterminate *&x) return (NTL_SUCCESS); } + + /**************************************************************************** * convert polynomial in Z[x] to cmo_recursive_polynomial * @@ -493,7 +494,6 @@ vec_pair_ZZX_long_to_cmo(vec_pair_ZZX_long &factors, c cmo * convert_cmon(cmo *p) { - switch (p->tag) { case CMON_ZZ: {