123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=9"/>
- <meta name="generator" content="Doxygen 1.8.17"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>MQTT C Client Libraries Internals: utf-8.c File Reference</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="dynsections.js"></script>
- <link href="search/search.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="search/searchdata.js"></script>
- <script type="text/javascript" src="search/search.js"></script>
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
- <div id="titlearea">
- <table cellspacing="0" cellpadding="0">
- <tbody>
- <tr style="height: 56px;">
- <td id="projectlogo"><img alt="Logo" src="pahologo.png"/></td>
- <td id="projectalign" style="padding-left: 0.5em;">
- <div id="projectname">MQTT C Client Libraries Internals
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.17 -->
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- /* @license-end */
- </script>
- <script type="text/javascript" src="menudata.js"></script>
- <script type="text/javascript" src="menu.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(function() {
- initMenu('',true,false,'search.php','Search');
- $(document).ready(function() { init_search(); });
- });
- /* @license-end */</script>
- <div id="main-nav"></div>
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- </div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <iframe src="javascript:void(0)" frameborder="0"
- name="MSearchResults" id="MSearchResults">
- </iframe>
- </div>
- </div><!-- top -->
- <div class="header">
- <div class="summary">
- <a href="#define-members">Macros</a> |
- <a href="#func-members">Functions</a> |
- <a href="#var-members">Variables</a> </div>
- <div class="headertitle">
- <div class="title">utf-8.c File Reference</div> </div>
- </div><!--header-->
- <div class="contents">
- <p>Functions for checking that strings contain UTF-8 characters only.
- <a href="#details">More...</a></p>
- <div class="textblock"><code>#include "utf-8.h"</code><br />
- <code>#include <stdlib.h></code><br />
- <code>#include <string.h></code><br />
- <code>#include "StackTrace.h"</code><br />
- </div><div class="textblock"><div class="dynheader">
- Include dependency graph for utf-8.c:</div>
- <div class="dyncontent">
- <div class="center"><img src="utf-8_8c__incl.png" border="0" usemap="#utf-8_8c" alt=""/></div>
- <map name="utf-8_8c" id="utf-8_8c">
- <area shape="rect" title="Functions for checking that strings contain UTF-8 characters only." alt="" coords="51,5,110,32"/>
- <area shape="rect" title=" " alt="" coords="5,80,68,107"/>
- <area shape="rect" title=" " alt="" coords="93,80,157,107"/>
- </map>
- </div>
- </div><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
- Macros</h2></td></tr>
- <tr class="memitem:a25f003de16c08a4888b69f619d70f427"><td class="memItemLeft" align="right" valign="top"><a id="a25f003de16c08a4888b69f619d70f427"></a>
- #define </td><td class="memItemRight" valign="bottom"><a class="el" href="utf-8_8c.html#a25f003de16c08a4888b69f619d70f427">ARRAY_SIZE</a>(a)   (sizeof(a) / sizeof(a[0]))</td></tr>
- <tr class="memdesc:a25f003de16c08a4888b69f619d70f427"><td class="mdescLeft"> </td><td class="mdescRight">Macro to determine the number of elements in a single-dimension array. <br /></td></tr>
- <tr class="separator:a25f003de16c08a4888b69f619d70f427"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
- Functions</h2></td></tr>
- <tr class="memitem:a9727caa7417e6bed8cfad4121a22628d"><td class="memItemLeft" align="right" valign="top">static const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="utf-8_8c.html#a9727caa7417e6bed8cfad4121a22628d">UTF8_char_validate</a> (int <a class="el" href="utf-8_8c.html#afed088663f8704004425cdae2120b9b3">len</a>, const char *data)</td></tr>
- <tr class="memdesc:a9727caa7417e6bed8cfad4121a22628d"><td class="mdescLeft"> </td><td class="mdescRight">Validate a single UTF-8 character. <a href="utf-8_8c.html#a9727caa7417e6bed8cfad4121a22628d">More...</a><br /></td></tr>
- <tr class="separator:a9727caa7417e6bed8cfad4121a22628d"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ad2012627fca4b4bdd9f67bde49b0d1cb"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="utf-8_8c.html#ad2012627fca4b4bdd9f67bde49b0d1cb">UTF8_validate</a> (int <a class="el" href="utf-8_8c.html#afed088663f8704004425cdae2120b9b3">len</a>, const char *data)</td></tr>
- <tr class="memdesc:ad2012627fca4b4bdd9f67bde49b0d1cb"><td class="mdescLeft"> </td><td class="mdescRight">Validate a length-delimited string has only UTF-8 characters. <a href="utf-8_8c.html#ad2012627fca4b4bdd9f67bde49b0d1cb">More...</a><br /></td></tr>
- <tr class="separator:ad2012627fca4b4bdd9f67bde49b0d1cb"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a4f3cf77538d867bb5b421bcb687dccdf"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="utf-8_8c.html#a4f3cf77538d867bb5b421bcb687dccdf">UTF8_validateString</a> (const char *string)</td></tr>
- <tr class="memdesc:a4f3cf77538d867bb5b421bcb687dccdf"><td class="mdescLeft"> </td><td class="mdescRight">Validate a null-terminated string has only UTF-8 characters. <a href="utf-8_8c.html#a4f3cf77538d867bb5b421bcb687dccdf">More...</a><br /></td></tr>
- <tr class="separator:a4f3cf77538d867bb5b421bcb687dccdf"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
- Variables</h2></td></tr>
- <tr class="memitem:a03bdcd5f0e47e86161d8f8a6e6d2ed1d"><td class="memItemLeft" >struct {</td></tr>
- <tr class="memitem:a2b3508920af3b46c4ea33ea0e6a58cfa"><td class="memItemLeft" >
-    int   <a class="el" href="utf-8_8c.html#afed088663f8704004425cdae2120b9b3">len</a></td></tr>
- <tr class="memdesc:a2b3508920af3b46c4ea33ea0e6a58cfa"><td class="mdescLeft"> </td><td class="mdescRight">number of elements in the following array (1 to 4) <br /></td></tr>
- <tr class="separator:a2b3508920af3b46c4ea33ea0e6a58cfa"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a2b165add953f0274aa17034848338b86"><td class="memItemLeft" >
-    struct {</td></tr>
- <tr class="memitem:aff90f712bbe02f22eb3681538c7f825f"><td class="memItemLeft" >
-       char   <a class="el" href="utf-8_8c.html#a17ae1b83727db4230c8df98b4ee953fc">lower</a></td></tr>
- <tr class="memdesc:aff90f712bbe02f22eb3681538c7f825f"><td class="mdescLeft"> </td><td class="mdescRight">lower limit of valid range <br /></td></tr>
- <tr class="separator:aff90f712bbe02f22eb3681538c7f825f"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a0cc1558bceab574eff8f0455583dc45e"><td class="memItemLeft" >
-       char   <a class="el" href="utf-8_8c.html#a716463de5d02ad40678f2376abcdd90a">upper</a></td></tr>
- <tr class="memdesc:a0cc1558bceab574eff8f0455583dc45e"><td class="mdescLeft"> </td><td class="mdescRight">upper limit of valid range <br /></td></tr>
- <tr class="separator:a0cc1558bceab574eff8f0455583dc45e"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a2b165add953f0274aa17034848338b86"><td class="memItemLeft" valign="top">   }   <a class="el" href="utf-8_8c.html#abf4b7aec66b165e9a0a8e3a4ad69f863">bytes</a> [4]</td></tr>
- <tr class="memdesc:a2b165add953f0274aa17034848338b86"><td class="mdescLeft"> </td><td class="mdescRight">up to 4 bytes can be used per character <br /></td></tr>
- <tr class="separator:a2b165add953f0274aa17034848338b86"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a03bdcd5f0e47e86161d8f8a6e6d2ed1d"><td class="memItemLeft" valign="top">} </td><td class="memItemRight" valign="bottom"><a class="el" href="utf-8_8c.html#a03bdcd5f0e47e86161d8f8a6e6d2ed1d">valid_ranges</a> []</td></tr>
- <tr class="memdesc:a03bdcd5f0e47e86161d8f8a6e6d2ed1d"><td class="mdescLeft"> </td><td class="mdescRight">Structure to hold the valid ranges of UTF-8 characters, for each byte up to 4. <a href="utf-8_8c.html#a03bdcd5f0e47e86161d8f8a6e6d2ed1d">More...</a><br /></td></tr>
- <tr class="separator:a03bdcd5f0e47e86161d8f8a6e6d2ed1d"><td class="memSeparator" colspan="2"> </td></tr>
- </table>
- <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
- <div class="textblock"><p>Functions for checking that strings contain UTF-8 characters only. </p>
- <p>See page 104 of the Unicode Standard 5.0 for the list of well formed UTF-8 byte sequences. </p>
- </div><h2 class="groupheader">Function Documentation</h2>
- <a id="a9727caa7417e6bed8cfad4121a22628d"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a9727caa7417e6bed8cfad4121a22628d">◆ </a></span>UTF8_char_validate()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">static const char * UTF8_char_validate </td>
- <td>(</td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>len</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">const char * </td>
- <td class="paramname"><em>data</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">static</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Validate a single UTF-8 character. </p>
- <dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">len</td><td>the length of the string in "data" </td></tr>
- <tr><td class="paramname">data</td><td>the bytes to check for a valid UTF-8 char </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>pointer to the start of the next UTF-8 character in "data" </dd></dl>
- </div>
- </div>
- <a id="ad2012627fca4b4bdd9f67bde49b0d1cb"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#ad2012627fca4b4bdd9f67bde49b0d1cb">◆ </a></span>UTF8_validate()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">int UTF8_validate </td>
- <td>(</td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>len</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">const char * </td>
- <td class="paramname"><em>data</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Validate a length-delimited string has only UTF-8 characters. </p>
- <dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">len</td><td>the length of the string in "data" </td></tr>
- <tr><td class="paramname">data</td><td>the bytes to check for valid UTF-8 characters </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>1 (true) if the string has only UTF-8 characters, 0 (false) otherwise </dd></dl>
- <div class="dynheader">
- Here is the call graph for this function:</div>
- <div class="dyncontent">
- <div class="center"><img src="utf-8_8c_ad2012627fca4b4bdd9f67bde49b0d1cb_cgraph.png" border="0" usemap="#utf-8_8c_ad2012627fca4b4bdd9f67bde49b0d1cb_cgraph" alt=""/></div>
- <map name="utf-8_8c_ad2012627fca4b4bdd9f67bde49b0d1cb_cgraph" id="utf-8_8c_ad2012627fca4b4bdd9f67bde49b0d1cb_cgraph">
- <area shape="rect" title="Validate a length-delimited string has only UTF-8 characters." alt="" coords="5,5,112,32"/>
- <area shape="rect" href="utf-8_8c.html#a9727caa7417e6bed8cfad4121a22628d" title="Validate a single UTF-8 character." alt="" coords="160,5,299,32"/>
- </map>
- </div>
- </div>
- </div>
- <a id="a4f3cf77538d867bb5b421bcb687dccdf"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a4f3cf77538d867bb5b421bcb687dccdf">◆ </a></span>UTF8_validateString()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">int UTF8_validateString </td>
- <td>(</td>
- <td class="paramtype">const char * </td>
- <td class="paramname"><em>string</em></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Validate a null-terminated string has only UTF-8 characters. </p>
- <dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">string</td><td>the string to check for valid UTF-8 characters </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>1 (true) if the string has only UTF-8 characters, 0 (false) otherwise </dd></dl>
- <div class="dynheader">
- Here is the call graph for this function:</div>
- <div class="dyncontent">
- <div class="center"><img src="utf-8_8c_a4f3cf77538d867bb5b421bcb687dccdf_cgraph.png" border="0" usemap="#utf-8_8c_a4f3cf77538d867bb5b421bcb687dccdf_cgraph" alt=""/></div>
- <map name="utf-8_8c_a4f3cf77538d867bb5b421bcb687dccdf_cgraph" id="utf-8_8c_a4f3cf77538d867bb5b421bcb687dccdf_cgraph">
- <area shape="rect" title="Validate a null-terminated string has only UTF-8 characters." alt="" coords="5,5,147,32"/>
- <area shape="rect" href="utf-8_8c.html#ad2012627fca4b4bdd9f67bde49b0d1cb" title="Validate a length-delimited string has only UTF-8 characters." alt="" coords="195,5,301,32"/>
- <area shape="rect" href="utf-8_8c.html#a9727caa7417e6bed8cfad4121a22628d" title="Validate a single UTF-8 character." alt="" coords="349,5,488,32"/>
- </map>
- </div>
- </div>
- </div>
- <h2 class="groupheader">Variable Documentation</h2>
- <a id="a03bdcd5f0e47e86161d8f8a6e6d2ed1d"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a03bdcd5f0e47e86161d8f8a6e6d2ed1d">◆ </a></span>valid_ranges</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">struct { ... } valid_ranges[]</td>
- </tr>
- </table>
- </div><div class="memdoc">
- <b>Initial value:</b><div class="fragment"><div class="line">=</div>
- <div class="line">{</div>
- <div class="line"> {1, { {00, 0x7F} } },</div>
- <div class="line"> {2, { {0xC2, 0xDF}, {0x80, 0xBF} } },</div>
- <div class="line"> {3, { {0xE0, 0xE0}, {0xA0, 0xBF}, {0x80, 0xBF} } },</div>
- <div class="line"> {3, { {0xE1, 0xEC}, {0x80, 0xBF}, {0x80, 0xBF} } },</div>
- <div class="line"> {3, { {0xED, 0xED}, {0x80, 0x9F}, {0x80, 0xBF} } },</div>
- <div class="line"> {3, { {0xEE, 0xEF}, {0x80, 0xBF}, {0x80, 0xBF} } },</div>
- <div class="line"> {4, { {0xF0, 0xF0}, {0x90, 0xBF}, {0x80, 0xBF}, {0x80, 0xBF} } },</div>
- <div class="line"> {4, { {0xF1, 0xF3}, {0x80, 0xBF}, {0x80, 0xBF}, {0x80, 0xBF} } },</div>
- <div class="line"> {4, { {0xF4, 0xF4}, {0x80, 0x8F}, {0x80, 0xBF}, {0x80, 0xBF} } },</div>
- <div class="line">}</div>
- </div><!-- fragment -->
- <p>Structure to hold the valid ranges of UTF-8 characters, for each byte up to 4. </p>
- </div>
- </div>
- </div><!-- contents -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated on Thu Sep 29 2022 11:34:46 for MQTT C Client Libraries Internals by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.17
- </small></address>
- </body>
- </html>
|