Skip to content

Fixed Ubuntu 20.04 build issues and changed Travis CI to test builds on it #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/output.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "types.h"
#include <stdarg.h>

#if !defined(PGSPHERE_VERSION)
#error "PGSPHERE_VERSION macro is not set"
Expand Down Expand Up @@ -384,7 +385,7 @@ spheretrans_out(PG_FUNCTION_ARGS)
{
SEuler *se = (SEuler *) PG_GETARG_POINTER(0);
char *buffer = (char *) palloc(255);
char buf[100];
char *buf;
char etype[4];
SPoint val[3];
unsigned char i,
Expand Down Expand Up @@ -412,21 +413,26 @@ spheretrans_out(PG_FUNCTION_ARGS)
{

case OUTPUT_DEG:
sprintf(&buf[0],
buf = psprintf(
"%.*gd",
sphere_output_precision, RADIANS * val[i].lng);
sphere_output_precision, RADIANS * val[i].lng
);
break;

case OUTPUT_HMS:
case OUTPUT_DMS:
rad_to_dms(val[i].lng, &rdeg, &rmin, &rsec);
sprintf(&buf[0],
buf = psprintf(
"%2ud %2um %.*gs",
rdeg, rmin, sphere_output_precision, rsec);
rdeg, rmin, sphere_output_precision, rsec
);
break;

default:
sprintf(&buf[0], "%.*g", sphere_output_precision, val[i].lng);
buf = psprintf(
"%.*g",
sphere_output_precision, val[i].lng
);
break;
}
strcat(&buf[0], ", ");
Expand Down Expand Up @@ -461,7 +467,7 @@ spheretrans_out(PG_FUNCTION_ARGS)
}
etype[3] = '\0';
strcat(buffer, etype);

pfree(buf);
PG_RETURN_CSTRING(buffer);
}

Expand Down