FileAttributesPlugin missing header

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FileAttributesPlugin missing header

Tobias Pape
 
Hi All, Hi Alistair

Good to have the new file attributes plugin.

However, it has a compile error: it uses PATH_MAX, but for this to work it needs <limits.h>

in my branch I already include limits.h but this is only sufficient on linux, where limits.h gets included by some other system header, apparently.


Here's the code: FileAttributesPlugin.c
============================================= snip ============================================================


#include "config.h"
#include <math.h>                                // <<< system headers that might not include limits.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <dirent.h>
#ifdef WIN32
#include <windows.h>
#include <winbase.h>
#define FAIL() { return -1; }
#include "sqWin32File.h"
#endif
typedef struct dirptrstruct {
    DIR *dp;
                int path_len;
    char *path_file;
    char path[PATH_MAX+4];             // << use of PATH_MAX from limits.h
    } osdir;
#include <sys/stat.h>
#if !defined(HAVE_LSTAT) && !defined(WIN32)
#define HAVE_LSTAT 1
#endif
#include <unistd.h>
/* AKG 2017 - FileAttributesPlugin.c translated from class FileAttributesPlugin */

/* Default EXPORT macro that does nothing (see comment in sq.h): */
#define EXPORT(returnType) returnType
================================================= snap ==========================================

Can someone please "#include <limits.h>"  somewhere there?

Best regards
        -Tobias

Reply | Threaded
Open this post in threaded view
|

Re: FileAttributesPlugin missing header

alistairgrant
 
Hi Tobias,


On 9 March 2018 at 00:00, Tobias Pape <[hidden email]> wrote:

>
> Hi All, Hi Alistair
>
> Good to have the new file attributes plugin.
>
> However, it has a compile error: it uses PATH_MAX, but for this to work it needs <limits.h>
>
> in my branch I already include limits.h but this is only sufficient on linux, where limits.h gets included by some other system header, apparently.
>
>
> Here's the code: FileAttributesPlugin.c
> ============================================= snip ============================================================
>
>
> #include "config.h"
> #include <math.h>                                // <<< system headers that might not include limits.h
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <time.h>
> #include <sys/types.h>
> #include <dirent.h>
> #ifdef WIN32
> #include <windows.h>
> #include <winbase.h>
> #define FAIL() { return -1; }
> #include "sqWin32File.h"
> #endif
> typedef struct dirptrstruct {
>                 DIR *dp;
>                 int path_len;
>                 char *path_file;
>                 char path[PATH_MAX+4];             // << use of PATH_MAX from limits.h
>                 } osdir;
> #include <sys/stat.h>
> #if !defined(HAVE_LSTAT) && !defined(WIN32)
> #define HAVE_LSTAT 1
> #endif
> #include <unistd.h>
> /* AKG 2017 - FileAttributesPlugin.c translated from class FileAttributesPlugin */
>
> /* Default EXPORT macro that does nothing (see comment in sq.h): */
> #define EXPORT(returnType) returnType
> ================================================= snap ==========================================
>
> Can someone please "#include <limits.h>"  somewhere there?


Shall do.

Cheers,
Alistair
Reply | Threaded
Open this post in threaded view
|

Re: FileAttributesPlugin missing header

alistairgrant
 
Hi Tobias & Eliot,

On 9 March 2018 at 08:09, Alistair Grant <[hidden email]> wrote:

> Hi Tobias,
>
>
> On 9 March 2018 at 00:00, Tobias Pape <[hidden email]> wrote:
>>
>> Hi All, Hi Alistair
>>
>> Good to have the new file attributes plugin.
>>
>> However, it has a compile error: it uses PATH_MAX, but for this to work it needs <limits.h>
>>
>> in my branch I already include limits.h but this is only sufficient on linux, where limits.h gets included by some other system header, apparently.
>>
>>
>> Here's the code: FileAttributesPlugin.c
>> ============================================= snip ============================================================
>>
>>
>> #include "config.h"
>> #include <math.h>                                // <<< system headers that might not include limits.h
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <string.h>
>> #include <time.h>
>> #include <sys/types.h>
>> #include <dirent.h>
>> #ifdef WIN32
>> #include <windows.h>
>> #include <winbase.h>
>> #define FAIL() { return -1; }
>> #include "sqWin32File.h"
>> #endif
>> typedef struct dirptrstruct {
>>                 DIR *dp;
>>                 int path_len;
>>                 char *path_file;
>>                 char path[PATH_MAX+4];             // << use of PATH_MAX from limits.h
>>                 } osdir;
>> #include <sys/stat.h>
>> #if !defined(HAVE_LSTAT) && !defined(WIN32)
>> #define HAVE_LSTAT 1
>> #endif
>> #include <unistd.h>
>> /* AKG 2017 - FileAttributesPlugin.c translated from class FileAttributesPlugin */
>>
>> /* Default EXPORT macro that does nothing (see comment in sq.h): */
>> #define EXPORT(returnType) returnType
>> ================================================= snap ==========================================
>>
>> Can someone please "#include <limits.h>"  somewhere there?
>
>
> Shall do.

FileAttributesPlugin.c should already include limits.h (the slang does).  But...

When Eliot regenerated all the code yesterday it went back to a *very*
early version.

Eliot, my guess is that this happened because the slang code hasn't
been integrated in to the VMMaker repository yet (it's still in my
personal repository on smalltalkhub.com).  If you agree, I'll add it
to the VMMaker-Plugins package.

Cheers,
Alistair