source: subversion/applications/utils/tirex/backend-mapnik/networkresponse.cc @ 29902

Last change on this file since 29902 was 29247, checked in by Dane Springmeyer, 7 years ago

malloc.h is not available on osx and should not be needed to be explicitly included on other platforms

File size: 998 bytes
Line 
1/*
2 * Tirex Tile Rendering System
3 *
4 * Mapnik rendering backend
5 *
6 * Originally written by Jochen Topf & Frederik Ramm.
7 *
8 */
9
10#include "networkresponse.h"
11
12#include <sys/types.h>
13#include <string.h>
14#include <stdio.h>
15#include <stdlib.h>
16#include <stdarg.h>
17
18NetworkResponse::NetworkResponse(const NetworkRequest *request)
19{
20    std::string id = request->getParam("id", "");
21    if (id.length()) setParam("id", id);
22    std::string type = request->getType();
23    setParam("type", type);
24}
25
26NetworkResponse::NetworkResponse()
27{
28}
29
30NetworkResponse::~NetworkResponse()
31{
32}
33
34const NetworkResponse *NetworkResponse::makeErrorResponse(const NetworkRequest *request, const char *fmt, ...)
35{
36    char buffer[0xffff];
37    va_list ap;
38    va_start(ap, fmt);
39    vsnprintf(buffer, sizeof(buffer), fmt, ap);
40    va_end(ap);
41    NetworkResponse *rv = request ? new NetworkResponse(request) : new NetworkResponse();
42    rv->setParam("errmsg", buffer);
43    rv->setParam("result", "error");
44    return rv;
45};
46
Note: See TracBrowser for help on using the repository browser.