Jump to content

Clover General discussion


ErmaC
30,171 posts in this topic

Recommended Posts

1 minute ago, Pene said:

But I'm not sure it's a good idea to do that in StrnCpy.

Because that's against the standard implementation: http://www.cplusplus.com/reference/cstring/strncpy/

Sometimes, we may pass a buffer of specific size, and doing a *Destination = L'\0' at the end will write past that buffer.

For this case memcpy exists.

Link to comment
Share on other sites

26 minutes ago, Slice said:

For this case memcpy exists.

Yes, I agree.

But with that change we need to remember that our StrnCpy doesn't follow the convention and we need to ensure we have a buffer of n+1.

Edited by Pene
Link to comment
Share on other sites

I think we can write it into definition and keep in mind. But I want strings will always be null-terminating no matter what EDK2 decided.

Or, for example claim that length must be 1 char less then allocated size.

Link to comment
Share on other sites

In standard C I remember there is also strncpy_s() which is null terminated. Does it not exist in edk2?

If I recall, the difference is that strncpy zeros all remaining bytes (if there are remaining), and strncpy_s always adds one single byte.

Yes: strncpy_s unlike strncpy is a null terminated string function, and does not pad the destination array with zeroes.

Edited by Pene
Link to comment
Share on other sites

50 minutes ago, Pene said:

In standard C I remember there is also strncpy_s() which is null terminated. Does it not exist in edk2?

If I recall, the difference is that strncpy zeros all remaining bytes (if there are remaining), and strncpy_s always adds one single byte.

Yes: strncpy_s unlike strncpy is a null terminated string function, and does not pad the destination array with zeroes.

Exactly what we need

There is analog in EDK2

StrnCpyS

so we must rewrite all our code to use new function instead of old one.

Or not use them at all and switch to XString. :)

  • Like 1
Link to comment
Share on other sites

I have some strange behavior in Clover, perhaps @Slice can point me in the right direction:

 

In UEFI shell, starup chime is crystal clear, but, when played by CLOVER it sounds like someones farting in a can ??? I'll attach a video of that behavior ... and besides that, after EVERY NVRam reset (F11) the sound gets lost and needs to be reapplyed from within the UEFI Shell: is there a way to tell CLOVER to use that sound via .plist?

 

Appreciate any answer!

 

Cheers

 

Goron

Link to comment
Share on other sites

6 hours ago, vector sigma said:

Hi @Killuminati91, with FakeSMC I have no problems since Mavericks till Catalina, btw this is the wrong thread to talk about issues related to VirtualSMC and other Lilu plugins.

 

 

Guys everythings ok here with gcc 10.1.0. Should we migrate? 

 

gcc10.diff.zip

CLOVERX64.efi.zip

There are new options and new warnings. May be create new toolset GCC10?

 

Nice

  • static const int π = 3;
    int get_naïve_pi() {
      return π;
    }

 

 

  • Like 1
Link to comment
Share on other sites

12 hours ago, Slice said:

There are new options and new warnings. May be create new toolset GCC10?

I did not touch the toolsdef, but if you see something usefull why not.

 

12 hours ago, Slice said:
  • 
    static const int π = 3;
    int get_naïve_pi() {
      return π;
    }

 

yep nice to use more characters (in truth I hate it Lol) . Nicer would be having also the setter method for a variable like the above. 

Edited by vector sigma
Link to comment
Share on other sites

22 minutes ago, vanxuanty95 said:

I want to ask why boot arguments always add -v while I deleted it. I am using ver r5116
Thanks

It seems you do something wrong.

Link to comment
Share on other sites

1 hour ago, vector sigma said:

I did not touch the toolsdef, but if you see something usefull why not.

 

yep nice to use more characters (in truth I hate it Lol) . Nicer would be having also the setter method for a variable like the above. 

Not done

iMac2017:Clover sergey$ ./build_gcc10.sh 
- Building GCC 10.1.0 toolchain for x64
- to /Users/sergey/src/opt/local/cross/bin/x86_64-clover-linux-gnu
  Running on Mac OS X 10.14, with x86_64 architecture.
  Using Xcode SDK: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Status: gmp-6.2.0 not found.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1965k  100 1965k    0     0  1043k      0  0:00:01  0:00:01 --:--:-- 1043k
Status: isl-0.22.1 not found.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1637k  100 1637k    0     0  2073k      0 --:--:-- --:--:-- --:--:-- 2072k
Status: binutils-2.34 not found.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 20.6M  100 20.6M    0     0  6915k      0  0:00:03  0:00:03 --:--:-- 6916k
Status: gcc-10.1.0 not found.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 71.1M  100 71.1M    0     0  11.5M      0  0:00:06  0:00:06 --:--:-- 15.5M

* GCC toolchain Build process took 0s to complete...
iMac2017:Clover sergey$ 

 

Link to comment
Share on other sites

32 minutes ago, Slice said:

It seems you do something wrong.

 

My config file does not have -v, and didn't change after boot, I am sure of it, and my log also noted that I did not use -v, but when booted it was automatically added, I also checked vram, -v always in there :(

Edited by vanxuanty95
Link to comment
Share on other sites

Just now, vanxuanty95 said:

 

My config file does not have -v, and didn't change after boot, I am sure of it, and my log also noted that I did not use -v, but when booted it was automatically added, I also checked vram, -v always in there :(

Show something please, config.plist, preboot.log, nvram somehow.

Link to comment
Share on other sites

52 minutes ago, vanxuanty95 said:

I also checked vram, -v always in there :(

delete it from nvram then because it's persistent

44 minutes ago, Slice said:

GCC 10.1 works! Now we have to find advantages.

Find no one yet but I feel confident from the GNU guys... as always. 

Edited by vector sigma
Link to comment
Share on other sites

New warning but not essential

/Users/sergey/src/Clover/rEFIt_UEFI/Platform/Settings.h:832:18: error: redundant class-key 'struct' in reference to 'struct MatchOSes' [-Werror=redundant-tags]
  832 | TrimMatchOSArray(struct MatchOSes *s);
      |                  ^~~~~~
      |                  ------

It can't produce an error but helps us to simplify sources.

  • Like 1
Link to comment
Share on other sites

-Weffc++ (C++ and Objective-C++ only)
Warn about violations of the following style guidelines from Scott Meyers’ Effective C++ series of books:

Define a copy constructor and an assignment operator for classes with dynamically-allocated memory.
Prefer initialization to assignment in constructors.
Have operator= return a reference to *this.
Don’t try to return a reference when you must return an object.
Distinguish between prefix and postfix forms of increment and decrement operators.
Never overload &&, ||, or ,.
This option also enables -Wnon-virtual-dtor, which is also one of the effective C++ recommendations. However, the check is extended to warn about the lack of virtual destructor in accessible non-polymorphic bases classes too.

When selecting this option, be aware that the standard library headers do not obey all of these guidelines; use ‘grep -v’ to filter out those warnings.

-Wnon-virtual-dtor (C++ and Objective-C++ only)
Warn when a class has virtual functions and an accessible non-virtual destructor itself or in an accessible polymorphic base class, in which case it is possible but unsafe to delete an instance of a derived class through a pointer to the class itself or base class. This warning is automatically enabled if -Weffc++ is specified.

..took me some time to find it here

Link to comment
Share on other sites

×
×
  • Create New...