Clean up white space.

This commit is contained in:
Jan Vidar Krey
2013-03-22 20:00:40 +01:00
parent 5835a06676
commit f25015927a
34 changed files with 232 additions and 232 deletions

View File

@@ -168,24 +168,24 @@ int adc_msg_get_arg_offset(struct adc_message* msg)
{
if (!msg || !msg->cache)
return -1;
switch (msg->cache[0])
{
/* These *SHOULD* never be seen on a hub */
case 'U':
case 'C':
return 4; /* Actually: 4 + strlen(cid). */
case 'I':
case 'H':
return 4;
case 'B':
return 9;
case 'F':
return (10 + (list_size(msg->feature_cast_include)*5) + (list_size(msg->feature_cast_exclude)*5));
case 'D':
case 'E':
return 14;
@@ -200,10 +200,10 @@ int adc_msg_is_empty(struct adc_message* msg)
if (offset == -1)
return -1;
if ((msg->length - 1) == (size_t) offset)
return 1;
return 0;
}
@@ -307,17 +307,17 @@ struct adc_message* adc_msg_copy(const struct adc_message* cmd)
struct adc_message* adc_msg_parse_verify(struct hub_user* u, const char* line, size_t length)
{
struct adc_message* command = adc_msg_parse(line, length);
if (!command)
return 0;
if (command->source && (!u || command->source != u->id.sid))
{
LOG_DEBUG("Command does not match user's SID (command->source=%d, user->id.sid=%d)", command->source, (u ? u->id.sid : 0));
adc_msg_free(command);
return 0;
}
return command;
}
@@ -331,7 +331,7 @@ struct adc_message* adc_msg_parse(const char* line, size_t length)
int ok = 1;
int need_terminate = 0;
struct linked_list* feature_cast_list;
if (command == NULL)
return NULL; /* OOM */
@@ -595,14 +595,14 @@ int adc_msg_remove_named_argument(struct adc_message* cmd, const char prefix_[2]
int found = 0;
int arg_offset = adc_msg_get_arg_offset(cmd);
size_t temp_len = 0;
adc_msg_unterminate(cmd);
start = memmem(&cmd->cache[arg_offset], (cmd->length - arg_offset), prefix, 3);
while (start)
{
endInfo = &cmd->cache[cmd->length];
if (&start[0] < &endInfo[0])
{
end = memchr(&start[1], ' ', &endInfo[0]-&start[1]);
@@ -611,13 +611,13 @@ int adc_msg_remove_named_argument(struct adc_message* cmd, const char prefix_[2]
{
end = NULL;
}
if (end)
{
temp_len = &end[0] - &start[0]; // strlen(start);
endlen = strlen(end);
memmove(start, end, endlen);
start[endlen] = '\0';
found++;
@@ -632,9 +632,9 @@ int adc_msg_remove_named_argument(struct adc_message* cmd, const char prefix_[2]
}
start = memmem(&cmd->cache[arg_offset], (cmd->length - arg_offset), prefix, 3);
}
adc_msg_terminate(cmd);
return found;
}
@@ -683,7 +683,7 @@ char* adc_msg_get_named_argument(struct adc_message* cmd, const char prefix_[2])
length = &end[0] - &start[0];
argument = hub_strndup(start, length);
if (length > 0 && argument[length-1] == '\n')
{
argument[length-1] = 0;

View File

@@ -229,7 +229,7 @@ void adc_msg_unterminate(struct adc_message* cmd);
/**
* @return the offset for the first command argument in msg->cache.
* or -1 if the command is not understood.
* NOTE: for 'U' and 'C' commands (normally not seen by hubs),
* NOTE: for 'U' and 'C' commands (normally not seen by hubs),
* this returns 4. Should be 4 + lengthOf(cid).
*/
int adc_msg_get_arg_offset(struct adc_message* msg);

View File

@@ -47,7 +47,7 @@ sid_t string_to_sid(const char* sid)
sid_t nsid = 0;
sid_t n, x;
sid_t factors[] = { 32768, 1024, 32, 1};
if (!sid || strlen(sid) != 4) return 0;
for (n = 0; n < 4; n++) {