Skip to content

Commit

Permalink
maint(gpg2john.c): add missing prototypes
Browse files Browse the repository at this point in the history
The clang compiler was complaining with the error message: "Passing
arguments to a function without a prototype is deprecated in all
versions of C".

Signed-off-by: Claudio André <[email protected]>
  • Loading branch information
claudioandre-br committed Dec 2, 2024
1 parent 364b1ca commit 5e8bffe
Showing 1 changed file with 74 additions and 6 deletions.
80 changes: 74 additions & 6 deletions src/gpg2john.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ Private_Packet(int len)
*/


typedef void (*funcptr)();
typedef void (*funcptr)(int);

private int get_new_len(int);
private int is_partial(int);
Expand Down Expand Up @@ -1295,7 +1295,7 @@ TAG[] = {
#define TAG_NUM (sizeof(TAG) * sizeof(string))

private void
(*tag_func[])() = {
(*tag_func[])(int) = {
Reserved,
Public_Key_Encrypted_Session_Key_Packet,
Signature_Packet,
Expand All @@ -1305,7 +1305,7 @@ private void
Public_Key_Packet,
Secret_Subkey_Packet,
Compressed_Data_Packet,
Symmetrically_Encrypted_Data_Packet,
NULL,
Marker_Packet,
Literal_Data_Packet,
Trust_Packet,
Expand All @@ -1314,7 +1314,7 @@ private void
NULL,
NULL,
User_Attribute_Packet,
Symmetrically_Encrypted_and_MDC_Packet,
NULL,
Modification_Detection_Code_Packet,
NULL,
NULL,
Expand Down Expand Up @@ -1363,6 +1363,74 @@ private void
Private_Packet,
};

private void
(*tag_func1[])(int, int, int, char *) = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
Symmetrically_Encrypted_Data_Packet,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
Symmetrically_Encrypted_and_MDC_Packet,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};

char *pkt_type(int tag) {
switch(tag) {
case 0: return "Reserved";
Expand Down Expand Up @@ -1629,7 +1697,7 @@ parse_packet(char *hash)
if (tag < TAG_NUM && tag_func[tag] != NULL) {
if (gpg_dbg)
fprintf(stderr, "Packet type %d, len %d at offset %d (Processing) (pkt-type %s) (Partial %s)\n", tag, len, offset, pkt_type(tag), partial?"yes":"no");
(*tag_func[tag])(len, 1, partial, hash); // first packet (possibly only one if partial is false).
(*tag_func1[tag])(len, 1, partial, hash); // first packet (possibly only one if partial is false).
} else {
if (gpg_dbg)
fprintf(stderr, "Packet type %d, len %d at offset %d (Skipping) (Partial %s)\n", tag, len, offset, partial?"yes":"no");
Expand All @@ -1651,7 +1719,7 @@ parse_packet(char *hash)
if (tag < TAG_NUM && tag_func[tag] != NULL) {
if (gpg_dbg)
fprintf(stderr, "Packet type %d, len %d at offset %d (Processing) (pkt-type %s) (Partial %s)\n", tag, len, offset, pkt_type(tag), partial?"yes":"no");
(*tag_func[tag])(len, 0, partial, hash); // subsquent packets.
(*tag_func1[tag])(len, 0, partial, hash); // subsquent packets.
} else
skip(len);
}
Expand Down

0 comments on commit 5e8bffe

Please sign in to comment.