This file is indexed.

/usr/share/doc/libnjb-doc/html/unicode_8c.html is in libnjb-doc 2.2.7~dfsg0-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.6"/>
<title>libnjb: /tmp/buildd/libnjb-2.2.7~dfsg0/src/unicode.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="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 style="padding-left: 0.5em;">
   <div id="projectname">libnjb
   &#160;<span id="projectnumber">2.2.7</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">unicode.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &lt;errno.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="libnjb_8h_source.html">libnjb.h</a>&quot;</code><br/>
<code>#include &quot;protocol.h&quot;</code><br/>
<code>#include &quot;<a class="el" href="protocol3_8h_source.html">protocol3.h</a>&quot;</code><br/>
<code>#include &quot;unicode.h&quot;</code><br/>
<code>#include &quot;njb_error.h&quot;</code><br/>
<code>#include &quot;usb_io.h&quot;</code><br/>
<code>#include &quot;ioutil.h&quot;</code><br/>
<code>#include &quot;defs.h&quot;</code><br/>
<code>#include &quot;base.h&quot;</code><br/>
</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:a6789ebc0df71a8ef76bfbb4fb5f74aad"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6789ebc0df71a8ef76bfbb4fb5f74aad"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MAX_STRING_LENGTH</b>&#160;&#160;&#160;512</td></tr>
<tr class="separator:a6789ebc0df71a8ef76bfbb4fb5f74aad"><td class="memSeparator" colspan="2">&#160;</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:a4af1a0bee89d7ee79ebb1bfb557f8e5e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8c.html#a4af1a0bee89d7ee79ebb1bfb557f8e5e">njb_set_unicode</a> (int flag)</td></tr>
<tr class="separator:a4af1a0bee89d7ee79ebb1bfb557f8e5e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd147761736f45b4282bebb6147c440a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8c.html#acd147761736f45b4282bebb6147c440a">ucs2strlen</a> (const unsigned char *unicstr)</td></tr>
<tr class="separator:acd147761736f45b4282bebb6147c440a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b1829345b6bf2af61d6dbbb1b02726b"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8c.html#a4b1829345b6bf2af61d6dbbb1b02726b">strtoutf8</a> (const unsigned char *str)</td></tr>
<tr class="separator:a4b1829345b6bf2af61d6dbbb1b02726b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a767008fdd0e78d87acbc7f1ad3bf4830"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8c.html#a767008fdd0e78d87acbc7f1ad3bf4830">utf8tostr</a> (const unsigned char *str)</td></tr>
<tr class="separator:a767008fdd0e78d87acbc7f1ad3bf4830"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a841f6472d66d10714cb565821cdb627f"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8c.html#a841f6472d66d10714cb565821cdb627f">ucs2tostr</a> (const unsigned char *unicstr)</td></tr>
<tr class="separator:a841f6472d66d10714cb565821cdb627f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7a77d04f2f0563c9c74d28fca28effdd"><td class="memItemLeft" align="right" valign="top">unsigned char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8c.html#a7a77d04f2f0563c9c74d28fca28effdd">strtoucs2</a> (const unsigned char *str)</td></tr>
<tr class="separator:a7a77d04f2f0563c9c74d28fca28effdd"><td class="memSeparator" colspan="2">&#160;</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:a60db410c9e82d9e61b1bf0be607922ed"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8c.html#a60db410c9e82d9e61b1bf0be607922ed">__sub_depth</a></td></tr>
<tr class="separator:a60db410c9e82d9e61b1bf0be607922ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac04b373ed657c74d96015d8935eb57b0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8c.html#ac04b373ed657c74d96015d8935eb57b0">njb_unicode_flag</a> = <a class="el" href="group__unicodeflags.html#gaaefbf25707acdc9606096ca303c69741">NJB_UC_8859</a></td></tr>
<tr class="separator:ac04b373ed657c74d96015d8935eb57b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This file contains general Unicode string manipulation functions. It mainly consist of functions for converting between UCS-2 (used on the devices), UTF-8 (used by several applications) and ISO 8859-1 / Codepage 1252 (fallback). </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a4af1a0bee89d7ee79ebb1bfb557f8e5e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void njb_set_unicode </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flag</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This flag determines whether to use ISO 8859-1 / codepage 1252 (default) or unicode UTF-8 for ALL strings sent into and out of libnjb, for ALL sessions and devices.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">flag</td><td>0 for ISO 8859-1 / codepage 1252 or 1 for Unicode UTF-8. </td></tr>
  </table>
  </dd>
</dl>

<p>References <a class="el" href="unicode_8c.html#ac04b373ed657c74d96015d8935eb57b0">njb_unicode_flag</a>.</p>

<p>Referenced by <a class="el" href="group__internals.html#ga22a893c243cd4398de35fcdea5b49b39">NJB_Set_Unicode()</a>.</p>

</div>
</div>
<a class="anchor" id="a7a77d04f2f0563c9c74d28fca28effdd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned char* strtoucs2 </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convert a simple ISO 8859-1 or a Unicode UTF8 string (depending on library Unicode flag) to a unicode UCS-2 string.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>the ISO 8859-1 or UTF-8 string to conver </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly allocated UCS-2 string </dd></dl>

<p>References <a class="el" href="group__unicodeflags.html#ga388e9c70b7a684c777f6b25e2e9d801b">NJB_UC_UTF8</a>, and <a class="el" href="unicode_8c.html#ac04b373ed657c74d96015d8935eb57b0">njb_unicode_flag</a>.</p>

<p>Referenced by <a class="el" href="datafile_8c.html#afc23fcd58e9e846ae7aa4ff500f5b198">datafile_pack3()</a>, <a class="el" href="datafile_8c.html#aa7ca666051692a0e0c2b458366e8fcf9">new_folder_pack3()</a>, <a class="el" href="group__playlistapi.html#gae1873045c0cd0eb27465992c3479b975">NJB_Update_Playlist()</a>, <a class="el" href="songid_8c.html#a1dcd88c13e7b209d9a5b6e31e71ff6e6">songid_pack()</a>, <a class="el" href="songid_8c.html#a4a04f572c79d5f5c4b813ba8c1932f6b">songid_pack3()</a>, and <a class="el" href="unicode_8c.html#a767008fdd0e78d87acbc7f1ad3bf4830">utf8tostr()</a>.</p>

</div>
</div>
<a class="anchor" id="a4b1829345b6bf2af61d6dbbb1b02726b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* strtoutf8 </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function converts an ordinary ISO 8859-1 string to a unicode UTF-8 string</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>the ISO 8859-1 string to convert </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated UTF-8 encoded string with the same content. Should be freed after use. </dd></dl>

<p>Referenced by <a class="el" href="datafile_8c.html#aa0767790f814895d8ddc310d933fb011">datafile_unpack()</a>, <a class="el" href="group__basic.html#gadca7f2a175da4e25244e81a5abafad7d">NJB_Get_Owner_String()</a>, <a class="el" href="playlist_8c.html#a696ec1b911d19920b16b51d865a933f8">playlist_unpack()</a>, and <a class="el" href="songid_8c.html#ab4fd686d31cb66af604ab8cd1b285046">songid_unpack()</a>.</p>

</div>
</div>
<a class="anchor" id="acd147761736f45b4282bebb6147c440a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucs2strlen </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>unicstr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the length (in characters, not bytes) of a unicode UCS-2 string, eg a string which physically is 0x00 0x41 0x00 0x00 will return a value of 1.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">unicstr</td><td>a UCS-2 Unicode string </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the length of the string, in number of characters. If you want to know the length in bytes, multiply this by two and add two (for zero terminator). </dd></dl>

<p>Referenced by <a class="el" href="protocol3_8h.html#a91831b3fc1d2c5ccafd2f62629733074">njb3_create_playlist()</a>, <a class="el" href="protocol3_8h.html#af4c77c8c12bea8f1a8c125e70019d5c1">njb3_update_string_frame()</a>, <a class="el" href="songid_8c.html#a1dcd88c13e7b209d9a5b6e31e71ff6e6">songid_pack()</a>, <a class="el" href="songid_8c.html#a4a04f572c79d5f5c4b813ba8c1932f6b">songid_pack3()</a>, and <a class="el" href="unicode_8c.html#a841f6472d66d10714cb565821cdb627f">ucs2tostr()</a>.</p>

</div>
</div>
<a class="anchor" id="a841f6472d66d10714cb565821cdb627f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* ucs2tostr </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>unicstr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Converts a Unicode UCS-2 2-byte string to a common ISO 8859-1 string quick and dirty (japanese unicodes etc, that use all 16 bits will fail miserably)</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">unicstr</td><td>the UCS-2 unicode string to convert </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated ISO 8859-1 string that tries to resemble the UCS-2 string </dd></dl>

<p>References <a class="el" href="group__unicodeflags.html#ga388e9c70b7a684c777f6b25e2e9d801b">NJB_UC_UTF8</a>, <a class="el" href="unicode_8c.html#ac04b373ed657c74d96015d8935eb57b0">njb_unicode_flag</a>, and <a class="el" href="unicode_8c.html#acd147761736f45b4282bebb6147c440a">ucs2strlen()</a>.</p>

<p>Referenced by <a class="el" href="songid_8c.html#ab4fd686d31cb66af604ab8cd1b285046">songid_unpack()</a>.</p>

</div>
</div>
<a class="anchor" id="a767008fdd0e78d87acbc7f1ad3bf4830"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* utf8tostr </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function approximates an ISO 8859-1 string from a UTF-8 string, leaving out untranslatable characters</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>the UTF-8 string to use as indata </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated ISO 8859-1 string which is as close a possible to the UTF-8 string. </dd></dl>

<p>References <a class="el" href="unicode_8c.html#a7a77d04f2f0563c9c74d28fca28effdd">strtoucs2()</a>.</p>

<p>Referenced by <a class="el" href="datafile_8c.html#aa580707078938ef2447d971a96638ce3">datafile_pack()</a>, <a class="el" href="group__basic.html#gac24779b3f78bf1290d09a2b80db49a3d">NJB_Set_Owner_String()</a>, <a class="el" href="group__playlistapi.html#gae1873045c0cd0eb27465992c3479b975">NJB_Update_Playlist()</a>, and <a class="el" href="songid_8c.html#a1dcd88c13e7b209d9a5b6e31e71ff6e6">songid_pack()</a>.</p>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a60db410c9e82d9e61b1bf0be607922ed"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int __sub_depth</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The current subroutine depth for all of libnjb (global) </p>

</div>
</div>
<a class="anchor" id="ac04b373ed657c74d96015d8935eb57b0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int njb_unicode_flag = <a class="el" href="group__unicodeflags.html#gaaefbf25707acdc9606096ca303c69741">NJB_UC_8859</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>A flag for if unicode is used or not (global) </p>

<p>Referenced by <a class="el" href="unicode_8c.html#a4af1a0bee89d7ee79ebb1bfb557f8e5e">njb_set_unicode()</a>, <a class="el" href="songid_8c.html#a1dcd88c13e7b209d9a5b6e31e71ff6e6">songid_pack()</a>, <a class="el" href="songid_8c.html#ab4fd686d31cb66af604ab8cd1b285046">songid_unpack()</a>, <a class="el" href="unicode_8c.html#a7a77d04f2f0563c9c74d28fca28effdd">strtoucs2()</a>, and <a class="el" href="unicode_8c.html#a841f6472d66d10714cb565821cdb627f">ucs2tostr()</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Apr 28 2014 23:44:57 for libnjb by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>