From fe671f4aebfa218f5a42e47621e683280fea214e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 11 Apr 2014 18:06:44 +0200 Subject: [PATCH] Add markers around generated code in error.c --- library/error.c | 4 ++++ scripts/data_files/error.fmt | 6 ++++++ scripts/generate_errors.pl | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/library/error.c b/library/error.c index 1eac108c0..c6c9838e2 100644 --- a/library/error.c +++ b/library/error.c @@ -198,6 +198,7 @@ void polarssl_strerror( int ret, char *buf, size_t buflen ) // High level error codes // + // BEGIN generated code #if defined(POLARSSL_CIPHER_C) if( use_ret == -(POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE) ) snprintf( buf, buflen, "CIPHER - The selected feature is not available" ); @@ -483,6 +484,7 @@ void polarssl_strerror( int ret, char *buf, size_t buflen ) if( use_ret == -(POLARSSL_ERR_X509_FILE_IO_ERROR) ) snprintf( buf, buflen, "X509 - Read/write of file failed" ); #endif /* POLARSSL_X509_USE,X509_CREATE_C */ + // END generated code if( strlen( buf ) == 0 ) snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); @@ -511,6 +513,7 @@ void polarssl_strerror( int ret, char *buf, size_t buflen ) // Low level error codes // + // BEGIN generated code #if defined(POLARSSL_AES_C) if( use_ret == -(POLARSSL_ERR_AES_INVALID_KEY_LENGTH) ) snprintf( buf, buflen, "AES - Invalid key length" ); @@ -710,6 +713,7 @@ void polarssl_strerror( int ret, char *buf, size_t buflen ) if( use_ret == -(POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH) ) snprintf( buf, buflen, "XTEA - The data input has an invalid length" ); #endif /* POLARSSL_XTEA_C */ + // END generated code if( strlen( buf ) != 0 ) return; diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt index 30ee257a5..413682f1b 100644 --- a/scripts/data_files/error.fmt +++ b/scripts/data_files/error.fmt @@ -63,7 +63,10 @@ void polarssl_strerror( int ret, char *buf, size_t buflen ) // High level error codes // + // BEGIN generated code HIGH_LEVEL_CODE_CHECKS + // END generated code + if( strlen( buf ) == 0 ) snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); } @@ -91,7 +94,10 @@ HIGH_LEVEL_CODE_CHECKS // Low level error codes // + // BEGIN generated code LOW_LEVEL_CODE_CHECKS + // END generated code + if( strlen( buf ) != 0 ) return; diff --git a/scripts/generate_errors.pl b/scripts/generate_errors.pl index 5631ae8e2..1bea6e687 100755 --- a/scripts/generate_errors.pl +++ b/scripts/generate_errors.pl @@ -135,11 +135,11 @@ while (my $line = ) if ($ll_old_define ne "") { - $ll_code_check .= "#endif /* POLARSSL_${ll_old_define}_C */\n\n"; + $ll_code_check .= "#endif /* POLARSSL_${ll_old_define}_C */\n"; } if ($hl_old_define ne "") { - $hl_code_check .= "#endif /* POLARSSL_${hl_old_define}_C */\n\n"; + $hl_code_check .= "#endif /* POLARSSL_${hl_old_define}_C */\n"; } $error_format =~ s/HEADER_INCLUDED\n/$headers/g;