Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3846 → Rev 3845

/branches/network/uspace/srv/net/measured_strings.c
27,12 → 27,11
*/
 
/** @addtogroup net
* @{
* @{
*/
 
/** @file
* A character string with measured length implementation file.
* @see measured_strings.h
/**
* @file
*/
 
#include <errno.h>
40,7 → 39,6
#include <stdio.h>
#include <string.h>
#include <unistd.h>
 
#include <ipc/ipc.h>
 
#include "err.h"
47,13 → 45,7
#include "measured_strings.h"
#include "modules.h"
 
/** Computes the lengths of the measured strings in the given array.
* @param strings The measured strings array to be processed. Input parameter.
* @param count The measured strings array size. Input parameter.
* @returns The computed sizes array.
* @returns NULL if there is no memory left.
*/
size_t * prepare_lengths( const measured_string_ref strings, size_t count );
size_t * prepare_lengths( measured_string_ref strings, size_t count );
 
measured_string_ref measured_string_create_bulk( const char * string, size_t length ){
measured_string_ref new;
65,9 → 57,7
if( ! new ) return NULL;
new->length = length;
new->value = (( char * ) new ) + sizeof( measured_string_t );
// append terminating zero explicitly - to be safe
memcpy( new->value, string, new->length );
new->value[ new->length ] = '\0';
memcpy( new->value, string, new->length + 1 );
return new;
}
 
74,10 → 64,10
int measured_strings_receive( measured_string_ref * strings, char ** data, size_t count ){
ERROR_DECLARE;
 
size_t * lengths;
int index;
size_t length;
char * next;
size_t * lengths;
int index;
size_t length;
char * next;
ipc_callid_t callid;
 
if(( ! strings ) || ( ! data ) || ( count <= 0 )){
127,12 → 117,12
return EOK;
}
 
int measured_strings_reply( const measured_string_ref strings, size_t count ){
int measured_strings_reply( measured_string_ref strings, size_t count ){
ERROR_DECLARE;
 
size_t * lengths;
int index;
size_t length;
size_t * lengths;
int index;
size_t length;
ipc_callid_t callid;
 
if(( ! strings ) || ( count <= 0 )){
166,7 → 156,7
ERROR_DECLARE;
 
size_t * lengths;
int index;
int index;
char * next;
 
if(( phone <= 0 ) || ( ! strings ) || ( ! data ) || ( count <= 0 )){
203,11 → 193,11
return EOK;
}
 
int measured_strings_send( int phone, const measured_string_ref strings, size_t count ){
int measured_strings_send( int phone, measured_string_ref strings, size_t count ){
ERROR_DECLARE;
 
size_t * lengths;
int index;
int index;
 
if(( phone <= 0 ) || ( ! strings ) || ( count <= 0 )){
return EINVAL;
227,9 → 217,9
return EOK;
}
 
size_t * prepare_lengths( const measured_string_ref strings, size_t count ){
size_t * prepare_lengths( measured_string_ref strings, size_t count ){
size_t * lengths;
int index;
int index;
size_t length;
 
lengths = ( size_t * ) malloc( sizeof( size_t ) * ( count + 1 ));