In the continuing saga of compiling AOSP 7 for the Samsung Galaxy S4, T-Mobile variant (SGH-M919, JFLTETMO) I ran into an interesting problem. While this used to be a non-issue for building Marshmallow and earlier, libcopybit seems to now have a problem in Nougat. Let’s take a look:
[CODE]
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1390:40: note: insert an explicit cast to silence this issue
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
^~~~~~
static_cast<int>( )
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1390:48: error: non-constant-expression cannot be narrowed from type ‘uint32_t’ (aka ‘unsigned int’) to ‘int’ in initializer list [-Wc++11-narrowing]
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
^~~~~~
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1390:48: note: insert an explicit cast to silence this issue
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
^~~~~~
static_cast<int>( )
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1391:40: error: non-constant-expression cannot be narrowed from type ‘uint32_t’ (aka ‘unsigned int’) to ‘int’ in initializer list [-Wc++11-narrowing]
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
^~~~~~
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1391:40: note: insert an explicit cast to silence this issue
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
^~~~~~
static_cast<int>( )
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1391:48: error: non-constant-expression cannot be narrowed from type ‘uint32_t’ (aka ‘unsigned int’) to ‘int’ in initializer list [-Wc++11-narrowing]
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
^~~~~~
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1391:48: note: insert an explicit cast to silence this issue
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
^~~~~~
static_cast<int>( )
4 errors generated.
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
[/CODE]
So, I changed hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp from this:
[CODE]
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
[/CODE]
To this:
[CODE]
struct copybit_rect_t dr = { 0, 0, (int)dst->w, (int)dst->h };
struct copybit_rect_t sr = { 0, 0, (int)src->w, (int)src->h };
[/CODE]
And it compiled sucessfully. Unfortunately, I don’t know how well that fixed the problem (or, if at all), since the AOSP 7 will currently not boot on my S4. But I’ll keep at it!
Linux – keep it simple.
I wish I understood more about this stuff. I just want to mention it is fantastic that sghm919 is still getting attention. It’s a great device. I locked the sim card somehow on mine and have been frustrated at the performance and lack of development for the SM-J320A I foolishly purchased. Long story very short? Thanks
Thanks for stopping by! Don’t feel bad, I don’t fully understand it all myself! I do agree, however, the S4 is still a great device and deserves a little more attention. Hopefully we can get it upgraded to nougat so this phone can continue to excel!
hmm thats horrendous
I’m trying to build nougat for the nexus 7 2013 and i’m facing the same problem, thanks for the tip!
No problem! Glad to be of service! Feel free to drop by and let us all know how it turns out!
I changed from this:
struct copybit_rect_t dr = { 0, 0, (int)dst->w, (int)dst->h };
struct copybit_rect_t sr = { 0, 0, (int)src->w, (int)src->h };
to:
struct copybit_rect_t dr = { 0, 0, static_cast(dst)->w, static_cast(dst)->h };
struct copybit_rect_t sr = { 0, 0, static_cast(src)->w, static_cast(src)->h };
It worked for me by the way. 🙂
Thanks Garv! I am still learning myself, and that seems like a much better way to do that!
Great Content
hello
It would be great if you could start writing for other programming languages too.
These codes are really amazing to learn. You should also check List of Windows Error Codes. You will know all the errors related to Windows. And you can fix your Windows PC/Laptops quickly.