Compare commits
	
		
			5 Commits
		
	
	
		
			c++
			...
			d71c47f8ce
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						d71c47f8ce
	
				 | 
					
					
						|||
| 
						
						
							
						
						425ea57b17
	
				 | 
					
					
						|||
| 
						
						
							
						
						8822d06091
	
				 | 
					
					
						|||
| 
						
						
							
						
						9639777814
	
				 | 
					
					
						|||
| 
						
						
							
						
						929229a1d7
	
				 | 
					
					
						
@@ -4,9 +4,9 @@ cmake_minimum_required (VERSION 2.8.5)
 | 
			
		||||
# Moar warnings
 | 
			
		||||
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
 | 
			
		||||
	# -Wunused-function is pretty annoying here, as everything is static
 | 
			
		||||
	set (wdisabled "-Wno-unused-function -Wno-implicit-fallthrough")
 | 
			
		||||
	set (wdisabled "-Wno-unused-function")
 | 
			
		||||
	set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra ${wdisabled}")
 | 
			
		||||
endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
# Dependencies
 | 
			
		||||
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
 | 
			
		||||
@@ -16,11 +16,9 @@ find_package (PkgConfig REQUIRED)
 | 
			
		||||
pkg_check_modules (libssl REQUIRED libssl libcrypto)
 | 
			
		||||
 | 
			
		||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
 | 
			
		||||
	include_directories (/usr/local/include)
 | 
			
		||||
	link_directories (/usr/local/lib)
 | 
			
		||||
	# Our POSIX version macros make these undefined
 | 
			
		||||
	add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1)
 | 
			
		||||
endif ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
set (common_libraries ${libssl_LIBRARIES})
 | 
			
		||||
include_directories (${libssl_INCLUDE_DIRS})
 | 
			
		||||
@@ -32,8 +30,8 @@ foreach (extra iconv rt)
 | 
			
		||||
	find_library (extra_lib_${extra} ${extra})
 | 
			
		||||
	if (extra_lib_${extra})
 | 
			
		||||
		list (APPEND common_libraries ${extra})
 | 
			
		||||
	endif (extra_lib_${extra})
 | 
			
		||||
endforeach (extra)
 | 
			
		||||
	endif ()
 | 
			
		||||
endforeach ()
 | 
			
		||||
 | 
			
		||||
# Build some unit tests
 | 
			
		||||
include_directories (${PROJECT_SOURCE_DIR})
 | 
			
		||||
@@ -43,4 +41,4 @@ foreach (name liberty proto)
 | 
			
		||||
	add_threads (test-${name})
 | 
			
		||||
	target_link_libraries (test-${name} ${common_libraries})
 | 
			
		||||
	add_test (NAME test-${name} COMMAND test-${name})
 | 
			
		||||
endforeach (name)
 | 
			
		||||
endforeach ()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								liberty.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								liberty.c
									
									
									
									
									
								
							@@ -2748,16 +2748,12 @@ utf8_decode (const char **s, size_t len)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// In the middle of a character
 | 
			
		||||
	if (sequence_len == 1)
 | 
			
		||||
	// or an overlong sequence (subset, possibly MUTF-8, not supported)
 | 
			
		||||
	if (sequence_len == 1 || *p == 0xC0 || *p == 0xC1)
 | 
			
		||||
		return -1;
 | 
			
		||||
 | 
			
		||||
	// Check the rest of the sequence
 | 
			
		||||
	uint32_t cp = *p++ & ~mask;
 | 
			
		||||
 | 
			
		||||
	// Overlong sequence (possibly MUTF-8, not supported)
 | 
			
		||||
	if (!cp && sequence_len)
 | 
			
		||||
		return -1;
 | 
			
		||||
 | 
			
		||||
	while (sequence_len && --sequence_len)
 | 
			
		||||
	{
 | 
			
		||||
		if (p == end)
 | 
			
		||||
@@ -4421,7 +4417,7 @@ socket_io_try_write (int socket_fd, struct str *wb)
 | 
			
		||||
//   char    = [\0-\177]  # or any Unicode codepoint in the UTF-8 encoding
 | 
			
		||||
//   escape  = [\\"abfnrtv] / [xX][0-9A-Fa-f][0-9A-Fa-f]? / [0-7][0-7]?[0-7]?
 | 
			
		||||
//
 | 
			
		||||
//   integer = lws '-'? [0-9]+  # whatever strtoll() accepts on your system
 | 
			
		||||
//   integer = lws [-+]? [0-9]+  # whatever strtoll() accepts on your system
 | 
			
		||||
//   null    = lws 'null'
 | 
			
		||||
//   boolean = lws 'yes'  / lws 'YES'  / lws 'no'    / lws 'NO'
 | 
			
		||||
//           / lws 'on'   / lws 'ON'   / lws 'off'   / lws 'OFF'
 | 
			
		||||
 
 | 
			
		||||
@@ -331,10 +331,12 @@ test_utf8 (void)
 | 
			
		||||
	soft_assert (utf8_decode (&partial, 1) == -2);
 | 
			
		||||
	soft_assert (utf8_decode (&empty,   0) == -1);
 | 
			
		||||
 | 
			
		||||
	const char valid[] = "2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm";
 | 
			
		||||
	const char valid_1[] = "2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm";
 | 
			
		||||
	const char valid_2[] = "\xf0\x93\x82\xb9";
 | 
			
		||||
	const char invalid_1[] = "\xf0\x90\x28\xbc";
 | 
			
		||||
	const char invalid_2[] = "\xc0\x80";
 | 
			
		||||
	soft_assert ( utf8_validate (valid,     sizeof valid));
 | 
			
		||||
	soft_assert ( utf8_validate (valid_1,   sizeof valid_1));
 | 
			
		||||
	soft_assert ( utf8_validate (valid_2,   sizeof valid_2));
 | 
			
		||||
	soft_assert (!utf8_validate (invalid_1, sizeof invalid_1));
 | 
			
		||||
	soft_assert (!utf8_validate (invalid_2, sizeof invalid_2));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user