attempt to make it cross platform

master
Ondřej Hruška 8 years ago
parent 0bc36eb526
commit f79c3a2a91
  1. 1
      .gitignore
  2. 2
      scpi.pro.user
  3. 9
      source/scpi_parser.c

1
.gitignore vendored

@ -32,3 +32,4 @@
*.dSYM/
*.autosave
*.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2015-12-05T23:23:08. -->
<!-- Written by QtCreator 3.5.1, 2015-12-06T20:03:28. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "scpi_parser.h"
#include "scpi_errors.h"
@ -61,8 +62,8 @@ static struct {
char charbuf[MAX_CHARBUF_LEN + 1];
uint16_t charbuf_i;
int32_t blob_cnt; // preamble counter, if 0, was just #, must read count. Used also for blob body.
int32_t blob_len; // total blob length to read
uint32_t blob_cnt; // preamble counter, if 0, was just #, must read count. Used also for blob body.
uint32_t blob_len; // total blob length to read
char string_quote; // symbol used to quote string
bool string_escape; // last char was backslash, next quote is literal
@ -861,7 +862,7 @@ static void arg_convert_value(void)
break;
case SCPI_DT_INT:
j = sscanf(pst.charbuf, "%d", &dest->INT);
j = sscanf(pst.charbuf, "%" SCNu32, &dest->INT);
if (j == 0 || pst.charbuf[0] == '\0') { //fail or empty buffer
sprintf(ebuf, "Invalid INT value: '%s'", pst.charbuf);
@ -937,7 +938,7 @@ static void pars_blob_preamble_char(uint8_t c)
// end of preamble sequence
charbuf_terminate();
sscanf(pst.charbuf, "%d", &pst.blob_len);
sscanf(pst.charbuf, "%" SCNu32, &pst.blob_len);
pst.args[pst.arg_i].BLOB_LEN = pst.blob_len;
run_command_callback();

Loading…
Cancel
Save