Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/shared/dmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ mallocflag CreateBlockInfo(bbyte *pbNew, size_t sizeNew){
assert(pbNew != NULL && sizeNew != 0);

pbi = (blockinfo *)malloc(sizeof(blockinfo));
if( pbi != NULL){
if(pbi != NULL){
pbi->pb = pbNew;
pbi->size = sizeNew;
pbi->pbiNext = pbiHead;
Expand Down
28 changes: 12 additions & 16 deletions Source/shared/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
/* Implementation that should never be optimized out by the compiler */
/* ------------------ mbedtls_zeroize ------------------------ */

static void mbedtls_zeroize( void *v, size_t n ){
static void mbedtls_zeroize( void *v, size_t n){
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ void mbedtls_md5_init( mbedtls_md5_context *ctx )

void mbedtls_md5_free( mbedtls_md5_context *ctx )
{
if( ctx == NULL )
if(ctx == NULL)
return;

mbedtls_zeroize( ctx, sizeof( mbedtls_md5_context ) );
Expand Down Expand Up @@ -257,7 +257,7 @@ void mbedtls_md5_update( mbedtls_md5_context *ctx, const unsigned char *input, s
size_t fill;
uint32_t left;

if( ilen == 0 )
if(ilen == 0)
return;

left = ctx->total[0] & 0x3F;
Expand All @@ -266,11 +266,10 @@ void mbedtls_md5_update( mbedtls_md5_context *ctx, const unsigned char *input, s
ctx->total[0] += (uint32_t) ilen;
ctx->total[0] &= 0xFFFFFFFF;

if( ctx->total[0] < (uint32_t) ilen )
if(ctx->total[0] < (uint32_t) ilen )
ctx->total[1]++;

if( left && ilen >= fill )
{
if(left && ilen >= fill){
memcpy( (void *) (ctx->buffer + left), input, fill );
mbedtls_md5_process( ctx, ctx->buffer );
input += fill;
Expand All @@ -285,8 +284,7 @@ void mbedtls_md5_update( mbedtls_md5_context *ctx, const unsigned char *input, s
ilen -= 64;
}

if( ilen > 0 )
{
if(ilen > 0){
memcpy( (void *) (ctx->buffer + left), input, ilen );
}
}
Expand Down Expand Up @@ -395,26 +393,24 @@ int mbedtls_md5_self_test( int verbose )
int i;
unsigned char md5sum[16];

for( i = 0; i < 7; i++ )
{
if( verbose != 0 )
for(i = 0; i < 7; i++){
if(verbose != 0 )
mbedtls_printf( " MD5 test #%d: ", i + 1 );

mbedtls_md5( md5_test_buf[i], md5_test_buflen[i], md5sum );

if( memcmp( md5sum, md5_test_sum[i], 16 ) != 0 )
{
if( verbose != 0 )
if(memcmp( md5sum, md5_test_sum[i], 16 ) != 0){
if(verbose != 0 )
mbedtls_printf( "failed\n" );

return( 1 );
}

if( verbose != 0 )
if(verbose != 0 )
mbedtls_printf( "passed\n" );
}

if( verbose != 0 )
if(verbose != 0 )
mbedtls_printf( "\n" );

return( 0 );
Expand Down
2 changes: 1 addition & 1 deletion Source/shared/readhvac.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void GetCellXYZs(float *xyz, int nxyz, int ncells, float **xyz_cellptr,
fractions_cell[ncells] = 1.0;

int i1, i2, nmerge;
for(i1 = 0, i2 = 0, nmerge = 0; i1 < nxyz || i2 < ncells; ){
for(i1 = 0, i2 = 0, nmerge = 0; i1 < nxyz || i2 < ncells;){
if(i1 >= nxyz){
fractions_both[nmerge++] = fractions_cell[i2++];
continue;
Expand Down
4 changes: 2 additions & 2 deletions Source/shared/readimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ unsigned char *ReadJPEG(const char *filename,int *width, int *height, int *is_tr
HEIGHT=gdImageSY(image);
*width=WIDTH;
*height=HEIGHT;
if( NewMemory((void **)&dataptr,(unsigned int)(4*WIDTH*HEIGHT) )==0){
if(NewMemory((void **)&dataptr,(unsigned int)(4*WIDTH*HEIGHT) )==0){
gdImageDestroy(image);
return NULL;
}
Expand Down Expand Up @@ -69,7 +69,7 @@ unsigned char *ReadPNG(const char *filename,int *width, int *height, int *is_tra
fclose(file);
*width=gdImageSX(image);
*height=gdImageSY(image);
if( NewMemory((void **)&dataptr,(unsigned int)(4*(*width)*(*height)) )==0){
if(NewMemory((void **)&dataptr,(unsigned int)(4*(*width)*(*height)) )==0){
gdImageDestroy(image);
return NULL;
}
Expand Down
10 changes: 5 additions & 5 deletions Source/shared/readobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void FreeObject(sv_object *object){

frame_start = &object->first_frame;
framei = frame_start->next;
for(; framei->next != NULL; ){
for(; framei->next != NULL;){
sv_object_frame *next_frame;

next_frame = framei->next;
Expand Down Expand Up @@ -126,7 +126,7 @@ sv_object *GetSmvObjectType2(object_collection *objectscoll, char *olabel,
if(strlen(labelptr) == 0) return default_object;
object_start = objectscoll->object_def_first.next;
objecti = object_start;
for(; objecti->next != NULL; ){
for(; objecti->next != NULL;){
if(STRCMP(labelptr, objecti->label) == 0){
objecti->used = 1;
return objecti;
Expand Down Expand Up @@ -1283,7 +1283,7 @@ int ReadObjectDefs(object_collection *objectscoll, const char *file){
object_start = objectscoll->object_def_first.next;
objecti = object_start;
objectscoll->nobject_defs = 0;
for(; objecti->next != NULL; ){
for(; objecti->next != NULL;){
CheckMemory;
(objectscoll->nobject_defs)++;
objecti->obj_frames = NULL;
Expand All @@ -1303,7 +1303,7 @@ int ReadObjectDefs(object_collection *objectscoll, const char *file){
object_start = objectscoll->object_def_first.next;
objecti = object_start;
i = 0;
for(; objecti->next != NULL; ){
for(; objecti->next != NULL;){
sv_object_frame *frame_start, *framei;

CheckMemory;
Expand All @@ -1312,7 +1312,7 @@ int ReadObjectDefs(object_collection *objectscoll, const char *file){
frame_start = objecti->first_frame.next;
framei = frame_start;
j = 0;
for(; framei->next != NULL; ){
for(; framei->next != NULL;){
int npushpop = 0, ii;

CheckMemory;
Expand Down
8 changes: 4 additions & 4 deletions Source/shared/readsmvfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3871,7 +3871,7 @@ int ParseSLCFProcess(smv_case *scase, int option, bufferstreamdata *stream, char
if(FGETS(buffer, 255, stream)==NULL){
return RETURN_BREAK;
}
if( (Match(buffer, "SLCF") == 1) ||
if((Match(buffer, "SLCF") == 1) ||
(Match(buffer, "SLCC") == 1) ||
#ifdef pp_SLFC
(Match(buffer, "SLFC") == 1) ||
Expand Down Expand Up @@ -4226,7 +4226,7 @@ int ParseSLCFProcess(smv_case *scase, int option, bufferstreamdata *stream, char
sd->full_mesh = YES;
}
if(sd->slice_filetype==SLICE_CELL_CENTER){
if( sd->is1==sd->is2&&sd->is1==1)sd->cell_center_edge = 1;
if(sd->is1==sd->is2&&sd->is1==1)sd->cell_center_edge = 1;
if(sd->cell_center_edge==0&&sd->js1==sd->js2&&sd->js1==1)sd->cell_center_edge = 1;
if(sd->cell_center_edge==0&&sd->ks1==sd->ks2&&sd->ks1==1)sd->cell_center_edge = 1;
if(sd->cell_center_edge==0&&sd->is1==sd->is2&&sd->is1==meshi->ibar)sd->cell_center_edge = 1;
Expand Down Expand Up @@ -5328,7 +5328,7 @@ int ReadSMV_Parse(smv_case *scase, bufferstreamdata *stream){

//*** SLCF

if( (MatchSMV(buffer, "SLCF") == 1) ||
if((MatchSMV(buffer, "SLCF") == 1) ||
(MatchSMV(buffer, "SLCC") == 1) ||
#ifdef pp_SLFC
(MatchSMV(buffer, "SLFC") == 1) ||
Expand Down Expand Up @@ -8621,7 +8621,7 @@ typedef struct {
++++++++++++++++++++++ SLCF ++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
if( (MatchSMV(buffer, "SLCF") == 1) ||
if((MatchSMV(buffer, "SLCF") == 1) ||
(MatchSMV(buffer, "SLCC") == 1) ||
#ifdef pp_SLFC
(MatchSMV(buffer, "SLFC") == 1) ||
Expand Down
2 changes: 1 addition & 1 deletion Source/shared/readtour.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ keyframe *CopyFrame(const keyframe *framei) {
void DeleteTourFrames(tourdata *thistour) {
keyframe *frame;

for(frame = thistour->first_frame.next; frame->next != NULL; ){
for(frame = thistour->first_frame.next; frame->next != NULL;){
keyframe *next;

next = frame->next;
Expand Down
31 changes: 14 additions & 17 deletions Source/shared/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

/* ------------------ mbedtls_zeroize ------------------------ */

static void mbedtls_zeroize( void *v, size_t n ){
static void mbedtls_zeroize( void *v, size_t n){
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
}

Expand Down Expand Up @@ -91,7 +91,7 @@ void mbedtls_sha1_init( mbedtls_sha1_context *ctx )

void mbedtls_sha1_free( mbedtls_sha1_context *ctx )
{
if( ctx == NULL )
if(ctx == NULL)
return;

mbedtls_zeroize( ctx, sizeof( mbedtls_sha1_context ) );
Expand Down Expand Up @@ -292,7 +292,7 @@ void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input,
size_t fill;
uint32_t left;

if( ilen == 0 )
if(ilen == 0)
return;

left = ctx->total[0] & 0x3F;
Expand All @@ -301,11 +301,10 @@ void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input,
ctx->total[0] += (uint32_t) ilen;
ctx->total[0] &= 0xFFFFFFFF;

if( ctx->total[0] < (uint32_t) ilen )
if(ctx->total[0] < (uint32_t) ilen)
ctx->total[1]++;

if( left && ilen >= fill )
{
if(left && ilen >= fill){
memcpy( (void *) (ctx->buffer + left), input, fill );
mbedtls_sha1_process( ctx, ctx->buffer );
input += fill;
Expand All @@ -320,7 +319,7 @@ void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input,
ilen -= 64;
}

if( ilen > 0 )
if(ilen > 0)
memcpy( (void *) (ctx->buffer + left), input, ilen );
}

Expand Down Expand Up @@ -424,18 +423,17 @@ int mbedtls_sha1_self_test( int verbose )
/*
* SHA-1
*/
for( i = 0; i < 3; i++ )
for(i = 0; i < 3; i++)
{
if( verbose != 0 )
if(verbose != 0 )
mbedtls_printf( " SHA-1 test #%d: ", i + 1 );

mbedtls_sha1_starts( &ctx );

if( i == 2 )
{
if(i == 2){
memset( buf, 'a', buflen = 1000 );

for( j = 0; j < 1000; j++ )
for(j = 0; j < 1000; j++)
mbedtls_sha1_update( &ctx, buf, buflen );
}
else
Expand All @@ -444,20 +442,19 @@ int mbedtls_sha1_self_test( int verbose )

mbedtls_sha1_finish( &ctx, sha1sum );

if( memcmp( sha1sum, sha1_test_sum[i], 20 ) != 0 )
{
if( verbose != 0 )
if(memcmp( sha1sum, sha1_test_sum[i], 20 ) != 0){
if(verbose != 0 )
mbedtls_printf( "failed\n" );

ret = 1;
goto exit;
}

if( verbose != 0 )
if(verbose != 0)
mbedtls_printf( "passed\n" );
}

if( verbose != 0 )
if(verbose != 0)
mbedtls_printf( "\n" );

exit:
Expand Down
Loading
Loading