* @brief read one piece of data at src according to the format * return the value as int64_t * this limits our format support to int types * * @param src * @param format */
| 178 | * @param format |
| 179 | */ |
| 180 | static inline int64_t read_data(char *src, char format) { |
| 181 | ; |
| 182 | |
| 183 | switch (format) { |
| 184 | case 'b': |
| 185 | case 'B': |
| 186 | case 'c': |
| 187 | return (int64_t)(*(int8_t *)src); |
| 188 | case 'h': |
| 189 | case 'H': |
| 190 | return (int64_t)(*(int16_t *)src); |
| 191 | case 'i': |
| 192 | case 'l': |
| 193 | case 'I': |
| 194 | case 'L': |
| 195 | return (int64_t)(*(int32_t *)src); |
| 196 | case 'q': |
| 197 | case 'Q': |
| 198 | return (int64_t)(*(int64_t *)src); |
| 199 | case 'f': |
| 200 | return (int64_t)(*(float *)src); |
| 201 | case 'd': |
| 202 | return (int64_t)(*(double *)src); |
| 203 | default: |
| 204 | ERROR("DO NOT recognize given format character: %c\n", format); |
| 205 | break; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | int binary_read_one_req(reader_t *reader, request_t *req) { |
| 210 | binary_params_t *params = (binary_params_t *)reader->reader_params; |
no outgoing calls
no test coverage detected