Quantcast
Channel: All LoadRunner Practitioners Forum posts
Viewing all articles
Browse latest Browse all 12134

Re: Correlation issue - conversion from hex to string

$
0
0

There's a small bug in the function convert_hexparam. I put the function below, and please be noticed that the fix in red.

 

void convert_hexparam(const char* paramName)
{
    char* src=0;
    char* psrc=0;
    char* dst = 0;
    char* pdst = 0;

    size_t srclen = 0;

    char c;
    char buf[5];

    char enclosedParamName[256];

    sprintf(enclosedParamName, "{%s}", paramName);
    src=lr_eval_string(enclosedParamName);

    srclen = strlen(src);

    dst = (char*)malloc(srclen);
    memset(dst, 0, srclen);

    for(psrc=src, pdst = dst; *psrc != '\0'; pdst++)
    {
        if(*psrc== '\\' && *(psrc + 1) == 'x')
        {
            memset(buf, 0, 5);
            buf[0] = '0';
            buf[1] = 'x';
            buf[2] = *(psrc + 2);
            buf[3] = *(psrc + 3);
            c = (char)strtol(buf, 0, 0 );

            *pdst  = c;
            psrc += 4;
        }
        else
        {
            *pdst = *psrc;
            ++psrc;
        }    
    }
    *(pdst) = '\0';

    lr_save_string(dst, paramName);

    free(dst);
}


Viewing all articles
Browse latest Browse all 12134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>