It is currently Fri Jan 18, 2019 10:43 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: #PB_Any returning negative values
PostPosted: Fri Jan 11, 2019 2:32 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Apr 27, 2010 3:20 pm
Posts: 118
Location: Wales, United Kingdom
This seems to only affect linux, and both of my machines (Ubuntu 18.04 x64, Linux Mint x64).

LoadSprite(#PB_Any, ...) fails because #PB_Any seems to be returning a negative value.

EDIT: It seems to be under very specific circumstances - will update when investigated further

_________________
Thanks!


Last edited by Env on Fri Jan 11, 2019 3:00 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: #PB_Any returning negative values
PostPosted: Fri Jan 11, 2019 2:37 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 893
Location: right here
You should check for non-zero, not for greater zero. Why do you think it fails? What does IsSprite() tell you? If you use variables then what type are they?

<edit>
works here
Code:
InitSprite()
UsePNGImageDecoder()

win=OpenWindow(#PB_Any, 50,100, ww,wh, "", style) :: AddKeyboardShortcut(win, #PB_Shortcut_Escape, 10)
OpenWindowedScreen(WindowID(win), 0,0, ww,wh, 0,0,0)

;file.s = #PB_Compiler_Home + "examples/3D/Data/PureBasic3DLogo.png" ; windows
file.s = #PB_Compiler_Home + "examples/3d/Data/PureBasic3DLogo.png" ; linux

Debug file
Debug FileSize(file)
sp.i = LoadSprite(#PB_Any, file)
Debug sp

;   /home/user/purebasic_570_lts/examples/3d/Data/PureBasic3DLogo.png
;   30617
;   26190776


Top
 Profile  
Reply with quote  
 Post subject: Re: #PB_Any returning negative values
PostPosted: Fri Jan 11, 2019 2:58 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 22, 2003 7:43 pm
Posts: 323
Location: Germany, Saarbrücken
Why are you posting things in the Bugs forum if there is no bug?

There are no negative handles, but wrong conversions to a decimal number.

_________________
Electronics, Crazy & Interesting Stuff, all that with text, image and sound? Click here!

The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.


Top
 Profile  
Reply with quote  
 Post subject: Re: #PB_Any returning negative values
PostPosted: Fri Jan 11, 2019 3:06 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 543
Location: France
#PB_Any is a negative constant
Code:
Debug #PB_Any
Code:
-1

But used as an object identifier in a function xxx(#PB_Any, ... it is just used to indicate that the object identifier must be generated by the return value.

:wink:

Not a bug: moderator, please move this topic to 'Coding Questions' (?)

_________________
English is not my native language, I use an online translator


Top
 Profile  
Reply with quote  
 Post subject: Re: #PB_Any returning negative values
PostPosted: Fri Jan 11, 2019 6:20 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Apr 27, 2010 3:20 pm
Posts: 118
Location: Wales, United Kingdom
Mod, you can actually delete lol

For some reason another change to the main code seems to have made the issue disappear. Not PB bug.. 4 hour grind mind-bug

_________________
Thanks!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye