title: cast unsigned char * (uint8_t *) to const char *
body: <p>I've a function which take an uint8_t * argument :</p>
  
  <pre><code>uint8_t* ihex_decode(uint8_t *in, size_t len, uint8_t *out)
  {
      uint8_t i, hn, ln;
  
      for (i = 0; i &lt; len; i+=2) {
          hn = in[i] &gt; '9' ? (in[i]|32) - 'a' + 10 : in[i] - '0';
          ln = in[i+1] &gt; '9' ? (in[i+1]|32) - 'a' + 10 : in[i+1] - '0';
  
          out[i/2] = (hn &lt;&lt; 4 ) | ln;
      }
  
      return out;
  }
  </code></pre>
  
  <p>I use this function with :</p>
  
  <pre><code>uint8_t data[SPM_PAGESIZE]; // SPM_PAGESIZE = 256 bytes
  uint8_t sysex_data[SPM_PAGESIZE/2];
  ihex_decode(data, strlen(data), sysex_data);
  </code></pre>
  
  <p>But in this case, my compiler (avr-gcc) return a warning :</p>
  
  <blockquote>
    <p>main.c|89|warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
    /usr/include/string.h|399|note: expected 'const char *' but argument is of type 'uint8_t *'</p>
  </blockquote>
  
  <p>So, i've found a solution by type casting the data var :</p>
  
  <pre><code>ihex_decode(data, strlen((const char *)data), sysex_data);
  </code></pre>
  
  <p>The warning disappears but I wonder if this solution is safe.</p>
  
  <p>Is there a better way ?</p>
  
  <p>Thanks</p>