]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmddata.c
CHG: -O4 changed into -O3 to remove some compiler warnings clang, on mac ..
[proxmark3-svn] / client / cmddata.c
index ad86f45f43fa3bd25de86b1b81dff1b0b368c42e..23863131833b09dc74dbd7e9db0bffb96f1c81eb 100644 (file)
@@ -827,19 +827,20 @@ int CmdUndec(const char *Cmd)
                return 0;
        }
 
-       uint8_t factor = param_get8ex(Cmd, 0,2, 10);
+       uint8_t factor = param_get8ex(Cmd, 0, 2, 10);
        //We have memory, don't we?
        int swap[MAX_GRAPH_TRACE_LEN] = { 0 };
        uint32_t g_index = 0 ,s_index = 0;
-       while(g_index < GraphTraceLen && s_index < MAX_GRAPH_TRACE_LEN)
+       while(g_index < GraphTraceLen && s_index + factor < MAX_GRAPH_TRACE_LEN)
        {
                int count = 0;
-               for(count = 0; count < factor && s_index+count < MAX_GRAPH_TRACE_LEN; count ++)
+               for (count = 0; count < factor && s_index + count < MAX_GRAPH_TRACE_LEN; count++)
                        swap[s_index+count] = GraphBuffer[g_index];
-               s_index+=count;
+               s_index += count;
+               g_index++;
        }
 
-       memcpy(GraphBuffer,swap, s_index * sizeof(int));
+       memcpy(GraphBuffer, swap, s_index * sizeof(int));
        GraphTraceLen = s_index;
        RepaintGraphWindow();
        return 0;
@@ -2046,7 +2047,7 @@ int CmdTuneSamples(const char *Cmd)
        clearCommandBuffer();
        SendCommand(&c);
        UsbCommand resp;
-       while(!WaitForResponseTimeout(CMD_MEASURED_ANTENNA_TUNING,&resp,1000)) {
+       while(!WaitForResponseTimeout(CMD_MEASURED_ANTENNA_TUNING, &resp, 2000)) {
                timeout++;
                printf(".");
                if (timeout > 7) {
@@ -2325,21 +2326,15 @@ int Cmdbin2hex(const char *Cmd)
 }
 
 int usage_data_hex2bin(){
-
-       PrintAndLog("Usage: data bin2hex <binary_digits>");
+       PrintAndLog("Usage: data hex2bin <hex_digits>");
        PrintAndLog("       This function will ignore all non-hexadecimal characters (but stop reading on whitespace)");
        return 0;
-
 }
 
 int Cmdhex2bin(const char *Cmd)
 {
        int bg =0, en =0;
-       if(param_getptr(Cmd, &bg, &en, 0))
-       {
-               return usage_data_hex2bin();
-       }
-
+       if(param_getptr(Cmd, &bg, &en, 0))  return usage_data_hex2bin();
 
        while(bg <= en )
        {
@@ -2416,8 +2411,8 @@ static command_t CommandTable[] =
        {NULL, NULL, 0, NULL}
 };
 
-int CmdData(const char *Cmd)
-{
+int CmdData(const char *Cmd){
+       clearCommandBuffer();
        CmdsParse(CommandTable, Cmd);
        return 0;
 }
Impressum, Datenschutz