Added encode flag to control whether the encoded string ends in a newline after padding or not
This commit is contained in:
		
							
								
								
									
										6
									
								
								external/libb64-1.2.1/include/b64/cencode.h
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								external/libb64-1.2.1/include/b64/cencode.h
									
									
									
									
										vendored
									
									
								
							| @@ -13,8 +13,14 @@ typedef enum | ||||
| 	step_A, step_B, step_C | ||||
| } base64_encodestep; | ||||
|  | ||||
| typedef enum | ||||
| { | ||||
| 	BASE64_ENC_NO_NEWLINE_TERM = 0x1 | ||||
| } base64_encodeflags; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
| 	base64_encodeflags flags; | ||||
| 	base64_encodestep step; | ||||
| 	char result; | ||||
| 	int stepcount; | ||||
|   | ||||
							
								
								
									
										4
									
								
								external/libb64-1.2.1/src/cencode.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								external/libb64-1.2.1/src/cencode.c
									
									
									
									
										vendored
									
									
								
							| @@ -11,6 +11,7 @@ const int CHARS_PER_LINE = 72; | ||||
|  | ||||
| void base64_init_encodestate(base64_encodestate* state_in) | ||||
| { | ||||
| 	state_in->flags = 0; | ||||
| 	state_in->step = step_A; | ||||
| 	state_in->result = 0; | ||||
| 	state_in->stepcount = 0; | ||||
| @@ -102,7 +103,10 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in) | ||||
| 	case step_A: | ||||
| 		break; | ||||
| 	} | ||||
| 	if ((BASE64_ENC_NO_NEWLINE_TERM & state_in->flags) == 0) | ||||
| 	{ | ||||
| 		*codechar++ = '\n'; | ||||
| 	} | ||||
| 	 | ||||
| 	return codechar - code_out; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user