From f5e3afa5c666c570ef9a27f862155c473f272704 Mon Sep 17 00:00:00 2001 From: Sergey Kosarevsky Date: Sun, 3 Jan 2016 02:23:19 +0300 Subject: [PATCH 1/6] Added LUrlParser --- docs/other_libs.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/other_libs.md b/docs/other_libs.md index 9c8bafc..bbf790d 100644 --- a/docs/other_libs.md +++ b/docs/other_libs.md @@ -62,6 +62,7 @@ this! But you might like them anyway: - **network** [yocto](https://github.com/tom-seddon/yhs): non-production-use http server (public domain) - **network** [happyhttp](http://scumways.com/happyhttp/happyhttp.html): http client requests (zlib license) - **network** [mongoose](https://github.com/cesanta/mongoose): http server (GPL v2) +- _**network** [LUrlParser](https://github.com/corporateshark/LUrlParser): lightweight URL & URI parser RFC 1738, RFC 3986 (MIT license)_ - **crypto** [TweetNaCl](http://tweetnacl.cr.yp.to/software.html): high-quality tiny cryptography library (public domain) - **AI** [micropather](http://www.grinninglizard.com/MicroPather/): pathfinding with A* (zlib license) - **compression** [miniz.c](https://github.com/richgel999/miniz): zlib compression,decompression, zip file, png writing (public domain) From 418d21f2e28cdda9044330827c844dbed89676ee Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sat, 16 Jan 2016 07:52:15 -0800 Subject: [PATCH 2/6] bump the version number and add version hisoty --- stb_c_lexer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stb_c_lexer.h b/stb_c_lexer.h index c1c4279..f6a0035 100644 --- a/stb_c_lexer.h +++ b/stb_c_lexer.h @@ -1,4 +1,4 @@ -// stb_c_lexer.h - v0.06 - public domain Sean Barrett 2013 +// stb_c_lexer.h - v0.07 - public domain Sean Barrett 2013 // lexer for making little C-like languages with recursive-descent parsers // // This file provides both the interface and the implementation. @@ -10,6 +10,7 @@ // suffixes on integer constants are not handled (you can override this). // // History: +// 0.07 fix mishandling of hexadecimal constants parsed by strtol // 0.06 fix missing next character after ending quote mark (Andreas Fredriksson) // 0.05 refixed get_location because github version had lost the fix // 0.04 fix octal parsing bug From ad9a570e271a8b00ac9574415feee6cc9dd597fb Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sat, 16 Jan 2016 10:20:54 -0800 Subject: [PATCH 3/6] stb_truetype version history; update README --- README.md | 12 ++++++------ stb_truetype.h | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0fb310e..889cbbc 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ single-file public domain libraries for C/C++ library | lastest version | category | LoC | description --------------------- | ---- | -------- | --- | -------------------------------- -**stb_vorbis.c** | 1.06 | audio | 5441 | decode ogg vorbis files from file/memory to float/16-bit signed output -**stb_image.h** | 2.08 | graphics | 6509 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC -**stb_truetype.h** | 1.08 | graphics | 3235 | parse, decode, and rasterize characters from truetype fonts -**stb_image_write.h** | 1.00 | graphics | 993 | image writing to disk: PNG, TGA, BMP +**stb_vorbis.c** | 1.07 | audio | 5462 | decode ogg vorbis files from file/memory to float/16-bit signed output +**stb_image.h** | 2.09 | graphics | 6610 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC +**stb_truetype.h** | 1.09 | graphics | 3246 | parse, decode, and rasterize characters from truetype fonts +**stb_image_write.h** | 1.01 | graphics | 1044 | image writing to disk: PNG, TGA, BMP **stb_image_resize.h** | 0.90 | graphics | 2586 | resize images larger/smaller with good quality **stb_rect_pack.h** | 0.08 | graphics | 572 | simple 2D rectangle packer with decent quality **stretchy_buffer.h** | 1.02 | utility | 216 | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++ @@ -21,13 +21,13 @@ library | lastest version | category | LoC | description **stb_easy_font.h** | 0.6 | 3D graphics | 232 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc **stb_tilemap_editor.h** | 0.36 | game dev | 4127 | embeddable tilemap editor **stb_herringbone_wa...** | 0.6 | game dev | 1220 | herringbone Wang tile map generator -**stb_c_lexer.h** | 0.06 | parsing | 815 | simplify writing parsers for C-like languages +**stb_c_lexer.h** | 0.07 | parsing | 816 | simplify writing parsers for C-like languages **stb_divide.h** | 0.91 | math | 379 | more useful 32-bit modulus e.g. "euclidean divide" **stb.h** | 2.25 | misc | 14136 | helper functions for C, mostly redundant in C++; basically author's personal stuff **stb_leakcheck.h** | 0.2 | misc | 124 | quick-and-dirty malloc/free leak-checking Total libraries: 18 -Total lines of C code: 46448 +Total lines of C code: 46633 FAQ diff --git a/stb_truetype.h b/stb_truetype.h index 0b1e3b5..b112b8a 100644 --- a/stb_truetype.h +++ b/stb_truetype.h @@ -50,7 +50,7 @@ // // VERSION HISTORY // -// 1.09 (????-??-??) warning fix; avoid crash on outofmem +// 1.09 (2016-01-16) warning fix; avoid crash on outofmem // 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges // 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints; // variant PackFontRanges to pack and render in separate phases; @@ -3203,6 +3203,7 @@ STBTT_DEF int stbtt_FindMatchingFont(const unsigned char *font_collection, const // FULL VERSION HISTORY // +// 1.09 (2016-01-16) warning fix; avoid crash on outofmem // 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges // 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints; // allow PackFontRanges to pack and render in separate phases; From 48ec72ac12383a8bbfa567c41b85184b60ad2f4a Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sat, 16 Jan 2016 10:26:36 -0800 Subject: [PATCH 4/6] Update stbtt_fontinfo.userdata field on paths where user never has access to it. --- stb_truetype.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stb_truetype.h b/stb_truetype.h index b112b8a..bfb1841 100644 --- a/stb_truetype.h +++ b/stb_truetype.h @@ -50,7 +50,7 @@ // // VERSION HISTORY // -// 1.09 (2016-01-16) warning fix; avoid crash on outofmem +// 1.09 (2016-01-16) warning fix; avoid crash on outofmem; use allocation userdata properly // 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges // 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints; // variant PackFontRanges to pack and render in separate phases; @@ -2522,6 +2522,7 @@ STBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset, // fo float scale; int x,y,bottom_y, i; stbtt_fontinfo f; + f.userdata = NULL; if (!stbtt_InitFont(&f, data, offset)) return -1; STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels @@ -2986,6 +2987,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontd if (rects == NULL) return 0; + info.userdata = spc->user_allocator_context; stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata,font_index)); n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects); @@ -3203,7 +3205,7 @@ STBTT_DEF int stbtt_FindMatchingFont(const unsigned char *font_collection, const // FULL VERSION HISTORY // -// 1.09 (2016-01-16) warning fix; avoid crash on outofmem +// 1.09 (2016-01-16) warning fix; avoid crash on outofmem; use alloc userdata for PackFontRanges // 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges // 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints; // allow PackFontRanges to pack and render in separate phases; From bc1b1f6cc993d87aff438cfd1fb550a36fe2780d Mon Sep 17 00:00:00 2001 From: Eugene Opalev Date: Mon, 18 Jan 2016 19:38:07 -0800 Subject: [PATCH 5/6] Warning C4703 fix --- stb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stb.h b/stb.h index d8aaf37..b152c91 100644 --- a/stb.h +++ b/stb.h @@ -7786,7 +7786,7 @@ stb_ps *stb_ps_remove_any(stb_ps *ps, void **value) void ** stb_ps_getlist(stb_ps *ps, int *count) { int i,n=0; - void **p; + void **p = NULL; switch (3 & (int) ps) { case STB_ps_direct: if (ps == NULL) { *count = 0; return NULL; } From a5bbc93087575e82f927cbf9e9e3e2a5c1e2c4d9 Mon Sep 17 00:00:00 2001 From: Eugene Opalev Date: Mon, 18 Jan 2016 22:41:17 -0800 Subject: [PATCH 6/6] Warning C4005 fix --- stb.h | 6 ++++++ stb_tilemap_editor.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/stb.h b/stb.h index b152c91..818554e 100644 --- a/stb.h +++ b/stb.h @@ -207,9 +207,15 @@ CREDITS #endif #ifdef _WIN32 + #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS + #endif + #ifndef _CRT_NONSTDC_NO_DEPRECATE #define _CRT_NONSTDC_NO_DEPRECATE + #endif + #ifndef _CRT_NON_CONFORMING_SWPRINTFS #define _CRT_NON_CONFORMING_SWPRINTFS + #endif #if !defined(_MSC_VER) || _MSC_VER > 1700 #include // _BitScanReverse #endif diff --git a/stb_tilemap_editor.h b/stb_tilemap_editor.h index 64480ba..f1f8155 100644 --- a/stb_tilemap_editor.h +++ b/stb_tilemap_editor.h @@ -328,7 +328,9 @@ #define STB_TILEMAP_INCLUDE_STB_TILEMAP_EDITOR_H #ifdef _WIN32 + #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS + #endif #include #include #endif