Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed optxxx var undefined in src/webpng.c under MSVC #512

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

willson-chen
Copy link
Member

unistd.h can not included by src/webpng.c under MSVC. So optind opterr and related var are unavaible.

@willson-chen
Copy link
Member Author

@vapier hi, could you please spare some time to offer some suggestion? I want improve the build under windows platform.

@willson-chen
Copy link
Member Author

Hi @vapier @cmb69, could you please spare some time to review this PR.

I have test this PR on win10 with cmake and it works.

But getopt is only used in webpng.c, which is not the lib source file, but a tool source file. Beside it, there are gdtopng.c, pngtogd.c, gdparttopng, gd2topng, pngtogd2, annotate, gd2copyal, gd2togif, giftogd2 in tool source file list. I don't know if someone still use these tools, but I think it is better to move them to a new folder named tools. The build failure of these tool source files block adding windows platform to CI.

What do you think? :)

@cmb69
Copy link
Contributor

cmb69 commented May 24, 2020

This looks okay to me. I wonder. though, if it makes sense to maintain these tools; they actually look more like examples to me, and their names are somewhat arbitrary.

@willson-chen
Copy link
Member Author

they actually look more like examples to me

Take gd2topng.cfor example. It generates a executable program, which is used to transform image from gd2 to png formats. It can be treated as a tools, or an example to show the transformation.

I strongly recommand to move them to a new folder, make srcdir only contain the source files used to generate the library file. What do you think we should deal with them?

#ifndef GETOPT_H
#define GETOPT_H 1

#ifdef __cplusplus
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if there is necessity in having cpp guard for c library header

@@ -2,6 +2,10 @@
#include "config.h"
#endif

#ifdef WIN32
#include "getopt.h"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header is good way to declare functions, but I haven't seen headers in this library and this functionality is used only in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants