Fixed protocol buffer error caused by not initializing properly
parent
5b7a88438e
commit
29a7ac49dc
|
@ -329,8 +329,10 @@ static bool geography_point_as_decoderbufs_point(Datum datum,
|
||||||
getPoint2d_p(point->point, 0, &p2d);
|
getPoint2d_p(point->point, 0, &p2d);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
p->x = p2d.x;
|
Decoderbufs__Point dp = DECODERBUFS__POINT__INIT;
|
||||||
p->y = p2d.y;
|
dp.x = p2d.x;
|
||||||
|
dp.y = p2d.y;
|
||||||
|
memcpy(p, &dp, sizeof(dp));
|
||||||
elog(DEBUG1, "Translating geography to point: (x,y) = (%f,%f)", p->x, p->y);
|
elog(DEBUG1, "Translating geography to point: (x,y) = (%f,%f)", p->x, p->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,9 +408,11 @@ static void set_datum_value(Decoderbufs__DatumMessage *datum_msg, Oid typid,
|
||||||
break;
|
break;
|
||||||
case POINTOID:
|
case POINTOID:
|
||||||
p = DatumGetPointP(datum);
|
p = DatumGetPointP(datum);
|
||||||
|
Decoderbufs__Point dp = DECODERBUFS__POINT__INIT;
|
||||||
|
dp.x = p->x;
|
||||||
|
dp.y = p->y;
|
||||||
datum_msg->datum_point = palloc(sizeof(Decoderbufs__Point));
|
datum_msg->datum_point = palloc(sizeof(Decoderbufs__Point));
|
||||||
datum_msg->datum_point->x = p->x;
|
memcpy(datum_msg->datum_point, &dp, sizeof(dp));
|
||||||
datum_msg->datum_point->y = p->y;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// PostGIS uses dynamic OIDs so we need to check the type again here
|
// PostGIS uses dynamic OIDs so we need to check the type again here
|
||||||
|
|
Loading…
Reference in New Issue