MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_parse_character

Function hb_parse_character

test/parsecsv.c:152–211  ·  view source on GitHub ↗

Raw parsing */

Source from the content-addressed store, hash-verified

150
151/* Raw parsing */
152static uint16_t hb_parse_character( hb_csv_file_t * file )
153{
154 int byte;
155 uint16_t c = 0;
156 int need_char = 1;
157
158 if( file == NULL )
159 {
160 return CSV_CHAR_ERROR;
161 }
162
163 while( need_char )
164 {
165 byte = fgetc( file->fileref );
166 if( feof( file->fileref ) )
167 {
168 return CSV_CHAR_EOF;
169 }
170 if( ferror( file->fileref ) )
171 {
172 return CSV_CHAR_ERROR;
173 }
174
175 if( file->parse_state == CSV_PARSE_SEEK && is_white(byte) )
176 {
177 continue;
178 }
179 else if( file->parse_state != CSV_PARSE_ESC && is_esc(byte) )
180 {
181 file->parse_state = CSV_PARSE_ESC;
182 continue;
183 }
184 else if( file->parse_state != CSV_PARSE_ESC && is_sep(byte) )
185 {
186 file->parse_state = CSV_PARSE_SEEK;
187 need_char = 0;
188 c = CSV_CHAR_COLSEP;
189 }
190 else if( file->parse_state == CSV_PARSE_ESC )
191 {
192 file->parse_state = CSV_PARSE_NORMAL;
193 need_char = 0;
194 c = (uint16_t)byte;
195 }
196 else if( is_newline(byte) )
197 {
198 file->parse_state = CSV_PARSE_SEEK;
199 need_char = 0;
200 c = CSV_CHAR_ROWSEP;
201 }
202 else
203 {
204 file->parse_state = CSV_PARSE_NORMAL;
205 need_char = 0;
206 c = (uint16_t)byte;
207 }
208 }
209

Callers 1

hb_read_next_cellFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected