This commit is contained in:
EBNull 2017-08-21 21:50:41 +00:00 committed by GitHub
commit 43a68c3e36
8 changed files with 321 additions and 5 deletions

View File

@ -521,7 +521,7 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
lex_unget_unsave(lex, c);
saved_text = strbuffer_value(&lex->saved_text);
#if JSON_HAVE_ERRNO
errno = 0;
intval = json_strtoint(saved_text, &end, 10);
if(errno == ERANGE) {
@ -531,7 +531,9 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
error_set(error, lex, "too big integer");
goto out;
}
#else
value = json_strtoint(saved_text, &end, 10);
#endif
assert(end == saved_text + lex->saved_text.length);
lex->token = TOKEN_INTEGER;
@ -1086,9 +1088,14 @@ json_t *json_load_file(const char *path, size_t flags, json_error_t *error)
fp = fopen(path, "rb");
if(!fp)
{
#if JSON_HAVE_ERRNO
error_set(error, NULL, "unable to open %s: %s",
path, strerror(errno));
return NULL;
#else
error_set(error, NULL, "unable to open %s: %s",
path, "");
#endif
return NULL;
}
result = json_loadf(fp, flags, error);

View File

@ -72,7 +72,7 @@ int jsonp_strtod(strbuffer_t *strbuffer, double *out)
#if JSON_HAVE_LOCALECONV
to_locale(strbuffer);
#endif
#if JSON_HAVE_ERRNO
errno = 0;
value = strtod(strbuffer->value, &end);
assert(end == strbuffer->value + strbuffer->length);
@ -81,7 +81,10 @@ int jsonp_strtod(strbuffer_t *strbuffer, double *out)
/* Overflow */
return -1;
}
#else
value = strtod(strbuffer->value, &end);
assert(end == strbuffer->value + strbuffer->length);
#endif
*out = value;
return 0;
}

2
win32/evc30/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
jansson.vcp -text -crlf eol=crlf
jansson.vcw -text -crlf eol=crlf

7
win32/evc30/README.txt Normal file
View File

@ -0,0 +1,7 @@
To build jansson in evc3.0:
1. Setup EVC++
a. Tools -> Options -> Directories -> Include Files -> New
b. Add win32/evc30 to include path (EVC doesn't have per-project include paths)
2. Ensure you have the minor patches from this branch (to silence errors about errno features Windows CE 3.0 doesn't have)
3. Build

221
win32/evc30/jansson.vcp Normal file
View File

@ -0,0 +1,221 @@
# Microsoft eMbedded Visual Tools Project File - Name="jansson" - Package Owner=<4>
# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02
# ** DO NOT EDIT **
# TARGTYPE "Win32 (WCE ARM) Static Library" 0x8504
CFG=jansson - Win32 (WCE ARM) Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "jansson.vcn".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "jansson.vcn" CFG="jansson - Win32 (WCE ARM) Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "jansson - Win32 (WCE ARM) Release" (based on "Win32 (WCE ARM) Static Library")
!MESSAGE "jansson - Win32 (WCE ARM) Debug" (based on "Win32 (WCE ARM) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
# PROP ATL_Project 2
CPP=clarm.exe
!IF "$(CFG)" == "jansson - Win32 (WCE ARM) Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ARMRel"
# PROP BASE Intermediate_Dir "ARMRel"
# PROP BASE CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}"
# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ARMRel"
# PROP Intermediate_Dir "ARMRel"
# PROP CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}"
# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c
# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
!ELSEIF "$(CFG)" == "jansson - Win32 (WCE ARM) Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "ARMDbg"
# PROP BASE Intermediate_Dir "ARMDbg"
# PROP BASE CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}"
# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "ARMDbg"
# PROP Intermediate_Dir "ARMDbg"
# PROP CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}"
# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c
# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
!ENDIF
# Begin Target
# Name "jansson - Win32 (WCE ARM) Release"
# Name "jansson - Win32 (WCE ARM) Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\src\dump.c
DEP_CPP_DUMP_=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
"..\..\src\utf.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\error.c
DEP_CPP_ERROR=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\hashtable.c
DEP_CPP_HASHT=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\load.c
DEP_CPP_LOAD_=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
"..\..\src\utf.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\memory.c
DEP_CPP_MEMOR=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\pack_unpack.c
DEP_CPP_PACK_=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
"..\..\src\utf.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\strbuffer.c
DEP_CPP_STRBU=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\strconv.c
DEP_CPP_STRCO=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\utf.c
DEP_CPP_UTF_C=\
"..\..\src\utf.h"\
# End Source File
# Begin Source File
SOURCE=..\..\src\value.c
DEP_CPP_VALUE=\
"..\..\src\hashtable.h"\
"..\..\src\jansson.h"\
"..\..\src\jansson_private.h"\
"..\..\src\strbuffer.h"\
"..\..\src\utf.h"\
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\src\hashtable.h
# End Source File
# Begin Source File
SOURCE=..\..\src\jansson.h
# End Source File
# Begin Source File
SOURCE=..\..\src\jansson_config.h
# End Source File
# Begin Source File
SOURCE=..\..\src\jansson_private.h
# End Source File
# Begin Source File
SOURCE=..\..\src\strbuffer.h
# End Source File
# Begin Source File
SOURCE=..\..\src\utf.h
# End Source File
# End Group
# End Target
# End Project

29
win32/evc30/jansson.vcw Normal file
View File

@ -0,0 +1,29 @@
Microsoft eMbedded Visual Tools Workspace File, Format Version 3.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "jansson"=.\jansson.vcp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -0,0 +1 @@
#include "jansson_config.h.evc_30.h"

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2010-2012 Petri Lehtinen <petri@digip.org>
*
* Jansson is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*
*
* This file specifies a part of the site-specific configuration for
* Jansson, namely those things that affect the public API in
* jansson.h.
*
* The configure script copies this file to jansson_config.h and
* replaces @var@ substitutions by values that fit your system. If you
* cannot run the configure script, you can do the value substitution
* by hand.
*/
#ifndef JANSSON_CONFIG_H
#define JANSSON_CONFIG_H
/* If your compiler supports the inline keyword in C, JSON_INLINE is
defined to `inline', otherwise empty. In C++, the inline is always
supported. */
#ifdef __cplusplus
#define JSON_INLINE inline
#else
#define JSON_INLINE __inline
#endif
/* If your compiler supports the `long long` type and the strtoll()
library function, JSON_INTEGER_IS_LONG_LONG is defined to 1,
otherwise to 0. */
#define JSON_INTEGER_IS_LONG_LONG 0
/* If locale.h and localeconv() are available, define to 1,
otherwise to 0. */
#define JSON_HAVE_LOCALECONV 0
#undef HAVE_INTTYPES_H
#undef HAVE_CONFIG_H
#define JSON_HAVE_ERRNO 0
#define _STLP_ASSERT(x)
#endif