Skip to content

Assignment Makes Pointer From Integer Without A Cast Csi

Re: ASUS USB-AC56 (RTL8812AU/RTL8821AU) Driver compile fails

Mon Feb 10, 2014 10:21 pm

I have been experimenting with hostapd on raspberry pi with a different adapter (Tenda W311ma RT5370 supported by rt2800usb kernel module). It seems the latest hostapd package in the raspian wheezy repositories hasn't been built with nl80211 support. I couldn't get AP mode to work with the stock hostapd installed via apt-get. Whenever I set "driver=nl80211" in hostapd.conf, I would get the "not found" error.

My solution was to download the latest hostapd stable version 2.1 from http://hostap.epitest.fi/hostapd/

I made sure to apt-get install all libnl-3-200 packages as well as their -dev versions first.

Then I built the new hostapd version 2.1. Be sure to copy the defconfig to .config after you untar the hostapd-2.1.tar.gz. Edit the .config options to change lines:

#CFLAGS += -I$<path to libnl include files>

to:

CFLAGS += -I/usr/include/libnl3

and

#CONFIG_LIBNL32=y

to

CONFIG_LIBNL32=y

run make.

Copy the new hostapd and hostapd_cli into /usr/sbin. I renamed to originals to save a backup copy. I also made sure the permisions on the new hostapd files matched the original ones.

Hope that helps.

As others already noted, in one case you are attempting to return (which is a value in this context - a pointer) from a function that is declared to return a (which is an integer). In another case you do the reverse: you are assigning a return value to a pointer. This is what triggers the warnings. You certainly need to declare your return values as , not as .

Note BTW that these assignments are in fact constraint violations from the language point of view (i.e. they are "errors"), since it is illegal to mix pointers and integers in C like that (aside from integral constant zero). Your compiler is simply too forgiving in this regard and reports these violations as mere "warnings".

What I also wanted to note is that in several answers you might notice the relatively strange suggestion to return from your functions, since you are modifying the string in-place. While it will certainly work (since you indeed are modifying the string in-place), there's nothing really wrong with returning the same value from the function. In fact, it is a rather standard practice in C language where applicable (take a look at the standard functions like and others), since it enables "chaining" of function calls if you choose to use it, and costs virtually nothing if you don't use "chaining".

That said, the assignments in your implementation of look complete superfluous to me (even though they won't break anything). I'd either get rid of them

or use "chaining" and do

(this is when your return would come handy). Just keep in mind that such "chained" function calls are sometimes difficult to debug with a step-by-step debugger.

As an additional, unrealted note, I'd say that implementing a string comparison function in such a destructive fashion (it modifies the input strings) might not be the best idea. A non-destructive function would be of a much greater value in my opinion. Instead of performing as explicit conversion of the input strings to a lower case, it is usually a better idea to implement a custom char-by-char case-insensitive string comparison function and use it instead of calling the standard .