]> gitweb @ CieloNegro.org - pkgsrc-cinelerra-cv.git/blob - patches/patch-mpeg3io_c
shmmax patch
[pkgsrc-cinelerra-cv.git] / patches / patch-mpeg3io_c
1 $NetBSD$
2
3 --- libmpeg3/mpeg3io.c.orig     2010-02-01 08:26:23.000000000 +0000
4 +++ libmpeg3/mpeg3io.c
5 @@ -1,7 +1,7 @@
6  #include "mpeg3private.h"
7  #include "mpeg3protos.h"
8  
9 -#include <mntent.h>
10 +#include <fstab.h>
11  #include <stdint.h>
12  #include <stdlib.h>
13  #include <string.h>
14 @@ -35,8 +35,8 @@ int mpeg3_copy_fs(mpeg3_fs_t *dst, mpeg3
15  
16  int64_t mpeg3io_get_total_bytes(mpeg3_fs_t *fs)
17  {
18 -       struct stat64 ostat;
19 -       stat64(fs->path, &ostat);
20 +       struct stat ostat;
21 +       stat(fs->path, &ostat);
22         fs->total_bytes = ostat.st_size;
23         return fs->total_bytes;
24         
25 @@ -50,8 +50,8 @@ int64_t mpeg3io_get_total_bytes(mpeg3_fs
26  
27  int64_t mpeg3io_path_total_bytes(char *path)
28  {
29 -       struct stat64 st;
30 -       if(stat64(path, &st) < 0) return 0;
31 +       struct stat st;
32 +       if(stat(path, &st) < 0) return 0;
33         return st.st_size;
34  }
35  
36 @@ -61,7 +61,7 @@ int mpeg3io_open_file(mpeg3_fs_t *fs)
37         mpeg3_get_keys(fs->css, fs->path);
38  
39  //printf("mpeg3io_open_file 1 %s\n", fs->path);
40 -       if(!(fs->fd = fopen64(fs->path, "rb")))
41 +       if(!(fs->fd = fopen(fs->path, "rb")))
42         {
43                 if (fs->path) fprintf(stderr,"[mpeg3io_open_file] Error opening file '%s': ",fs->path);
44                 perror("");
45 @@ -162,7 +162,7 @@ void mpeg3io_read_buffer(mpeg3_fs_t *fs)
46  
47  
48  
49 -               fseeko64(fs->fd, new_buffer_position, SEEK_SET);
50 +               fseek(fs->fd, new_buffer_position, SEEK_SET);
51                 fread(fs->buffer, 1, remainder_start, fs->fd);
52  
53  
54 @@ -177,7 +177,7 @@ void mpeg3io_read_buffer(mpeg3_fs_t *fs)
55                 fs->buffer_position = fs->current_byte;
56                 fs->buffer_offset = 0;
57  
58 -               result = fseeko64(fs->fd, fs->buffer_position, SEEK_SET);
59 +               result = fseek(fs->fd, fs->buffer_position, SEEK_SET);
60  //printf("mpeg3io_read_buffer 2 %llx %llx\n", fs->buffer_position, ftell(fs->fd));
61                 fs->buffer_size = fread(fs->buffer, 1, MPEG3_IO_SIZE, fs->fd);
62  
63 @@ -216,27 +216,27 @@ void mpeg3io_complete_path(char *complet
64  
65  int mpeg3io_device(char *path, char *device)
66  {
67 -       struct stat64 file_st, device_st;
68 -    struct mntent *mnt;
69 -       FILE *fp;
70 +       struct stat file_st, device_st;
71 +    struct fstab *mnt;
72 +       int fp;
73  
74 -       if(stat64(path, &file_st) < 0)
75 +       if(stat(path, &file_st) < 0)
76         {
77                 perror("mpeg3io_device");
78                 return 1;
79         }
80  
81 -       fp = setmntent(MOUNTED, "r");
82 -    while(fp && (mnt = getmntent(fp)))
83 +       fp = setfsent();
84 +    while(fp && (mnt = getfsent()))
85         {
86 -               if(stat64(mnt->mnt_fsname, &device_st) < 0) continue;
87 +               if(stat(mnt->fs_spec, &device_st) < 0) continue;
88                 if(device_st.st_rdev == file_st.st_dev)
89                 {
90 -                       strncpy(device, mnt->mnt_fsname, MPEG3_STRLEN);
91 +                       strncpy(device, mnt->fs_spec, MPEG3_STRLEN);
92                         break;
93                 }
94         }
95 -       endmntent(fp);
96 +       endfsent();
97  
98         return 0;
99  }