*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/* Implementation of registry frontend view functions. */
/**********************************************************************
*********************************************************************/
-int regval_convert_multi_sz( uint16 *multi_string, size_t multi_len, char ***values )
+int regval_convert_multi_sz( uint16 *multi_string, size_t byte_len, char ***values )
{
char **sz;
int i;
int num_strings = 0;
fstring buffer;
uint16 *wp;
+ size_t multi_len = byte_len / 2;
- *values = NULL;
-
- if ( !multi_string || !*values )
+ if ( !multi_string || !values )
return 0;
+ *values = NULL;
+
/* just count the NULLs */
for ( i=0; (i<multi_len-1) && !(multi_string[i]==0x0 && multi_string[i+1]==0x0); i++ ) {
- if ( multi_string[i] == 0x0 )
+ /* peek ahead */
+ if ( multi_string[i+1] == 0x0 )
num_strings++;
}
-
+
if ( num_strings == 0 )
return 0;
uint16 *buf, *b;
UNISTR2 sz;
- if ( !values || !*buffer )
+ if ( !values || !buffer )
return 0;
/* go ahead and alloc some space */
for ( i=0; values[i]; i++ ) {
ZERO_STRUCT( sz );
-
+ /* DEBUG(0,("regval_build_multi_sz: building [%s]\n",values[i])); */
init_unistr2( &sz, values[i], UNI_STR_TERMINATE );
/* Alloc some more memory. Always add one one to account for the
buf = b;
/* copy the unistring2 buffer and increment the size */
-
- memcpy( buf+buf_size, sz.buffer, sz.uni_str_len );
+ /* dump_data(1,sz.buffer,sz.uni_str_len*2); */
+ memcpy( buf+buf_size, sz.buffer, sz.uni_str_len*2 );
buf_size += sz.uni_str_len;
/* cleanup rather than leaving memory hanging around */
}
-
-
-
-