mirror of
https://github.com/VARCem/ihex.git
synced 2026-09-23 23:44:59 +00:00
const arguments for input data
This commit is contained in:
@@ -106,7 +106,7 @@
|
||||
#ifndef KK_IHEX_H
|
||||
#define KK_IHEX_H
|
||||
|
||||
#define KK_IHEX_VERSION "2015-02-26"
|
||||
#define KK_IHEX_VERSION "2015-03-04"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ ihex_end_read (struct ihex_state * const ihex) {
|
||||
}
|
||||
|
||||
void
|
||||
ihex_read_byte (struct ihex_state * const ihex, const int byte) {
|
||||
ihex_read_byte (struct ihex_state * const ihex, const char byte) {
|
||||
uint_fast8_t b = (uint_fast8_t) byte;
|
||||
uint_fast8_t len = ihex->length;
|
||||
uint_fast8_t state = (ihex->flags & IHEX_READ_STATE_MASK);
|
||||
@@ -169,7 +169,7 @@ save_read_state:
|
||||
|
||||
void
|
||||
ihex_read_bytes (struct ihex_state * restrict ihex,
|
||||
char * restrict data,
|
||||
const char * restrict data,
|
||||
ihex_count_t count) {
|
||||
while (count > 0) {
|
||||
ihex_read_byte(ihex, *data++);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* kk_ihex_read.h: A simple library for reaing Intel HEX data. See
|
||||
* kk_ihex_read.h: A simple library for reading Intel HEX data. See
|
||||
* the accompanying kk_ihex_write.h for IHEX write support.
|
||||
*
|
||||
*
|
||||
@@ -53,11 +53,12 @@ void ihex_begin_read(struct ihex_state *ihex);
|
||||
void ihex_read_at_address(struct ihex_state *ihex,
|
||||
ihex_address_t address);
|
||||
|
||||
// Read a single byte
|
||||
void ihex_read_byte(struct ihex_state *ihex, int chr);
|
||||
// Read a single character
|
||||
void ihex_read_byte(struct ihex_state *ihex, char chr);
|
||||
|
||||
// Read `count` bytes from `data`
|
||||
void ihex_read_bytes(struct ihex_state * restrict ihex, char * restrict data,
|
||||
void ihex_read_bytes(struct ihex_state * restrict ihex,
|
||||
const char * restrict data,
|
||||
ihex_count_t count);
|
||||
|
||||
// End reading (may call `ihex_data_read` if there is data waiting)
|
||||
|
||||
@@ -213,7 +213,7 @@ ihex_write_byte (struct ihex_state * const ihex, uint8_t byte) {
|
||||
|
||||
void
|
||||
ihex_write_bytes (struct ihex_state * restrict const ihex,
|
||||
uint8_t * restrict r,
|
||||
const uint8_t * restrict r,
|
||||
ihex_count_t count) {
|
||||
while (count > 0) {
|
||||
if (ihex->line_length > ihex->length) {
|
||||
|
||||
@@ -116,7 +116,7 @@ void ihex_write_byte(struct ihex_state *ihex, uint8_t b);
|
||||
|
||||
// Write `count` bytes from `data`
|
||||
void ihex_write_bytes(struct ihex_state * restrict ihex,
|
||||
uint8_t * restrict data,
|
||||
const uint8_t * restrict data,
|
||||
ihex_count_t count);
|
||||
|
||||
// End writing (flush buffers, write end of file record)
|
||||
|
||||
Reference in New Issue
Block a user