Results 1 to 6 of 6

Thread: Size Limit Fix

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Size Limit Fix

    I got error :
    Code:
    1>c:\users\georgi\documents\visual studio 2010\projects\mfs\mfs\configs.cpp(302): warning C4305: 'argument' : truncation from '__int64' to 'INT'
    maybe becouse my code (number is big)
    Code:
    // Max Zen Config
    bool MaxZen ( char * ini )
    {
    	DWORD MaxZ;
    	MaxZ = GetPrivateProfileInt("Zen","MaxZen_Inventory",200000000000,ini);
    	*(unsigned int*) GS_MAX_ZEN = MaxZ ;
    
    	MaxZ = GetPrivateProfileInt("Zen","MaxZen_Vault",100000000000,ini);
    	*(unsigned int*) GS_MAX_ZEN_W = MaxZ ;
    
    	MaxZ = GetPrivateProfileInt("Zen","MaxZen_Vault2",200000000000,ini);
    	*(unsigned int*) GS_MAX_ZEN_W2 = MaxZ ;
    
    	MaxZ = GetPrivateProfileInt("Zen","MaxZen_Vault3",300000000000,ini);
    	*(unsigned int*) GS_MAX_ZEN_W3 = MaxZ ;
    	return 1;
    }
    //End

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Size Limit Fix

    The values you are passing to GetPrivateProfileInt are 64 bit ints. These are truncated in order to fit the INT datatype, which is most likely a 32 bit integer.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Re: Size Limit Fix

    so how to fix the code ?

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Size Limit Fix

    one crazy idea would be to just pass values that fall within range of the INT type.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Re: Size Limit Fix

    so if it read the value from the .ini file will be okey? or still will not work the code ?
    how to fix it what need to be added or changed to work normal

  6. #6
    Junior Member
    Join Date
    May 2011
    Posts
    23

    Re: Size Limit Fix

    Whether you are reading from a .ini file or not, you still need to use smaller values to qualify as an integer.
    Simply cut off a few digits from the value listed in the .ini, and make the same change in your code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width