Search found 12 matches

by NilsH
Fri May 24, 2024 3:56 pm
Forum: Bugs - Documentation
Topic: Base64EncoderBuffer(): Bad explanation of OutputSize parameter, example with bug, and weird behavior of function itself.
Replies: 4
Views: 1899

Re: Base64EncoderBuffer(): Bad explanation of OutputSize parameter, example with bug, and weird behavior of function its



As you can see, there are still problems.

Yes, you are right, because of the padding.

I'm not exactly sure what you mean by that. I do know that Base64 usually pads its output to a multiple of 4 characters, because 4 output characters map exactly to 3 input bytes.
My point is that the manual ...
by NilsH
Thu May 23, 2024 10:15 pm
Forum: Feature Requests and Wishlists
Topic: IDE Improvement: Logarithmic scale for the Profiler
Replies: 0
Views: 848

IDE Improvement: Logarithmic scale for the Profiler

Hello!

I want to suggest an improvement to the Profiler tool (from the Debugger menu).
When you have some lines in your code that are executed several million times, the horizontal scale of the chart becomes so large that you can no longer see the other lines that are executed much less often.

I ...
by NilsH
Thu May 23, 2024 9:56 pm
Forum: Bugs - Documentation
Topic: Base64EncoderBuffer(): Bad explanation of OutputSize parameter, example with bug, and weird behavior of function itself.
Replies: 4
Views: 1899

Re: Base64EncoderBuffer(): Bad explanation of OutputSize parameter, example with bug, and weird behavior of function its


At some point Base64Encoder was introduced, which returns a string instead of using the encoded ascii buffer.

That's good if you need the result as a PureBasic string, but when you want to write ASCII bytes to a buffer, Base64EncoderBuffer() is the way to go.

Furthermore, it encodes the input ...
by NilsH
Thu May 23, 2024 7:19 pm
Forum: Bugs - Documentation
Topic: Base64EncoderBuffer(): Bad explanation of OutputSize parameter, example with bug, and weird behavior of function itself.
Replies: 4
Views: 1899

Base64EncoderBuffer(): Bad explanation of OutputSize parameter, example with bug, and weird behavior of function itself.

Hello!

In the documentation for Base64EncoderBuffer() we can find the following explanation for the required size of the output buffer:
The output buffer should be at last 33% bigger than the input buffer, with a minimum size of 64 bytes. It's recommended to get a slightly larger buffer, like 35 ...
by NilsH
Sun Nov 12, 2023 10:18 pm
Forum: Feature Requests and Wishlists
Topic: Update PathRequester() to use IFileDialog on Windows
Replies: 3
Views: 1206

Re: Update PathRequester() to use IFileDialog on Windows

Axolotl wrote: Tue Nov 07, 2023 3:42 pm maybe you should look at this.
Select folder dialog
Thanks! I will check this out.

However, I still think that PathRequester() should be updated, given that the new dialog was introduced 17 years ago.
by NilsH
Fri Nov 03, 2023 12:15 am
Forum: Feature Requests and Wishlists
Topic: Update PathRequester() to use IFileDialog on Windows
Replies: 3
Views: 1206

Update PathRequester() to use IFileDialog on Windows

Hello!

I noticed that as of PureBasic 6.03 PathRequester() still uses the old "Open Folder" dialog, even though there is a new and much more user-friendly dialog available since Windows Vista. This new dialog looks like the dialog used by OpenFileRequester() and SaveFileRequester().
As far as I ...
by NilsH
Wed Jun 28, 2017 1:29 am
Forum: Feature Requests and Wishlists
Topic: Sorting function with callback
Replies: 7
Views: 4176

Re: Sorting function with callback

I just wrote a user lib that does what I wanted. I just wanted to see if I can get it working, so I simply copied the bubblesort algorithm from Stargate's thread .

See below for the files. If you want to try it, copy PureLib\PBUserLib to your UserLibraries directory and run the .pb files. I ...
by NilsH
Tue Jun 27, 2017 12:22 am
Forum: Feature Requests and Wishlists
Topic: Sorting function with callback
Replies: 7
Views: 4176

Re: Sorting function with callback

I use qsort() with custom callback comparison procedures for my structures.
This works only for arrays, not for lists. Also it relies on undocumented behavior (Import "" <- empty string).

at the moment, you can use my CustomSortList http://www.purebasic.fr/english/viewtopic.php?f=3&t=43230,
it ...
by NilsH
Mon Jun 26, 2017 2:05 am
Forum: Feature Requests and Wishlists
Topic: Sorting function with callback
Replies: 7
Views: 4176

Sorting function with callback

Hi!
I think PureBasic could really use sorting functions that make use of a user-defined callback function to determine the sorting order.

The functions would look as follows:
SortArrayCallback(ArrayToSort(), @Callback())
SortListCallback(ListToSort(), @Callback())
They accept the list or array ...
by NilsH
Mon Apr 17, 2017 2:45 am
Forum: Coding Questions
Topic: Bug when appending return value of procedure to a string
Replies: 9
Views: 4004

Re: Bug when appending return value of procedure to a string

Just tried it.
#include <stdio.h>

int myfunc(int *intptr) {
*intptr += 200;
return 10;
}

int main(int argc, char *argv[]) {

int myint = 3000;
myint = myint + myfunc(&myint);
printf("myint = %i\n", myint);

return 0;

}
myint = 3210
Probably it's a just very bad idea to modify a variable ...
by NilsH
Sun Apr 16, 2017 9:57 pm
Forum: Coding Questions
Topic: Bug when appending return value of procedure to a string
Replies: 9
Views: 4004

Re: Bug when appending return value of procedure to a string

Its not a bug, it is the expected behavior.
Okay, now I understand the reason for this behavior, but I still think it's confusing,
because when I see something like "a + b()" I wouldn't expect that the compiler understands it as "a = a + b()".
The documentation unfortunately is not very clear ...
by NilsH
Sun Apr 16, 2017 9:00 pm
Forum: Coding Questions
Topic: Bug when appending return value of procedure to a string
Replies: 9
Views: 4004

Bug when appending return value of procedure to a string

Hi!

I think I found a bug in the PureBasic compiler.
When modifying a string variable from within a procedure that returns a string
and then appending the returned string to the same variable,
the modifications done by the procedure are lost.
I'm using PureBsic 5.60 64 bit on Windows 7 SP1 64 bit ...