PackBits_pack_buffer()
This commit is contained in:
		
							parent
							
								
									0dcee6acc3
								
							
						
					
					
						commit
						59b029effe
					
				@ -180,3 +180,16 @@ int PackBits_pack_flush(T_PackBits_data * data)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  return data->output_count;
 | 
					  return data->output_count;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int PackBits_pack_buffer(FILE * f, const byte * buffer, size_t size)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  T_PackBits_data pb_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  PackBits_pack_init(&pb_data, f);
 | 
				
			||||||
 | 
					  while (size-- > 0)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    if (PackBits_pack_add(&pb_data, *buffer++))
 | 
				
			||||||
 | 
					      return -1;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return PackBits_pack_flush(&pb_data);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -70,4 +70,11 @@ int PackBits_pack_add(T_PackBits_data * data, byte b);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
int PackBits_pack_flush(T_PackBits_data * data);
 | 
					int PackBits_pack_flush(T_PackBits_data * data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Pack a full buffer to FILE
 | 
				
			||||||
 | 
					 * @param f FILE output or NULL (for no output)
 | 
				
			||||||
 | 
					 * @return -1 for error, or the size of the packed stream so far
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int PackBits_pack_buffer(FILE * f, const byte * buffer, size_t size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user