Verified Commit c60ec56c authored by Tomáš Stefan's avatar Tomáš Stefan
Browse files

documentation of modules header, sig_dict, sig_field

parent 1089796c
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -7,9 +7,20 @@

#include "types.h"


/** @brief Read the header at the beginning of the PDF and get the PDF version
 *
 * @param sgl context
 * @return ERR_NONE if success
 */
sigil_err_t process_header(sigil_t *sgl);

/** @brief Tests for the header module
 *
 * @param verbosity output level - 0 means nothing, 1 prints module names with
 *                  the overall module result, and 2 prints also each test inside
 *                  of the module
 * @return 0 if success, 1 if failed
 */
int sigil_header_self_test(int verbosity);

#endif /* PDF_SIGIL_HEADER_H */
+13 −1
Original line number Diff line number Diff line
@@ -7,9 +7,21 @@

#include "types.h"


/** @brief Does the signature dictionary processing. Does't depend on the current
 *         position in the PDF
 *
 * @param sgl context
 * @return ERR_NONE if success
 */
sigil_err_t process_sig_dict(sigil_t *sgl);

/** @brief Tests for the sig_dict module
 *
 * @param verbosity output level - 0 means nothing, 1 prints module names with
 *                  the overall module result, and 2 prints also each test inside
 *                  of the module
 * @return 0 if success, 1 if failed
 */
int sigil_sig_dict_self_test(int verbosity);

#endif /* PDF_SIGIL_SIG_DICT_H */
+22 −2
Original line number Diff line number Diff line
@@ -7,11 +7,31 @@

#include "types.h"


/** @brief Go through all the objects mentioned in the Fields entry from the
 *         interactive form dictionary (AcroForm) and look for the signature
 *         field. If found, save the object reference inside the context
 *
 * @param sgl context
 * @return ERR_NONE if success
 */
sigil_err_t find_sig_field(sigil_t *sgl);

/** @brief Does processing of the signature field and saves the position of the
 *         signature dictionary (V entry). Doesn't depend on the current
 *         position in the PDF
 *
 * @param sgl context
 * @return ERR_NONE if success
 */
sigil_err_t process_sig_field(sigil_t *sgl);

int sigil_sigil_self_test(int verbosity);
/** @brief Tests for the sig_field module
 *
 * @param verbosity output level - 0 means nothing, 1 prints module names with
 *                  the overall module result, and 2 prints also each test inside
 *                  of the module
 * @return 0 if success, 1 if failed
 */
int sigil_sig_field_self_test(int verbosity);

#endif /* PDF_SIGIL_SIG_FIELD_H */
+17 −5
Original line number Diff line number Diff line
@@ -126,30 +126,25 @@ sigil_err_t process_sig_dict(sigil_t *sgl)
            case DICT_KEY_SubFilter:
                if ((err = parse_subfilter(sgl)) != ERR_NONE)
                    return err;

                break;
            case DICT_KEY_Cert:
                err = parse_certs(sgl);
                if (err != ERR_NONE)
                    return err;

                break;
            case DICT_KEY_Contents:
                err = parse_contents(sgl);
                if (err != ERR_NONE)
                    return err;

                break;
            case DICT_KEY_ByteRange:
                if ((err = parse_byte_range(sgl)) != ERR_NONE)
                    return err;

                break;
            case DICT_KEY_UNKNOWN:
                err = skip_dict_unknown_value(sgl);
                if (err != ERR_NONE)
                    return err;

                break;
            default:
                return ERR_PDF_CONTENT;
@@ -160,5 +155,22 @@ sigil_err_t process_sig_dict(sigil_t *sgl)
        return ERR_NONE;

    return err;
}

int sigil_sig_dict_self_test(int verbosity)
{
    print_module_name("sig_dict", verbosity);

    // place for possible later tests
    // ...

    // all tests done
    print_module_result(1, verbosity);
    return 0;

failed:
    print_test_result(0, verbosity);
    print_module_result(0, verbosity);

    return 1;
}
+18 −0
Original line number Diff line number Diff line
@@ -118,3 +118,21 @@ sigil_err_t process_sig_field(sigil_t *sgl)

    return err;;
}

int sigil_sig_field_self_test(int verbosity)
{
    print_module_name("sig_field", verbosity);

    // place for possible later tests
    // ...

    // all tests done
    print_module_result(1, verbosity);
    return 0;

failed:
    print_test_result(0, verbosity);
    print_module_result(0, verbosity);

    return 1;
}
 No newline at end of file
Loading