@@ -91,32 +91,22 @@ wflShiftDouble(wflBlobDsc* blob)
9191return res;
9292}
9393
94- char *
94+ std::string
9595wflShiftPgPoint (wflBlobDsc* blob)
9696{
97- char buf[10000 ];
98- int ret, length;
99- char *res;
97+ std::string res =" " ;
10098char *a1, *a2;
10199
102100 a1 =wflShiftDouble (blob);
103- if (! a1)return NULL ;
101+ if (! a1)return res ;
104102
105103 a2 =wflShiftDouble (blob);
106104if (! a2)
107105 {
108106wflFree (blob->mctx , a1);
109- return NULL ;
107+ return res ;
110108 }
111- ret =snprintf (buf,10000 ," (%s, %s)" ,a1, a2);
112- // FIXME анализировать ret
113-
114- length =strlen (buf);
115- res = (char *)wflMalloc (blob->mctx ,length+1 );
116- memcpy (res,buf,length +1 );
117- wflFree (blob->mctx , a1);
118- wflFree (blob->mctx , a2);
119-
109+ res = (std::string)" (" + a1 +" ," + a2 +" )" ;
120110return res;
121111}
122112
@@ -125,13 +115,15 @@ std::string
125115wflShiftPgPath (wflBlobDsc* blob)
126116{
127117 std::string res =" " ;
128- char *pc ;
118+ std::string point ;
129119
130- while (pc = wflShiftPgPoint (blob) )
120+ while (1 )
131121 {
122+ point =wflShiftPgPoint (blob);
123+ if (point.empty ())
124+ break ;
132125if (!res.empty ()) res = res +" ," ;
133- res = res + pc;
134- wflFree (blob->mctx , pc);
126+ res = res + point;
135127 }
136128if (res.empty ())
137129return res;
@@ -148,9 +140,8 @@ poly_contain_prepare(char* in, int in_size, char ** res1, char ** res2)
148140 wflMemCtx * mctx;
149141 wflBlobDsc blob;
150142 wflBlobDsc * b2;
151- char *r1;
152143
153- std::string r2;
144+ std::stringr1, r2;
154145
155146 mctx =wflCreateMemCtx ();
156147
@@ -162,23 +153,22 @@ poly_contain_prepare(char* in, int in_size, char ** res1, char ** res2)
162153
163154 r1 =wflShiftPgPoint (&blob);
164155
165- if (! r1 )
156+ if (r1. empty () )
166157 {
167158fprintf (stderr," Problema\n " );
168159return 1 ;
169160 }
170-
161+
171162 r2 =wflShiftPgPath (& blob);
172163
173164if (r2.empty ())
174165 {
175166fprintf (stderr," Problema\n " );
176167return 1 ;
177168 }
178-
179- *res1 = (char *)malloc (strlen (r1)+1 );
180- memcpy (*res1, r1,strlen (r1) +1 );
181- free (r1);
169+
170+ *res1 = (char *)malloc (strlen (r1.c_str ()) +1 );
171+ memcpy (*res1, r1.c_str (),strlen (r1.c_str ()) +1 );
182172
183173 *res2 = (char *)malloc (strlen (r2.c_str ())+1 );
184174memcpy (*res2, r2.c_str (),strlen (r2.c_str ()) +1 );