Commit graph

14 commits

Author SHA1 Message Date
Micah Snyder
15eef50656 Code cleanup: Refactor to clean up formatting issues
Refactored the clamscan code that determines 'what to scan' in order
to clean up some very messy logic and also to get around a difference in
how vscode and clang-format handle formatting #ifdef blocks in the
middle of an else/if.

In addition to refactoring, there is a slight behavior improvement. With
this change, doing `clamscan blah -` will now scan `blah` and then also
scan `stdin`.  You can even do `clamscan - blah` to now scan `stdin` and
then scan `blah`. Before, The `-` had to be the only "filename" argument
in order to scan from stdin.

In addition, added a bunch of extra empty lines or changing multi-line
function calls to single-line function calls in order to get around a
bug in clang-format with these two options do not playing nice together:
- AlignConsecutiveAssignments: true
- AlignAfterOpenBracket: true

AlignAfterOpenBracket is not taking account the spaces inserted by
AlignConsecutiveAssignments, so you end up with stuff like this:
```c
    bleeblah = 1;
    blah     = function(arg1,
                    arg2,
                    arg3);

                //  ^--- these args 4-left from where they should be.
```

VSCode, meanwhile, somehow fixes this whitespace issue so code that is
correctly formatted by VSCode doesn't have this bug, meaning that:

1. The clang-format check in GH Actions fails.
2. We'd all have to stop using format-on-save in VSCode and accept the
  bug if we wanted those GH Actions tests to pass.

Adding an empty line before variable assignments from multi-line
function calls evades the buggy behavior.

This commit should resolve the clang-format github action test failures,
for now.
2022-03-22 10:42:46 -07:00
mko-x
a21cc6dcd7
Add explicit log level parameter to application logging API
* Added loglevel parameter to logg()

* Fix logg and mprintf internals with new loglevels

* Update all logg calls to set loglevel

* Update all mprintf calls to set loglevel

* Fix hidden logg calls

* Executed clam-format
2022-02-15 15:13:55 -08:00
Micah Snyder
b3e82e5e61 Replacing libclamav/cltypes.h with clamav-types.h.in, which generates a header clamav-types.h that we install alongside clamav.h. 2019-10-02 16:08:17 -04:00
Micah Snyder
72fd33c8b2 clang-format'd using new .clang-format rules. 2019-10-02 16:08:16 -04:00
Kevin Lin
3ae8211ca6 added implementation of cli_qsort_r (qsort with cb arg) 2015-05-21 15:03:46 -04:00
Shawn Webb
60d8d2c352 Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00
Shawn Webb
b2e7c931d0 Use OpenSSL for hashing. 2014-02-08 00:31:12 -05:00
Tomasz Kojm
bb1e844cc2 fix some warnings 2010-01-27 16:06:12 +01:00
Tomasz Kojm
e1b21aeec4 another missing parentheses (bb#1769) 2009-12-03 17:35:09 +01:00
Tomasz Kojm
f032fb29f0 libclamav/qsort.c: fix CMP1 macro (bb#1769) 2009-12-02 23:17:59 +01:00
Tomasz Kojm
51e223fe17 libclamav/qsort.c: don't call med3 when using internal cmp 2009-11-17 18:04:12 +01:00
aCaB
1cc4f4e326 fix build of internal qsort in win32 2009-11-16 23:16:56 +01:00
Tomasz Kojm
15ae50177a fix some compile warnings 2009-11-16 20:08:28 +01:00
Tomasz Kojm
424d41d344 libclamav: replace qsort implementation and optimize its common usage (bb#1721) 2009-11-16 19:27:35 +01:00