Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

Files at this revision

API Documentation at this revision

Comitter:
andrewboyson
Date:
Tue Jun 09 14:33:55 2020 +0000
Parent:
140:8951a8b45289
Child:
142:b472ba95b018
Commit message:
Added routine to parse a float (double) value from a query.

Changed in this revision

http/http.h Show annotated file Show diff for this revision Revisions of this file
http/httpquery.c Show annotated file Show diff for this revision Revisions of this file
--- a/http/http.h	Wed Jun 03 10:47:51 2020 +0000
+++ b/http/http.h	Tue Jun 09 14:33:55 2020 +0000
@@ -45,10 +45,11 @@
 
 extern int    HttpRequestRead(char *p, int len, char** ppMethod, char** ppPath, char** ppQuery, char** ppLastModified, char** ppCookies, int* pContentLength);
 
-extern char*  HttpCookiesSplit   (char* pCookies, char** ppName, char** ppValue);
-extern char*  HttpQuerySplit     (char* pQuery,   char** ppName, char** ppValue);
-extern int    HttpQueryValueAsInt(char* pValue);
-extern void   HttpQueryUnencode  (char* pValue);
+extern char*  HttpCookiesSplit      (char* pCookies, char** ppName, char** ppValue);
+extern char*  HttpQuerySplit        (char* pQuery,   char** ppName, char** ppValue);
+extern int    HttpQueryValueAsInt   (char* pValue);
+extern double HttpQueryValueAsDouble(char* pValue);
+extern void   HttpQueryUnencode     (char* pValue);
 
 extern void   HttpDateFromDateTime(const char* date, const char *ptime, char* ptext);
 extern void   HttpDateFromNow(char* pText);
--- a/http/httpquery.c	Wed Jun 03 10:47:51 2020 +0000
+++ b/http/httpquery.c	Tue Jun 09 14:33:55 2020 +0000
@@ -64,6 +64,10 @@
 {
     return (int)strtol(pValue, NULL, 10);
 }
+double HttpQueryValueAsDouble(char* pValue)
+{
+    return strtod(pValue, NULL);
+}
 char* HttpCookiesSplit(char* p, char** ppName, char** ppValue) //returns the start of the next name value pair
 {    
     *ppValue   = NULL;