mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Expose the rest of LoadedFile in headers.
This will allow it to be used more conveniently for things other than key files. For the moment, the implementation still lives in sshpubk.c. Moving it out into utils.c or misc.c would be nicer, but it has awkward dependencies on marshal.c and the per-platform f_open function. Perhaps another time.
This commit is contained in:
12
sshpubk.c
12
sshpubk.c
@ -44,13 +44,7 @@ static const ptrlen rsa1_signature =
|
||||
(x)=='+' ? 62 : \
|
||||
(x)=='/' ? 63 : 0 )
|
||||
|
||||
typedef enum {
|
||||
LF_OK, /* file loaded successfully */
|
||||
LF_TOO_BIG, /* file didn't fit in buffer */
|
||||
LF_ERROR, /* error from stdio layer */
|
||||
} LoadFileStatus;
|
||||
|
||||
static LoadedFile *lf_new(size_t max_size)
|
||||
LoadedFile *lf_new(size_t max_size)
|
||||
{
|
||||
LoadedFile *lf = snew_plus(LoadedFile, max_size);
|
||||
lf->data = snew_plus_get_aux(lf);
|
||||
@ -66,7 +60,7 @@ void lf_free(LoadedFile *lf)
|
||||
sfree(lf);
|
||||
}
|
||||
|
||||
static LoadFileStatus lf_load_fp(LoadedFile *lf, FILE *fp)
|
||||
LoadFileStatus lf_load_fp(LoadedFile *lf, FILE *fp)
|
||||
{
|
||||
lf->len = 0;
|
||||
while (lf->len < lf->max_size) {
|
||||
@ -94,7 +88,7 @@ static LoadFileStatus lf_load_fp(LoadedFile *lf, FILE *fp)
|
||||
return status;
|
||||
}
|
||||
|
||||
static LoadFileStatus lf_load(LoadedFile *lf, const Filename *filename)
|
||||
LoadFileStatus lf_load(LoadedFile *lf, const Filename *filename)
|
||||
{
|
||||
FILE *fp = f_open(filename, "rb", false);
|
||||
if (!fp)
|
||||
|
Reference in New Issue
Block a user