Reading too few bytes

2006-03-21 Thread Paul J. Lucas
Here's a small test program:

#include fcntl.h
#include cstdlib
#include iostream

using namespace std;

int main() {
int fd = ::open( ESLF, O_RDONLY );
if ( fd == -1 ) {
cerr  could not open ESLF file  endl;
::exit( 1 );
}
char buf[ 64 ];
ssize_t bytesRead = ::read( fd, buf, sizeof( buf ) );
cout  read   bytesRead   bytes  endl;
::close( fd );
}

Here's the contents of a small biinary file ESLF (printed in hex bytes):

54 39 CA 1A 44

When I compile the program as:

g++ -o test test.cpp

and run it, it prints read 5 bytes as one would expect.  When I compile
the program as:

g++ -mno-cygwin -o test test.cpp

and run it, it prints read 3 bytes.  Why?  How do I teg it to read all
5 bytes?

- Paul


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: fopen with UTF-8 chars in filenames

2006-03-17 Thread Paul J. Lucas
On Thu, 16 Mar 2006, Christopher Faylor wrote:

 I don't know if doing what the OP wants is possible on Cygwin ...

I solved my problem by using _wfopen() and converting the path
to UTF-16 first.  Unless there's a way to work directly with
UTF-8, I'll stick with that.

- Paul

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: fopen with UTF-8 chars in filenames

2006-03-17 Thread Paul J. Lucas
On Fri, 17 Mar 2006, Christopher Faylor wrote:

 Cygwin doesn't provide _wfopen.

1. I install Cygwin.
2. It's in stdio.h that gets installed as part of the Cygwin install.

Therefore, as far as I'm concerned, it's in Cygwin.

 So, if you are using _wfopen you stopped using Cygwin, then, too, possibly
 using -mno-cygwin.

As it happens, I am suppliying -mno-cygwin.

 I am trying to do what this person did INSERT URL HERE and I get an
 unreferenced error

Then why does it work for me?

- Paul

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



fopen with UTF-8 chars in filenames

2006-03-14 Thread Paul J. Lucas
Is this known to work (or not work)?  Apparently, it doesn't.

FYI: I'm writing JNI code.  The strings passed from Java to C
are UTF-8.  A string containing a non-ASCII character, e.g., an
'e' with an accent, works fine with fopen() under Mac OS X.  The
same JNI code under Cygwin fails.

- Paul

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



stat(2) of a directory

2006-03-04 Thread Paul J. Lucas
Under *nix, I can use stat(2) of a directory to know when its
contents have changed (file added or deleted from it).

Under cygwin, this doesn't work because a directory's
modification time doesn't change when its contents change.

Any recommendations as to how to monitor a directory to know
when its contents change under cygwin?

- Paul

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Missing INTERNET_CONNECTED_INFO ?

2006-02-20 Thread Paul J. Lucas
Why isn't this structure declared in wininet.h like this:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internet_connected_info.asp

says it is?  Same goes for INTERNET_STATE_CONNECTED,
INTERNET_STATE_DISCONNECTED, etc.

- Paul

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



libtiff, libjpeg, cygwin compile problems

2005-12-04 Thread Paul J. Lucas
I'm trying to compile libtiff (using libjpeg) under cygwin and
I'm getting all kinds of compile-time errors.  FYI: I need to
compile with the -mno-cygwin flag to gcc since my software as a
whole can't depend on the end-user having cygwin installed.

libjpeg (version 6b) compiles and works just fine by itself.
However, if I try to compile libtiff (version 3.7.4) using my
compiled libjpeg, I get lots of errors (a sample of which are
below).

I did find some information about a cygwin patch:

http://www.cygwin.com/ml/cygwin-announce/2000/msg00050.html

for libjpeg and applied the patch, but it didn't help.

How can I get libtiff to compile with libjpeg?

- Paul


libjpeg/include/jmorecfg.h:195: error: conflicting types for 'INT32'
usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/basetsd.h:52: 
error: previous declaration of 'INT32' was here
In file included from tif_jpeg.c:75:
libjpeg/include/jpeglib.h:99: error: parse error before boolean
libjpeg/include/jpeglib.h:541: error: parse error before '*' token
libjpeg/include/jpeglib.h:640: error: conflicting types for 'master'
libjpeg/include/jpeglib.h:416: error: previous declaration of 'master' was here
libjpeg/include/jpeglib.h:641: warning: 'main' is usually a function
libjpeg/include/jpeglib.h:641: error: conflicting types for 'main'
libjpeg/include/jpeglib.h:417: error: previous declaration of 'main' was here
libjpeg/include/jpeglib.h:642: error: conflicting types for 'codec'
libjpeg/include/jpeglib.h:419: error: previous declaration of 'codec' was here
libjpeg/include/jpeglib.h:645: error: conflicting types for 'marker'
libjpeg/include/jpeglib.h:420: error: previous declaration of 'marker' was here
libjpeg/include/jpeglib.h:647: error: conflicting types for 'cconvert'
libjpeg/include/jpeglib.h:421: error: previous declaration of 'cconvert' was 
here
libjpeg/include/jpeglib.h:649: error: parse error before '}' token
tif_jpeg.c:116: error: field `c' has incomplete type
tif_jpeg.c:117: error: field `d' has incomplete type
tif_jpeg.c:118: error: field `comm' has incomplete type
tif_jpeg.c:128: error: field `dest' has incomplete type
tif_jpeg.c:129: error: field `src' has incomplete type
tif_jpeg.c: In function `TIFFjpeg_error_exit':
tif_jpeg.c:215: error: dereferencing pointer to incomplete type
tif_jpeg.c: In function `TIFFjpeg_output_message':
tif_jpeg.c:231: error: dereferencing pointer to incomplete type
tif_jpeg.c: In function `TIFFjpeg_create_compress':
tif_jpeg.c:252: error: invalid application of `sizeof' to incomplete type 
`jpeg_compress_struct' 
tif_jpeg.c: In function `TIFFjpeg_create_decompress':
tif_jpeg.c:263: error: invalid application of `sizeof' to incomplete type 
`jpeg_decompress_struct' 
tif_jpeg.c: At top level:
tif_jpeg.c:395: error: `std_empty_output_buffer' declared as function returning 
a function
tif_jpeg.c:446: error: `tables_empty_output_buffer' declared as function 
returning a function
tif_jpeg.c: In function `tables_empty_output_buffer':
tif_jpeg.c:454: error: dereferencing pointer to incomplete type
tif_jpeg.c:454: error: dereferencing pointer to incomplete type

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



windres VERSIONINFO not working

2005-11-17 Thread Paul J. Lucas
I'm trying to use gcc and windres to build a small native
Windows application.  When compiling, I'm using -mno-cygwin;
when linking, I'm using -mwindows.  To generate a .res file from
a .rc file, I'm using:

windres -O coff $ $@

in my makefile.  Everything seems to work and the generated
executable also shows its icon as specified in the .rc file, but
there's no version information tab in Windows explorer.  My .rc
file is below.

Any ideas why this doesn't work and how to make it work?

- Paul

#include windows.h

My_Icon ICON MyIcon.ico

My_Version VERSIONINFO
FILEVERSION 1,0,5,0
PRODUCTVERSION  1,0,5,0
FILEFLAGSMASK   0
FILEFLAGS   0
FILEOS  VOS__WINDOWS32
FILETYPEVFT_APP
FILESUBTYPE 0
{
BLOCK StringFileInfo
{
BLOCK 0x040904E4  // U.S. English + Windows
{
VALUE CompanyName, My Company, Inc.
VALUE FileDescription, Best application ever
VALUE FileVersion, 1.0.5
VALUE InternalName, WIdget
VALUE LegalCopyright, Copyright \251 2005 Me.
VALUE OriginalFilename, Widget.exe
VALUE ProductName, Widget
VALUE ProductVersion, 1.0.5
}
}
BLOCK VarFileInfo
{
VALUE Translation, 0x0409,0
}
}

/* vim:set et sw=4 ts=4: */

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Error in GetICMProfile() declaration

2005-11-11 Thread Paul J. Lucas
In /usr/include/w32api/wingdi.h, GetICMProfile() has its second argument
declared as a DWORD.  According to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/icm/icm_5aed.asp

it should be declared as an LPDWORD.  Indeed, in order to call this
function correctly, I current have to do something like:

HDC dc = GetDC( NULL );
char path[ MAX_PATH ];
DWORD len = sizeof path;
GetICMProfile( dc, (DWORD)len, path );

So this really looks like a bug in the declaration.

- Paul

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/