Skip to content

Commit 01cdb78

Browse files
author
stepan-neretin7
committed
Fix travis tests in pg10, pg11
1 parent 77929d7 commit 01cdb78

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Diff for: src/output.c

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "types.h"
2+
#include <stdarg.h>
23

34
#if !defined(PGSPHERE_VERSION)
45
#error "PGSPHERE_VERSION macro is not set"
@@ -384,7 +385,7 @@ spheretrans_out(PG_FUNCTION_ARGS)
384385
{
385386
SEuler *se = (SEuler *) PG_GETARG_POINTER(0);
386387
char *buffer = (char *) palloc(255);
387-
char buf[100];
388+
char *buf;
388389
char etype[4];
389390
SPoint val[3];
390391
unsigned char i,
@@ -412,21 +413,26 @@ spheretrans_out(PG_FUNCTION_ARGS)
412413
{
413414

414415
case OUTPUT_DEG:
415-
sprintf(&buf[0],
416+
buf = psprintf(
416417
"%.*gd",
417-
sphere_output_precision, RADIANS * val[i].lng);
418+
sphere_output_precision, RADIANS * val[i].lng
419+
);
418420
break;
419421

420422
case OUTPUT_HMS:
421423
case OUTPUT_DMS:
422424
rad_to_dms(val[i].lng, &rdeg, &rmin, &rsec);
423-
sprintf(&buf[0],
425+
buf = psprintf(
424426
"%2ud %2um %.*gs",
425-
rdeg, rmin, sphere_output_precision, rsec);
427+
rdeg, rmin, sphere_output_precision, rsec
428+
);
426429
break;
427430

428431
default:
429-
sprintf(&buf[0], "%.*g", sphere_output_precision, val[i].lng);
432+
buf = psprintf(
433+
"%.*g",
434+
sphere_output_precision, val[i].lng
435+
);
430436
break;
431437
}
432438
strcat(&buf[0], ", ");
@@ -461,7 +467,7 @@ spheretrans_out(PG_FUNCTION_ARGS)
461467
}
462468
etype[3] = '\0';
463469
strcat(buffer, etype);
464-
470+
pfree(buf);
465471
PG_RETURN_CSTRING(buffer);
466472
}
467473

0 commit comments

Comments
 (0)