mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
Whitespace changes only
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37345 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
1
acl.c
1
acl.c
@@ -423,3 +423,4 @@ int ast_find_ourip(struct in_addr *ourip, struct sockaddr_in bindaddr)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
94
sha1.c
94
sha1.c
@@ -90,8 +90,7 @@ void SHA1ProcessMessageBlock(SHA1Context *);
|
||||
*/
|
||||
int SHA1Reset(SHA1Context *context)
|
||||
{
|
||||
if (!context)
|
||||
{
|
||||
if (!context) {
|
||||
return shaNull;
|
||||
}
|
||||
|
||||
@@ -135,34 +134,27 @@ int SHA1Result( SHA1Context *context,
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!context || !Message_Digest)
|
||||
{
|
||||
if (!context || !Message_Digest) {
|
||||
return shaNull;
|
||||
}
|
||||
|
||||
if (context->Corrupted)
|
||||
{
|
||||
if (context->Corrupted) {
|
||||
return context->Corrupted;
|
||||
}
|
||||
|
||||
if (!context->Computed)
|
||||
{
|
||||
if (!context->Computed) {
|
||||
SHA1PadMessage(context);
|
||||
for(i=0; i<64; ++i)
|
||||
{
|
||||
for (i = 0; i < 64; ++i) {
|
||||
/* message may be sensitive, clear it out */
|
||||
context->Message_Block[i] = 0;
|
||||
}
|
||||
context->Length_Low = 0; /* and clear length */
|
||||
context->Length_High = 0;
|
||||
context->Computed = 1;
|
||||
|
||||
}
|
||||
|
||||
for(i = 0; i < SHA1HashSize; ++i)
|
||||
{
|
||||
Message_Digest[i] = context->Intermediate_Hash[i>>2]
|
||||
>> 8 * ( 3 - ( i & 0x03 ) );
|
||||
for (i = 0; i < SHA1HashSize; ++i) {
|
||||
Message_Digest[i] = context->Intermediate_Hash[i >> 2] >> 8 * ( 3 - ( i & 0x03 ) );
|
||||
}
|
||||
|
||||
return shaSuccess;
|
||||
@@ -188,48 +180,38 @@ int SHA1Result( SHA1Context *context,
|
||||
* sha Error Code.
|
||||
*
|
||||
*/
|
||||
int SHA1Input( SHA1Context *context,
|
||||
const uint8_t *message_array,
|
||||
unsigned length)
|
||||
{
|
||||
if (!length)
|
||||
int SHA1Input(SHA1Context *context, const uint8_t *message_array, unsigned length)
|
||||
{
|
||||
if (!length) {
|
||||
return shaSuccess;
|
||||
}
|
||||
|
||||
if (!context || !message_array)
|
||||
{
|
||||
if (!context || !message_array) {
|
||||
return shaNull;
|
||||
}
|
||||
|
||||
if (context->Computed)
|
||||
{
|
||||
if (context->Computed) {
|
||||
context->Corrupted = shaStateError;
|
||||
return shaStateError;
|
||||
}
|
||||
|
||||
if (context->Corrupted)
|
||||
{
|
||||
if (context->Corrupted) {
|
||||
return context->Corrupted;
|
||||
}
|
||||
while(length-- && !context->Corrupted)
|
||||
{
|
||||
context->Message_Block[context->Message_Block_Index++] =
|
||||
(*message_array & 0xFF);
|
||||
|
||||
while (length-- && !context->Corrupted) {
|
||||
context->Message_Block[context->Message_Block_Index++] = (*message_array & 0xFF);
|
||||
|
||||
context->Length_Low += 8;
|
||||
if (context->Length_Low == 0)
|
||||
{
|
||||
if (context->Length_Low == 0) {
|
||||
context->Length_High++;
|
||||
if (context->Length_High == 0)
|
||||
{
|
||||
if (context->Length_High == 0) {
|
||||
/* Message is too long */
|
||||
context->Corrupted = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (context->Message_Block_Index == 64)
|
||||
{
|
||||
if (context->Message_Block_Index == 64) {
|
||||
SHA1ProcessMessageBlock(context);
|
||||
}
|
||||
|
||||
@@ -275,16 +257,14 @@ void SHA1ProcessMessageBlock(SHA1Context *context)
|
||||
/*
|
||||
* Initialize the first 16 words in the array W
|
||||
*/
|
||||
for(t = 0; t < 16; t++)
|
||||
{
|
||||
for (t = 0; t < 16; t++) {
|
||||
W[t] = context->Message_Block[t * 4] << 24;
|
||||
W[t] |= context->Message_Block[t * 4 + 1] << 16;
|
||||
W[t] |= context->Message_Block[t * 4 + 2] << 8;
|
||||
W[t] |= context->Message_Block[t * 4 + 3];
|
||||
}
|
||||
|
||||
for(t = 16; t < 80; t++)
|
||||
{
|
||||
for (t = 16; t < 80; t++) {
|
||||
W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
|
||||
}
|
||||
|
||||
@@ -294,10 +274,8 @@ void SHA1ProcessMessageBlock(SHA1Context *context)
|
||||
D = context->Intermediate_Hash[3];
|
||||
E = context->Intermediate_Hash[4];
|
||||
|
||||
for(t = 0; t < 20; t++)
|
||||
{
|
||||
temp = SHA1CircularShift(5,A) +
|
||||
((B & C) | ((~B) & D)) + E + W[t] + K[0];
|
||||
for (t = 0; t < 20; t++) {
|
||||
temp = SHA1CircularShift(5,A) + ((B & C) | ((~B) & D)) + E + W[t] + K[0];
|
||||
E = D;
|
||||
D = C;
|
||||
C = SHA1CircularShift(30,B);
|
||||
@@ -305,8 +283,7 @@ void SHA1ProcessMessageBlock(SHA1Context *context)
|
||||
A = temp;
|
||||
}
|
||||
|
||||
for(t = 20; t < 40; t++)
|
||||
{
|
||||
for (t = 20; t < 40; t++) {
|
||||
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
|
||||
E = D;
|
||||
D = C;
|
||||
@@ -315,10 +292,8 @@ void SHA1ProcessMessageBlock(SHA1Context *context)
|
||||
A = temp;
|
||||
}
|
||||
|
||||
for(t = 40; t < 60; t++)
|
||||
{
|
||||
temp = SHA1CircularShift(5,A) +
|
||||
((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
|
||||
for (t = 40; t < 60; t++) {
|
||||
temp = SHA1CircularShift(5,A) + ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
|
||||
E = D;
|
||||
D = C;
|
||||
C = SHA1CircularShift(30,B);
|
||||
@@ -326,8 +301,7 @@ void SHA1ProcessMessageBlock(SHA1Context *context)
|
||||
A = temp;
|
||||
}
|
||||
|
||||
for(t = 60; t < 80; t++)
|
||||
{
|
||||
for (t = 60; t < 80; t++) {
|
||||
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
|
||||
E = D;
|
||||
D = C;
|
||||
@@ -377,26 +351,20 @@ void SHA1PadMessage(SHA1Context *context)
|
||||
* block, process it, and then continue padding into a second
|
||||
* block.
|
||||
*/
|
||||
if (context->Message_Block_Index > 55)
|
||||
{
|
||||
if (context->Message_Block_Index > 55) {
|
||||
context->Message_Block[context->Message_Block_Index++] = 0x80;
|
||||
while(context->Message_Block_Index < 64)
|
||||
{
|
||||
while (context->Message_Block_Index < 64) {
|
||||
context->Message_Block[context->Message_Block_Index++] = 0;
|
||||
}
|
||||
|
||||
SHA1ProcessMessageBlock(context);
|
||||
|
||||
while(context->Message_Block_Index < 56)
|
||||
{
|
||||
while (context->Message_Block_Index < 56) {
|
||||
context->Message_Block[context->Message_Block_Index++] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
context->Message_Block[context->Message_Block_Index++] = 0x80;
|
||||
while(context->Message_Block_Index < 56)
|
||||
{
|
||||
while (context->Message_Block_Index < 56) {
|
||||
context->Message_Block[context->Message_Block_Index++] = 0;
|
||||
}
|
||||
}
|
||||
|
59
tdd.c
59
tdd.c
@@ -71,12 +71,20 @@ static int tdd_decode_baudot(struct tdd_state *tdd,unsigned char data) /* covert
|
||||
'\n','$','4','\'',',','<EFBFBD>',':','(',
|
||||
'5','+',')','2','<EFBFBD>','6','0','1',
|
||||
'9','7','<EFBFBD>','^','.','/','=','^' };
|
||||
int d;
|
||||
d=0; /* return 0 if not decodeable */
|
||||
int d = 0; /* return 0 if not decodeable */
|
||||
switch (data) {
|
||||
case 0x1f : tdd->modo=0; break;
|
||||
case 0x1b : tdd->modo=1; break;
|
||||
default: if (tdd->modo==0) d=ltrs[data]; else d=figs[data]; break;
|
||||
case 0x1f:
|
||||
tdd->modo = 0;
|
||||
break;
|
||||
case 0x1b:
|
||||
tdd->modo = 1;
|
||||
break;
|
||||
default:
|
||||
if (tdd->modo == 0)
|
||||
d = ltrs[data];
|
||||
else
|
||||
d = figs[data];
|
||||
break;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
@@ -120,9 +128,7 @@ int ast_tdd_gen_ecdisa(unsigned char *outbuf, int len)
|
||||
int pos = 0;
|
||||
int cnt;
|
||||
while (len) {
|
||||
cnt = len;
|
||||
if (cnt > sizeof(ecdisa))
|
||||
cnt = sizeof(ecdisa);
|
||||
cnt = len > sizeof(ecdisa) ? sizeof(ecdisa) : len;
|
||||
memcpy(outbuf + pos, ecdisa, cnt);
|
||||
pos += cnt;
|
||||
len -= cnt;
|
||||
@@ -267,49 +273,41 @@ int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *str)
|
||||
#if 0
|
||||
printf("%c",c); fflush(stdout);
|
||||
#endif
|
||||
if (c == 0) /* send null */
|
||||
{
|
||||
if (c == 0) { /* send null */
|
||||
PUT_TDD(0);
|
||||
continue;
|
||||
}
|
||||
if (c == '\r') /* send c/r */
|
||||
{
|
||||
if (c == '\r') { /* send c/r */
|
||||
PUT_TDD(8);
|
||||
continue;
|
||||
}
|
||||
if (c == '\n') /* send c/r and l/f */
|
||||
{
|
||||
if (c == '\n') { /* send c/r and l/f */
|
||||
PUT_TDD(8);
|
||||
PUT_TDD(2);
|
||||
continue;
|
||||
}
|
||||
if (c == ' ') /* send space */
|
||||
{
|
||||
if (c == ' ') { /* send space */
|
||||
PUT_TDD(4);
|
||||
continue;
|
||||
}
|
||||
for(i = 0; i < 31; i++)
|
||||
{
|
||||
if (lstr[i] == c) break;
|
||||
for (i = 0; i < 31; i++) {
|
||||
if (lstr[i] == c)
|
||||
break;
|
||||
}
|
||||
if (i < 31) /* if we found it */
|
||||
{
|
||||
if (tdd->mode) /* if in figs mode, change it */
|
||||
{
|
||||
if (i < 31) { /* if we found it */
|
||||
if (tdd->mode) { /* if in figs mode, change it */
|
||||
PUT_TDD(31); /* Send LTRS */
|
||||
tdd->mode = 0;
|
||||
}
|
||||
PUT_TDD(i);
|
||||
continue;
|
||||
}
|
||||
for(i = 0; i < 31; i++)
|
||||
{
|
||||
if (fstr[i] == c) break;
|
||||
for (i = 0; i < 31; i++) {
|
||||
if (fstr[i] == c)
|
||||
break;
|
||||
}
|
||||
if (i < 31) /* if we found it */
|
||||
{
|
||||
if (tdd->mode != 1) /* if in ltrs mode, change it */
|
||||
{
|
||||
if (i < 31) { /* if we found it */
|
||||
if (tdd->mode != 1) { /* if in ltrs mode, change it */
|
||||
PUT_TDD(27); /* send FIGS */
|
||||
tdd->mode = 1;
|
||||
}
|
||||
@@ -320,4 +318,3 @@ int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *str)
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -687,3 +687,4 @@ unsigned int ast_translate_path_steps(unsigned int dest, unsigned int src)
|
||||
else
|
||||
return tr_matrix[src][dest].multistep + 1;
|
||||
}
|
||||
|
||||
|
4
ulaw.c
4
ulaw.c
@@ -94,13 +94,13 @@ void ast_ulaw_init(void)
|
||||
f = mu & 0x0f;
|
||||
y = f * (1 << (e + 3));
|
||||
y += etab[e];
|
||||
if (mu & 0x80) y = -y;
|
||||
if (mu & 0x80)
|
||||
y = -y;
|
||||
__ast_mulaw[i] = y;
|
||||
}
|
||||
/* set up the reverse (mu-law) conversion table */
|
||||
for (i = -32768; i < 32768; i++) {
|
||||
__ast_lin2mu[((unsigned short)i) >> 2] = linear2ulaw(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
4
utils.c
4
utils.c
@@ -1050,7 +1050,7 @@ char *ast_process_quotes_and_slashes(char *start, char find, char replace_with)
|
||||
return dataPut;
|
||||
}
|
||||
|
||||
void ast_join(char *s, size_t len, char * const w[])
|
||||
void ast_join(char *s, size_t len, const char *w[])
|
||||
{
|
||||
int x, ofs = 0;
|
||||
const char *src;
|
||||
@@ -1156,6 +1156,7 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
|
||||
}
|
||||
|
||||
AST_MUTEX_DEFINE_STATIC(fetchadd_m); /* used for all fetc&add ops */
|
||||
|
||||
int ast_atomic_fetchadd_int_slow(volatile int *p, int v)
|
||||
{
|
||||
int ret;
|
||||
@@ -1191,3 +1192,4 @@ int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user