2018年9月3日 星期一

mkfs.ubifs: Fix build with gcc 5.1


Android開發中,

遇到以下兩個問題:

error: redefinition of ‘hashtable_iterator_key’
error: redefinition of ‘hashtable_iterator_value’

這是由於gcc 5.1 對於編譯C文件已由gnu89改為gnu11,

這改變了對extern inline的定義,





在mkfs.ubifs中,

這導致了hashtable_iterator_key 與 hashtable_iterator_value 產生多重定義,(redefine),

最快速的解決方法是以extern inline 取代 static inline.


也就是在hashtable_itr.c 與 hashtable_itr.h 中
改為下列所示:


diff --git a/mkfs.ubifs/hashtable/hashtable_itr.c b/mkfs.ubifs/hashtable/hashtable_itr.c
index 24f4dde..d102453 100644
--- a/mkfs.ubifs/hashtable/hashtable_itr.c
+++ b/mkfs.ubifs/hashtable/hashtable_itr.c
@@ -35,18 +35,6 @@ hashtable_iterator(struct hashtable *h)
 }
 
 /*****************************************************************************/
-/* key      - return the key of the (key,value) pair at the current position */
-/* value    - return the value of the (key,value) pair at the current position */
-
-void *
-hashtable_iterator_key(struct hashtable_itr *i)
-{ return i->e->k; }
-
-void *
-hashtable_iterator_value(struct hashtable_itr *i)
-{ return i->e->v; }
-
-/*****************************************************************************/
 /* advance - advance the iterator to the next element
  *           returns zero if advanced to end of table */
 
diff --git a/mkfs.ubifs/hashtable/hashtable_itr.h b/mkfs.ubifs/hashtable/hashtable_itr.h
index 87a97eb..5c94a04 100644
--- a/mkfs.ubifs/hashtable/hashtable_itr.h
+++ b/mkfs.ubifs/hashtable/hashtable_itr.h
@@ -28,7 +28,7 @@ hashtable_iterator(struct hashtable *h);
 /* hashtable_iterator_key
  * - return the value of the (key,value) pair at the current position */
 
-extern inline void *
+static inline void *
 hashtable_iterator_key(struct hashtable_itr *i)
 {
     return i->e->k;
@@ -37,7 +37,7 @@ hashtable_iterator_key(struct hashtable_itr *i)
 /*****************************************************************************/
 /* value - return the value of the (key,value) pair at the current position */
 
-extern inline void *
+static inline void *
 hashtable_iterator_value(struct hashtable_itr *i)
 {
     return i->e->v;
}





2018年9月2日 星期日

商品推薦- 米勒八格書櫃

今天要來推薦商品

米勒八格書櫃

目前這個時代,

許多人喜歡DIY,

做蛋糕要DIY,

而書櫃組裝也要來個DIY,

為何推薦這個米勒八格書櫃呢?

主要原因是 -   孔位精準且孔位深度也打得剛剛好

大小   27.2x81.4x120cm,


價格也不高貴

Pchome售價 1390 元,



打開箱子,

第一步當然是檢查各部件是否與說明書中列表相符,

不然組到一半缺零件是很尷尬的,

檢查完即可開始進行前置作業,

將24個木榫塞進各部件孔洞之中,

塞之前塗上隨箱附贈的白膠以增加產品強固性
(白膠贈送兩小罐, 一般DIY書櫃沒有附贈)



找到E ,   F   ,   G   三塊位於底部的板子並將腳粒釘上去,

(各部件側邊都有印章蓋上英文字母,  辨別部件位置很方便)



F  , G   部件的腳粒建議在五公分處


24個木榫裝置完畢後,

將 B, C 與   B,D   木板合組為兩個T形


 並鎖上平尾螺絲

再將兩者組立起來,

這書櫃中間的骨架就完成了


再將背板兩兩以H形條組合起來並將其滑入軌道中

(記得將白膠用上, 以免背板晃動)



接著將兩側板與底部 E板安裝鎖上
 
組裝起來長這個樣子 ,

再把各個隔板用上即可



2018年9月1日 星期六

Adnroid 專案的文件結構

在Android   左側的窗格中,

各個文件以樹狀結構展現,

從下圖可看到最上層兩者為

app   :    包含各種APP所需的檔案

Gradle   Scripts :   包含與build APP有關的各個Gradle檔案


開發者編輯的檔案都放在app層中,

manifests :   所有的App設定檔以XML方式存在

java :   用於存放程式檔案

res :   存放程式會用到的各類資源檔案 ,
                例如 :  圖形檔, 選單,  設定值

 


從下圖可看出

針對不同螢幕提供了不同的版本,

分別為 mdpi   ,   hdpi,   xdpi ,   xxdpi,   xxxdpi五種版本,

Android 會根據目前螢幕選擇適當的圖檔使用



除了以   Android studio預設的   Android模式檢視檔案之外,

也可以選擇以   project   模式檢視專案結構,

此方式則是以資料實際儲存的結構來顯示專案內容

如下圖,

可看到這個樹狀結構就呈現了專案在硬碟中實際的存放情形