MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / extractLongLatOrReply

Function extractLongLatOrReply

src/geo.cpp:94–109  ·  view source on GitHub ↗

Input Argument Helper */ Take a pointer to the latitude arg then use the next arg for longitude. * On parse error C_ERR is returned, otherwise C_OK. */

Source from the content-addressed store, hash-verified

92/* Take a pointer to the latitude arg then use the next arg for longitude.
93 * On parse error C_ERR is returned, otherwise C_OK. */
94int extractLongLatOrReply(client *c, robj **argv, double *xy) {
95 int i;
96 for (i = 0; i < 2; i++) {
97 if (getDoubleFromObjectOrReply(c, argv[i], xy + i, NULL) !=
98 C_OK) {
99 return C_ERR;
100 }
101 }
102 if (xy[0] < GEO_LONG_MIN || xy[0] > GEO_LONG_MAX ||
103 xy[1] < GEO_LAT_MIN || xy[1] > GEO_LAT_MAX) {
104 addReplyErrorFormat(c,
105 "-ERR invalid longitude,latitude pair %f,%f\r\n",xy[0],xy[1]);
106 return C_ERR;
107 }
108 return C_OK;
109}
110
111/* Input Argument Helper */
112/* Decode lat/long from a zset member's score.

Callers 2

geoaddCommandFunction · 0.85
georadiusGenericFunction · 0.85

Calls 2

addReplyErrorFormatFunction · 0.85

Tested by

no test coverage detected