#PB_Any returning negative values

Just starting out? Need help? Post your questions and find answers here.
Env
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 27, 2010 3:20 pm
Location: Wales, United Kingdom

#PB_Any returning negative values

Post by Env »

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
Last edited by Env on Fri Jan 11, 2019 3:00 pm, edited 1 time in total.
Thanks!
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: #PB_Any returning negative values

Post by #NULL »

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: Select all

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
User avatar
NicTheQuick
Addict
Addict
Posts: 1224
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: #PB_Any returning negative values

Post by NicTheQuick »

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.
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.
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: #PB_Any returning negative values

Post by Marc56us »

#PB_Any is a negative constant

Code: Select all

Debug #PB_Any

Code: Select all

-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' (?)
Env
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 27, 2010 3:20 pm
Location: Wales, United Kingdom

Re: #PB_Any returning negative values

Post by Env »

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!
Post Reply