Răsfoiți Sursa

android: Build the APK asset tree in the same order its listed in the file.

This tends to get you enumerations in alphabetical order, instead of them
being reverse-alphabetical.

Reference Issue #15587.
Ryan C. Gordon 3 zile în urmă
părinte
comite
5e483dc166
1 a modificat fișierele cu 7 adăugiri și 2 ștergeri
  1. 7 2
      src/core/android/SDL_android.c

+ 7 - 2
src/core/android/SDL_android.c

@@ -1875,6 +1875,7 @@ typedef struct APKNode
     SDL_PathInfo info;
     SDL_PathInfo info;
     struct APKNode *parent;
     struct APKNode *parent;
     struct APKNode *children;
     struct APKNode *children;
+    struct APKNode *children_tail;
     struct APKNode *next_sibling;
     struct APKNode *next_sibling;
 } APKNode;
 } APKNode;
 
 
@@ -1983,8 +1984,12 @@ static APKNode *AddAPKChildNode(APKNode *parent, const char *child)
         SDL_copyp(&node->info, &parent->info);  // you probably need to update this afterwards.
         SDL_copyp(&node->info, &parent->info);  // you probably need to update this afterwards.
 
 
         node->parent = parent;
         node->parent = parent;
-        node->next_sibling = parent->children;
-        parent->children = node;
+        if (parent->children_tail) {  // APKs tend to be sorted alphabetically, so insert new nodes at the end of the list to maintain this order.
+            parent->children_tail->next_sibling = node;
+        } else {
+            parent->children = node;
+        }
+        parent->children_tail = node;
     }
     }
     return node;
     return node;
 }
 }