Deleted Added
full compact
magic.c (299234) magic.c (299736)
1/*
2 * Copyright (c) Christos Zoulas 2003.
3 * All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28#ifdef WIN32
29#include <windows.h>
30#include <shlwapi.h>
31#endif
32
33#include "file.h"
34
35#ifndef lint
1/*
2 * Copyright (c) Christos Zoulas 2003.
3 * All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28#ifdef WIN32
29#include <windows.h>
30#include <shlwapi.h>
31#endif
32
33#include "file.h"
34
35#ifndef lint
36FILE_RCSID("@(#)$File: magic.c,v 1.97 2016/03/31 17:51:12 christos Exp $")
36FILE_RCSID("@(#)$File: magic.c,v 1.99 2016/05/03 16:09:38 christos Exp $")
37#endif /* lint */
38
39#include "magic.h"
40
41#include <stdlib.h>
42#include <unistd.h>
43#include <string.h>
44#ifdef QUICK

--- 473 unchanged lines hidden (view full) ---

518 }
519
520 (void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
521 if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
522 goto done;
523 rv = 0;
524done:
525 free(buf);
37#endif /* lint */
38
39#include "magic.h"
40
41#include <stdlib.h>
42#include <unistd.h>
43#include <string.h>
44#ifdef QUICK

--- 473 unchanged lines hidden (view full) ---

518 }
519
520 (void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
521 if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
522 goto done;
523 rv = 0;
524done:
525 free(buf);
526 if (pos != (off_t)-1)
527 (void)lseek(fd, pos, SEEK_SET);
528 close_and_restore(ms, inname, fd, &sb);
526 if (fd != -1) {
527 if (pos != (off_t)-1)
528 (void)lseek(fd, pos, SEEK_SET);
529 close_and_restore(ms, inname, fd, &sb);
530 }
529out:
530 return rv == 0 ? file_getbuffer(ms) : NULL;
531}
532
533
534public const char *
535magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
536{

--- 111 unchanged lines hidden ---
531out:
532 return rv == 0 ? file_getbuffer(ms) : NULL;
533}
534
535
536public const char *
537magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
538{

--- 111 unchanged lines hidden ---