LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-01-2005, 05:24 AM   #1
B00H
LQ Newbie
 
Registered: Oct 2005
Location: Sussex
Posts: 10

Rep: Reputation: 0
Unhappy Integer Constant is too large


Hello guys, hope you all are OK.

Its me again, its a beautiful day out and I am playing with Linux again! (hurrah!) \o/

I am trying to install a program called Pasco. (apparently it runs on windows too), when I try to run the make file I get an error:

gcc -o pasco pasco.c -lm -lc;cp pasco ../bin
pasco.c: In function 'win_time_to_unix':
pasco.c.100: warning: integer constant is too large for "long" type.

I have googled the error and found that a few other people are having this problem too (with other programs) but I have not found out how to remedy it yet.

I have Suse v9 point something (sorry!), I have done online updates and I have run make files before so I think I have all the gubbins I need.

Can anyone translate this error for me so I can find out whats wrong?

Many thanks for your help again!

Booh
xx

Last edited by B00H; 11-01-2005 at 05:36 AM.
 
Old 11-01-2005, 06:25 AM   #2
tlowk
Member
 
Registered: Nov 2003
Location: Belgium
Distribution: Slackware
Posts: 184

Rep: Reputation: 36
can you give that line and a couple of lines around the line, to see what kind of value is assigned, since a long seems big for me, I'm curious what you try to store

tlowk
 
Old 11-01-2005, 07:01 AM   #3
B00H
LQ Newbie
 
Registered: Oct 2005
Location: Sussex
Posts: 10

Original Poster
Rep: Reputation: 0
Hi tlowk,

Thanks for your reply, the lines above is everything that it output after running the make install command.

The last line does show 100 if that is any use?

Thanks for your help,

Booh
xx
 
Old 11-01-2005, 07:37 AM   #4
tlowk
Member
 
Registered: Nov 2003
Location: Belgium
Distribution: Slackware
Posts: 184

Rep: Reputation: 36
what I need is a part from the file pasco.c around line 100, but it can be also
in a subdirectory

find . -name pasco.c -print

head -n 120 pasco.c | tail -n 50
 
Old 11-01-2005, 08:42 AM   #5
B00H
LQ Newbie
 
Registered: Oct 2005
Location: Sussex
Posts: 10

Original Poster
Rep: Reputation: 0
Here it is:

time_t win_time_to_unix( char *val ) {
unsigned long low, high;
double dbl;
time_t total;

char fourbytes[4];

fourbytes[0] = val[0];
fourbytes[1] = val[1];
fourbytes[2] = val[2];
fourbytes[3] = val[3];

low = bah_to_i( fourbytes, 4 );

fourbytes[0] = val[4];
fourbytes[1] = val[5];
fourbytes[2] = val[6];
fourbytes[3] = val[7];

high = bah_to_i( fourbytes, 4 );

dbl = ((double)high)*(pow(2,32));
dbl += (double)(low);

if ( dbl==0 ) {
return 0;
}

dbl *= 1.0e-7;
dbl -= 11644473600;

total = (double)dbl;

return total;
}

//
/* This function prepares a string for nice output */
//
int printablestring( char *str ) {
int i;

i = 0;
while ( str[i] != '\0' ) {
if ( (unsigned char)str[i] < 32 || (unsigned char)str[i] > 127 ) {
str[i] = ' ';
}
i++;
}
return 0;

Thanks for your help

Booh
xx
 
Old 11-01-2005, 09:29 AM   #6
kees-jan
Member
 
Registered: Sep 2004
Distribution: Debian, Ubuntu, BeatrIX, OpenWRT
Posts: 273

Rep: Reputation: 30
The offending line is most likely
Code:
 dbl -= 11644473600;
The constant here (when interpreted as an integer) is five bytes. I always thought longs were 8, but still...

Anyway. Change the line to
Code:
 dbl -= 11644473600.0;
and you should be fine.

Groetjes,

Kees-Jan
 
Old 11-01-2005, 09:33 AM   #7
tlowk
Member
 
Registered: Nov 2003
Location: Belgium
Distribution: Slackware
Posts: 184

Rep: Reputation: 36
I don't know what bah_to_i means exactly but try this

replace :
low = bah_to_i( fourbytes, 4 );

with
low=(int)fourbytes[0];
low<<=8; low+=(int)fourbytes[1];
low<<=8; low+=(int)fourbytes[2];
low<<=8; low+=(int)fourbytes[3];

and replace
high = bah_to_i( fourbytes, 4 );
with:

high=(int)fourbytes[4];
high<<=8; high+=(int)fourbytes[5];
high<<=8; high+=(int)fourbytes[6];
high<<=8; high+=(int)fourbytes[7];


if the result is not what you expect replace the order of the index of the
fourbytes eg (3,2,1,0) and (7,6,5,4)

This could solve your problem, althoug it is not so elegant
 
Old 11-01-2005, 09:39 AM   #8
B00H
LQ Newbie
 
Registered: Oct 2005
Location: Sussex
Posts: 10

Original Poster
Rep: Reputation: 0
Thank you so much!

It has worked \o/

Yet again LQ and the team saves the day.

Thank you Kees-Jan

Take care

Booh
xx
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Integer Numbers in C Mercurius Programming 24 10-20-2005 09:54 AM
Constant HD access LouFogle SUSE / openSUSE 4 11-24-2004 11:00 AM
64 bit integer fahad153 Programming 9 08-26-2003 02:03 AM
Oh, that constant pinging... thosm Linux - Networking 4 07-31-2003 01:32 PM
Large drive- too much space lost by large block size? tome Linux - General 5 12-14-2001 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration